/* Diseño de Stitch adaptado a los componentes reales de Centro de trabajo. */
:root {
    color-scheme: dark;
    --page: #10131f;
    --sidebar: #0b0e19;
    --surface: #181b27;
    --raised: #272936;
    --border: #303242;
    --text: #e0e1f3;
    --muted: #a9a5b9;
    --accent: #d2bbff;
    --accent-soft: #302046;
    --primary: #7c3aed;
    --green: #4edea3;
    --mono: 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
}
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 13px; background: var(--page); color: var(--text); height: 100dvh; }
button, input, select, textarea { font: inherit; }
button { transition: background .15s, border-color .15s, color .15s; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #7c3aed88; color: #fff; }
.ui-icon { display: inline-block; width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
* { scrollbar-color: #78738e #10131f; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #78738e; border: 2px solid #10131f; border-radius: 8px; }
::-webkit-scrollbar-track { background: #10131f; }
::-webkit-scrollbar-thumb:hover { background: #b2a5c9; }

/* Navigation */
#app-shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); height: 100dvh; }
.app-header { grid-column: 1 / -1; height: 64px; min-width: 0; padding: 0 20px; gap: 24px; background: #10131ff2; border-bottom: 1px solid #272936; box-shadow: 0 2px 15px #0002; z-index: 3; }
.app-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 194px; margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.4px; white-space: nowrap; }
.brand-logo { display: block; width: 36px; height: 36px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 16px #7c3aed35; }
.auth-logo { display: block; width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 20px; object-fit: cover; box-shadow: 0 14px 36px #0008, 0 0 24px #7c3aed38; }
.auth-card h1, .auth-card > p { text-align: center; }
.top-nav { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--sidebar); }
.nav-btn { padding: 7px 15px; color: var(--muted); border-radius: 99px; font-size: 12px; white-space: nowrap; }
.nav-btn:hover { color: var(--text); background: var(--raised); }
.nav-btn.active { color: #f2eaff; background: var(--primary); box-shadow: 0 0 14px #7c3aed35; }
.user-menu { margin-left: auto; gap: 8px; min-width: 0; font-size: 12px; }
#current-user { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; margin-right: 6px; }
.user-admin-shortcut.active { color: #f2eaff; background: var(--primary); box-shadow: 0 0 14px #7c3aed35; }
.eyebrow, .sidebar-label { color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: 1.15px; }
.workspace-view { grid-column: 1; grid-row: 2; min-width: 0; min-height: 0; }
.workspace-view.active { display: flex; flex-direction: column; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; padding: 24px 0 18px; }
.workspace-heading h1 { margin: 7px 0 0; font-size: 24px; line-height: 1.25; letter-spacing: -.65px; font-weight: 650; }
.eyebrow b { font-weight: 500; color: var(--accent); }
.workspace-badge { padding: 8px 12px; border-radius: 8px; background: var(--raised); color: var(--accent); font: 11px var(--mono); white-space: nowrap; }

/* Shared controls */
.primary-btn, .secondary-btn, .danger-action, .new-note-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 7px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.primary-btn, .new-note-btn { background: linear-gradient(110deg, #7c3aed, #6344da); color: #fff; border: 1px solid #9661ec; box-shadow: 0 3px 14px #7c3aed25; }
.primary-btn:hover, .new-note-btn:hover { background: #8b4cf3; }
.secondary-btn { background: #242735; border: 1px solid transparent; color: #ccc3d8; }
.secondary-btn:hover { background: #363448; color: #f1eaff; }
.danger-action { background: #40252e; border: 1px solid #71404c; color: #ffb4ab; }
.danger-action:hover { background: #66333b; }
.icon-button { width: 34px; padding: 7px; }
#logout-button { color: #ffb4ab; }
.form-stack label { color: var(--muted); font-size: 12px; }
.form-stack input, .form-stack select, .form-stack textarea, .dialog input, .dialog select, .dialog textarea, .search-bar, .host-search, .connection-bar input, .connection-bar select, .sftp-path {
    background: #1c1f2b; color: var(--text); border: 1px solid #383848; border-radius: 8px; padding: 9px 11px; outline: none; min-width: 0;
}
input::placeholder, textarea::placeholder { color: #958da1; }
input:focus, select:focus, textarea:focus { border-color: #9b73df; }
.section-heading { min-height: 34px; margin-bottom: 12px; }
.section-heading h2 { font-size: 15px; letter-spacing: -.3px; }

/* Notes */
#notes-view.active { --notes-sidebar-width: 320px; position: relative; display: grid; grid-template-columns: minmax(220px, var(--notes-sidebar-width)) 20px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 0; padding: 0 22px 20px; }
#notes-view > .workspace-heading { grid-column: 1 / -1; }
.sidebar { grid-column: 1; grid-row: 2; width: auto; min-width: 0; padding: 16px; gap: 12px; overflow: hidden; background: var(--sidebar); border: 1px solid #222535; border-radius: 16px; box-shadow: 0 10px 30px #0002; }
.notes-divider { position: relative; grid-column: 2; grid-row: 2; min-width: 20px; cursor: col-resize; touch-action: none; }
.notes-divider::before { content: ''; position: absolute; inset: 36px 8px 8px; width: 3px; border-radius: 99px; background: transparent; transition: background .15s ease; }
.notes-divider:hover::before, body.resizing-notes .notes-divider::before { background: #6f4da3; }
.notes-sidebar-toggle { position: absolute; z-index: 3; top: 10px; left: 50%; display: grid; place-items: center; width: 24px; height: 28px; padding: 0; border: 1px solid #484151; border-radius: 8px; background: #242735; color: #d9d0e8; box-shadow: 0 3px 12px #0005; font: 20px/1 var(--mono); cursor: pointer; transform: translateX(-50%); }
.notes-sidebar-toggle:hover { border-color: #795ca0; background: #39334d; color: #fff; }
body.resizing-notes { cursor: col-resize; user-select: none; }
body.resizing-notes iframe { pointer-events: none; }
#notes-view.notes-sidebar-collapsed { grid-template-columns: 0 28px minmax(0, 1fr); }
#notes-view.notes-sidebar-collapsed > .sidebar { display: none; }
#notes-view.notes-sidebar-collapsed .notes-divider { cursor: default; }
#notes-view.notes-sidebar-collapsed .notes-divider::before { display: none; }
.sidebar-intro { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.sidebar-intro h2 { color: var(--text); font-size: 15px; margin: 0; }
.search-bar { width: 100%; min-height: 38px; font-size: 12px; }
.filter-input { position: relative; min-width: 0; }
.filter-input .search-bar, .filter-input .host-search { margin: 0; padding-right: 34px; }
.filter-clear { position: absolute; top: 50%; right: 7px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #a99fb9; font: 18px/1 var(--mono); cursor: pointer; transform: translateY(-50%); }
.filter-clear:hover, .filter-clear:focus-visible { outline: none; background: #39334d; color: #fff; }
.new-note-btn { min-height: 36px; width: 100%; }
.sidebar-label { margin: 5px 0 0; font-size: 9px; }
#notes-list { min-height: 0; flex: 1; margin: 0; padding-right: 3px; }
.note-item { align-items: flex-start; padding: 13px 11px; margin-bottom: 8px; border: 1px solid transparent; border-radius: 11px; background: var(--surface); gap: 5px; }
.note-item:hover { background: #222534; }
.note-item.active { background: var(--raised); border-color: #5c457b; box-shadow: inset 3px 0 0 var(--accent), 0 4px 10px #0002; }
.note-item.dragging { opacity: .3; border-color: var(--accent); }
.note-item.note-moving { will-change: transform; }
.note-drag-preview { position: fixed; top: -1000px; left: -1000px; z-index: 9999; opacity: .96; box-shadow: 0 16px 36px #0009; pointer-events: none; }
.note-drag-handle { flex: 0 0 auto; display: grid; place-items: center; width: 18px; height: 28px; margin: 1px 2px 0 -5px; border-radius: 6px; color: #756d80; cursor: grab; }
.note-drag-handle:hover { color: #cbb8e8; background: #302b3d; }
.note-drag-handle:active { cursor: grabbing; }
.note-drag-handle svg { width: 12px; height: 20px; fill: currentColor; }
.note-item-info { display: grid; gap: 7px; min-width: 0; flex: 1; }
.note-item-title { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.4; }
.note-item.active .note-item-title { color: #eaddff; }
.note-item-access { font-size: 11px; color: var(--muted); }
.note-item-date { font: 10px var(--mono); color: #aea4be; }
.note-item.pinned { border-color: #7c3aed55; }
.note-item-actions { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pin-note-btn { display: grid; place-items: center; width: 24px; height: 24px; padding: 4px; border: 0; border-radius: 6px; background: transparent; color: #777080; cursor: pointer; }
.pin-note-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pin-note-btn:hover, .pin-note-btn:focus-visible { outline: none; background: #39334d; color: #d2bbff; }
.pin-note-btn.active { color: var(--accent); text-shadow: 0 0 7px #8b5cf6aa; }
.delete-btn { padding: 1px 5px; font-size: 17px; color: #aaa0b9; border-radius: 5px; }
.delete-btn:hover { color: #ffb4ab; background: #4b2734; }
.tag-cloud { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); max-height: 105px; overflow: auto; flex-shrink: 0; }
.tag-cloud:empty { display: none; }
.tag-item { border: 1px solid #454055; border-radius: 7px; background: #242333; color: var(--accent); font: 10px var(--mono); padding: 5px 8px; }
.tag-clear-filter { display: inline-block; margin: 0 4px 4px 0; border: 1px solid #6f4da3; border-radius: 7px; background: #352845; color: #eadcff; font: 10px var(--mono); padding: 5px 8px; cursor: pointer; }
.tag-clear-filter:hover, .tag-clear-filter:focus-visible { outline: none; border-color: var(--accent); background: #49345f; }
.tag-item:hover, .tag-item.active { background: #593a8e; }
.tag { color: var(--accent); }
.editor-container { grid-column: 3; grid-row: 2; min-width: 0; min-height: 0; padding: 18px 22px 0; background: var(--sidebar); border: 1px solid #222535; border-radius: 16px; box-shadow: 0 10px 30px #0002; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; min-height: 30px; margin-bottom: 15px; }
.document-label { display: inline-flex; gap: 6px; align-items: center; color: var(--accent); font: 11px var(--mono); }
.editor-heading .secondary-btn { min-height: 28px; font-size: 11px; }
.title-input { padding: 4px 0 15px; margin: 0 0 12px; border: none; border-radius: 0; background: transparent; color: var(--text); font-size: clamp(22px, 2vw, 32px); font-weight: 650; letter-spacing: -.8px; flex-shrink: 0; }
.title-input::placeholder { color: #80788f; }
.title-input:focus-visible { outline: none; box-shadow: 0 1px var(--accent); }
.toolbar { gap: 4px; padding: 6px; border: 1px solid #353347; border-radius: 10px; background: var(--raised); flex-shrink: 0; }
.toolbar-group { gap: 2px; padding-right: 4px; border-color: #494354; }
.format-btn, .format-select { height: 30px; min-width: 30px; background: transparent; color: #ccc3d8; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; font-size: 11px; }
.format-btn { display: inline-flex; align-items: center; justify-content: center; }
.format-btn .ui-icon { width: 16px; height: 16px; }
.format-select { background: #1c1f2b; min-width: 108px; }
.format-btn:hover, .format-select:hover { background: #3c354d; color: #fff; }
.format-btn.active { background: var(--primary); border-color: #9b71e1; color: #fff; }
.save-indicator { color: var(--green); font: 10px var(--mono); height: 14px; flex-shrink: 0; margin: 10px 0 0; }
.editor { min-height: 0; padding: 14px 4px 24px; border: 0; border-radius: 0; background: transparent; color: var(--text); font-size: 14px; line-height: 1.8; }
.editor:focus-visible { outline: none; }
.editor blockquote { border-color: var(--accent); background: #211c30; color: #d5c8e5; }
.editor pre { border-color: #343049; background: #181b27; border-radius: 10px; font-family: var(--mono); color: #adc6ff; }
.editor th, .editor td { border-color: #383748; }
.editor th { background: var(--raised); }
.editor a { color: #adc6ff; }
.task-checkbox, .editor audio { accent-color: var(--primary); }
.resize-handle, .audio-resize-handle { background: var(--accent); }
.task-item:hover { background: #222534; }
.task-text:focus, .task-text:focus-visible { outline: none; box-shadow: none; }
.task-text:focus, .task-text:focus-visible { outline: none; box-shadow: none; }
.editor-footer { display: flex; justify-content: space-between; gap: 8px; padding: 12px 0; border-top: 1px solid #272936; font: 10px var(--mono); color: var(--muted); flex-shrink: 0; }
.readonly-banner { background: #3e3424; color: #ead6ae; margin-top: 9px; }
mark { background: #baa2e0; color: #14101b; }

/* SSH, terminal and SFTP: all scroll areas stay within the available height. */
#ssh-view, #keys-view { padding: 0 22px 20px; }
.ssh-layout, .key-layout { grid-template-columns: 270px minmax(0, 1fr); gap: 16px; flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.ssh-layout { --ssh-sidebar-width: 300px; position: relative; grid-template-columns: minmax(220px, var(--ssh-sidebar-width)) 16px minmax(0, 1fr); gap: 0; }
.ssh-layout.host-sidebar-collapsed { grid-template-columns: 0 28px minmax(0, 1fr); gap: 0; }
.ssh-layout.host-sidebar-collapsed .ssh-sidebar { display: none; }
.ssh-layout .ssh-sidebar { grid-column: 1; min-width: 0; }
.ssh-layout .ssh-main { grid-column: 3; }
.host-divider { position: relative; grid-column: 2; grid-row: 1; min-width: 16px; cursor: col-resize; touch-action: none; }
.host-divider::before { content: ''; position: absolute; inset: 36px 6px 8px; width: 3px; border-radius: 99px; background: transparent; transition: background .15s ease; }
.host-divider:hover::before, .host-divider:focus-visible::before, body.resizing-hosts .host-divider::before { background: #6f4da3; }
.host-divider:focus-visible { outline: none; }
.host-sidebar-collapsed .host-divider { cursor: default; }
.host-sidebar-collapsed .host-divider::before { display: none; }
body.resizing-hosts { cursor: col-resize; user-select: none; }
body.resizing-hosts iframe, body.resizing-hosts .xterm { pointer-events: none; }
.ssh-sidebar, .key-sidebar { padding: 16px; background: var(--sidebar); border: 1px solid #222535; border-radius: 14px; }
.host-sidebar-toggle { position: absolute; z-index: 5; top: 10px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 24px; height: 28px; padding: 0; border: 1px solid #484151; border-radius: 8px; background: #242735; color: #d9d0e8; box-shadow: 0 3px 12px #0005; font: 20px/1 var(--mono); cursor: pointer; }
.host-sidebar-toggle:hover { border-color: #795ca0; background: #39334d; color: #fff; }
.host-search { width: 100%; font-size: 11px; }
.host-filter-input { margin-bottom: 10px; }
#new-key-group-button { margin-bottom: 10px; }
.host-heading-actions { display: flex; align-items: center; gap: 4px; }
.ssh-sidebar .section-heading h2 { flex: 0 0 auto; }
.host-heading-actions .primary-btn, .host-heading-actions .secondary-btn { padding-right: 5px; padding-left: 5px; font-size: 11px; }
#new-group-button { min-height: 32px; margin: 0; white-space: nowrap; }
/* Árbol compacto de hosts, al estilo de la vista de recursos de Proxmox. */
.host-group { margin: 1px 0; }
.host-group-header { gap: 6px; min-height: 26px; padding: 2px 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 12px; font-weight: 600; }
.host-group-header:hover { background: var(--surface); }
.host-group-header.drop-target { background: #302747; border-color: var(--accent); box-shadow: 0 0 0 2px #d2bbff25, inset 0 0 18px #7c3aed20; }
.host-group-caret { width: 10px; color: var(--muted); font-size: 10px; text-align: center; }
.host-group-icon { flex: 0 0 15px; width: 15px; height: 15px; color: var(--accent); }
.host-group-action { min-height: 20px; font-size: 10px; padding: 2px 5px; opacity: 0; }
.host-group-header:hover .host-group-action, .host-group-action:focus-visible { opacity: 1; }
.host-group-contents { margin-left: 10px; padding: 1px 0 1px 8px; border-color: #3c354b; }
.host-card, .key-card { background: var(--surface); border: 1px solid transparent; border-radius: 9px; padding: 11px 9px; }
.host-card { display: flex; align-items: center; gap: 7px; min-height: 28px; margin: 1px 0; padding: 2px 4px 2px 6px; border-radius: 6px; background: transparent; font-size: 12px; }
.host-row-icon { position: relative; display: grid; flex: 0 0 18px; place-items: center; width: 18px; height: 18px; }
.host-card .host-os-logo { width: 18px; height: 18px; padding: 1px; border-radius: 3px; }
.host-card .host-os-fallback { width: 18px; font-size: 14px; line-height: 1; }
.host-row-icon .host-status-dot { position: absolute; right: -3px; bottom: -3px; width: 8px; height: 8px; border: 2px solid var(--sidebar); }
.host-name-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-row-tags { display: flex; flex: 0 0 auto; gap: 3px; margin-left: auto; overflow: hidden; }
.host-card-actions { display: flex; flex: 0 0 auto; gap: 3px; }
.host-card-action { display: grid; place-items: center; width: 22px; height: 22px; padding: 4px; border: 0; border-radius: 6px; color: #dcd4ec; cursor: pointer; }
.host-card-action .ui-icon { width: 13px; height: 13px; }
.host-card-connect { background: linear-gradient(105deg, #8438ed 0%, #6243ed 45%, #1269dc 100%); box-shadow: 0 0 8px #7c3aed45; color: #f4edff; }
.host-card-connect:hover { filter: brightness(1.14); box-shadow: 0 0 12px #7c3aed65; }
.host-card-edit { background: #29283b; }
.host-card-edit:hover { background: #39334d; color: #fff; }
.host-card:hover, .key-card:hover { background: #252736; border-color: #484151; }
.host-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.host-card[draggable="true"] { cursor: grab; }
.host-card.dragging { cursor: grabbing; opacity: .45; border-color: var(--accent); }
.host-card.active, .key-card.active { background: var(--raised); border-color: #8d68b9; box-shadow: inset 2px 0 var(--accent); }
.host-card.active .host-row-icon .host-status-dot { border-color: var(--raised); }
.host-card:hover .host-row-icon .host-status-dot { border-color: #252736; }
.key-card strong { font-size: 12px; }
.key-card small { font: 10px/1.65 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.local-host-label { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 2px 5px; border: 1px solid #8b5cf680; border-radius: 99px; background: #7c3aed20; color: var(--accent); font: 8px/1 var(--mono); text-transform: uppercase; letter-spacing: .45px; }
.host-route-label { display: inline-block; flex: 0 1 auto; min-width: 0; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 5px; border: 1px solid #8b5cf680; border-radius: 99px; background: #7c3aed20; color: var(--accent); font: 8px/1 var(--mono); text-transform: uppercase; letter-spacing: .35px; }
.host-list-heading { color: var(--muted); font: 9px var(--mono); margin-top: 10px; }
.ssh-main { min-width: 0; min-height: 0; padding: 0; gap: 0; overflow: hidden; }
.sftp-progress { color: var(--green); font: 11px/1.5 var(--mono); min-height: 16px; }
.terminal-strip { position: relative; display: flex; align-items: center; min-width: 0; gap: 6px; background: var(--surface); padding: 5px 6px 0; border-radius: 10px 10px 0 0; flex-shrink: 0; }
.terminal-strip .terminal-tabs { flex: 1; min-width: 0; min-height: 34px; }
.terminal-tab { flex: 0 0 auto; max-width: 340px; min-height: 44px; gap: 8px; background: #1c1f2b; border: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; font: 11px/1.4 var(--mono); color: var(--muted); padding: 6px 10px; text-align: left; }
.terminal-tab.active { background: var(--sidebar); color: var(--text); border-bottom-color: var(--accent); }
.terminal-tab.in-layout:not(.active) { background: #242033; color: #c5bed3; border-bottom-color: #6f5b91; }
.terminal-tab:hover { background: #242635; }
.terminal-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.terminal-tab-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #797587; }
.terminal-tab[data-state="online"] .terminal-tab-dot { background: var(--green); box-shadow: 0 0 8px #4edea380; }
.terminal-tab[data-state="connecting"] .terminal-tab-dot { background: #e8bb6a; }
.terminal-tab[data-state="error"] .terminal-tab-dot { background: #f18b9a; }
.terminal-tab-address { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.terminal-tab-port { display: block; color: var(--muted); font-size: 9px; font-weight: 400; }
.terminal-tab-badge { max-width: 100px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; padding: 1px 5px; border-radius: 4px; background: #292a38; color: var(--muted); font-size: 9px; }
.terminal-tab-close { flex-shrink: 0; display: grid; place-items: center; width: 20px; height: 24px; border-radius: 4px; color: #908a9f; font: 17px/1 var(--mono); }
.terminal-tab-close:hover { color: var(--text); background: #ffffff12; }
.terminal-layout-button { flex: 0 0 auto; width: 34px; min-height: 32px; padding: 6px; margin-bottom: 4px; border-radius: 5px; color: var(--muted); font: 16px/1 var(--mono); }
.terminal-layout-button:not(:disabled):hover { color: var(--text); }
.terminal-font-picker { flex: 0 0 auto; margin-bottom: 4px; }
.terminal-font-toggle { width: 36px; min-height: 32px; border-radius: 5px; font: 600 12px/1 var(--mono); color: var(--muted); }
.terminal-font-toggle[aria-expanded="true"] { color: var(--text); background: #ffffff1a; }
.terminal-font-popover { top: calc(100% + 3px); min-width: 54px; padding: 8px 7px 7px; border-color: var(--border); border-radius: 7px; background: var(--surface); box-shadow: 0 10px 24px #000a; }
.terminal-font-scale { color: var(--text); font: 600 12px/1 var(--mono); }
.terminal-font-scale-small { font-size: 8px; }
.terminal-font-slider { appearance: none; width: 16px; height: 112px; margin: 0; background: transparent; }
.terminal-font-slider::-webkit-slider-runnable-track { width: 3px; border-radius: 999px; background: #555263; }
.terminal-font-slider::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-left: -4.5px; border: 2px solid #c4b5fd; border-radius: 50%; background: #8b5cf6; box-shadow: 0 0 0 2px #8b5cf633; }
.terminal-font-slider::-moz-range-track { width: 3px; border-radius: 999px; background: #555263; }
.terminal-font-slider::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid #c4b5fd; border-radius: 50%; background: #8b5cf6; box-shadow: 0 0 0 2px #8b5cf633; }
.terminal-font-slider:focus-visible { outline: none; }
.terminal-font-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px #8b5cf655; }
.terminal-font-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px #8b5cf655; }
.terminal-font-value { min-width: 34px; color: var(--muted); text-align: center; font: 8px/1 var(--mono); }
.terminal-sftp-button { flex: 0 0 auto; width: 34px; min-height: 32px; padding: 7px; margin-bottom: 4px; white-space: nowrap; }
.terminal-sftp-button .ui-icon { width: 16px; height: 16px; }
.remote-workspace { flex: 1 0 220px; min-height: 220px; grid-template-rows: minmax(0, 1fr); }
#terminal-workspace { min-height: 0; min-width: 0; background: var(--sidebar); border-color: #323244; border-radius: 0 0 10px 10px; }
#terminal-workspace[data-panel-count="1"] { grid-template-rows: minmax(0, 1fr); }
.terminal-pane { outline: none; }
.terminal-pane.active { border-color: var(--accent); box-shadow: 0 0 0 1px #8b5cf633; }
.terminal-panel-header { background: #1b1e2b; color: var(--muted); font: 9px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .35px; }
.terminal-pane.active .terminal-panel-header { color: var(--text); background: #272238; }
.terminal-panel-remove { border-radius: 4px; color: var(--muted); font: 15px/1 var(--mono); }
.terminal-panel-remove:hover, .terminal-panel-remove:focus-visible { outline: none; color: var(--text); background: #ffffff12; }
.terminal-empty { text-align: center; color: var(--muted); font: 12px var(--mono); padding: 24px; }
.sftp-panel { min-height: 0; overflow: hidden; background: var(--surface); border: 1px solid #38344a; border-radius: 10px; padding: 12px; }
.sftp-panel > :not(.sftp-list) { flex-shrink: 0; }
.sftp-panel .section-heading { margin: 0; }
.sftp-toolbar .secondary-btn, .sftp-toolbar .primary-btn { min-height: 28px; font-size: 10px; padding: 5px 7px; }
.sftp-path { font: 11px var(--mono); }
.sftp-list { border-color: var(--border); min-height: 40px; }
.sftp-row { grid-template-columns: minmax(0, 1fr) auto; border-color: var(--border); font-size: 11px; }
.sftp-row:hover { background: #2c293b; }
.sftp-row.context-selected { background: #302747; box-shadow: inset 2px 0 var(--accent); }
.sftp-row small { color: var(--muted); }
.sftp-context-menu { position: fixed; z-index: 4000; min-width: 180px; max-width: min(300px, calc(100vw - 16px)); padding: 6px; border: 1px solid #514866; border-radius: 10px; background: #1b1e2b; box-shadow: 0 16px 45px #000a; }
.sftp-context-title { max-width: 270px; padding: 6px 9px 8px; overflow: hidden; border-bottom: 1px solid #303242; color: var(--muted); font: 9px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.sftp-context-menu button { display: block; width: 100%; min-height: 30px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 11px; text-align: left; cursor: pointer; }
.sftp-context-menu button:hover, .sftp-context-menu button:focus-visible { outline: none; background: #302b40; }
.sftp-context-menu button.danger { color: #ffb4ab; }
.sftp-context-menu button.danger:hover, .sftp-context-menu button.danger:focus-visible { background: #472931; }
.terminal-pane .xterm-viewport, .sftp-list { overflow-y: scroll !important; scrollbar-gutter: stable; scrollbar-width: auto; scrollbar-color: #8e80a3 #10131f; }
.terminal-pane .xterm-viewport::-webkit-scrollbar, .sftp-list::-webkit-scrollbar { width: 12px; }
#ssh-view:fullscreen { background: var(--page); height: 100dvh; padding: 12px; }
#ssh-view:fullscreen > .workspace-heading { display: none; }
#ssh-view:fullscreen .ssh-layout { height: auto; }

/* Vault, administration and dialogs */
.key-main { padding: 24px; background: var(--sidebar); border-radius: 14px; border: 1px solid #222535; }
.key-detail { max-width: 100%; color: var(--muted); }
.key-detail h2 { color: var(--text); margin: 0; }
.key-detail code { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--accent); font: 12px/1.7 var(--mono); }
.key-actions a { text-decoration: none; }
.users-view { padding: 24px; }
.devices-view { padding: 24px; overflow-y: auto; }
.device-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.download-agent-btn { text-decoration: none; white-space: nowrap; }
.devices-layout { width: min(100%, 980px); display: grid; gap: 16px; padding: 24px; }
.device-intro, .pairing-panel, .device-card, .device-empty { border: 1px solid #2d2e3d; border-radius: 14px; background: var(--sidebar); padding: 20px; }
.device-intro h2, .pairing-panel h2 { margin: 0 0 8px; font-size: 17px; }
.device-intro p, .pairing-panel p, .device-empty { margin: 0; color: var(--muted); line-height: 1.6; }
.pairing-code { display: grid; gap: 7px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #11131d; font: 10px/1.55 var(--mono); overflow-wrap: anywhere; }
.pairing-windows-data span { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; }
.pairing-windows-data b { color: var(--muted); }
.pairing-candidate { display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border); }
.pairing-actions, .device-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.device-list { display: grid; gap: 10px; }
.device-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.device-card h3 { margin: 0 0 5px; font-size: 14px; }
.device-meta { color: var(--muted); font: 10px/1.6 var(--mono); overflow-wrap: anywhere; }
.device-status { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.device-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #777382; }
.device-status.online { color: var(--green); }
.device-status.online::before { background: var(--green); box-shadow: 0 0 8px #4edea380; }
.users-panel { max-width: 1050px; gap: 16px; }
.users-panel > div, .users-panel > form { background: var(--sidebar); border: 1px solid #2d2e3d; border-radius: 14px; padding: 22px; }
.users-panel h2 { font-size: 18px; margin: 0 0 10px; }
.users-panel p { color: var(--muted); line-height: 1.6; }
.user-row, .share-row { border-color: var(--border); flex-wrap: wrap; }
.dialog { background: var(--surface); border: 1px solid #58506d; border-radius: 16px; color: var(--text); box-shadow: 0 24px 80px #0009; max-height: 90dvh; }
.dialog::backdrop { background: #050712b8; backdrop-filter: blur(4px); }
.dialog-body { padding: 26px; gap: 16px; }
.dialog-body h2 { font-size: 19px; }
.dialog-actions { flex-wrap: wrap; }
.share-scope-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
#host-dialog { width: min(94vw, 760px); }
#host-dialog .dialog-body { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 86dvh; overflow-y: auto; }
#host-dialog .dialog-body > h2,
#host-dialog .dialog-body > .host-credentials-editor,
#host-dialog .dialog-body > .host-credential-new-hint,
#host-dialog .dialog-body > .dialog-actions { grid-column: 1 / -1; }
.host-credentials-editor { min-width: 0; margin: 4px 0 0; padding: 16px; border: 1px solid #3c3d50; border-radius: 12px; background: #121520; }
.host-credentials-editor legend { padding: 0 7px; color: var(--accent); font-weight: 700; }
.host-preferred-key-label { display: grid; gap: 5px; margin-bottom: 14px; color: var(--muted); font-size: 11px; }
.host-preferred-key-label small { color: #807b91; font: 9px/1.4 var(--mono); }
.host-saved-credential-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.host-saved-credential-row label,
.host-credential-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.host-credential-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.host-credential-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.host-credential-status { flex: 1; color: var(--green); font: 10px/1.4 var(--mono); }
.host-credential-new-hint { margin: 0; color: var(--muted); font-size: 11px; }
.error-message { color: #ffb4ab; }
.auth-view { background: radial-gradient(ellipse at 50% 0%, #302044, var(--page) 65%); }
.auth-card { background: #0b0e19ed; border: 1px solid #49405d; border-radius: 20px; padding: 36px; box-shadow: 0 25px 100px #0005; }
.auth-card::before { content: '>_  CENTRO DE TRABAJO'; display: block; color: var(--accent); font: 11px var(--mono); letter-spacing: 1px; margin-bottom: 24px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.6px; }
.auth-card p { color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
@media (max-width: 1350px) {
    .ssh-layout, .key-layout { grid-template-columns: 240px minmax(0, 1fr); }
    .ssh-layout { --ssh-sidebar-width: 260px; grid-template-columns: minmax(220px, var(--ssh-sidebar-width)) 16px minmax(0, 1fr); }
    .ssh-layout.host-sidebar-collapsed { grid-template-columns: 0 28px minmax(0, 1fr); }
}
@media (max-width: 1050px) {
    .app-header { padding: 0 12px; gap: 12px; }
    .app-brand { display: flex; min-width: 36px; font-size: 0; }
    .nav-btn { padding: 7px 11px; }
    .remote-workspace.sftp-open { grid-template-columns: minmax(0, 1fr) minmax(290px, 45%); }
    #notes-view.active { padding: 0 14px 14px; grid-template-columns: minmax(220px, var(--notes-sidebar-width)) 20px minmax(0, 1fr); }
    #notes-view.notes-sidebar-collapsed { grid-template-columns: 0 28px minmax(0, 1fr); }
    .editor-container { padding: 14px 14px 0; }
    #ssh-view, #keys-view { padding: 0 14px 14px; }
    .ssh-layout, .key-layout { grid-template-columns: 215px minmax(0, 1fr); gap: 10px; }
    .ssh-layout { --ssh-sidebar-width: 220px; grid-template-columns: minmax(220px, var(--ssh-sidebar-width)) 12px minmax(0, 1fr); gap: 0; }
    .ssh-layout.host-sidebar-collapsed { grid-template-columns: 0 28px minmax(0, 1fr); gap: 0; }
    .ssh-sidebar, .key-sidebar { padding: 12px; }
}
@media (max-width: 760px) {
    #app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px minmax(0, 1fr); }
    .workspace-view { grid-column: 1; }
    .app-header { height: 58px; gap: 6px; padding: 0 8px; }
    .app-brand { display: none; }
    #current-user { display: none; }
    .nav-btn { padding: 7px 9px; font-size: 11px; }
    .user-menu { gap: 3px; }
    .workspace-heading { padding: 16px 0 10px; }
    .workspace-heading h1 { font-size: 20px; }
    .eyebrow { font-size: 8px; letter-spacing: .5px; }
    #notes-view.active { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 225px minmax(420px, 1fr); overflow: auto; }
    .sidebar { padding: 12px; gap: 8px; }
    #notes-list { min-height: 50px; }
    .sidebar-label { display: none; }
    .sidebar-intro h2 { font-size: 13px; }
    #notes-view .sidebar { grid-column: 1; grid-row: 2; }
    #notes-view .editor-container { grid-column: 1; grid-row: 3; }
    #notes-view .notes-divider { position: absolute; z-index: 4; top: 78px; right: 18px; width: 24px; min-width: 24px; height: 30px; cursor: default; }
    #notes-view .notes-divider::before { display: none; }
    #notes-view.notes-sidebar-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(420px, 1fr); }
    #notes-view.notes-sidebar-collapsed .editor-container { grid-row: 2; }
    .ssh-layout, .key-layout { display: flex; flex-direction: column; overflow-y: auto; }
    .ssh-layout .host-divider { display: contents; }
    .ssh-layout .host-sidebar-toggle { left: auto; right: 8px; transform: none; }
    .ssh-layout.host-sidebar-collapsed .host-sidebar-toggle { left: 4px; right: auto; }
    .ssh-sidebar, .key-sidebar { flex: 0 0 190px; min-height: 0; }
    .ssh-main { flex: 1 0 650px; overflow: visible; }
    .key-main { flex: 1 0 350px; }
    .remote-workspace.sftp-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 1fr) minmax(280px, 1fr); min-height: 520px; }
    #terminal-workspace[data-panel-count="2"], #terminal-workspace[data-panel-count="3"], #terminal-workspace[data-panel-count="4"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(var(--terminal-panel-count, 1), minmax(180px, 1fr)); overflow-y: auto; }
    #terminal-workspace[data-panel-count="3"] .terminal-pane[data-panel-position="1"] { grid-row: auto; }
    .users-view { padding: 14px; }
    #host-dialog .dialog-body, .host-credential-fields { grid-template-columns: minmax(0, 1fr); }
    #host-dialog .dialog-body > * { grid-column: 1; }
    .host-saved-credential-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 650px) and (min-width: 761px) {
    .workspace-heading { padding-top: 12px; padding-bottom: 10px; }
    .workspace-heading h1 { font-size: 20px; }
}
@media (max-width: 1999px) {
    #ssh-view > .workspace-heading { display: none; }
    #ssh-view { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { button { transition: none; } }

/* Estado de ICMP medido desde el servidor. */
.host-status-dot { display: inline-block; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #958da1; box-sizing: content-box; }
.host-status-dot.online { background: var(--green); box-shadow: 0 0 7px #4edea355; }
.host-status-dot.unreachable { background: #ffb4ab; }
.host-latency { flex: 0 0 auto; white-space: nowrap; color: var(--muted); font: 9px var(--mono); }
.host-latency.online { color: var(--green); }
.host-latency.unreachable { color: #ffb4ab; }

#sftp-button { width: 34px; height: 32px; min-height: 32px; padding: 7px; border: 0; border-radius: 9px; background: #29283b; color: #d4cce6; }
#sftp-button:hover:not(:disabled) { background: #39334d; color: #f0e4ff; }
#sftp-button.active { background: linear-gradient(110deg, #7c3aed, #6344da); color: #fff; box-shadow: 0 0 14px #7c3aed55; }
#sftp-button.active:hover:not(:disabled) { background: #8b4cf3; }
#sftp-button .ui-icon { width: 17px; height: 17px; }
.windows-signing { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 0.85rem; }
.windows-signing summary { cursor: pointer; overflow-wrap: anywhere; }
.windows-signing #windows-signing-commands { white-space: pre-wrap; }

/* Integración con IA */
.ai-warning { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ai-dialog-device { font: 11px/1.5 var(--mono); color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.ai-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.ai-check input { width: auto; margin: 0; }
.ai-scopes { border: 1px solid #2d2e3d; border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; margin: 0; }
.ai-scopes legend { padding: 0 6px; font-size: 12px; color: var(--muted); }
.ai-scopes:disabled { opacity: .5; }
.ai-setup h3 { font-size: 13px; margin: 6px 0; }
.ai-snippet { white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.5 var(--mono); background: #12131c; border: 1px solid #2d2e3d; border-radius: 8px; padding: 10px; margin: 0; }
#ai-note-button.active { color: #f0b36b; }
.ai-requests { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(360px, calc(100vw - 32px)); max-height: 60vh; overflow: auto;
  background: var(--sidebar); border: 1px solid #5b3fb0; border-radius: 14px; padding: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); display: grid; gap: 10px; }
.ai-requests-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ai-request { border: 1px solid #2d2e3d; border-radius: 10px; padding: 10px; display: grid; gap: 4px; font-size: 12px; overflow-wrap: anywhere; }
.ai-request.pending { border-color: #f0b36b; }
.ai-request small { color: var(--muted); font: 10px/1.5 var(--mono); }
.ai-request p { margin: 2px 0; }
.ai-request-actions { display: flex; justify-content: flex-end; gap: 6px; }
#host-ai-notes-button.has-notes { color: #f0b36b; border-color: #6b4f2b; }
.host-ai-notes-dialog { width: min(760px, calc(100vw - 32px)); }
.host-ai-notes-dialog textarea { font: 12px/1.5 var(--mono); min-height: 320px; resize: vertical; }
.host-ai-notes-meta { font: 11px/1.5 var(--mono); color: var(--muted); margin: 0; }
.host-ai-label { flex: 0 0 auto; margin-left: 0; padding: 2px 5px; border: 1px solid #6b4f2b; border-radius: 99px; color: #f0b36b; font: 8px/1 var(--mono); letter-spacing: .35px; }
.ai-activity { display: grid; gap: 8px; }
.ai-activity-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ai-activity-header h2 { margin: 0; }
.ai-activity-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; padding: 8px 0; border-top: 1px solid #2d2e3d; font-size: 12px; }
.ai-activity-row > :not(.ai-activity-when) { grid-column: 2; }
.ai-activity-row code { font: 11px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: #d6cde6; }
.ai-activity-row small { color: var(--muted); font: 10px/1.5 var(--mono); }
.ai-activity-row.failed strong { color: #f88; }
.ai-activity-when { color: var(--muted); font: 10px/1.6 var(--mono); }
@media (max-width: 600px) { .ai-activity-row { grid-template-columns: 1fr; } .ai-activity-row > * { grid-column: 1 !important; } }
