/* Fuentes: stack del sistema (sin descarga externa). El panel se ve igual de bien
   con Segoe UI / SF Pro / Cascadia / Consolas que con Inter / JetBrains Mono. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: local('Inter'), local('-apple-system'), local('Segoe UI'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 500; font-display: swap; src: local('JetBrains Mono'), local('Cascadia Mono'), local('Consolas'), local('Menlo'); }

[hidden] { display: none !important; }

:root {
  --bg:           #08090c;
  --bg-2:         #0f1117;
  --bg-3:         #161922;
  --bg-4:         #1d212c;
  --bg-hover:     #1f2330;
  --fg:           #e9eaf2;
  --fg-muted:     #6b7081;
  --fg-dim:       #4a4f5e;
  --border:       #1d212c;
  --border-2:     #262b38;
  --accent:       #7c5cff;
  --accent-2:     #5d3bff;
  --accent-soft:  rgba(124, 92, 255, 0.12);
  --accent-glow:  rgba(124, 92, 255, 0.35);
  --success:      #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warn:         #f59e0b;
  --warn-soft:    rgba(245, 158, 11, 0.12);
  --danger:       #ef4444;
  --danger-soft:  rgba(239, 68, 68, 0.12);
  --radius:       10px;
  --radius-lg:    14px;
  --radius-sm:    6px;
  --sidebar-w:    188px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.25);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:    0 12px 40px rgba(0,0,0,0.5);
  --tr:           cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg:           #fafafb;
  --bg-2:         #ffffff;
  --bg-3:         #f5f5f7;
  --bg-4:         #ebebef;
  --bg-hover:     #f0f0f4;
  --fg:           #131419;
  --fg-muted:     #6b6f7a;
  --fg-dim:       #b1b4bd;
  --border:       #ececf0;
  --border-2:     #d8d8df;
  --accent-soft:  rgba(124, 92, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; overflow: hidden; }

#topbar { display: flex; align-items: center; gap: 14px; padding: 0 20px; background: var(--bg-2); border-bottom: 1px solid var(--border); height: 56px; flex-shrink: 0; }
.brand { font-weight: 700; font-size: 15px; background: linear-gradient(135deg, var(--accent) 0%, #b794ff 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; white-space: nowrap; letter-spacing: -0.01em; }
.brand .version { color: var(--fg-muted); -webkit-text-fill-color: var(--fg-muted); font-size: 11px; font-weight: 500; margin-left: 4px; }
.host-selector { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-muted); }
.host-selector select { background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; transition: border-color .2s var(--tr); }
.host-selector select:hover { border-color: var(--accent); background: var(--bg-hover); }
.spacer { flex: 1; }
.user-info { display: flex; align-items: center; gap: 6px; font-size: 12px; }
#user-label { color: var(--fg); background: var(--bg-3); padding: 5px 12px; border-radius: 100px; font-weight: 500; font-size: 11.5px; margin-right: 4px; border: 1px solid var(--border); }
.icon-btn { background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); padding: 6px 11px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 500; transition: all .2s var(--tr); font-family: inherit; }
.icon-btn:hover { background: var(--accent); border-color: var(--accent); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.user-info .btn { background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; cursor: pointer; transition: all .2s var(--tr); }
.user-info .btn:hover { background: var(--danger); border-color: var(--danger); color: white; transform: translateY(-1px); }

#body { display: grid; grid-template-columns: var(--sidebar-w) 1fr; overflow: hidden; }
#body.collapsed { grid-template-columns: 60px 1fr; }
#body.collapsed #sidebar .lbl, #body.collapsed #sidebar .nav-sep { display: none; }
#body.collapsed #sidebar button { justify-content: center; padding: 10px 0; }

#sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 14px 10px; overflow-y: auto; overflow-x: hidden; }
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
#sidebar nav { display: flex; flex-direction: column; gap: 1px; }
#sidebar button { display: flex; align-items: center; gap: 11px; background: transparent; color: var(--fg-muted); border: none; border-radius: var(--radius-sm); padding: 8px 11px; cursor: pointer; font-size: 13px; font-weight: 500; text-align: left; width: 100%; font-family: inherit; transition: background .15s var(--tr), color .15s var(--tr); white-space: nowrap; position: relative; }
#sidebar button .ico { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; filter: grayscale(0.4); transition: filter .2s var(--tr); }
#sidebar button .lbl { flex: 1; }
#sidebar button:hover { background: var(--bg-hover); color: var(--fg); }
#sidebar button:hover .ico { filter: grayscale(0); }
#sidebar button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#sidebar button.active::before { content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 3px; height: 18px; background: var(--accent); border-radius: 0 3px 3px 0; box-shadow: 0 0 8px var(--accent-glow); }
#sidebar button.active .ico { filter: grayscale(0); }
.nav-sep { font-size: 10px; font-weight: 600; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .1em; padding: 14px 12px 6px; }

#content { overflow: auto; position: relative; padding: 24px 28px; background: radial-gradient(circle at 0% 0%, rgba(124, 92, 255, 0.04) 0%, transparent 50%), var(--bg); }
#content::-webkit-scrollbar { width: 10px; }
#content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
.pane { display: none; animation: fadeIn .25s var(--tr); }
.pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

#statusbar { display: flex; gap: 20px; padding: 6px 20px; background: var(--bg-2); border-top: 1px solid var(--border); font-size: 11px; color: var(--fg-muted); font-family: 'JetBrains Mono', 'Consolas', monospace; height: 30px; flex-shrink: 0; align-items: center; }
#statusbar .sb-item { display: inline-flex; align-items: center; gap: 4px; }
.sb-item.right { margin-left: auto; }

.overlay { position: fixed; inset: 0; background: rgba(8, 9, 12, 0.75); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(12px); }
.login-card { background: var(--bg-2); border: 1px solid var(--border); padding: 40px 36px; border-radius: var(--radius-lg); width: 380px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg), 0 0 80px rgba(124, 92, 255, 0.1); position: relative; }
.login-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.login-card h1 { font-size: 22px; font-weight: 700; background: linear-gradient(135deg, var(--accent) 0%, #b794ff 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.02em; }
.login-card .muted { color: var(--fg-muted); font-size: 12.5px; }
.login-card input { background: var(--bg); color: var(--fg); border: 1px solid var(--border-2); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; transition: border-color .2s var(--tr), box-shadow .2s var(--tr); }
.login-card input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card button { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: white; border: none; padding: 11px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; font-weight: 600; font-family: inherit; transition: transform .15s var(--tr), box-shadow .2s var(--tr); }
.login-card button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.login-card .error { color: var(--danger); font-size: 12px; min-height: 16px; }

.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; transition: border-color .2s var(--tr); }
.panel:hover { border-color: var(--border-2); }
.panel h2 { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; letter-spacing: -0.01em; }
.panel h3 { font-size: 10.5px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.col { flex: 1; min-width: 0; }

button.btn, .btn { background: var(--bg-3); color: var(--fg); border: 1px solid var(--border-2); padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; font-weight: 500; font-family: inherit; transition: all .15s var(--tr); line-height: 1.4; }
button.btn:hover { background: var(--bg-hover); border-color: var(--border-2); color: var(--fg); transform: translateY(-1px); }
button.btn.primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: white; border-color: transparent; font-weight: 600; }
button.btn.primary:hover { box-shadow: 0 6px 20px var(--accent-glow); transform: translateY(-1px); }
button.btn.danger { background: var(--danger); color: white; border-color: var(--danger); font-weight: 600; }
button.btn.danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,0.35); }
button.btn.success { background: var(--success); color: white; border-color: var(--success); font-weight: 600; }
button.btn.success:hover { box-shadow: 0 6px 20px rgba(34,197,94,0.35); }
button.btn.small { padding: 4px 10px; font-size: 11.5px; }

input, select, textarea { background: var(--bg); color: var(--fg); border: 1px solid var(--border-2); padding: 7px 11px; border-radius: var(--radius-sm); font-size: 12.5px; font-family: inherit; transition: border-color .15s var(--tr), box-shadow .15s var(--tr); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
table.data thead th { background: var(--bg-3); color: var(--fg-muted); font-weight: 600; text-transform: uppercase; font-size: 10.5px; letter-spacing: .07em; }
table.data tbody tr { transition: background .12s var(--tr); }
table.data tr:hover td { background: var(--bg-3); }
table.data tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge.active { background: var(--success-soft); color: var(--success); }
.badge.inactive { background: var(--danger-soft); color: var(--danger); }
.badge.partial { background: var(--warn-soft); color: var(--warn); }
.badge.unknown { background: var(--bg-3); color: var(--fg-muted); }

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; transition: transform .2s var(--tr), border-color .2s var(--tr), box-shadow .2s var(--tr); position: relative; overflow: hidden; }
.metric-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0; transition: opacity .2s var(--tr); }
.metric-card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--shadow-md); }
.metric-card:hover::before { opacity: 1; }
.metric-card .label { color: var(--fg-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.metric-card .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.metric-card .sub { color: var(--fg-muted); font-size: 11px; margin-top: 4px; font-family: 'JetBrains Mono', monospace; }

.term-container { background: #000; border-radius: var(--radius); height: calc(100vh - 180px); padding: 8px; border: 1px solid var(--border); }
.term-tabs { display: flex; gap: 3px; margin-bottom: 8px; }
.term-tabs .tab { background: var(--bg-3); padding: 6px 14px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: 11.5px; cursor: pointer; color: var(--fg-muted); border: 1px solid var(--border); border-bottom: none; }
.term-tabs .tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.term-tabs .add { background: var(--bg-3); padding: 6px 12px; cursor: pointer; border-radius: var(--radius-sm); }

.fm-split { display: grid; grid-template-columns: 1fr 8px 1fr; height: calc(100vh - 240px); }
.fm-pane { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.fm-pane .header { padding: 10px; background: var(--bg-3); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.fm-pane .list { flex: 1; overflow: auto; }
.fm-pane .list .item { padding: 6px 12px; border-bottom: 1px solid rgba(255,255,255,.02); display: grid; grid-template-columns: 22px 1fr 100px 90px 140px; gap: 10px; cursor: pointer; font-family: 'JetBrains Mono', monospace; font-size: 12px; transition: background .12s var(--tr); }
.fm-pane .list .item:hover { background: var(--bg-3); }
.fm-pane .list .item.selected { background: var(--accent-soft); color: var(--accent); }
.fm-pane.dnd-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }
.fm-pane.dnd-over .list::before { content: 'Soltá aquí para subir →'; position: sticky; top: 0; padding: 12px; text-align: center; color: var(--accent); font-weight: 700; display: block; background: var(--bg-2); border-bottom: 1px solid var(--accent); }
.fm-queue { margin-top: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.fm-queue h3 { margin: 0 0 8px 0; font-size: 13px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.fm-ctx-menu div:active { background: var(--accent-soft); }
.notes-md-preview { padding: 14px; line-height: 1.55; }
.notes-md-preview h1, .notes-md-preview h2, .notes-md-preview h3 { margin-top: 0.8em; }
.notes-md-preview code { background: var(--bg-3); padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.notes-md-preview pre { background: var(--bg-3); padding: 10px; border-radius: 6px; overflow-x: auto; }
.notes-md-preview blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--fg-muted); margin: 0.6em 0; }
.notes-md-preview a { color: var(--accent); }

.sql-area { display: grid; grid-template-rows: 1fr 1fr; height: calc(100vh - 240px); gap: 10px; }
.CodeMirror { height: 100% !important; font-size: 12.5px; border-radius: var(--radius); font-family: 'JetBrains Mono', monospace; }

#toasts { position: fixed; bottom: 40px; right: 22px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-2); color: var(--fg); border: 1px solid var(--border-2); padding: 12px 18px; border-radius: var(--radius); min-width: 260px; box-shadow: var(--shadow-lg); font-size: 12.5px; font-weight: 500; animation: slideIn .25s var(--tr); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warn { border-left: 3px solid var(--warn); }

#cmd-palette .palette { background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius-lg); padding: 14px; width: 600px; max-height: 70vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg), 0 0 80px rgba(124, 92, 255, 0.1); }
#cmd-palette input { background: var(--bg); color: var(--fg); border: 1px solid var(--border-2); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14.5px; font-family: inherit; }
#cmd-palette input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#cmd-palette ul { list-style: none; margin-top: 10px; overflow: auto; }
#cmd-palette li { padding: 10px 14px; cursor: pointer; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: background .12s var(--tr); }
#cmd-palette li.active, #cmd-palette li:hover { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: white; }

.alert-banner { background: linear-gradient(135deg, var(--danger), #b91c1c); color: white; padding: 10px 18px; font-size: 12.5px; font-weight: 600; text-align: center; }
.alert-banner.warn { background: linear-gradient(135deg, var(--warn), #b45309); color: white; }

.mono { font-family: 'JetBrains Mono', 'Consolas', monospace; }
.muted { color: var(--fg-muted); }
.right { text-align: right; }
.center { text-align: center; }
.flex-row { display: flex; gap: 10px; align-items: center; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }
.mb-sm { margin-bottom: 10px; }
.mt-sm { margin-top: 10px; }

/* ── DB module ── */
.db-app { display: grid; grid-template-columns: 240px 1fr; gap: 14px; height: calc(100vh - 140px); }
.db-aside { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.db-aside-header { display: flex; gap: 4px; margin-bottom: 8px; }
.db-aside-header select { flex: 1; padding: 5px 8px; }
.db-section { font-size: 10px; font-weight: 600; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .08em; padding: 10px 4px 4px; }
.db-list { display: flex; flex-direction: column; gap: 1px; }
.db-item { display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; transition: background .12s var(--tr); color: var(--fg-muted); }
.db-item:hover { background: var(--bg-hover); color: var(--fg); }
.db-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.db-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.db-quick button { font-size: 11px; padding: 4px 8px; }
.db-main { display: flex; flex-direction: column; gap: 12px; overflow: auto; min-width: 0; }
.db-main > .panel { margin: 0; }
.db-main textarea { width: 100%; min-height: 160px; font-family: 'JetBrains Mono', monospace; resize: vertical; }
.db-error { color: var(--danger); padding: 10px; background: var(--danger-soft); border-radius: var(--radius-sm); }
.db-hist-item { padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s var(--tr); }
.db-hist-item:hover { background: var(--bg-hover); }
.muted.small { font-size: 11px; padding: 4px 8px; }

/* ─────────── Terminal — Windows Terminal style ─────────── */
/* Reemplazo el grid del pane terminal para que ocupe todo el alto */
.pane[data-pane="terminal"].active {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 8px;
  height: calc(100vh - 100px);
}

/* Toolbar superior */
.term-toolbar {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  flex-wrap: wrap;
}
.term-tool {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border-2);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all .15s var(--tr);
  display: inline-flex; align-items: center; gap: 6px;
}
.term-tool:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.term-tool.small { padding: 4px 8px; font-size: 11px; }
.term-tool-sep   { width: 1px; height: 22px; background: var(--border-2); margin: 0 4px; }
.term-tool-lbl   { color: var(--fg-muted); font-size: 11px; font-weight: 600; padding: 0 4px; }
.term-tool-sel {
  background: var(--bg-3);
  color: var(--fg);
  border: 1px solid var(--border-2);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  cursor: pointer;
}

