/* Server Portal — always-dark, mobile-first */
:root {
  --bg: #0b0e14;
  --bg-2: #0f131b;
  --surface: #141a24;
  --surface-2: #1a2130;
  --surface-3: #212a3b;
  --border: #232c3d;
  --border-2: #2e3a50;
  --text: #dbe2ee;
  --text-2: #a9b4c6;
  --muted: #7d889b;
  --accent: #7aa2f7;
  --accent-2: #5b84e0;
  --accent-ink: #0b1222;
  --green: #8fd16a;
  --yellow: #e5b567;
  --red: #f7768e;
  --purple: #bb9af7;
  --cyan: #7dcfff;
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --top-h: 56px;
  --tabs-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }
code, pre, .mono { font-family: var(--mono); }
.ic { flex: none; display: block; }
[hidden] { display: none !important; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.gap-lg { gap: 14px; }
.mt { margin-top: 12px; }
.center-pad { display: grid; place-items: center; padding: 48px 0; }

/* ---- Boot / spinner ---- */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Shell ---- */
#app.shell { height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  min-height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 10px 0 16px;
  background: rgba(11, 14, 20, .92);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .back { margin-left: -8px; }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.full { overflow: hidden; display: flex; flex-direction: column; }
.content { padding: 14px 14px calc(var(--tabs-h) + var(--safe-b) + 24px); max-width: 860px; margin: 0 auto; }
.content-full { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: calc(var(--tabs-h) + var(--safe-b)); }
body.no-tabs .content-full { padding-bottom: var(--safe-b); }
body.no-tabs .tabs { display: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(13, 17, 25, .96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 550;
}
.tab.active { color: var(--accent); }
.tab-ic { position: relative; }
.tab .dot { position: absolute; top: -2px; right: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--bg); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: rgba(247, 118, 142, .14); border-color: rgba(247, 118, 142, .4); color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 0; color: var(--text-2);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.on { color: var(--accent); background: rgba(122, 162, 247, .12); }

/* ---- Cards / lists ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px;
}
.card.tap { cursor: pointer; transition: border-color .15s, background .15s; display: block; color: inherit; }
.card.tap:active { background: var(--surface-2); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { font-size: 15px; flex: 1; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 8px; }
.section-title h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); color: inherit; min-height: 52px; }
.list-item:first-child { border-top: 0; }
.list-item.tap:active { background: var(--surface-2); }
.list-item .title { font-weight: 600; }
.list-item .sub { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-all; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.green { background: rgba(143, 209, 106, .14); color: var(--green); }
.badge.yellow { background: rgba(229, 181, 103, .16); color: var(--yellow); }
.badge.red { background: rgba(247, 118, 142, .15); color: var(--red); }
.badge.blue { background: rgba(122, 162, 247, .15); color: var(--accent); }
.badge.purple { background: rgba(187, 154, 247, .15); color: var(--purple); }
.badge.pulse::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.meter { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > div { height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s; }
.meter.yellow > div { background: var(--yellow); }
.meter.red > div { background: var(--red); }
.meter.green > div { background: var(--green); }

.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty .btn { margin-top: 10px; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.field > span { font-weight: 600; }
.field small { color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text); font-size: 16px; outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 88px; line-height: 1.4; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text); min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }

/* ---- Toasts ---- */
#toasts { position: fixed; z-index: 100; left: 12px; right: 12px; top: calc(var(--safe-t) + 10px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 520px; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 550;
  background: var(--surface-3); border: 1px solid var(--border-2); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: toastIn .2s ease-out; white-space: pre-wrap;
}
.toast.error { border-color: rgba(247,118,142,.5); color: #ffd0d9; }
.toast.ok { border-color: rgba(143,209,106,.45); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ---- Sheets ---- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(3, 5, 9, .62);
  display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s;
}
.overlay.out { opacity: 0; transition: opacity .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-2); border-bottom: 0;
  border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b);
  animation: sheetUp .22s cubic-bezier(.2,.8,.2,1);
}
.sheet.wide { max-width: 900px; height: 88vh; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } }
.sheet-head { display: flex; align-items: center; padding: 10px 8px 6px 18px; }
.sheet-title { flex: 1; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 4px 18px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.sheet-body > .stack { padding-top: 4px; }
.sheet-actions { display: flex; gap: 8px; padding: 10px 18px 14px; border-top: 1px solid var(--border); }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--border-2); }
}
.menu-list { display: flex; flex-direction: column; margin: 0 -8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 10px; border: 0; background: none; text-align: left;
  border-radius: 10px; font-size: 15px; font-weight: 550; color: var(--text);
}
.menu-item:active { background: var(--surface-2); }
.menu-item small { margin-left: auto; color: var(--muted); font-weight: 500; }
.menu-item.danger { color: var(--red); }
.menu-item .ic { color: var(--text-2); }
.menu-item.danger .ic { color: var(--red); }
.viewer {
  margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; height: 100%; overflow: auto;
}

/* ---- Login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 18px; }
.login-card { width: 100%; max-width: 380px; }
.login-logo { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px; background: linear-gradient(140deg, #1d2a45, #12192a); border: 1px solid var(--border-2); color: var(--accent); }
.login h1 { text-align: center; font-size: 22px; }
.login .lead { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login .err { color: var(--red); font-size: 14px; min-height: 20px; text-align: center; }

/* ---- Dashboard ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 550; margin-left: 3px; }
.stat-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 40px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-area { fill: rgba(122, 162, 247, .12); stroke: none; }
.spark.green .spark-line { stroke: var(--green); } .spark.green .spark-area { fill: rgba(143, 209, 106, .12); }
.spark.purple .spark-line { stroke: var(--purple); } .spark.purple .spark-area { fill: rgba(187, 154, 247, .12); }
.spark.yellow .spark-line { stroke: var(--yellow); } .spark.yellow .spark-area { fill: rgba(229, 181, 103, .12); }
.chart-card .spark { height: 64px; }
.host-line { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin: 0 2px 12px; }
.alert-row { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.alert-row:first-child { border-top: 0; }
.alert-row .t { font-weight: 600; font-size: 14px; }
.alert-row .b { font-size: 12.5px; color: var(--text-2); }
.alert-row .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.lvl { width: 4px; border-radius: 4px; flex: none; background: var(--accent); }
.lvl.warn { background: var(--yellow); } .lvl.crit { background: var(--red); }

/* ---- Claude sessions ---- */
.sess-card { display: flex; flex-direction: column; gap: 8px; }
.sess-card .title { font-weight: 650; font-size: 15.5px; }
.sess-card .last { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sess-card.waiting { border-color: rgba(229, 181, 103, .55); box-shadow: 0 0 0 1px rgba(229,181,103,.15) inset; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); z-index: 25;
  height: 52px; padding: 0 20px; border-radius: 26px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.5);
}
.fab:active { transform: scale(.96); }

/* ---- Chat ---- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px 8px; overscroll-behavior: contain; }
.chat-inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 100%; }
.msg.user { align-self: flex-end; max-width: 88%; background: #233256; border: 1px solid #2d3f6b; color: #e7edfb; padding: 9px 13px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; word-break: break-word; }
.msg.assistant { align-self: stretch; padding: 2px 2px; word-break: break-word; }
.msg.command { align-self: flex-end; font-family: var(--mono); font-size: 12.5px; color: var(--purple); background: rgba(187,154,247,.1); border-radius: 8px; padding: 4px 10px; }
.msg.system { align-self: stretch; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; border-left: 2px solid var(--border-2); padding: 2px 10px; }
.msg-time { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: right; }
.tool {
  align-self: stretch; border: 1px solid var(--border); background: var(--bg-2); border-radius: 10px; font-size: 13px; overflow: hidden;
}
.tool summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; min-height: 36px; }
.tool summary::-webkit-details-marker { display: none; }
.tool .tname { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--cyan); flex: none; }
.tool .tsum { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-size: 12.5px; }
.tool .tstate { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.tool.done .tstate { background: var(--green); animation: none; }
.tool.err .tstate { background: var(--red); animation: none; }
.tool pre { margin: 0; padding: 8px 10px; border-top: 1px solid var(--border); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; color: var(--text-2); }
.tool pre.cmd { color: var(--text); background: var(--bg); }
.tool-group { align-self: stretch; display: flex; flex-direction: column; gap: 4px; }
.load-more { align-self: center; }

.prompt-card { margin: 0 12px 8px; padding: 12px; border-radius: 14px; background: #2a2416; border: 1px solid rgba(229,181,103,.5); max-width: 860px; align-self: center; width: calc(100% - 24px); }
.prompt-card .q { font-size: 13.5px; white-space: pre-wrap; margin-bottom: 10px; max-height: 30vh; overflow: auto; color: #f3e2c0; }
.prompt-card .opts { display: flex; flex-direction: column; gap: 6px; }
.prompt-card .opts .btn { justify-content: flex-start; text-align: left; white-space: normal; min-height: 42px; }
.prompt-card .opts .btn b { color: var(--yellow); margin-right: 4px; }

.composer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 8px 10px calc(8px); }
.composer-inner { max-width: 860px; margin: 0 auto; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; min-height: 42px; max-height: 40vh; resize: none; padding: 10px 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text); font-size: 16px; line-height: 1.35; outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.send-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.send-btn:disabled { opacity: .4; }
.keys { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.key { flex: none; min-width: 40px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-2); font-size: 12.5px; font-weight: 650; font-family: var(--mono); }
.key:active, .key.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.attach-row { display: flex; gap: 6px; flex-wrap: wrap; padding-bottom: 6px; }
.attach { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-2); background: var(--surface); display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.attach img { width: 100%; height: 100%; object-fit: cover; }
.attach button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; display: grid; place-items: center; padding: 0; }
.status-strip { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--bg-2); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.status-strip::-webkit-scrollbar { display: none; }

/* ---- Markdown ---- */
.md { font-size: 14.5px; line-height: 1.55; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 6px; line-height: 1.3; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16.5px; } .md h3, .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; color: #c9d6f5; word-break: break-word; }
.md pre { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: 6px 0 10px; }
.md pre code { background: none; padding: 0; font-size: 12px; line-height: 1.5; color: var(--text); word-break: normal; white-space: pre; }
.md blockquote { margin: 6px 0; padding: 2px 12px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.md .tbl { overflow-x: auto; margin: 6px 0 10px; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); }

/* ---- Terminal ---- */
.term-wrap { flex: 1; min-height: 0; position: relative; background: #0b0e14; }
.term-host { position: absolute; inset: 4px 2px 0 6px; }
.term-host .xterm { height: 100%; }
.term-host .xterm-viewport { overscroll-behavior: contain; }
.term-status { position: absolute; top: 8px; right: 10px; z-index: 5; }
.keybar { display: flex; gap: 5px; overflow-x: auto; padding: 6px 8px; background: var(--bg-2); border-top: 1px solid var(--border); scrollbar-width: none; flex: none; }
.keybar::-webkit-scrollbar { display: none; }
.keybar .key { height: 36px; min-width: 42px; }

/* ---- tmux ---- */
.tmux-win { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.tmux-win .idx { font-family: var(--mono); color: var(--muted); font-size: 12.5px; width: 22px; }
.pane-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border-2); font-size: 12.5px; color: var(--text); }

/* ---- Folder browser ---- */
.crumbs { display: flex; gap: 2px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; align-items: center; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button { flex: none; border: 0; background: var(--surface-2); color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.crumbs button.cur { background: var(--accent); color: var(--accent-ink); }
.crumbs .sep { color: var(--muted); padding: 0 2px; flex: none; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fs-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-align: center; min-width: 0;
}
.fs-item:active { background: var(--surface-2); }
.fs-item.file { opacity: .78; cursor: default; }
.fs-item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.fs-item .nm { font-size: 12.5px; font-weight: 600; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-item .info { font-size: 10.5px; color: var(--muted); }
.fs-ic { width: 40px; height: 34px; display: grid; place-items: center; position: relative; }
.fs-ic.folder svg { color: var(--yellow); }
.fs-ic.file svg { color: var(--muted); }
.fs-ic .tag { position: absolute; bottom: -4px; right: -8px; font-size: 9px; font-weight: 800; padding: 1px 4px; border-radius: 5px; background: var(--surface-3); color: var(--cyan); text-transform: uppercase; }
.fs-bar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 0 2px; background: linear-gradient(transparent, var(--surface) 30%); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; }
.chip:active, .chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---- Tables (processes, usage) ---- */
.proc { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); }
.proc:first-child { border-top: 0; }
.proc .cmd { font-family: var(--mono); font-size: 12px; color: var(--text-2); grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc .num { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; min-width: 54px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 6px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; height: 100%; }
.bars .bar > div { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar span { font-size: 9.5px; color: var(--muted); }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }

/* ---- xterm tweaks ---- */
.xterm .xterm-viewport { background: #0b0e14 !important; }
