/* ==========================================================================
   SiteDeck — design system & application styles
   ========================================================================== */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --accent: #6366f1;
  --accent-hover: #7c7ff5;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);

  --sidebar-w: 248px;
  --topbar-h: 60px;
}

html[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-elevated: #11151d;
  --surface: #151a24;
  --surface-2: #1b2130;
  --surface-3: #232a3b;
  --border: #242c3b;
  --border-strong: #33405a;
  --text: #e6e9ef;
  --text-dim: #9aa4b6;
  --text-faint: #667089;
  --code-bg: #0d1117;
}

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e6e9ef;
  --border: #e2e5ea;
  --border-strong: #cfd5df;
  --text: #1a1f2b;
  --text-dim: #5b6474;
  --text-faint: #8a93a3;
  --code-bg: #f6f8fa;
  --shadow: 0 8px 24px rgba(20, 30, 50, 0.08);
  --shadow-lg: 0 24px 60px rgba(20, 30, 50, 0.16);
  --shadow-sm: 0 1px 2px rgba(20, 30, 50, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* ------------------------------- boot ------------------------------------ */
.app-loading { display: grid; place-items: center; min-height: 100vh; }
.boot-splash { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--text-dim); }
.boot-logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }

/* ------------------------------- layout ---------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0;
  background: var(--bg-elevated); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #22d3ee); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 16px rgba(99,102,241,.35);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-tag { font-size: 11px; color: var(--text-faint); margin-top: -2px; }
.sidebar-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius);
  color: var(--text-dim); font-weight: 500; cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-item .nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav-item .nav-badge { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-dim); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 14px 12px 6px; font-weight: 600; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--accent-hover); flex-shrink: 0; }
.user-chip .u-name { font-size: 13px; font-weight: 600; }
.user-chip .u-role { font-size: 11px; color: var(--text-faint); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 80%, transparent);
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px);
}
.topbar-title { font-size: 16px; font-weight: 650; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 24px; max-width: 1500px; width: 100%; margin: 0 auto; }
.mobile-toggle { display: none; }

/* ------------------------------ buttons ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 550; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.3); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: #f65d5d; }
.btn-danger-soft { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn-danger-soft:hover { background: rgba(239,68,68,.22); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-icon { padding: 7px; width: 34px; height: 34px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 4px; }

/* ------------------------------- forms ----------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.field .hint { font-size: 11.5px; color: var(--text-faint); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: 12.5px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent);
  width: 16px; height: 16px; cursor: pointer;
  color-scheme: dark;
}
html[data-theme="light"] input[type="checkbox"], html[data-theme="light"] input[type="radio"] { color-scheme: light; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ------------------------------- cards ----------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 650; }
.card-sub { font-size: 12px; color: var(--text-faint); }

/* ------------------------------ status pill ------------------------------ */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; line-height: 1.4; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { color: var(--success); background: var(--success-soft); }
.pill.offline { color: var(--danger); background: var(--danger-soft); }
.pill.auth_error { color: var(--warning); background: var(--warning-soft); }
.pill.unknown { color: var(--text-faint); background: var(--surface-3); }
.pill.online .dot { box-shadow: 0 0 0 3px var(--success-soft); animation: blink 2.2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ------------------------------ dashboard -------------------------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.page-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; position: relative; overflow: hidden; }
.stat-label { font-size: 12px; color: var(--text-dim); font-weight: 550; display: flex; align-items: center; gap: 7px; }
.stat-value { font-size: 28px; font-weight: 720; letter-spacing: -0.02em; margin-top: 6px; line-height: 1.1; }
.stat-value small { font-size: 14px; color: var(--text-faint); font-weight: 500; }
.stat-foot { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.stat .stat-ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hover); }
.stat .stat-ico svg { width: 18px; height: 18px; }

.toolbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 340px; }
.search-box .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.search-box .input { padding-left: 34px; }

.group-block { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.group-dot { width: 10px; height: 10px; border-radius: 3px; }
.group-name { font-weight: 650; font-size: 14px; }
.group-count { font-size: 12px; color: var(--text-faint); }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.agent-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; position: relative;
  transition: border-color .15s, box-shadow .15s, transform .1s; cursor: pointer;
}
.agent-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.agent-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ac-top { display: flex; align-items: flex-start; gap: 10px; }
.ac-check { margin-top: 2px; }
.ac-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-host { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.metric .m-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.metric .m-value { font-size: 13px; font-weight: 650; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric .m-value.mono { font-family: var(--font-mono); font-size: 12px; }
.ac-actions { display: flex; gap: 7px; margin-top: 2px; }
.ac-actions .btn { flex: 1; }
.ac-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 10px; }
.ac-foot .grow { flex: 1; }
.disk-bar { height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.disk-bar > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--accent), #22d3ee); }
.disk-bar.warn > span { background: linear-gradient(90deg, var(--warning), var(--danger)); }

.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty .empty-ico { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-faint); }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--text); }
.empty p { font-size: 13px; max-width: 420px; margin: 0 auto 18px; }

/* -------------------------------- tables --------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); position: sticky; top: 0; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warn { color: var(--warning); }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-6 { gap: 6px; }
.gap-10 { gap: 10px; }
.gap-14 { gap: 14px; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* -------------------------------- modal ---------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 8, 14, 0.6); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; animation: fade .12s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .16s ease;
}
.modal.wide { max-width: 780px; }
.modal.xwide { max-width: 1080px; }
.modal.full { max-width: 1400px; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 20px 22px; }
.modal-body.tight { padding: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }

/* -------------------------------- toasts --------------------------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: 380px; }
.toast { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); animation: toastIn .18s ease; font-size: 13px; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast .t-title { font-weight: 650; margin-bottom: 2px; }
.toast .t-msg { color: var(--text-dim); font-size: 12.5px; word-break: break-word; }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------ file manager ----------------------------- */
.fm-layout { display: grid; grid-template-columns: 1fr; gap: 0; height: calc(100vh - var(--topbar-h) - 48px); min-height: 500px; }
.fm-panel { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.fm-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 3px; flex: 1; min-width: 200px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
.crumb { padding: 3px 7px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-dim); }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--text-faint); }
.fm-body { flex: 1; overflow: auto; min-height: 0; }
.fm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fm-table th { position: sticky; top: 0; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); z-index: 1; cursor: pointer; user-select: none; }
.fm-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); }
.fm-row { cursor: pointer; }
.fm-row:hover td { background: var(--surface-2); }
.fm-row.selected td { background: var(--accent-soft); }
.fm-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.fm-name .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-ico { width: 18px; height: 18px; flex-shrink: 0; }
.fm-ico.dir { color: var(--info); }
.fm-ico.file { color: var(--text-faint); }
.fm-ico.link { color: var(--warning); }
.fm-actions-cell { display: flex; gap: 4px; justify-content: flex-end; }
.fm-empty { padding: 40px; text-align: center; color: var(--text-faint); }
.dropzone { position: absolute; inset: 0; background: var(--accent-soft); border: 2px dashed var(--accent); border-radius: var(--radius-lg); display: grid; place-items: center; z-index: 5; font-weight: 600; color: var(--accent-hover); pointer-events: none; }

/* Editor */
.editor-wrap { display: flex; flex-direction: column; height: 100%; }
.editor-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor-path { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-path .dirty { color: var(--warning); margin-left: 6px; }
.editor-host { flex: 1; min-height: 0; overflow: hidden; }
.editor-host .cm-editor { height: 100%; }
.editor-status { display: flex; align-items: center; gap: 14px; padding: 5px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); background: var(--surface-2); }

/* -------------------------------- terminal ------------------------------- */
.term-panel { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 48px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--code-bg); overflow: hidden; }
.term-head { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.term-out { flex: 1; overflow-y: auto; padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.term-line-cmd { color: var(--accent-hover); }
.term-line-cmd::before { content: "$ "; color: var(--success); }
.term-stdout { color: var(--text); }
.term-stderr { color: var(--danger); }
.term-meta { color: var(--text-faint); font-size: 11.5px; margin: 4px 0 10px; }
.term-input-row { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.term-prompt { color: var(--success); font-family: var(--font-mono); font-weight: 700; }
.term-input { flex: 1; background: transparent; border: none; outline: none; font-family: var(--font-mono); font-size: 13px; color: var(--text); }

/* bulk */
.bulk-result { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.bulk-result-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); cursor: pointer; }
.bulk-result-body { padding: 10px 14px; border-top: 1px solid var(--border); }
.bulk-pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; margin: 6px 0 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; cursor: pointer; user-select: none; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }

/* misc */
.kv { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 12px; word-break: break-word; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 650; margin: 20px 0 10px; }
.section-title:first-child { margin-top: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-dim); font-weight: 600; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.no { background: var(--danger-soft); color: var(--danger); }
.warn-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent); color: var(--text); font-size: 12.5px; margin-bottom: 8px; }
.warn-box .ico { color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.info-box { padding: 12px 14px; border-radius: var(--radius); background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); font-size: 12.5px; }
.secret-box { font-family: var(--font-mono); font-size: 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; word-break: break-all; position: relative; }
.spinner { width: 15px; height: 15px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.loading-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }

/* auth screen */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,.18), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(34,211,238,.12), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); padding: 30px 28px; box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo .brand-mark { width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .auth-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.auth-card .btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 4px; }
.auth-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }

/* responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: 1fr; }
  .fm-layout, .term-panel { height: auto; min-height: calc(100vh - 140px); }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
}