/* Search bar */
.term-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.term-search input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
}

/* Tabs estilo Windows Terminal */
.term-tabs {
  display: flex; align-items: flex-end; gap: 3px;
  padding: 0 4px;
  border-bottom: 1px solid var(--border);
}
.term-tab {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 7px 14px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  margin-bottom: -1px;
  transition: background .15s var(--tr), color .15s var(--tr);
  position: relative;
}
.term-tab:hover { background: var(--bg-hover); color: var(--fg); }
.term-tab.active {
  background: #000;
  color: var(--accent);
  border-color: var(--border-2);
  border-bottom: 1px solid #000;
}
.term-tab.active::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius) var(--radius) 0 0;
}
.term-tab-icon { font-size: 9px; color: var(--success); }
.term-tab.active .term-tab-icon { color: var(--accent); }
.term-tab-label { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.term-tab-close {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
  color: var(--fg-muted);
  opacity: 0.6;
  transition: all .12s var(--tr);
}
.term-tab-close:hover {
  background: var(--danger);
  color: white;
  opacity: 1;
}

.term-tab-add {
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  margin-bottom: -1px;
  transition: all .12s var(--tr);
}
.term-tab-add:hover { background: var(--bg-hover); color: var(--accent); }

/* Host de terminales (fondo negro como Windows Terminal) */
.term-host {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px;
  overflow: hidden;
  min-height: 300px;
}
.term-pane { height: 100%; }
.term-pane .xterm-viewport { background: transparent !important; }

/* Status bar inferior */
.term-statusbar {
  display: flex; align-items: center; gap: 14px;
  padding: 5px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--fg-muted);
}
.term-statusbar .spacer { flex: 1; }

