/* ───────────────────────── Fonts ───────────────────────── */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

/* ───────────────────────── Tokens ───────────────────────── */
:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-xs: 5px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 120ms; --t: 220ms;
}

/* Ceramic: glazed porcelain over warm stone */
[data-theme="ceramic"] {
  color-scheme: light;
  --bg: #e6e5e0;
  --bg-glow: radial-gradient(1000px 520px at 14% -10%, rgba(255, 255, 255, 0.8), transparent 65%),
             radial-gradient(800px 500px at 100% 0%, rgba(205, 210, 224, 0.55), transparent 60%);
  --panel: #fbfaf8;
  --panel-hi: #ffffff;
  --sunk: #eeede9;

  --ink: #15161b; --ink-2: #3a3d47; --muted: #6c6f7a; --faint: #9a9ca6;
  --line: rgba(22, 22, 30, 0.085); --line-strong: rgba(22, 22, 30, 0.15);
  --hl: rgba(255, 255, 255, 0.95);

  --shadow-sm: 0 1px 2px rgba(28, 26, 18, 0.07);
  --shadow-md: 0 1px 2px rgba(28, 26, 18, 0.05), 0 8px 20px -8px rgba(32, 34, 48, 0.16);
  --shadow-lg: 0 2px 4px rgba(28, 26, 18, 0.06), 0 28px 56px -14px rgba(32, 34, 48, 0.3);
  --inset: inset 0 1px 2px rgba(28, 26, 18, 0.08);

  --primary-bg: #17181e; --primary-ink: #f7f6f2; --primary-hover: #292b36; --primary-ring: rgba(0, 0, 0, 0.6); --primary-hl: rgba(255, 255, 255, 0.16);

  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .3  0 0 0 0 .34  0 0 0 .085 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --noise-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .35  0 0 0 0 .38  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --backdrop: rgba(206, 207, 214, 0.55);
  --term-bg: #13151c; --term-ink: #dcdfe7;

  --ok: #2f8f5f; --warn: #b87a1c; --bad: #bd4636;
}

/* Midnight: obsidian, cold blacks, hairline light */
[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #07080c;
  --bg-glow: radial-gradient(1000px 540px at 12% -12%, rgba(66, 80, 128, 0.26), transparent 65%),
             radial-gradient(700px 420px at 100% 0%, rgba(40, 50, 84, 0.2), transparent 60%);
  --panel: #0d1016;
  --panel-hi: #141822;
  --sunk: #080a0e;

  --ink: #e8eaf0; --ink-2: #bec2ce; --muted: #848999; --faint: #545967;
  --line: rgba(255, 255, 255, 0.07); --line-strong: rgba(255, 255, 255, 0.13);
  --hl: rgba(255, 255, 255, 0.055);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 32px 64px -12px rgba(0, 0, 0, 0.8);
  --inset: inset 0 1px 3px rgba(0, 0, 0, 0.6);

  --primary-bg: #ecebe7; --primary-ink: #0b0c10; --primary-hover: #ffffff; --primary-ring: rgba(255, 255, 255, 0); --primary-hl: rgba(255, 255, 255, 1);

  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .03 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --noise-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --backdrop: rgba(2, 3, 6, 0.7);
  --term-bg: #121621; --term-ink: #d6d9e2;

  --ok: #52bd88; --warn: #dea648; --bad: #ee7866;
}

/* ───────────────────────── Base ───────────────────────── */
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; font-family: var(--font); font-size: 13.5px; line-height: 1.5; color: var(--ink);
  background: var(--bg); background-image: var(--bg-glow); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Grain lives behind content only, so text stays crisp. */
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; background-image: var(--noise-bg); }
#root { position: relative; z-index: 1; }
::selection { background: color-mix(in srgb, var(--ink) 16%, transparent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.92em; font-feature-settings: "zero"; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.018em; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--ink) 50%, transparent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 20px; height: 20px; }
.icon.sm { width: 14px; height: 14px; }

/* ───────────────────────── Surfaces ───────────────────────── */
.panel {
  position: relative; background-color: var(--panel); background-image: var(--noise); border-radius: var(--r-lg);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-md), inset 0 1px 0 var(--hl);
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); min-height: 50px; }
.panel-head h3 { font-size: 13px; }
.panel-head .count { color: var(--faint); font-weight: 500; font-size: 12px; }

/* ───────────────────────── Layout ───────────────────────── */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px; padding: 18px 12px 14px;
  border-right: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #f4f3ef; flex: none;
  background: linear-gradient(180deg, #2b3148, #0b0e16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.55), 0 4px 10px -3px rgba(10, 12, 24, 0.5);
}
.brand-name { font-weight: 650; letter-spacing: -0.02em; font-size: 14.5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; transition: color var(--t-fast), background var(--t-fast);
}
.nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--panel-hi); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm), inset 0 1px 0 var(--hl); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); min-width: 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 10.5px; font-weight: 650;
  background: var(--panel-hi); box-shadow: 0 0 0 1px var(--line-strong), inset 0 1px 0 var(--hl), var(--shadow-sm);
}
.whoami .name { font-weight: 600; font-size: 12.5px; line-height: 1.25; }
.whoami .role { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.whoami > div { min-width: 0; }

.main { min-width: 0; padding: 28px 40px 80px; }
.page { max-width: 1120px; margin: 0 auto; animation: rise 360ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; min-height: 36px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; line-height: 1.2; display: flex; align-items: baseline; gap: 10px; }
.page-head h1 .count { font-size: 13px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.crumb { color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); margin-bottom: 10px; }

/* ───────────────────────── Buttons ───────────────────────── */
.btn {
  --h: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--h); padding: 0 12px;
  border-radius: var(--r-sm); font-weight: 520; font-size: 13px; white-space: nowrap; user-select: none; text-decoration: none;
  background: var(--panel-hi); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-sm), inset 0 1px 0 var(--hl);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.btn:hover { box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-md), inset 0 1px 0 var(--hl); transform: translateY(-0.5px); }
.btn:active { transform: translateY(0.5px); box-shadow: 0 0 0 1px var(--line-strong), var(--inset); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--primary-bg); color: var(--primary-ink); box-shadow: 0 0 0 1px var(--primary-ring), var(--shadow-sm), inset 0 1px 0 var(--primary-hl); }
.btn.primary:hover { background: var(--primary-hover); box-shadow: 0 0 0 1px var(--primary-ring), var(--shadow-md), inset 0 1px 0 var(--primary-hl); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); transform: none; box-shadow: none; }
.btn.danger { color: var(--bad); }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); }
.btn.sm { --h: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-only { width: var(--h); padding: 0; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────────────────── Forms ───────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 550; color: var(--ink-2); }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--r-sm); border: 0; outline: 0;
  background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line);
  transition: box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { background: var(--panel); box-shadow: var(--inset), 0 0 0 1px var(--line-strong), 0 0 0 4px color-mix(in srgb, var(--ink) 9%, transparent); }
.input:disabled { opacity: 0.55; }
.textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.textarea.mono, .input.mono { font-family: var(--mono); font-size: 12.5px; }
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 11px center; }

.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 33px; padding-right: 34px; }
.search .kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.kbd { font-family: var(--mono); font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 5px; background: var(--panel-hi); color: var(--faint); box-shadow: 0 0 0 1px var(--line), 0 1px 0 var(--line); }

.seg { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line); gap: 2px; }
.seg button { height: 28px; padding: 0 12px; border-radius: 6px; font-size: 12.5px; font-weight: 530; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; transition: all var(--t-fast); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { color: var(--ink); background: var(--panel-hi); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm), inset 0 1px 0 var(--hl); }

.check { position: relative; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 9px 12px; border-radius: var(--r-sm); transition: background var(--t-fast); }
.check:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 17px; height: 17px; border-radius: 5px; flex: none; margin-top: 1px; display: grid; place-items: center; background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line-strong); color: transparent; transition: all var(--t-fast); }
.check:hover .box { box-shadow: var(--inset), 0 0 0 1px color-mix(in srgb, var(--ink) 38%, transparent); }
.check .box svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.check input:checked + .box { background: var(--primary-bg); color: var(--primary-ink); box-shadow: 0 0 0 1px var(--primary-ring), inset 0 1px 0 var(--primary-hl); }
.check input:checked + .box { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 60%, transparent), inset 0 1px 0 var(--primary-hl); }
.check input:focus-visible + .box { outline: 2px solid color-mix(in srgb, var(--ink) 50%, transparent); outline-offset: 2px; }
.check .t { font-weight: 550; font-size: 13px; line-height: 1.3; }
.check .d { font-size: 11.5px; color: var(--muted); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; margin: 0 -12px; }

.switch { position: relative; width: 36px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line-strong); transition: background var(--t); pointer-events: none; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel-hi); box-shadow: var(--shadow-md), 0 0 0 1px var(--line-strong), inset 0 1px 0 var(--hl); transition: transform var(--t) var(--ease); pointer-events: none; }
.switch input:checked ~ .track { background: var(--ink); }
.switch input:checked ~ .thumb { transform: translateX(14px); }
.switch input:focus-visible ~ .track { outline: 2px solid color-mix(in srgb, var(--ink) 50%, transparent); outline-offset: 2px; }

/* ───────────────────────── Small pieces ───────────────────────── */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 520; color: var(--ink-2); background: color-mix(in srgb, var(--ink) 6%, transparent); white-space: nowrap; }
.tag.more { color: var(--faint); background: transparent; padding: 0 3px; }
.tags { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 530; color: var(--muted); white-space: nowrap; transition: all var(--t-fast); }
.pill:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pill[aria-pressed="true"] { color: var(--ink); background: var(--panel-hi); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-sm), inset 0 1px 0 var(--hl); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 520; white-space: nowrap; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.status.ok { color: var(--ok); } .status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.status.bad { color: var(--bad); } .status.bad .dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 16%, transparent); }
.status.warn { color: var(--warn); } .status.warn .dot { background: var(--warn); }
.status.idle { color: var(--muted); }

.glyph-box { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--ink-2); background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line); }

/* ───────────────────────── Servers list ───────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search { width: 260px; }
.pills { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

.list-head, .srow { display: grid; grid-template-columns: 32px minmax(180px, 1.3fr) minmax(150px, 1.2fr) 120px 96px 16px; align-items: center; gap: 16px; padding: 0 18px; }
.list-head { height: 38px; font-size: 11.5px; font-weight: 550; color: var(--faint); border-bottom: 1px solid var(--line); }
.srow { height: 58px; text-decoration: none; border-bottom: 1px solid var(--line); transition: background var(--t-fast); position: relative; }
.srow:last-child { border-bottom: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.srow:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.srow:hover .chev { transform: translateX(2px); color: var(--ink); }
.srow .n { font-weight: 600; font-size: 13.5px; line-height: 1.25; }
.srow .a { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.srow .chev { color: var(--faint); transition: transform var(--t) var(--ease), color var(--t-fast); }
.srow .hk { font-size: 12.5px; }
.srow .when { color: var(--muted); font-size: 12.5px; }

/* ───────────────────────── Tabs ───────────────────────── */
.tabs { display: flex; gap: 2px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; padding: 9px 12px; font-weight: 530; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; transition: color var(--t-fast); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }

/* ───────────────────────── Detail ───────────────────────── */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 0; }
.kv dt, .kv dd { padding: 11px 18px; border-bottom: 1px solid var(--line); margin: 0; min-width: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { font-weight: 500; word-break: break-word; display: flex; align-items: center; min-height: 42px; }
.kv dd .btn.icon-only { --h: 22px; margin: -4px 0; }
.kv dt:nth-last-of-type(1), .kv dd:last-of-type { border-bottom: 0; }

.item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.item:last-child { border-bottom: 0; }
.item .t { font-weight: 560; line-height: 1.3; }
.item .s { font-size: 12px; color: var(--muted); line-height: 1.35; }
.item > div { min-width: 0; }
.item-empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ───────────────────────── Terminal ───────────────────────── */
.term {
  display: flex; flex-direction: column; height: min(66vh, 640px); border-radius: var(--r-lg); overflow: hidden;
  background: var(--term-bg); color: var(--term-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 0 0 2px rgba(0, 0, 0, 0.35), var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}
.term-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.025); font-size: 12px; color: #8a8e9d; }
.term-lights { display: flex; gap: 6px; }
.term-lights i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.13); }
.term-body { flex: 1; overflow: auto; padding: 16px 18px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; }
.term-block { margin-bottom: 16px; }
.term-cmd { display: flex; gap: 10px; color: #f1f2f6; }
.term-cmd .ps { color: #6d7287; user-select: none; }
.term-out, .term-err { white-space: pre-wrap; word-break: break-word; margin: 4px 0 0 20px; font: inherit; }
.term-err { color: #ef8e80; }
.term-meta { margin: 6px 0 0 20px; font-size: 11px; color: #636880; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.term-meta .ok { color: #56c08c; } .term-meta .bad { color: #ec7563; }
.term-empty { color: #5a5f73; display: grid; place-items: center; height: 100%; text-align: center; }
.term-empty .icon { margin: 0 auto; }
.term-input { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid rgba(255, 255, 255, 0.07); background: rgba(0, 0, 0, 0.22); font-family: var(--mono); font-size: 13px; }
.term-input .ps { color: #6d7287; }
.term-input input { flex: 1; background: none; border: 0; outline: 0; color: #f1f2f6; font: inherit; caret-color: #cfd6ff; }
.term-input input::placeholder { color: #4a4f63; }
.term-input input:disabled { opacity: 0.5; }
.term-opts { display: flex; align-items: center; gap: 8px; }
.term-opts input { width: 140px; background: rgba(255, 255, 255, 0.05); border: 0; outline: 0; border-radius: 6px; padding: 4px 8px; color: #c8cbd8; font: inherit; font-size: 11.5px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4); }

.meter { display: grid; gap: 7px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.meter-label { font-weight: 550; color: var(--ink-2); }
.meter-text { color: var(--muted); font-size: 12px; }
.meter-track { height: 6px; border-radius: 99px; background: var(--sunk); box-shadow: var(--inset), 0 0 0 1px var(--line); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: var(--ok); transition: width 600ms var(--ease), background 300ms; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }
.a-sub { color: var(--faint); font-size: 11.5px; }

.term.shell { height: min(72vh, 720px); }
.xterm-host { flex: 1; min-height: 0; padding: 10px 6px 6px 14px; overflow: hidden; }
.xterm-host .xterm { height: 100%; }
.xterm-host .xterm-viewport { background: transparent !important; }

/* ───────────────────────── Files ───────────────────────── */
.pathbar { display: flex; align-items: center; gap: 2px; padding: 0 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; flex: 1; min-width: 0; }
.pathbar button { padding: 3px 6px; border-radius: 5px; color: var(--muted); transition: all var(--t-fast); white-space: nowrap; }
.pathbar button:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pathbar button:last-child { color: var(--ink); font-weight: 600; }
.pathbar .sep { color: var(--faint); }
.file-row { display: grid; grid-template-columns: 22px 1fr 90px 130px 32px; align-items: center; gap: 12px; padding: 0 18px; height: 40px; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.file-row:last-child { border-bottom: 0; }
.file-row.clickable { cursor: pointer; }
.file-row.clickable:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
.file-row.head { height: 36px; font-size: 11.5px; font-weight: 550; color: var(--faint); cursor: default; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .muted { font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ───────────────────────── Tables ───────────────────────── */
.scroll-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 550; color: var(--faint); padding: 0 18px; height: 38px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.table .name { font-weight: 600; }
.table .id { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.table .actions { text-align: right; white-space: nowrap; }
.table.dense td { padding: 9px 18px; font-size: 12.5px; }
.table tr.denied td:first-child { box-shadow: inset 2px 0 0 var(--bad); }
.perm { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }
.perm i { font-style: normal; color: var(--faint); padding: 0 5px; }
.detail { font-family: var(--mono); font-size: 11.5px; color: var(--muted); max-width: 420px; }

/* ───────────────────────── Modal ───────────────────────── */
dialog { border: 0; padding: 0; background: transparent; color: inherit; max-width: none; max-height: none; margin: auto; overflow: visible; }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(8px); animation: fade 200ms var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background-color: var(--panel); background-image: var(--noise); border-radius: var(--r-xl);
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-lg), inset 0 1px 0 var(--hl); animation: pop 280ms var(--ease);
}
.modal.wide { width: min(820px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.modal-head h2 { font-size: 16px; }
.modal-sub { padding: 0 22px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 22px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunk) 60%, transparent); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.section-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.divider { height: 1px; background: var(--line); margin: 2px 0; }
.token-box { font-family: var(--mono); font-size: 12.5px; padding: 14px 16px; border-radius: var(--r-md); word-break: break-all; line-height: 1.6; background: var(--term-bg); color: #e6e8f0; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), var(--shadow-md); }

/* ───────────────────────── Toasts ───────────────────────── */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); font-weight: 520; font-size: 13px; max-width: 420px; background: var(--panel-hi); box-shadow: 0 0 0 1px var(--line-strong), var(--shadow-lg), inset 0 1px 0 var(--hl); animation: toast-in 340ms var(--ease); pointer-events: auto; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 220ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ───────────────────────── Empty / skeleton / login ───────────────────────── */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 56px 24px; color: var(--muted); }
.empty .glyph-box { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 8px; color: var(--faint); }
.empty h3 { color: var(--ink); font-size: 14.5px; }
.empty p { max-width: 40ch; font-size: 13px; }
.empty .btn { margin-top: 10px; }
.skeleton { border-radius: var(--r-sm); background: linear-gradient(100deg, var(--sunk) 30%, color-mix(in srgb, var(--panel) 70%, var(--sunk)) 50%, var(--sunk) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); padding: 30px; display: flex; flex-direction: column; gap: 22px; animation: pop 480ms var(--ease); }
.login-card .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.login-card h1 { font-size: 19px; margin-top: 14px; }
.login-card .sub { color: var(--muted); margin-top: 3px; }
.login .theme-float { position: fixed; top: 16px; right: 16px; }
.err-text { color: var(--bad); font-size: 12.5px; font-weight: 520; display: flex; gap: 7px; align-items: center; }

/* ───────────────────────── Responsive ───────────────────────── */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 14px 8px; gap: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { order: 1; flex: 1; }
  .sidebar-foot { order: 2; margin: 0; flex-direction: row; align-items: center; }
  .sidebar-foot .row { gap: 2px; }
  .nav { order: 3; flex: 0 0 100%; flex-direction: row; overflow-x: auto; }
  .nav a { flex: none; }
  .whoami { display: none; }
  .main { padding: 20px 16px 60px; }
  .grid-2, .check-grid, .split { grid-template-columns: 1fr; }
  .list-head { display: none; }
  .srow { grid-template-columns: 32px 1fr 16px; height: auto; padding-top: 12px; padding-bottom: 12px; }
  .srow > .tags, .srow > .hk, .srow > .when { display: none; }
  .file-row { grid-template-columns: 22px 1fr 32px; } .file-row > :nth-child(3), .file-row > :nth-child(4) { display: none; }
  .toolbar .search { width: 100%; }
  .kv { grid-template-columns: 1fr; } .kv dt { border-bottom: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
