/* S.A.L.T NEXUS — design system v3.
   A theme is a full set of tokens: surfaces, glass, radius, type, background art and buttons.
   Components only ever read tokens. */

@font-face { font-family: "Jakarta"; src: url("/vendor/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/vendor/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/vendor/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/vendor/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("/vendor/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/vendor/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/vendor/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ---------- themes ---------- */
:root, [data-theme="executive"] {
  --font-ui: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Jakarta", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --fs: 14px; --head-weight: 700; --head-track: -0.015em;
  --bg: #060D1B;
  --canvas: radial-gradient(1200px 700px at 85% -10%, rgba(212, 175, 55, .14), transparent 60%),
            radial-gradient(900px 700px at -10% 110%, rgba(56, 120, 255, .16), transparent 60%),
            linear-gradient(180deg, #08142A 0%, #060D1B 100%);
  --blob-a: transparent; --blob-b: transparent; --blob-c: transparent;
  --surface: rgba(16, 30, 58, .62); --surface-solid: #0F1C36; --surface-2: rgba(30, 50, 90, .55); --surface-3: rgba(46, 70, 118, .55);
  --glass: blur(18px) saturate(140%);
  --border: rgba(150, 175, 220, .13); --border-strong: rgba(170, 195, 240, .26);
  --text: #EAF0FA; --text-2: #A9B7CF; --text-3: #7486A6;
  --accent: #D4AF37; --accent-2: #F0D27A; --accent-3: #A9861A; --accent-ink: #1A1303;
  --accent-soft: rgba(212, 175, 55, .14);
  --btn-primary: linear-gradient(135deg, #F2D57E 0%, #D4AF37 45%, #AE8A1E 100%);
  --info: #5CC8FF; --info-soft: rgba(92, 200, 255, .14);
  --warn: #F2B04A; --danger: #FF6B7D; --danger-soft: rgba(255, 107, 125, .12);
  --live: #5CC8FF;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 10px 30px rgba(2, 8, 20, .45);
  --shadow-lg: 0 30px 80px rgba(2, 8, 20, .6);
  --rail-bg: rgba(5, 12, 26, .72); --rail-text: #93A3C2; --rail-active: #fff; --rail-active-bg: rgba(212, 175, 55, .16);
  --w1: #1D3B78; --w2: #3B6FD8; --w3: #7A5CE0; --w4: #D4AF37;
  --term-bg: #07101F;
  --gap: 20px; --pad: 20px;
  --focus: #F0D27A;
  color-scheme: dark;
}
[data-theme="aurora"] {
  --bg: #090619;
  --canvas: linear-gradient(160deg, #0D0A26 0%, #090619 60%, #07051A 100%);
  --blob-a: #6D28D9; --blob-b: #2563EB; --blob-c: #DB2777;
  --surface: rgba(28, 22, 64, .48); --surface-solid: #18123A; --surface-2: rgba(60, 48, 120, .40); --surface-3: rgba(90, 72, 170, .40);
  --glass: blur(26px) saturate(170%);
  --border: rgba(255, 255, 255, .10); --border-strong: rgba(255, 255, 255, .22);
  --text: #F3F0FF; --text-2: #BDB5E6; --text-3: #8C83BD;
  --accent: #A78BFA; --accent-2: #67E8F9; --accent-3: #7C3AED; --accent-ink: #FFFFFF;
  --accent-soft: rgba(167, 139, 250, .16);
  --btn-primary: linear-gradient(120deg, #8B5CF6 0%, #6366F1 45%, #06B6D4 100%);
  --info: #67E8F9; --info-soft: rgba(103, 232, 249, .14); --live: #67E8F9;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px;
  --shadow-md: 0 14px 40px rgba(10, 4, 40, .55); --shadow-lg: 0 40px 90px rgba(10, 4, 40, .7);
  --rail-bg: rgba(14, 10, 38, .55); --rail-text: #A69DD6; --rail-active-bg: rgba(167, 139, 250, .2);
  --w1: #4C1D95; --w2: #7C3AED; --w3: #2563EB; --w4: #EC4899;
  --term-bg: #0C0922; --focus: #67E8F9;
}
[data-theme="daylight"] {
  --bg: #EEF2F8;
  --canvas: radial-gradient(1000px 600px at 100% 0%, rgba(37, 99, 235, .08), transparent 60%),
            radial-gradient(800px 600px at 0% 100%, rgba(212, 175, 55, .10), transparent 60%), #EEF2F8;
  --surface: #FFFFFF; --surface-solid: #FFFFFF; --surface-2: #F4F7FB; --surface-3: #E8EEF6;
  --glass: none;
  --border: #E2E8F1; --border-strong: #CCD6E4;
  --text: #0E1A2E; --text-2: #4A5A73; --text-3: #7A889E;
  --accent: #2563EB; --accent-2: #3B82F6; --accent-3: #1D4ED8; --accent-ink: #FFFFFF;
  --accent-soft: rgba(37, 99, 235, .08);
  --btn-primary: linear-gradient(180deg, #3B82F6 0%, #2563EB 100%);
  --info: #0284C7; --info-soft: rgba(2, 132, 199, .10); --live: #0284C7;
  --warn: #B45309; --danger: #DC2626; --danger-soft: rgba(220, 38, 38, .08);
  --shadow-sm: 0 1px 2px rgba(15, 26, 46, .06);
  --shadow-md: 0 1px 2px rgba(15, 26, 46, .05), 0 8px 24px rgba(15, 26, 46, .07);
  --shadow-lg: 0 24px 60px rgba(15, 26, 46, .16);
  --rail-bg: #0E1A2E; --rail-text: #8FA0BC; --rail-active: #FFFFFF; --rail-active-bg: rgba(255, 255, 255, .10);
  --w1: #C7D7FB; --w2: #93B4F8; --w3: #B9A6F5; --w4: #F3D98A;
  --term-bg: #0E1A2E; --focus: #2563EB;
  color-scheme: light;
}
[data-theme="carbon"] {
  --font-ui: "Plex", system-ui, sans-serif; --font-head: "Plex", system-ui, sans-serif;
  --head-weight: 600; --head-track: 0;
  --bg: #161616; --canvas: #161616;
  --surface: #1E1E1E; --surface-solid: #1E1E1E; --surface-2: #262626; --surface-3: #333333;
  --glass: none;
  --border: #303030; --border-strong: #4A4A4A;
  --text: #F4F4F4; --text-2: #C6C6C6; --text-3: #8D8D8D;
  --accent: #4589FF; --accent-2: #78A9FF; --accent-3: #0F62FE; --accent-ink: #FFFFFF;
  --accent-soft: rgba(69, 137, 255, .14);
  --btn-primary: #0F62FE;
  --info: #33B1FF; --info-soft: rgba(51, 177, 255, .12); --live: #33B1FF;
  --warn: #F1C21B; --danger: #FA4D56; --danger-soft: rgba(250, 77, 86, .12);
  --r-sm: 2px; --r-md: 2px; --r-lg: 2px; --r-xl: 2px;
  --shadow-sm: none; --shadow-md: none; --shadow-lg: 0 0 0 1px #4A4A4A;
  --rail-bg: #0B0B0B; --rail-text: #A8A8A8; --rail-active-bg: #262626;
  --w1: #262626; --w2: #393939; --w3: #0F62FE; --w4: #4589FF;
  --term-bg: #161616; --gap: 16px; --pad: 16px; --focus: #78A9FF;
}
[data-theme="classic"] {
  --font-ui: "JetBrains Mono", ui-monospace, Consolas, monospace; --font-head: "JetBrains Mono", ui-monospace, monospace;
  --fs: 13px; --head-weight: 700; --head-track: 0;
  --bg: #05080F;
  --canvas: linear-gradient(rgba(63, 200, 228, .035) 1px, transparent 1px) 0 0 / 28px 28px,
            linear-gradient(90deg, rgba(63, 200, 228, .035) 1px, transparent 1px) 0 0 / 28px 28px, #05080F;
  --surface: #0A0F1A; --surface-solid: #0A0F1A; --surface-2: #101828; --surface-3: #18223A;
  --glass: none;
  --border: #1C2740; --border-strong: #2C3B5C;
  --text: #D6DEEB; --text-2: #9AA7BF; --text-3: #66738F;
  --accent: #C9A227; --accent-2: #E3C254; --accent-3: #A9831A; --accent-ink: #120D00;
  --accent-soft: rgba(201, 162, 39, .12);
  --btn-primary: #C9A227;
  --info: #3FC8E4; --info-soft: rgba(63, 200, 228, .12); --live: #3FC8E4;
  --r-sm: 3px; --r-md: 4px; --r-lg: 4px; --r-xl: 4px;
  --shadow-sm: none; --shadow-md: none; --shadow-lg: 0 0 0 1px #2C3B5C;
  --rail-bg: #070B14; --rail-text: #7E8BA6; --rail-active: #E3C254; --rail-active-bg: rgba(201, 162, 39, .12);
  --w1: #10233F; --w2: #18406B; --w3: #3FC8E4; --w4: #C9A227;
  --term-bg: #05080F; --gap: 16px; --pad: 16px; --focus: #3FC8E4;
}
[data-theme="contrast"] {
  --bg: #000; --canvas: #000;
  --surface: #000; --surface-solid: #000; --surface-2: #141414; --surface-3: #262626;
  --glass: none;
  --border: #8A8A8A; --border-strong: #FFFFFF;
  --text: #FFFFFF; --text-2: #FFFFFF; --text-3: #DDDDDD;
  --accent: #FFD400; --accent-2: #FFE35C; --accent-3: #E6BF00; --accent-ink: #000;
  --accent-soft: rgba(255, 212, 0, .18); --btn-primary: #FFD400;
  --info: #00E1FF; --info-soft: rgba(0, 225, 255, .15); --live: #00E1FF;
  --warn: #FFB020; --danger: #FF7A7A;
  --shadow-sm: none; --shadow-md: none; --shadow-lg: 0 0 0 2px #FFF;
  --rail-bg: #000; --rail-text: #FFF; --rail-active: #000; --rail-active-bg: #FFD400;
  --w1: #333; --w2: #555; --w3: #00E1FF; --w4: #FFD400;
  --term-bg: #000; --focus: #FFD400;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track); margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
kbd { font: 500 11px/1 var(--font-mono); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--text-3); }
svg { flex: none; }
[data-icon] svg { width: 18px; height: 18px; display: block; }

/* background canvas with drifting colour blobs (Aurora) */
.canvas { position: fixed; inset: 0; background: var(--canvas); z-index: -1; overflow: hidden; }
.blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .55; }
.b1 { background: var(--blob-a); left: -15vmax; top: -20vmax; animation: drift1 38s ease-in-out infinite alternate; }
.b2 { background: var(--blob-b); right: -20vmax; top: 10vmax; animation: drift2 44s ease-in-out infinite alternate; }
.b3 { background: var(--blob-c); left: 20vmax; bottom: -30vmax; opacity: .35; animation: drift1 52s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.1); } }
@keyframes drift2 { to { transform: translate(-6vmax, 8vmax) scale(.92); } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--btn-primary); color: var(--accent-ink); border-color: transparent; box-shadow: var(--shadow-sm); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.lg { height: 46px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn [data-icon] svg { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.field { display: grid; gap: 6px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); font-size: 14px; font-weight: 400;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; font-family: var(--font-mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); flex: none; }
.check input[type=checkbox], .check input[type=radio] { flex: none; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.check.sm { font-size: 12.5px; color: var(--text-2); }
.form-error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.form-ok { color: var(--info); font-size: 13px; margin: 8px 0 0; }
.form-error:empty, .form-ok:empty { display: none; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: calc(var(--r-sm) - 2px); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-checked="true"] { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.seg [data-icon] svg { width: 16px; height: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip[aria-selected="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.chip [data-icon] svg { width: 14px; height: 14px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.tag.live { background: var(--info-soft); color: var(--live); border-color: transparent; }
.tag.gold { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag.off { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px var(--info-soft); flex: none; }

/* glass surfaces */
.panel, .card, .hero, .host-card, .term-window, .dock, .topbar, .sheet, .modal, .palette-box, .menu, .table-wrap, .theme-card, .ai-card, .toast {
  -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass);
}

/* ---------- sign-in ---------- */
.login { height: 100%; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; padding: 48px; border-right: 1px solid var(--border); background: linear-gradient(160deg, color-mix(in srgb, var(--w1) 55%, transparent), transparent 70%); }
.login-art .waves { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.login-art-inner { position: relative; max-width: 460px; display: grid; gap: 22px; justify-items: start; }
.login-salt { width: 210px; height: auto; filter: drop-shadow(0 20px 50px rgba(212, 175, 55, .28)); }
.login-tag { font: 700 30px/1.2 var(--font-head); letter-spacing: -0.02em; margin: 0; color: var(--text); }
.login-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--text-2); }
.login-points li { display: flex; gap: 10px; align-items: baseline; }
.login-points li::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); transform: translateY(-2px); flex: none; }
.login-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 34px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.login-head h1 { font-size: 22px; }
.login-head p { margin: 2px 0 0; color: var(--text-2); }
.login-foot { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; margin: 6px 0 0; }
.login-foot b { color: var(--accent); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 84px 1fr; height: 100%; height: 100dvh; }
.rail { display: flex; flex-direction: column; align-items: center; padding: 16px 0 14px; gap: 18px; background: var(--rail-bg); border-right: 1px solid var(--border); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.rail-brand { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-md); }
.rail-nav { display: grid; gap: 6px; width: 100%; padding: 0 10px; }
.rail-item { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 0 8px; border-radius: var(--r-md); color: var(--rail-text); font-size: 11px; font-weight: 600; }
.rail-item [data-icon] svg { width: 22px; height: 22px; }
.rail-item:hover { color: var(--rail-active); background: color-mix(in srgb, var(--rail-active-bg) 60%, transparent); }
.rail-item[aria-current="page"] { color: var(--rail-active); background: var(--rail-active-bg); }
.rail-item[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-badge { position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--live); color: #001018; font: 700 10.5px/18px var(--font-ui); font-style: normal; text-align: center; }
.rail-foot { margin-top: auto; display: grid; gap: 14px; justify-items: center; }
.rail-salt { width: 44px; height: auto; opacity: .95; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface-2); color: var(--accent); font-weight: 800; cursor: pointer; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.page-head { min-width: 0; }
.page-head h1 { font-size: 20px; line-height: 1.2; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger { margin-left: auto; display: flex; align-items: center; gap: 10px; width: min(420px, 36vw); height: 40px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); cursor: pointer; font-size: 13.5px; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger .st-text { flex: 1; text-align: left; }
.top-actions { display: flex; gap: 8px; }

.view { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; display: grid; align-content: start; grid-auto-rows: max-content; gap: var(--gap); }
.view-terminal { padding: 16px; display: flex; overflow: hidden; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--pad); box-shadow: var(--shadow-md); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { font-size: 15px; }
.panel-head.sub { margin-top: 22px; }
.panel-head .head-links { display: inline-flex; align-items: center; gap: 14px; }
.qc-filter select { width: auto; height: 30px; padding: 0 28px 0 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; min-width: 0; }
.qc-empty { grid-column: 1 / -1; padding: 10px 2px; }
.link { color: var(--accent); font-weight: 600; font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--pad); box-shadow: var(--shadow-md); display: grid; gap: 12px; }
.card h3 { font-size: 15px; }

/* ---------- home ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); min-height: 210px; display: flex; align-items: center; }
.hero .waves { position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; }
.hero-body { position: relative; padding: 30px 34px; max-width: 760px; display: grid; gap: 10px; }
.hero-hello { margin: 0; color: var(--text-2); font-weight: 600; }
.hero h2 { font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.hero-chips .tag { height: 28px; padding: 0 12px; font-size: 12.5px; background: color-mix(in srgb, var(--surface-solid) 70%, transparent); }
.hero-salt { position: relative; margin-left: auto; margin-right: 34px; width: 130px; height: auto; filter: drop-shadow(0 16px 40px rgba(212, 175, 55, .25)); }
.home-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--gap); align-items: start; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid transparent; }
.list li:hover { border-color: var(--border); }
.list .l-main { flex: 1; min-width: 0; display: grid; }
.list .l-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .l-sub { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .empty-row { background: transparent; color: var(--text-3); padding: 6px 2px; }

/* ---------- hosts ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.input-icon { position: relative; flex: 0 1 340px; min-width: 200px; }
.input-icon [data-icon] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-icon input { padding-left: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.host-grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.host-card { position: relative; display: grid; gap: 14px; padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); transition: border-color .15s, transform .15s; overflow: hidden; }
.host-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--g1, var(--accent)), var(--g2, var(--info))); opacity: .9; }
.host-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.hc-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.hc-avatar { width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; font: 800 15px/1 var(--font-head); color: #fff; background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); flex: none; }
.hc-name { font: 700 15px/1.25 var(--font-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-addr { font: 400 12px/1.4 var(--font-mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.hc-foot { display: flex; gap: 6px; align-items: center; min-width: 0; }
.hc-foot .spacer { flex: 1; }
.hc-foot .hc-ic { width: 32px; height: 32px; flex: none; }
.hc-foot .hc-ic svg { width: 17px; height: 17px; }
.host-card { container-type: inline-size; }
@container (max-width: 320px) { .hc-foot .hc-desk { padding: 0 9px; } .hc-foot .hc-desk .lbl { display: none; } }
.host-card.small { padding: 14px; gap: 10px; cursor: pointer; }
.host-card.small .hc-avatar { width: 36px; height: 36px; font-size: 13px; }
.host-grid.as-list { grid-template-columns: 1fr; gap: 8px; }
.host-grid.as-list .host-card { grid-template-columns: minmax(220px, 1.4fr) 1fr auto; align-items: center; padding: 12px 16px; }
.host-grid.as-list .host-card::before { inset: 0 auto 0 0; width: 3px; height: auto; }
.host-grid.as-list .hc-foot .btn.primary { flex: none; }
.empty-hosts { grid-column: 1 / -1; text-align: center; padding: 50px 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); color: var(--text-2); display: grid; gap: 12px; justify-items: center; }

/* ---------- terminal workspace ---------- */
.term-shell { flex: 1; display: flex; gap: 16px; min-width: 0; min-height: 0; }
.term-window { flex: 1; min-width: 0; display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.term-tabs { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-solid) 60%, transparent); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; min-width: 130px; max-width: 240px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font-weight: 600; font-size: 13px; }
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--surface-solid); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.tab .t-av { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font: 800 10px/1 var(--font-head); color: #fff; background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); flex: none; }
.tab .t-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.tab .t-state { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.tab[data-state="attached"] .t-state { background: var(--live); box-shadow: 0 0 0 3px var(--info-soft); }
.tab[data-state="replaying"] .t-state, .tab[data-state="reconnecting"] .t-state { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.tab[data-state="closed"] .t-state { background: var(--danger); }
.tab .t-close { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--text-3); }
.tab .t-close:hover { background: var(--surface-3); color: var(--text); }
.tab .t-close svg { width: 14px; height: 14px; }
@keyframes pulse { 50% { opacity: .35; } }

.terminals { position: relative; flex: 1; min-height: 0; background: var(--term-bg); }
.term-pane { position: absolute; inset: 0; padding: 10px 6px 4px 14px; }
.term-pane .xterm { height: 100%; }
.term-pane .xterm-viewport { background-color: var(--term-bg) !important; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.term-overlay { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 13px; z-index: 5; max-width: calc(100% - 32px); }
.term-overlay.closed { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.empty { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; gap: 12px; padding: 24px; color: var(--text-2); background: var(--surface); }
.empty-icon { width: 64px; height: 64px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon svg { width: 30px; height: 30px; }
.empty h2 { font-size: 20px; color: var(--text); }
.empty p { max-width: 50ch; margin: 0; }
.empty-actions { display: flex; gap: 10px; margin-top: 6px; }

.strip { display: flex; align-items: center; gap: 12px; padding: 6px 10px 6px 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); background: color-mix(in srgb, var(--surface-solid) 60%, transparent); }
.pill-state { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 11.5px; }
.pill-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.pill-state[data-state="attached"] { color: var(--live); background: var(--info-soft); }
.pill-state[data-state="attached"]::before { background: var(--live); }
.pill-state[data-state="replaying"]::before, .pill-state[data-state="reconnecting"]::before { background: var(--accent); }
.pill-state[data-state="closed"] { color: var(--danger); background: var(--danger-soft); }
.pill-state[data-state="closed"]::before { background: var(--danger); }
.strip-host, .strip-size { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.keybar { display: flex; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; background: var(--surface); }
.keybar button { flex: none; min-width: 46px; height: 40px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); font: 500 13px var(--font-mono); cursor: pointer; }
.keybar button.mod[aria-pressed="true"] { background: var(--btn-primary); color: var(--accent-ink); border-color: transparent; }

/* ---------- co-pilot ---------- */

.typing::after { content: ""; display: inline-block; width: 8px; height: 15px; margin-left: 2px; background: var(--accent); vertical-align: text-bottom; animation: pulse .9s steps(2) infinite; }

/* ---------- sessions ---------- */
.table-wrap { overflow: auto; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); }
.panel .table-wrap { background: transparent; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 700; font-size: 12px; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-solid) 80%, transparent); position: sticky; top: 0; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.table td.mono { font-family: var(--font-mono); font-size: 12px; }
.table select { width: auto; height: 32px; }
.cell-title { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-title small { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- settings ---------- */
.view-settings { grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
.subnav { position: sticky; top: 0; display: grid; gap: 4px; padding: 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; }
.subnav a:hover { background: var(--surface-2); color: var(--text); }
.subnav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.subnav a[aria-current="page"] [data-icon] { color: var(--accent); }
.panes { min-width: 0; }
.pane { display: grid; gap: 18px; max-width: 1040px; }
.pane-head h2 { font-size: 22px; }
.pane-head p { margin: 4px 0 0; color: var(--text-2); max-width: 75ch; }
.pane-head.row { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 640px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-actions .form-ok, .form-actions .form-error { margin: 0; }
.stack { display: grid; gap: 12px; }
.narrow-card { max-width: 560px; }
.checks { align-content: center; gap: 10px; }
.allowed { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; grid-auto-flow: column; }
.inline-form input, .inline-form select { flex: 1 1 170px; width: auto; }
.limits-form { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.limits-form .save { justify-self: start; grid-column: 1 / -1; }
.limits-form .hint { font-weight: 400; color: var(--text-3); font-size: 12px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.theme-card { display: grid; gap: 0; padding: 0; overflow: hidden; border-radius: var(--r-lg); border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); transition: transform .15s, border-color .15s; }
.theme-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.theme-card .tc-name { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; font-weight: 700; }
.theme-card .tc-desc { padding: 0 14px 14px; color: var(--text-3); font-size: 12px; }
.tc-preview { height: 128px; position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 10px; }
.tc-preview .p-rail { border-radius: 4px; }
.tc-preview .p-main { display: grid; grid-template-rows: 16px 1fr; gap: 6px; }
.tc-preview .p-top { border-radius: 4px; }
.tc-preview .p-body { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tc-preview .p-card { border-radius: 6px; padding: 7px; display: grid; align-content: start; gap: 5px; }
.tc-preview .p-line { height: 5px; border-radius: 3px; }
.tc-preview .p-btn { height: 10px; width: 60%; border-radius: 4px; margin-top: auto; }
.tc-preview .p-term { border-radius: 6px; padding: 7px; font: 8px/1.4 var(--font-mono); }

.ai-list { display: grid; gap: 12px; }
.ai-card { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); }
.ai-card .ai-ico { grid-row: span 2; width: 42px; height: 42px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--btn-primary); color: var(--accent-ink); }
.ai-card .t { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-card .d { color: var(--text-3); font-size: 12.5px; font-family: var(--font-mono); overflow-wrap: anywhere; grid-column: 2; }
.ai-card .acts { grid-row: 1 / span 2; grid-column: 3; display: flex; gap: 6px; }
.ai-form h3 { font-size: 16px; }

.about { display: flex; gap: 40px; align-items: center; padding: 30px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.about-salt { width: 190px; height: auto; filter: drop-shadow(0 18px 40px rgba(212, 175, 55, .25)); }
.about-title { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.about-title h2 { font-size: 26px; }
.about p { margin: 6px 0; max-width: 60ch; }

/* ---------- sheet, modal, palette, menu, toasts ---------- */
dialog { color: var(--text); }
dialog::backdrop { background: rgba(4, 8, 18, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
[data-theme="daylight"] dialog::backdrop { background: rgba(14, 26, 46, .28); }
.sheet { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(560px, 100vw); padding: 0; border: 0; border-left: 1px solid var(--border); background: var(--surface-solid); box-shadow: var(--shadow-lg); }
.sheet[open] { animation: slidein .22s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.sheet form { height: 100%; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 14px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 20px; }
.sheet-head p { margin: 4px 0 0; font-size: 13px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 24px 24px; display: grid; gap: 12px; align-content: start; }
.group-title { font-size: 13px; color: var(--accent); margin-top: 14px; }
.sheet-foot { display: flex; gap: 8px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--border); }
.key-box { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; display: grid; gap: 12px; background: var(--surface-2); }
.key-box summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-2); }
.key-box summary [data-icon] svg { width: 16px; height: 16px; }
.file-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent); cursor: pointer; justify-self: start; }
.file-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.modal { width: min(480px, calc(100vw - 24px)); padding: 0; border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: var(--surface-solid); box-shadow: var(--shadow-lg); }
.modal header { padding: 22px 24px 4px; }
.modal header h2 { font-size: 18px; }
.modal > p, .modal > dl, .modal > pre { margin: 10px 24px; color: var(--text-2); }
.modal footer { display: flex; gap: 8px; padding: 16px 24px 20px; }
.fp { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.fp dt { color: var(--text-3); }
.fp dd { margin: 0; font-family: var(--font-mono); font-size: 12px; word-break: break-all; color: var(--text); }
.code-preview { padding: 12px 14px; background: var(--term-bg); border: 1px solid var(--border); border-radius: var(--r-md); font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; color: #E6ECF5 !important; }

.palette { padding: 0; border: 0; background: transparent; width: min(640px, calc(100vw - 24px)); margin-top: 12vh; }
.palette-box { border-radius: var(--r-xl); border: 1px solid var(--border-strong); background: var(--surface-solid); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input input { height: 56px; border: 0; background: transparent; font-size: 16px; padding: 0; box-shadow: none !important; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); cursor: pointer; }
.palette-list li[aria-selected="true"] { background: var(--accent-soft); }
.palette-list .p-kind { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.palette-list .p-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font: 800 11px/1 var(--font-head); flex: none; }
.palette-list .p-ico.host { color: #fff; background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); }
.palette-list .p-sub { color: var(--text-3); font-size: 12px; font-family: var(--font-mono); }
.palette-list .p-empty { color: var(--text-3); cursor: default; }

.menu { position: fixed; left: 92px; bottom: 16px; min-width: 240px; padding: 6px; border-radius: var(--r-lg); border: 1px solid var(--border-strong); background: var(--surface-solid); box-shadow: var(--shadow-lg); z-index: 60; display: grid; }
.menu-head { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head span { font-size: 12px; }
.menu button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer; text-align: left; font-weight: 600; color: var(--text-2); }
.menu button:hover { background: var(--surface-2); color: var(--text); }

.toasts { position: fixed; right: 20px; top: 76px; display: grid; gap: 8px; z-index: 80; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slidein .2s ease-out; }
.toast::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--info); flex: none; }
.toast.warn::before { background: var(--warn); }
.toast.error::before { background: var(--danger); }

.bottom-nav { display: none; }
.hide-sm { }

/* ---------- classic theme specifics ---------- */
[data-theme="classic"] .rail-item, [data-theme="classic"] .btn, [data-theme="classic"] .chip, [data-theme="classic"] .tag { letter-spacing: 0; }
[data-theme="classic"] .panel, [data-theme="classic"] .host-card, [data-theme="classic"] .card { border-style: solid; }
[data-theme="classic"] .host-card::before { height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 12px); }
[data-theme="classic"] .hero .waves { opacity: .5; }
[data-theme="carbon"] .host-card::before { background: var(--accent); }
[data-theme="carbon"] .hero .waves { opacity: .55; }
[data-theme="carbon"] .host-card:hover, [data-theme="carbon"] .theme-card:hover { transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr; }
  .search-trigger { width: 260px; }
}
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; overflow-y: auto; }
  .login-art { padding: 36px 24px 20px; border-right: 0; min-height: 0; }
  .login-art-inner { justify-items: center; text-align: center; }
  .login-salt { width: 130px; }
  .login-tag { font-size: 21px; }
  .login-points { display: none; }
  .login-art .waves { top: auto; bottom: 0; height: 45%; }
  .login-side { padding: 8px 16px 32px; }
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { display: none; }
  .bottom-nav { display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--rail-bg); -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
  .bottom-nav a { position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 10px; border-radius: var(--r-md); color: var(--rail-text); font-size: 11px; font-weight: 600; }
  .bottom-nav a[aria-current="page"] { color: var(--rail-active); background: var(--rail-active-bg); }
  .bottom-nav .rail-badge { right: 4px; top: 0; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .page-head h1 { font-size: 17px; }
  .page-head p { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger .st-text, .search-trigger kbd { display: none; }
  .hide-sm { display: none; }
  .top-actions .btn { padding: 0 11px; }
  .view { padding: 14px; }
  .view-terminal { padding: 0; }
  .term-shell { gap: 0; }
  .term-window { border-radius: 0; border: 0; }
  .hero { min-height: 0; }
  .hero-body { padding: 22px; }
  .hero h2 { font-size: 21px; }
  .hero-salt { display: none; }
  .view-settings { grid-template-columns: 1fr; }
  .subnav { position: static; display: flex; overflow-x: auto; padding: 6px; }
  .subnav a { white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .host-grid.as-list .host-card { grid-template-columns: 1fr; }
  .about { flex-direction: column; text-align: center; }
  .menu { left: auto; right: 12px; bottom: 76px; }
  .col-user { display: none; }
  .pane-head.row { flex-direction: column; }
  #strip-size { display: none; }
  .strip { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .tab .t-state, .typing::after { animation: none !important; }
  .sheet[open], .toast { animation: none; }
  .host-card, .theme-card { transition: none; }
}

/* ---- v0.3 additions used by app.js ---- */
.hc-id { min-width: 0; flex: 1; }
.hc-notes { margin: 0; font-size: 12.5px; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip .count { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); }
.chip[aria-selected="true"] .count { background: var(--accent); color: var(--on-accent, #fff); }
.list .live-dot, .list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 22%, transparent); flex: none; }
.palette-list .p-text { display: grid; gap: 2px; min-width: 0; }
.palette-list .p-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .p-ico svg { width: 16px; height: 16px; }
.term-overlay .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hero .waves { -webkit-mask-image: linear-gradient(90deg, transparent 10%, #000 65%); mask-image: linear-gradient(90deg, transparent 10%, #000 65%); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; position: relative; overflow: hidden; transition: transform .15s ease, border-color .15s ease; -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--g1) 30%, transparent), transparent 70%); pointer-events: none; }
.stat:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--g1) 55%, var(--border)); }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--g1), var(--g2)); flex: none; box-shadow: 0 8px 20px -8px var(--g1); }
.stat-ico svg { width: 22px; height: 22px; }
.stat-body { display: grid; min-width: 0; }
.stat-value { font: 800 24px/1.1 var(--font-head); letter-spacing: -0.02em; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.stat-sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-theme="carbon"] .stat, [data-theme="carbon"] .stat-ico { border-radius: 0; }
[data-theme="carbon"] .stat::after, [data-theme="contrast"] .stat::after { display: none; }
[data-theme="classic"] .stat-ico { border-radius: 4px; background: transparent; border: 1px solid var(--g1); color: var(--g1); box-shadow: none; }
[data-theme="contrast"] .stat { border-width: 2px; border-color: var(--text); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats { gap: 10px; } .stat { padding: 12px; gap: 10px; } .stat-ico { width: 36px; height: 36px; } .stat-value { font-size: 20px; } }

/* ======================================================================
   v0.4 — NEXUS AI dock, agent, files, profile
   ====================================================================== */
.nx-logo { width: 18px; height: 18px; border-radius: 5px; flex: none; display: inline-block; vertical-align: -3px; }
.btn .nx-logo { width: 18px; height: 18px; }
.spin-soft { animation: nxpulse 1.4s ease-in-out infinite; }
@keyframes nxpulse { 50% { opacity: .45; transform: scale(.9); } }
.tag.ok { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tag.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-color: transparent; }
.btn.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.link-btn.danger { color: var(--danger); }
.grow { flex: 1; min-width: 0; }
.mono { font-family: var(--font-mono); }
.spinner { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing .terminals { pointer-events: none; }

/* topbar dock toggles */
.dock-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.nx-btn .nx-logo { width: 20px; height: 20px; }

/* strip additions */
.strip-cwd { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.strip-cwd:not(:empty)::before { content: "▸ "; color: var(--accent); }
.nx-running { display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.nx-running .nx-logo { width: 16px; height: 16px; flex: none; }
/* two tidy lines ("NEXUS AI" over "Step N") instead of three wrapped words in the narrow strip */
.nx-run-lines { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.nx-run-lines strong { font-weight: 700; }
.nx-run-lines #strip-nexus-text { font-weight: 600; font-size: 11px; opacity: .85; }
.btn.toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* terminal overlays: selection ask, exit chip, drop hint */
.terminals .sel-ask { position: absolute; right: 18px; bottom: 14px; z-index: 6; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: var(--surface-solid); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-md); animation: rise .18s ease-out; }
.terminals .sel-ask:hover { background: var(--accent-soft); }
.exit-chip { position: absolute; right: 18px; top: 12px; z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--surface-solid); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); box-shadow: var(--shadow-md); font-size: 12.5px; animation: rise .18s ease-out; }
.exit-chip .x { color: var(--danger); font-weight: 700; font-family: var(--font-mono); }
.exit-chip .icon-btn { width: 28px; height: 28px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.drop-hint, .fb-drop { position: absolute; inset: 10px; z-index: 8; border: 2px dashed var(--accent); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface-solid) 82%, transparent); display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--text); pointer-events: none; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.drop-hint [data-icon] svg, .fb-drop [data-icon] svg { width: 34px; height: 34px; color: var(--accent); }
.drop-hint span:last-child, .fb-drop-path { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

/* ---------- dock ---------- */
.dock { position: relative; width: 430px; flex: none; display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.dock-resize { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 5; }
.dock-resize:hover, body.resizing .dock-resize { background: linear-gradient(90deg, var(--accent), transparent); opacity: .6; }
.dock-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 8px 0 12px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-solid) 55%, transparent); }
.dock-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font-weight: 700; font-size: 13px; cursor: pointer; letter-spacing: .01em; }
.dock-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.dock-tabs [role="tab"] [data-icon] svg { width: 16px; height: 16px; }
.dock-tabs .icon-btn { width: 32px; height: 32px; margin-bottom: 4px; }
.dock-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dock-pane[hidden] { display: none; }

/* ---------- NEXUS AI ---------- */
.ai-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 16px; background: linear-gradient(115deg, var(--accent-soft), transparent 75%); }
.ai-logo { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 8px 22px -8px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.ai-id { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ai-id strong { font: 800 15px/1.2 var(--font-head); letter-spacing: .04em; }
.model-pick { justify-self: start; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-family: var(--font-mono); cursor: pointer; }
.model-pick:hover { color: var(--text); border-color: var(--border-strong); }
.model-pick > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-pick .dot { width: 6px; height: 6px; box-shadow: none; }
.model-pick [data-icon] svg { width: 13px; height: 13px; }
.ai-modebar { display: flex; align-items: center; gap: 8px; padding: 0 12px 10px 16px; }
.ai-modebar .seg button[data-mode="agent"][aria-checked="true"] { background: var(--btn-primary); color: var(--accent-ink); }
.toggle-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-3); font-size: 12px; font-weight: 700; cursor: pointer; }
.toggle-chip [data-icon] svg { width: 14px; height: 14px; }
.toggle-chip[aria-pressed="true"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.agent-status { font-size: 12px; font-weight: 700; color: var(--text-2); font-family: var(--font-mono); }
.agent-status.live { color: var(--accent); }
.agent-status.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; animation: nxpulse 1s infinite; }
#nx-stop { height: 28px; }
#nx-stop [data-icon] svg { width: 12px; height: 12px; }
.ai-goal { padding: 0 12px 8px 16px; }
.ai-goal-btn { width: 100%; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--r-sm); border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3); font-size: 12.5px; cursor: pointer; text-align: left; }
.ai-goal-btn > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-goal-btn.set { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.ai-goal-btn [data-icon] { color: var(--accent); }
.ai-goal-btn [data-icon] svg { width: 15px; height: 15px; }
.ai-goal-form { display: flex; gap: 6px; }
.ai-goal-form input { height: 32px; font-size: 13px; }
.ai-ctx { display: flex; align-items: center; gap: 8px; padding: 7px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); background: color-mix(in srgb, var(--surface-solid) 40%, transparent); white-space: nowrap; overflow: hidden; }
.ai-ctx .dot { width: 7px; height: 7px; background: var(--text-3); box-shadow: none; }
.ai-ctx .dot.on { background: var(--live); box-shadow: 0 0 0 3px var(--info-soft); }
.ai-ctx .sep { overflow: hidden; text-overflow: ellipsis; }
.ai-ctx .sep::before { content: "·"; margin-right: 8px; color: var(--text-3); }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.nx-empty { margin: auto 0; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 18px 8px; color: var(--text-2); }
.nx-hero-logo { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 14px 40px -12px var(--accent), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.nx-empty h3 { font-size: 16px; color: var(--text); }
.nx-empty p { margin: 0; font-size: 13px; line-height: 1.55; max-width: 34ch; }
.nx-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.nx-msg { display: grid; gap: 6px; font-size: 13.5px; line-height: 1.6; min-width: 0; }
.nx-msg.user { justify-items: end; }
.nx-msg.user .bubble { max-width: 90%; padding: 9px 13px; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); white-space: pre-wrap; word-break: break-word; }
.nx-msg.ai .who { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); }
.nx-msg.ai .who strong { color: var(--text-2); font-weight: 800; letter-spacing: .04em; font-size: 11.5px; }
.nx-msg.ai .who .model { font-family: var(--font-mono); font-size: 11px; }
.nx-msg.report { padding: 12px 14px; border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(160deg, var(--accent-soft), transparent 60%); }
.nx-body { display: grid; gap: 8px; min-width: 0; }
.nx-body p { margin: 0; }
.nx-body p.st { padding-left: 2px; font-weight: 600; }
.nx-body .ok, .md-list li.ok { color: var(--info); }
.nx-body .bad, .md-list li.bad { color: var(--danger); }
.nx-body .warn, .md-list li.warn { color: var(--warn); }
.nx-body .md-h { margin: 6px 0 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 800; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.nx-body h3.md-h { font-size: 13px; }
.nx-body hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.md-list { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.md-list li::marker { color: var(--accent); }
.nx-body code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.nx-body strong { color: var(--text); }
.md-table-wrap { overflow-x: auto; }
.md-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.md-table th { background: var(--surface-2); font-weight: 700; }
.cb { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--term-bg); }
.cb-head { display: flex; padding: 5px 12px; font: 600 10.5px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: #8a97b0; background: rgba(255,255,255,.03); border-bottom: 1px solid rgba(255,255,255,.06); }
.cb pre { margin: 0; padding: 10px 12px; font: 12.5px/1.55 var(--font-mono); white-space: pre-wrap; word-break: break-word; color: #E6ECF5; max-height: 320px; overflow: auto; }
.cb-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--border); background: var(--surface-solid); }
.cb-actions .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.cb-actions .btn [data-icon] svg { width: 13px; height: 13px; }
.cb-actions .risk { color: var(--warn); font-size: 12px; font-weight: 600; margin-left: 2px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: nxpulse 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.nx-step { border: 1px solid var(--border); border-left: 3px solid var(--info); border-radius: var(--r-md); background: color-mix(in srgb, var(--surface-solid) 70%, transparent); overflow: hidden; }
.nx-step.countdown, .nx-step.running { border-left-color: var(--accent); }
.nx-step.confirm, .nx-step.sudo { border-left-color: var(--warn); }
.nx-step.critical { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.nx-step.critical .step-reason { color: var(--danger); font-weight: 600; }
.nx-step.failed { border-left-color: var(--danger); }
.nx-step.skipped { opacity: .6; border-left-color: var(--text-3); }
.step-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px 12px; font-size: 12px; }
.step-n { font: 800 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); flex: none; }
.step-intro { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.step-cmd { margin: 4px 10px 8px 12px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--term-bg); color: #E6ECF5; font: 12.5px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
.step-cmd .ps { color: var(--accent); }
.step-where { display: flex; align-items: center; gap: 6px; margin: -4px 12px 8px; font: 11.5px/1.4 var(--font-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-where svg { width: 13px; height: 13px; flex: none; }
.countbar { height: 3px; margin: 0 12px 8px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.countbar i { display: block; height: 100%; background: var(--btn-primary); animation: countdown 2s linear forwards; }
@keyframes countdown { from { width: 0; } to { width: 100%; } }
.step-reason { margin: 0 12px 8px; font-size: 12.5px; color: var(--warn); }
.nx-step.failed .step-reason { color: var(--danger); }
.step-out { margin: 0 12px 8px; }
.step-out summary { cursor: pointer; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 2px 0; }
.step-out pre { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--term-bg); color: #C9D3E3; font: 11.5px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.step-acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.step-acts .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.nx-alert { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: var(--r-md); font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.nx-alert.bad { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.nx-alert .dot { background: currentColor; box-shadow: none; }
.nx-alert .btn { height: 26px; color: var(--text); }
.nx-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); justify-content: center; text-align: center; }
.nx-note [data-icon] svg { width: 14px; height: 14px; }
.nx-note.pause { color: var(--warn); font-weight: 600; justify-content: flex-start; text-align: left; padding: 8px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.nx-note.err { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--r-md); justify-content: flex-start; text-align: left; }
.ai-files { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; border-top: 1px solid var(--border); }
.ai-files .lbl { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 8px; border-radius: 999px; background: var(--info-soft); color: var(--text); font-size: 12px; max-width: 220px; }
.fchip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip [data-icon] svg { width: 13px; height: 13px; }
.fchip .x { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.ai-quick .chip { height: 28px; font-size: 12px; }
.ai-form { position: relative; margin: 10px 12px 4px; }
.ai-form textarea { display: block; min-height: 46px; max-height: 180px; padding: 12px 52px 12px 14px; font-family: var(--font-ui); font-size: 14px; line-height: 1.45; resize: none; border-radius: var(--r-md); background: var(--surface-solid); }
.ai-send { position: absolute; right: 7px; bottom: 7px; width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center; background: var(--btn-primary); color: var(--accent-ink); cursor: pointer; }
.ai-send svg { width: 16px; height: 16px; }
.ai-send.busy { background: var(--danger); color: #fff; }
.ai-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 16px 12px; font-size: 11.5px; }
.ai-foot .check.sm { font-size: 12px; }

/* context menu */
.ctx-menu { position: fixed; z-index: 1000; min-width: 210px; padding: 6px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface-solid); box-shadow: var(--shadow-lg); display: grid; }
.ctx-menu button { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; background: none; color: var(--text); border-radius: var(--r-sm); font-size: 13px; text-align: left; cursor: pointer; }
.ctx-menu button:hover { background: var(--surface-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button [data-icon] svg { width: 16px; height: 16px; color: var(--text-3); }
.ctx-menu button.danger [data-icon] svg { color: var(--danger); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* ---------- file browser ---------- */
.fb { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fb-top { padding: 12px 12px 0 14px; display: grid; gap: 8px; }
.fb-host { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.fb-av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 800 12px/1 var(--font-head); background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); flex: none; }
.fb-av.local { background: var(--surface-3); color: var(--text-2); }
.fb-av.local svg { width: 18px; height: 18px; }
.fb-host-text { display: grid; min-width: 0; line-height: 1.3; }
.fb-host-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-host-text span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-pathrow { padding: 0 12px 0 14px; }
.fb-crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding: 4px 0; min-height: 32px; }
.fb-crumbs::-webkit-scrollbar { display: none; }
.crumb { border: 0; background: none; color: var(--text-2); font: 600 12.5px/1 var(--font-mono); padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); background: var(--surface-2); }
.crumb.root { color: var(--accent); }
.crumb-sep { color: var(--text-3); font-family: var(--font-mono); font-size: 12px; }
.fb-path-input { height: 32px; font-family: var(--font-mono); font-size: 12.5px; }
.fb-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 10px 6px 10px; }
.fb-toolbar .icon-btn { width: 32px; height: 32px; }
.fb-toolbar .icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.fb-toolbar .icon-btn svg { width: 17px; height: 17px; }
.fb-toolbar .btn { margin: 0 2px; }
.fb-filterrow { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; padding: 0 10px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.fb-filterrow svg { width: 15px; height: 15px; }
.fb-filter { border: 0; background: transparent; height: 30px; padding: 0; font-size: 13px; box-shadow: none !important; }
.fb-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 6px 6px; outline: none; scrollbar-width: thin; }
.fb-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto 30px; align-items: center; gap: 8px; height: 36px; padding: 0 4px 0 8px; border-radius: var(--r-sm); cursor: default; user-select: none; font-size: 13px; }
.fb:not(.fb-dock) .fb-row { grid-template-columns: 26px minmax(0, 1fr) 80px 100px 130px 30px; }
.fb-local .fb-row { grid-template-columns: 26px minmax(0, 1fr) 80px 130px; }
.fb-row:hover { background: var(--surface-2); }
.fb-row.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.fb-ico svg { width: 19px; height: 19px; }
.fb-ico.k-folder { color: var(--accent); }
.fb-ico.k-folder svg { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.fb-ico.k-filecode { color: var(--info); }
.fb-ico.k-filetext { color: var(--text-2); }
.fb-ico.k-archive { color: #C084FC; }
.fb-ico.k-image { color: #F472B6; }
.fb-ico.k-file { color: var(--text-3); }
.fb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-row.dir .fb-name { font-weight: 600; }
.fb-link { margin-left: 6px; color: var(--text-3); font-size: 11px; }
.fb-size, .fb-time, .fb-perm { font-size: 11.5px; color: var(--text-3); text-align: right; white-space: nowrap; }
.fb-dock .fb-time { display: none; }
.fb-more { width: 28px; height: 28px; opacity: 0; }
.fb-row:hover .fb-more, .fb-row.sel .fb-more { opacity: 1; }
.fb-more svg { width: 16px; height: 16px; }
.fb-status { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); min-height: 34px; }
.fb-selacts { margin-left: auto; display: flex; gap: 12px; }
.fb-empty, .fb-intro { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 16px; color: var(--text-3); font-size: 13px; }
.fb-intro h3 { color: var(--text); font-size: 15px; }
.fb-intro p { margin: 0; max-width: 42ch; line-height: 1.55; }
.fb-intro .row-actions { justify-content: center; margin-top: 6px; }
.fb-error { display: grid; gap: 6px; justify-items: start; margin: 8px; padding: 12px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.fb-error span { color: var(--text-2); }

/* transfers */
.xfer { border-top: 1px solid var(--border); max-height: 220px; display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface-solid) 50%, transparent); }
.xfer-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px 4px; font-size: 12px; }
.xfer-list { overflow-y: auto; padding: 0 8px 8px; display: grid; gap: 2px; }
.xfer-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) 30px; gap: 8px; align-items: center; padding: 6px; border-radius: var(--r-sm); }
.xfer-dir svg { width: 16px; height: 16px; color: var(--accent); }
.xfer-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); }
.xfer-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin: 4px 0 3px; }
.xfer-bar i { display: block; height: 100%; background: var(--btn-primary); transition: width .2s; }
.xfer-item.done .xfer-bar i { background: var(--info); }
.xfer-item.error .xfer-bar i { background: var(--danger); width: 100% !important; }
.xfer-meta { font-size: 11px; color: var(--text-3); }
.xfer-item.error .xfer-meta { color: var(--danger); }
.xfer-state { text-align: center; font-weight: 800; }
.xfer-state.done { color: var(--info); } .xfer-state.error { color: var(--danger); }
.xfer-item .icon-btn { width: 28px; height: 28px; }

/* Files page */
.view-files { grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.files-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline select { width: auto; min-width: 280px; }
.files-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--gap); min-height: 460px; }
.fb-panel { display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); overflow: hidden; -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.xfer-panel { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); overflow: hidden; max-height: 260px; display: flex; flex-direction: column; }

/* editor */
dialog.editor { width: min(1100px, 96vw); max-width: none; height: min(86vh, 900px); padding: 0; display: none; }
dialog.editor[open] { display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.editor-head [data-icon] svg { width: 22px; height: 22px; color: var(--accent); }
.editor-head h2 { font-size: 15px; }
.editor-head p { margin: 2px 0 0; }
#editor-text { flex: 1; border: 0; border-radius: 0; resize: none; padding: 14px 18px; background: var(--term-bg); color: #E6ECF5; font: 13px/1.6 var(--font-mono); tab-size: 4; white-space: pre; box-shadow: none !important; }
dialog.editor footer { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }

/* profile & photo */
.profile-card { display: flex; gap: 22px; align-items: flex-start; }
.profile-photo { width: 96px; height: 96px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font: 800 30px/1 var(--font-head); background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); overflow: hidden; box-shadow: 0 0 0 3px var(--surface-solid), 0 0 0 5px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow-md); }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-btn { overflow: hidden; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.hc-avatar.has-photo { padding: 0; overflow: hidden; background: var(--surface-3); }
.hc-avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; }
.menu-head { display: flex; align-items: center; gap: 12px; }
.menu-head > div { display: grid; min-width: 0; }
dialog.crop { width: min(420px, 94vw); }
.crop-stage { position: relative; width: 100%; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: #0b1220; touch-action: none; }
.crop-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(4, 8, 18, .55); outline: 2px solid rgba(255, 255, 255, .7); outline-offset: -2px; }
#ask-dialog input { font-family: var(--font-mono); }

/* themes */
[data-theme="carbon"] .dock, [data-theme="carbon"] .fb-panel, [data-theme="carbon"] .nx-step, [data-theme="carbon"] .cb, [data-theme="carbon"] .ai-logo, [data-theme="carbon"] .nx-hero-logo { border-radius: 0; }
[data-theme="classic"] .ai-id strong, [data-theme="classic"] .dock-tabs [role="tab"] { font-family: var(--font-mono); }
[data-theme="contrast"] .dock, [data-theme="contrast"] .nx-step, [data-theme="contrast"] .fb-panel { border-width: 2px; border-color: var(--text); }
[data-theme="daylight"] .cb-head { color: #93A3BF; }

@media (max-width: 1100px) {
  .files-split { grid-template-columns: 1fr; }
  .fb:not(.fb-dock) .fb-row { grid-template-columns: 26px minmax(0, 1fr) 80px 30px; }
  .fb:not(.fb-dock) .fb-perm, .fb:not(.fb-dock) .fb-time { display: none; }
}
@media (max-width: 860px) {
  .dock { position: fixed; inset: 0 0 calc(64px + env(safe-area-inset-bottom)) 0; width: auto !important; border-radius: 0; z-index: 40; background: var(--surface-solid); }
  .dock-resize { display: none; }
  .terminals .sel-ask { left: 12px; right: 12px; justify-content: center; }
  .strip-cwd { display: none; }
  .profile-card { flex-direction: column; align-items: center; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .field.inline select { min-width: 0; width: 100%; }
  .field.inline { width: 100%; }
  .fb-more { opacity: 1; }
  .fb-local .fb-row { grid-template-columns: 26px minmax(0, 1fr) 80px; }
  .fb-local .fb-time { display: none; }
}
.ai-log > * { flex-shrink: 0; }
.toasts .toast:nth-last-child(n+4) { display: none; }
input[type=range] { height: 22px; padding: 0; background: none; border: 0; box-shadow: none !important; accent-color: var(--accent); }
dialog.crop .crop-stage, dialog.crop .field { margin: 0 24px; width: auto; }
dialog.crop .field { margin-top: 14px; }
#ask-form { padding: 0 24px 20px; gap: 12px; }
#ask-form > p { margin: 0; }
#ask-form footer { padding: 4px 0 0; display: flex; gap: 8px; }
.fb-tip { display: flex; gap: 10px; align-items: flex-start; max-width: 46ch; text-align: left; padding: 10px 12px; border-radius: var(--r-md); background: var(--info-soft); color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.fb-tip [data-icon] { color: var(--info); flex: none; margin-top: 1px; }
.fb-tip [data-icon] svg { width: 16px; height: 16px; }
.fb-tip code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.fb-recent { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 4px; }
.dock-pane.ai { position: relative; }
.ai-form textarea { padding-left: 46px; }
.ai-attach { position: absolute; left: 7px; bottom: 7px; width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center; background: transparent; color: var(--text-3); cursor: pointer; }
.ai-attach:hover { background: var(--surface-2); color: var(--accent); }
.ai-attach svg { width: 18px; height: 18px; }
.fchip.loading { background: var(--surface-2); color: var(--text-2); }
.fchip.cut { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 50%, transparent); }
.fchip .spinner { width: 10px; height: 10px; color: var(--accent); }
.nx-drop { inset: 8px; z-index: 20; }
.avatar-btn { padding: 0; display: grid; place-items: center; aspect-ratio: 1; flex: none; }
.avatar-btn img, .hc-avatar.has-photo img, .profile-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hc-avatar { aspect-ratio: 1; }
.term-overlay .overlay-note { margin: 4px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }
.term-overlay .btn [data-icon] svg { width: 15px; height: 15px; }
.term-overlay.closed { flex-direction: column; }
.ai-ctx .dot.off { background: var(--danger); }

/* v0.5 live sync: devices pill in the NEXUS context bar */
.ai-ctx .nx-devices { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--text-1); background: linear-gradient(90deg, color-mix(in srgb, var(--w1, #8B5CF6) 22%, transparent), color-mix(in srgb, var(--w3, #EC4899) 22%, transparent));
  border: 1px solid color-mix(in srgb, var(--w2, #6366F1) 40%, transparent); flex: none; }
.ai-ctx .nx-devices .dot { width: 6px; height: 6px; }

/* v0.5 host icons by operating system */
.hc-avatar.os svg { width: 58%; height: 58%; }
.t-av.os svg { width: 74%; height: 74%; }
.fb-av.os svg { width: 60%; height: 60%; }
.palette-list .p-ico.os svg { width: 62%; height: 62%; }
.hc-avatar.os[data-os="unknown"], .t-av.os[data-os="unknown"], .fb-av.os[data-os="unknown"], .p-ico.os[data-os="unknown"] { color: #fff; }
.hc-avatar.os, .t-av.os, .fb-av.os { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.tag.os-tag { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nx-agent-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.ai-ctx .nx-devices.off { background: color-mix(in srgb, var(--warn, #F59E0B) 18%, transparent); border-color: color-mix(in srgb, var(--warn, #F59E0B) 45%, transparent); }
.fb-tip p { margin: 0 0 6px; }
.fb-tip-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* v0.6 terminal behaviour */
.term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
.term-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-top: 12px; }
@media (max-width: 860px) { .term-grid, .term-checks { grid-template-columns: 1fr; } }
#term-settings h3 { display: flex; align-items: center; gap: 8px; }
.term-pane.bell { animation: nx-bell .25s ease-out; }
@keyframes nx-bell { 0% { box-shadow: inset 0 0 0 3px var(--gold, #F2C94C); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.paste-preview { max-height: 220px; overflow: auto; background: var(--term-bg, #0A1426); color: #DCE4FA; border-radius: 10px; padding: 10px 12px; font: 12px/1.45 "JetBrains Mono", monospace; white-space: pre; margin: 8px 0 14px; }
#paste-dialog footer { display: flex; align-items: center; gap: 8px; }

/* v0.6: reports, branding, host memory, server-to-server copy */
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: var(--r-sm); gap: 5px; }
.btn.xs [data-icon] svg { width: 14px; height: 14px; }
.nx-acts { display: flex; gap: 6px; margin-top: 6px; opacity: .75; }
.nx-msg.ai:hover .nx-acts, .nx-acts:focus-within { opacity: 1; }
.nx-file { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--info) 10%, transparent) 70%); }
.nx-file .grow { min-width: 140px; }
.nx-file strong { display: block; font-size: 13.5px; overflow-wrap: anywhere; }
.nx-file-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); }
.nx-file-ico svg { width: 20px; height: 20px; }
.nx-file-acts { display: flex; gap: 6px; }
.mem-btn { display: inline-flex; align-items: center; gap: 4px; }
.mem-btn svg { width: 14px; height: 14px; }
.modal.wide { width: min(760px, calc(100vw - 24px)); }
.memory-view { margin: 8px 24px; max-height: 52vh; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); font-size: 13.5px; }
#memory-edit { display: block; margin: 8px 24px; width: calc(100% - 48px); font-size: 12.5px; line-height: 1.5; }
.report-list { display: grid; gap: 4px; }
.report-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.report-row:last-child { border-bottom: 0; }
.report-row .grow { min-width: 160px; }
.report-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--info))); }
.report-ico svg { width: 17px; height: 17px; }
.brand-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.brand-logo { width: 132px; height: 96px; border-radius: var(--r-md); display: grid; place-items: center; padding: 10px; flex: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--text) 6%, transparent) 0 25%, transparent 0 50%) 0 0 / 16px 16px, var(--surface-2); border: 1px solid var(--border); }
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.form-row.colors { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row.colors input[type="color"] { height: 40px; padding: 4px; cursor: pointer; }
.files-left-mode { flex: none; }
.modal > .form-grid { margin: 8px 24px 0; }
.modal > .form-error { margin: 6px 24px 0; }
.md-quote { margin: 6px 0; padding: 6px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text-2); }

/* ---- v0.6.2 scroll wheel (side-view thumb wheel; floats over the right edge, takes no space) ---- */
.ai-log-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ai-log-wrap > .ai-log { flex: 1; }
.nx-wheel { position: absolute; right: 4px; top: 50%; z-index: 30; display: flex; align-items: center; gap: 5px;
  transform: translateY(-50%); opacity: 1; transition: opacity .35s ease, transform .35s ease; pointer-events: none; }
.nx-wheel[hidden] { display: none; }
.nx-wheel > * { pointer-events: auto; }
.nx-wheel[data-active="0"] { opacity: .4; transform: translateY(-50%) translateX(12px); }
.nx-wheel[data-active="0"] .nx-wheel-cap { opacity: 0; pointer-events: none; }
.nx-wheel.nothing { visibility: hidden; }
.nx-wheel.keys .nx-wheel-strip { visibility: hidden; }   /* a full-screen program has no position to show */
.nx-wheel-strip { position: relative; width: 3px; height: min(280px, 62%); min-height: 120px; border-radius: 2px; background: color-mix(in srgb, var(--border-strong) 70%, transparent); align-self: center; }
.nx-wheel { height: min(340px, calc(100% - 24px)); }
.nx-wheel-thumb { position: absolute; left: 0; width: 3px; height: 44px; border-radius: 2px; background: linear-gradient(180deg, #3FC8E4, #7C5CFF 55%, var(--accent)); }
.nx-wheel-col { display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; justify-content: center; }
.nx-wheel-cap { width: 40px; height: 34px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: opacity .35s ease; border-radius: 10px; }
.nx-wheel-cap:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.nx-wheel-cap svg { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nx-wheel-body { position: relative; width: 30px; height: min(200px, calc(100% - 76px)); min-height: 90px; border-radius: 15px; overflow: hidden; touch-action: none; cursor: grab; outline: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 14px rgba(124,92,255,.35), 0 0 22px rgba(63,200,228,.18), 0 8px 18px rgba(0,0,0,.5);
  background: linear-gradient(90deg, #070C17 0%, #1E2A47 22%, #3A4A72 46%, #2A3860 62%, #121B33 84%, #060A14 100%); }
.nx-wheel[data-drag] .nx-wheel-body { cursor: grabbing; }
.nx-wheel-body:focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(124,92,255,.5); }
.nx-wheel-ridges { position: absolute; inset: 0;
  background-image: repeating-linear-gradient(180deg, transparent 0px, transparent 6px, color-mix(in srgb, var(--accent) 60%, transparent) 6px, color-mix(in srgb, var(--accent-2) 85%, white 10%) 7.5px, color-mix(in srgb, var(--accent-3) 70%, black 20%) 9px, transparent 9px, transparent 12px);
  -webkit-mask-image: linear-gradient(90deg, transparent 6%, #000 30%, #000 70%, transparent 94%); mask-image: linear-gradient(90deg, transparent 6%, #000 30%, #000 70%, transparent 94%); }
.nx-wheel-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,10,20,.95) 0%, rgba(6,10,20,0) 26%, rgba(6,10,20,0) 74%, rgba(6,10,20,.95) 100%); }
.nx-wheel-shine { position: absolute; left: 8px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.22) 50%, rgba(255,255,255,0)); }
.nx-live-pill { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 30; height: 34px; padding: 0 14px 0 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--surface-solid); color: var(--accent); font: 600 12.5px var(--font-ui, inherit);
  display: inline-flex; align-items: center; gap: 4px; box-shadow: var(--shadow-md); cursor: pointer; animation: rise .18s ease-out; }
.nx-live-pill[hidden] { display: none; }
.nx-live-pill svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; width: 14px; height: 14px; }
.ai-log-wrap .nx-live-pill { bottom: 10px; }
[data-theme="carbon"] .nx-wheel-body, [data-theme="contrast"] .nx-wheel-body { border-radius: 6px; }
[data-theme="daylight"] .nx-wheel-strip { background: #C9D3E3; }
/* with the wheel on, the strip beside it shows the position, so the thin native bar steps aside */
[data-wheel="on"] .term-pane .xterm .scrollbar.vertical, [data-wheel="on"] .term-pane .xterm-viewport { scrollbar-width: none; }
[data-wheel="on"] .term-pane .xterm .scrollbar.vertical { opacity: 0 !important; pointer-events: none; }
[data-wheel="on"] .ai-log { scrollbar-width: none; }
@media (prefers-reduced-motion: reduce) { .nx-wheel, .nx-wheel-cap { transition: none; } }

/* ---- v0.6.3 smart keys: a floating strip with the running program's own keys ---- */
.nx-keys { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 31; display: flex; align-items: center; gap: 4px;
  max-width: calc(100% - 84px); padding: 5px 5px 5px 6px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: var(--shadow-md), 0 0 18px rgba(124,92,255,.18);
  animation: rise .18s ease-out; user-select: none; -webkit-user-select: none; }
.nx-keys[hidden] { display: none; }
.nx-keys::before { content: ""; position: absolute; left: 12px; right: 12px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #3FC8E4, #7C5CFF 50%, var(--accent)); opacity: .9; }
.nx-keys-row { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nx-keys-row::-webkit-scrollbar { display: none; }
.nx-keys-app { flex: none; font: 700 10.5px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); padding: 0 6px 0 4px; }
.nx-key { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 12px/1 var(--font-ui); white-space: nowrap; }
.nx-key:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.nx-key:active { transform: translateY(1px); }
.nx-key kbd { font: 600 10.5px/1 var(--font-mono); color: var(--text-2); padding: 3px 5px; border-radius: 5px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.nx-key.answer { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.nx-key.warn { border-color: rgba(242,112,138,.55); color: #F2A0B0; }
.nx-key.mod[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.nx-key.mod[aria-pressed="true"] kbd { color: var(--accent-ink); }
.nx-keys-ask { display: inline-flex; gap: 4px; flex: none; }
.nx-keys-sep { flex: none; width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.nx-keys-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 18px; line-height: 1; cursor: pointer; }
.nx-keys-close:hover { background: var(--surface-2); color: var(--text); }
/* Docked: the terminal gives the strip room (the program redraws above it), so nothing is covered.
   Fit measures the .xterm element's own padding, so the room goes there. */
.term-pane.keys-docked .xterm { padding-bottom: 50px; }
.nx-keys { bottom: 8px; }
.nx-keys[data-pos="top"] { bottom: auto; top: 8px; }
.term-pane.has-keys .nx-live-pill { bottom: 62px; }
.nx-keys[data-style="compact"] .nx-key:not(.answer):not(.mod) .k-label { display: none; }
.nx-keys[data-style="compact"] .nx-key:not(.answer):not(.mod) { padding: 0 7px; }
.nx-keys[data-style="compact"] .nx-key:not(.answer):not(.mod) kbd { background: none; color: var(--text); font-size: 11.5px; padding: 0; }
@media (max-width: 860px) {
  .nx-keys { left: 8px; right: 8px; bottom: 6px; transform: none; max-width: none; }
  .term-pane.keys-docked .xterm { padding-bottom: 52px; }
  .nx-keys[data-pos="top"] { top: 6px; bottom: auto; }
  .nx-key { height: 36px; padding: 0 10px; }
  .nx-key .k-label { font-size: 12.5px; }
}

/* =====================================================================
   v0.7 — NEXUS Fleet (Home, Fleet page, host page)
   Status colours come from the theme (good = --live, warning = --warn, critical = --danger, off = --text-3)
   and always sit beside a text label. Trend lines use the house wave: cyan → violet → gold.
   ===================================================================== */
:root { --st-ok: var(--live); --st-warn: var(--warn); --st-bad: var(--danger); --st-off: var(--text-3);
  --fl-w1: #3FC8E4; --fl-w2: #7C5CFF; --fl-w3: #E3C254; --fl-fill: rgba(124, 92, 255, .26); }
[data-theme="daylight"] { --fl-w1: #0284C7; --fl-w2: #6D28D9; --fl-w3: #B45309; --fl-fill: rgba(109, 40, 217, .14); }
[data-theme="contrast"] { --fl-w1: #00E1FF; --fl-w2: #FFFFFF; --fl-w3: #FFD400; --fl-fill: rgba(255, 255, 255, .12); }
.fl-w1 { stop-color: var(--fl-w1); } .fl-w2 { stop-color: var(--fl-w2); } .fl-w3 { stop-color: var(--fl-w3); }
.fl-f1 { stop-color: var(--fl-fill); } .fl-f2 { stop-color: transparent; }
.rail-badge.warn { background: var(--warn); color: #1A1303; }

.home-fleet { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.home-fleet:empty { display: none; }
#fleet-root { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.fl-top > *, .fl-mid > *, .fl-hp-grid > *, .fl-charts > * { min-width: 0; }
.fl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.fl-head h3 { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.fl-head h3 svg { width: 18px; height: 18px; color: var(--accent); }
.fl-seg-label { margin-right: -6px; }
.fl-loading { padding: 18px 2px; }

.fl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st-off); flex: none; }
.fl-dot.ok { background: var(--st-ok); } .fl-dot.warn { background: var(--st-warn); } .fl-dot.bad { background: var(--st-bad); }
.fl-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.fl-status.ok .fl-dot { background: var(--st-ok); } .fl-status.warn .fl-dot { background: var(--st-warn); } .fl-status.bad .fl-dot { background: var(--st-bad); }
.fl-status.warn { color: var(--text); background: color-mix(in srgb, var(--st-warn) 16%, transparent); }
.fl-status.bad { color: var(--text); background: color-mix(in srgb, var(--st-bad) 16%, transparent); }
.fl-lvl { flex: none; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text); }
.fl-lvl.bad { background: color-mix(in srgb, var(--st-bad) 20%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-bad) 50%, transparent); }
.fl-lvl.warn { background: color-mix(in srgb, var(--st-warn) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-warn) 45%, transparent); }

/* top row: health card + four gauges */
.fl-top { display: grid; grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(140px, 1fr)); gap: 14px; }
.fl-health, .fl-gauge { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 16px 18px; min-width: 0; }
.fl-health { display: flex; flex-direction: column; gap: 10px; }
.fl-h-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fl-h-label { font-weight: 700; font-size: 13px; color: var(--text-2); }
.fl-h-num { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; }
.fl-h-num strong { font: 800 34px/1 var(--font-head); letter-spacing: -0.02em; }
.fl-h-sub { width: 100%; font-size: 13px; color: var(--text-2); }
.fl-mix { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.fl-mix i { display: block; min-width: 4px; background: var(--st-off); }
.fl-mix i.ok { background: var(--st-ok); } .fl-mix i.warn { background: var(--st-warn); } .fl-mix i.bad { background: var(--st-bad); }
.fl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.fl-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.fl-legend strong { color: var(--text); }
.fl-gauge { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.fl-g-label { align-self: flex-start; font-weight: 700; font-size: 13px; color: var(--text-2); }
.fl-gauge svg { width: 100%; max-width: 160px; height: auto; }
.fl-g-track { stroke: var(--surface-3); }
.fl-g-val.ok { stroke: var(--st-ok); } .fl-g-val.warn { stroke: var(--st-warn); } .fl-g-val.bad { stroke: var(--st-bad); } .fl-g-val.off { stroke: var(--st-off); }
.fl-g-num { fill: var(--text); font: 800 20px var(--font-head); }
.fl-g-note { min-height: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 11.5px; }

/* needs attention + assets */
.fl-mid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 14px; }
.fl-attn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fl-attn-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.fl-attn-list li:first-child { border-top: 0; padding-top: 0; }
.fl-a-main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fl-a-title { font-weight: 600; font-size: 13.5px; }
.fl-a-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.fl-calm { margin: 0; }
.fl-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fl-totals > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.fl-totals strong { font: 800 18px var(--font-head); }
.fl-osmix { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.fl-os-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 24px; align-items: center; gap: 10px; font-size: 12.5px; }
.fl-os-row strong { text-align: right; }

/* bars, meters, sparklines */
.fl-bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.fl-bar i { display: block; height: 100%; border-radius: 4px; background: var(--st-off); }
.fl-bar i.ok { background: var(--st-ok); } .fl-bar i.warn { background: var(--st-warn); } .fl-bar i.bad { background: var(--st-bad); }
.fl-meter { display: grid; grid-template-columns: 54px 34px; align-items: center; gap: 8px; }
.fl-mval { font: 600 12px var(--font-mono); color: var(--text); text-align: right; }
.fl-spark { display: block; }
.fl-spark-end { fill: var(--fl-w3); }
.fl-spark-none { stroke: var(--surface-3); stroke-width: 2; stroke-dasharray: 3 4; }
.fl-table td.num { font: 12.5px var(--font-mono); white-space: nowrap; }
.fl-table td, .fl-table th { padding: 9px 12px; }
.fl-host { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 150px; }
.fl-host:hover strong { color: var(--accent); }
.fl-host-id { display: flex; flex-direction: column; min-width: 0; }
.fl-host-id strong { font: 700 13px var(--font-mono); }
.fl-host-id .small { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-issue { max-width: 240px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.sm { height: 18px; padding: 0 6px; font-size: 10.5px; margin-left: 6px; }
.tag.warn { color: var(--text); background: color-mix(in srgb, var(--st-warn) 16%, transparent); border-color: color-mix(in srgb, var(--st-warn) 40%, transparent); }
.fl-foot { margin: 0; }

/* summary and off */
.fl-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.fl-strip-i { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-2); }
.fl-strip-i strong { font: 800 18px var(--font-head); color: var(--text); }
.fl-strip-top { flex: 1 1 320px; font-size: 13px; color: var(--text-2); }
.fl-off, .fl-empty { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 14px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13.5px; }
.fl-off > span:nth-child(2), .fl-empty > div { flex: 1 1 320px; }
.fl-off svg { width: 20px; height: 20px; }
.fl-empty p { margin: 4px 0 0; }
.fl-empty .empty-icon svg { width: 26px; height: 26px; color: var(--accent); }
.home-fleet + .home-grid { margin-top: 0; }

/* host page */
.fl-back { align-self: flex-start; font-size: 13px; font-weight: 600; }
.fl-hp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; }
.fl-hp-id { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fl-hp-name { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.fl-hp-name h2 { font: 800 24px var(--font-mono); margin: 0; }
.fl-hp-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-hp-acts .nx-logo { width: 18px; height: 18px; }
.fl-band { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; background: var(--surface); border: 1px solid var(--border); }
.fl-band > span:not(.fl-lvl):not(.fl-status) { flex: 1 1 300px; }
.fl-band.bad { background: color-mix(in srgb, var(--st-bad) 9%, var(--surface)); border-color: color-mix(in srgb, var(--st-bad) 40%, transparent); }
.fl-band.warn { background: color-mix(in srgb, var(--st-warn) 8%, var(--surface)); border-color: color-mix(in srgb, var(--st-warn) 35%, transparent); }
.fl-band.info { border-style: dashed; }
.fl-band svg { width: 18px; height: 18px; color: var(--accent); }
.fl-sec { font-size: 15px; margin: 4px 0 -6px; }
.fl-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.fl-chart { margin: 0; padding: 14px 16px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fl-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fl-c-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-c-now { font: 800 20px var(--font-head); color: var(--text); }
.fl-c-wrap { position: relative; }
.fl-c-svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.fl-c-grid { stroke: var(--border); stroke-width: 1; }
.fl-c-axis { fill: var(--text-3); font: 9px var(--font-ui); }
.fl-c-end { fill: var(--fl-w3); stroke: var(--surface-solid); stroke-width: 2; }
.fl-c-cross { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.fl-c-dot { fill: var(--surface-solid); stroke: var(--text); stroke-width: 2; }
.fl-tip { position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 1px; padding: 5px 9px; border-radius: var(--r-sm); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.fl-tip strong { color: var(--text); font-size: 13px; }
.fl-hp-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 14px; }
.fl-disks { display: flex; flex-direction: column; gap: 10px; }
.fl-disk { display: grid; grid-template-columns: minmax(70px, 130px) minmax(60px, 1fr) minmax(120px, auto); align-items: center; gap: 12px; font-size: 13px; }
.fl-disk .mono { font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-disk .fl-bar { height: 10px; border-radius: 5px; }
.fl-services { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.fl-svc { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); font: 12px var(--font-mono); }
.fl-kvs { display: flex; flex-direction: column; }
.fl-kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.fl-kv:first-child { border-top: 0; }
.fl-kv span:last-child { overflow-wrap: anywhere; }
.fl-include { margin-top: 12px; }
.fl-notes { white-space: pre-wrap; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.about-modules { margin: 6px 0 10px; padding-left: 18px; color: var(--text-2); }
.about-modules li { margin: 3px 0; }

@media (max-width: 1180px) { .fl-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fl-health { grid-column: 1 / -1; } }
@media (max-width: 900px) { .fl-mid, .fl-hp-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .fl-top { gap: 10px; } .fl-gauge { padding: 12px; } .fl-h-num strong { font-size: 28px; }
  .fl-seg-label { display: none; } .fl-head .seg { order: 5; }
  .fl-disk { grid-template-columns: minmax(60px, 1fr) minmax(60px, 1.4fr); } .fl-disk > span:last-child { grid-column: 1 / -1; margin-top: -6px; }
  .fl-hp-name h2 { font-size: 20px; } .fl-hp-acts .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 860px) { .bottom-nav a { flex: 1 1 0; min-width: 0; padding: 6px 2px; } }

/* =====================================================================
   v0.8 — NEXUS Desktop and NEXUS Agent
   ===================================================================== */
.hc-protos { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.hc-protos span { font: 600 10px/16px var(--font-mono); padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.hc-protos span.on { background: color-mix(in srgb, var(--live) 22%, transparent); color: var(--text); }
.view-desktop { padding: 16px; display: flex; overflow: hidden; }
.dk-shell { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-md); overflow: hidden; }
.dk-shell:fullscreen { border-radius: 0; border: 0; }
.dk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dk-id { display: flex; flex-direction: column; min-width: 0; }
.dk-id strong { font: 700 14px var(--font-mono); }
.dk-id .small { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-agent-ico svg { width: 26px; height: 26px; color: var(--accent); }
.dk-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.dk-tools .nx-logo { width: 16px; height: 16px; }
.show-sm { display: none; }
.dk-body { position: relative; flex: 1; min-height: 0; display: flex; }
/* The stage is a plain scroll container; the inner wrapper centres the screen when it fits and grows to the
   screen's size when zoomed, so at 1:1 every corner (top and left too) is reachable by the scrollbars. A centred
   flex child, by contrast, clips its own top-left once it overflows. */
.dk-stage { flex: 1; min-width: 0; min-height: 0; display: block; overflow: auto; background: #05080F; outline: none; }
.dk-canvas-wrap { min-width: 100%; min-height: 100%; width: max-content; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.dk-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.dk-canvas { display: block; image-rendering: auto; cursor: default; touch-action: none; }
.dk-guac { margin: auto; }
.dk-guac canvas { image-rendering: auto; }
.dk-kbd-input { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dk-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 8, 16, .72); z-index: 3; }
.dk-ov-card { max-width: 440px; margin: 16px; padding: 22px 24px; border-radius: var(--r-lg); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dk-ov-card p { margin: 0; color: var(--text); }
.dk-ov-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.dk-ai { width: 380px; max-width: 100%; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-left: 1px solid var(--border); background: var(--surface-solid); overflow-y: auto; z-index: 2; }
.dk-ai header { display: flex; align-items: center; gap: 8px; }
.dk-ai header .nx-logo { width: 22px; height: 22px; }
.dk-ai img#dk-ai-shot { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--border); }
.dk-ai textarea { width: 100%; box-sizing: border-box; }
.dk-ai-answer { font-size: 13.5px; line-height: 1.55; }
.dk-ai-answer p { margin: 4px 0; } .dk-ai-answer h4 { margin: 10px 0 4px; font-size: 14px; }
.dk-ai-code { margin: 6px 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--term-bg); color: #E6ECF5; font: 12px/1.5 var(--font-mono); white-space: pre-wrap; }
.ag-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.ag-head h3 { margin: 0; }
.ag-head p { margin: 4px 0 0; max-width: 820px; }
.ag-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); flex: none; }
.ag-dot.on { background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 25%, transparent); }
.ag-table td.num { font: 12.5px var(--font-mono); }
.ag-dl-list { display: flex; flex-direction: column; }
.ag-dl-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(0, 1.5fr) auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ag-dl-row:first-child { border-top: 0; }
.mono { font-family: var(--font-mono); }
.ag-link { padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); display: flex; flex-direction: column; gap: 10px; }
.ag-link p { margin: 0; }
.ag-link input { width: 100%; box-sizing: border-box; }
.ag-dialog form { padding: 4px; }
.ag-dialog header h3 { margin: 0; }
.ag-consent { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 860px) {
  .view-desktop { padding: 0; }
  .dk-shell { border-radius: 0; border: 0; }
  .show-sm { display: inline-flex; }
  .dk-ai { position: absolute; inset: auto 0 0 0; width: auto; max-height: 70%; border-left: 0; border-top: 1px solid var(--border); }
  .ag-dl-row { grid-template-columns: 1fr auto; } .ag-dl-row .mono { grid-column: 1 / -1; order: 3; }
}

/* v0.8.1: Add remote desktop over SSH, Add a machine */
.ai-install header h3, .ag-link header h3 { margin: 0 0 4px; }
.ai-opts { display: grid; gap: 10px; }
.ai-steps { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 10px; }
.ai-steps li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-3, var(--text-2)); }
.ai-steps li strong { display: block; font-weight: 600; font-size: 13.5px; }
.ai-steps li small { display: block; font-size: 12.5px; overflow-wrap: anywhere; }
.ai-mark { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border-strong); }
.ai-steps li.run, .ai-steps li.ok, .ai-steps li.fail { color: var(--text); }
.ai-steps li.run .ai-mark { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.ai-steps li.ok .ai-mark { border-color: var(--info, #3FC8E4); background: var(--info, #3FC8E4); box-shadow: inset 0 0 0 3px var(--surface); }
.ai-steps li.fail .ai-mark { border-color: var(--danger); background: var(--danger); box-shadow: inset 0 0 0 3px var(--surface); }
.ai-steps li.fail small { color: var(--danger); }
.ag-copy { display: grid; gap: 4px; }
.ag-copy-row { display: flex; gap: 6px; }
.ag-copy-row input { flex: 1; min-width: 0; font-size: 12.5px; }
.ag-copy .btn { justify-self: start; }
.ai-install, .ag-link, #add-machine-dialog .form-grid { grid-template-columns: 1fr; padding: 18px 20px; gap: 14px; align-content: start; }
#agent-install-dialog, #add-machine-dialog { width: min(520px, 100vw); }

/* v0.9 NEXUS Desktop: quality/monitor controls and the AI chat panel */
.dk-controls { display: inline-flex; align-items: center; gap: 6px; }
.dk-controls .dk-ic svg { width: 16px; height: 16px; color: var(--text-2); }
.dk-sel { height: 32px; padding: 0 8px; font-size: 12.5px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); max-width: 180px; }
.dk-qpop { position: fixed; z-index: 60; width: 260px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg, var(--shadow-md)); padding: 12px; display: grid; gap: 12px; }
.dk-qrow { display: grid; gap: 4px; font-size: 12.5px; color: var(--text); }
.dk-qrow > span { display: flex; justify-content: space-between; }
.dk-qval { color: var(--accent); font-variant-numeric: tabular-nums; }
.dk-qrow input[type=range] { width: 100%; accent-color: var(--accent); }

/* the Ask NEXUS chat panel */
.dk-ai { display: flex; flex-direction: column; }
.dk-chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.dk-msg { display: grid; gap: 4px; max-width: 100%; }
.dk-msg .who { font-size: 11px; color: var(--text-3, var(--text-2)); text-transform: uppercase; letter-spacing: .04em; }
.dk-msg .bubble { border-radius: var(--r-md); padding: 9px 12px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.dk-msg.me .bubble { background: var(--accent-soft); color: var(--text); justify-self: end; }
.dk-msg.ai .bubble { background: var(--surface-2); color: var(--text); }
.dk-msg .bubble pre { background: var(--code-bg, #07101f); border-radius: 8px; padding: 8px; overflow-x: auto; font-size: 12px; margin: 6px 0; }
.dk-msg .shot { border-radius: 8px; border: 1px solid var(--border); max-width: 180px; cursor: zoom-in; }
.dk-chat-foot { border-top: 1px solid var(--border); padding: 10px; display: grid; gap: 8px; }
.dk-chat-foot .snaprow { display: flex; align-items: center; gap: 8px; }
.dk-chat-foot .snaprow img { height: 40px; border-radius: 6px; border: 1px solid var(--border); }
.dk-chat-foot textarea { width: 100%; box-sizing: border-box; resize: none; }
.dk-chat-foot .acts { display: flex; gap: 8px; align-items: center; }

/* NEXUS AI desktop control (and the Ask/Control mode toggle) */
.dk-ai-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.dk-mode-btn { border: 0; background: none; color: var(--text-2); font: 600 12px var(--font); padding: 3px 12px; border-radius: 999px; cursor: pointer; }
.dk-mode-btn[aria-selected="true"] { background: var(--accent); color: var(--accent-ink, #0B1220); }
.dk-mode-btn:disabled { opacity: .5; cursor: default; }
.dk-ai[data-mode="control"] #dk-ai-snaprow { display: none; }
.dk-step { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; margin: 6px 0; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.dk-step-ico { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.dk-step-body { min-width: 0; flex: 1; }
.dk-step-text { display: block; color: var(--text); overflow-wrap: anywhere; }
.dk-step-reason { display: block; margin-top: 2px; font-size: 12px; color: var(--warning, #E3C254); }
.dk-step-acts { display: flex; gap: 6px; margin-top: 7px; }
.dk-step.done { border-color: color-mix(in srgb, var(--info, #3FC8E4) 50%, var(--border)); }
.dk-step.done .dk-step-ico { color: var(--info, #3FC8E4); }
.dk-step.confirm { border-color: color-mix(in srgb, var(--warning, #E3C254) 60%, var(--border)); background: color-mix(in srgb, var(--warning, #E3C254) 10%, var(--surface-2)); }
.dk-step.confirm .dk-step-ico { color: var(--warning, #E3C254); }
.dk-step.fail, .dk-step.skipped { opacity: .75; }
.dk-step.fail .dk-step-ico, .dk-step.skipped .dk-step-ico { color: var(--text-3); }
.dk-step.ask { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
/* the target ring NEXUS AI is about to act on */
.dk-marker { position: fixed; z-index: 60; width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 3px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent); pointer-events: none; animation: dk-ping 1s ease-out infinite; }
.dk-marker::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--accent); opacity: .85; }
@keyframes dk-ping { 0% { transform: scale(.7); } 70% { transform: scale(1.1); } 100% { transform: scale(.7); } }