/* ── Scrollbar de xterm.js (terminal) ── */
.xterm-viewport::-webkit-scrollbar {
  width: 10px;
  background: transparent;
}
.xterm-viewport::-webkit-scrollbar-track {
  background: var(--bg-2);
  border-radius: 5px;
}
.xterm-viewport::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 5px;
  border: 2px solid var(--bg-2);
}
.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
.xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) var(--bg-2);
}

/* Scrollbars globales para Firefox y cualquier elemento con overflow */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

/* Default scrollbar para todo lo que no esté ya estilizado */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }
::-webkit-scrollbar-corner { background: transparent; }

/* ── Notes module ── */
.notes-app { display: grid; grid-template-columns: 260px 1fr; gap: 14px; height: calc(100vh - 140px); }
.notes-aside { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.notes-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.notes-item { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s var(--tr); }
.notes-item:hover { background: var(--bg-hover); }
.notes-item.active { background: var(--accent-soft); }
.notes-item-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.notes-item-meta { font-size: 10.5px; color: var(--fg-muted); }
.notes-main { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.notes-title-input { font-size: 18px; font-weight: 600; border: none; background: transparent; padding: 4px 0; }
.notes-title-input:focus { box-shadow: none; }
.notes-tags-input { font-size: 12px; border: 1px solid var(--border); padding: 5px 10px; }
.notes-textarea { flex: 1; min-height: 300px; font-family: 'JetBrains Mono', monospace; font-size: 13px; resize: none; }

/* ─── Cheat sheet de atajos (Ctrl+?) ─── */
.sc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.sc-overlay[hidden] { display: none !important; }
.sc-modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 22px 26px; width: 560px; max-width: 95vw; max-height: 85vh; overflow: auto; }
.sc-modal h2 { margin: 0 0 4px; font-size: 18px; }
.sc-sub { font-size: 12px; color: var(--fg-muted); margin: 0 0 14px; }
.sc-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.sc-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.sc-keys { display: flex; align-items: center; gap: 4px; min-width: 140px; }
.sc-keys kbd { background: var(--bg-3); border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; font-weight: 600; }
.sc-plus { color: var(--fg-muted); font-size: 10px; }
.sc-desc { font-size: 12.5px; color: var(--fg); }
.sc-footer { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ─── Global search (Ctrl+/) ─── */
.gs-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding-top: 80px; }
.gs-overlay[hidden] { display: none !important; }
.gs-modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; width: 640px; max-width: 95vw; max-height: 70vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.gs-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.gs-icon { font-size: 18px; }
.gs-input { flex: 1; background: transparent; border: none; outline: none; color: var(--fg); font-size: 15px; }
.gs-close { background: none; border: none; color: var(--fg-muted); font-size: 16px; cursor: pointer; padding: 2px 8px; border-radius: 4px; }
.gs-close:hover { background: var(--bg-3); color: var(--fg); }
.gs-results { flex: 1; overflow-y: auto; padding: 8px; }
.gs-section { margin-bottom: 12px; }
.gs-section-title { font-size: 10px; font-weight: 700; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .08em; padding: 6px 10px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: background .12s; }
.gs-item:hover { background: var(--bg-3); }
.gs-item-ico { font-size: 16px; min-width: 22px; }
.gs-item-body { flex: 1; min-width: 0; }
.gs-item-title { font-size: 13px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-sub { font-size: 11px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-tag { font-size: 9.5px; padding: 2px 7px; border-radius: 10px; background: var(--bg-3); color: var(--fg-muted); text-transform: uppercase; font-weight: 600; letter-spacing: .04em; }
.gs-empty { padding: 30px 20px; text-align: center; color: var(--fg-muted); font-size: 12px; }
.gs-empty.error { color: var(--danger); }
.gs-foot { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--fg-muted); text-align: center; }

/* ─── Onboarding tour ─── */
.ob-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1900; display: flex; align-items: center; justify-content: center; }
.ob-overlay[hidden] { display: none !important; }
.ob-modal { background: var(--bg-2); border: 1px solid var(--accent); border-radius: 12px; padding: 30px; max-width: 520px; box-shadow: 0 0 30px rgba(124,92,255,.3); }
.ob-modal h2 { margin: 0 0 12px; color: var(--accent); }
.ob-modal p { line-height: 1.6; color: var(--fg); margin: 0 0 16px; }
.ob-progress { font-size: 11px; color: var(--fg-muted); text-align: center; padding: 8px 0; }
.ob-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

/* ─── Favorites star ─── */
.fav-star { font-size: 11px; transition: opacity .15s; }
.fav-star:hover { opacity: 1 !important; color: gold; }

/* ─── Themes: cyberpunk ─── */
:root[data-theme="cyberpunk"] {
  --bg: #0a0014; --bg-2: #14001f; --bg-3: #1f0033;
  --fg: #e0d4ff; --fg-muted: #9a7fc4;
  --accent: #ff00ff; --accent-2: #00ffff; --accent-soft: rgba(255,0,255,.12);
  --border: #3d1a5f; --border-2: #5a2980;
  --success: #00ff9f; --warn: #ffa500; --danger: #ff0066;
}
:root[data-theme="cyberpunk"] body { background: linear-gradient(135deg, #0a0014 0%, #1a0033 100%); }

/* ─── Themes: github-light ─── */
:root[data-theme="github-light"] {
  --bg: #ffffff; --bg-2: #f6f8fa; --bg-3: #eaeef2;
  --fg: #1f2328; --fg-muted: #59636e;
  --accent: #0969da; --accent-2: #0550ae; --accent-soft: rgba(9,105,218,.08);
  --border: #d1d9e0; --border-2: #b8c1cb;
  --success: #1a7f37; --warn: #9a6700; --danger: #d1242f;
}

/* ─── Empty states ─── */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 20px; color: var(--fg-muted); }
.empty-state .ico { font-size: 48px; opacity: 0.5; }
.empty-state h3 { font-size: 16px; margin: 0; color: var(--fg); }
.empty-state p { font-size: 12.5px; margin: 0; max-width: 320px; text-align: center; }

/* ─── Statusbar hover ─── */
#statusbar .sb-item:hover { background: var(--bg-3); border-radius: 4px; }

/* ─── Disk warn badge animado ─── */
#sidebar-disk-warn { animation: hertnez-pulse 2s infinite; }
@keyframes hertnez-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }