@font-face { font-family:"Space Grotesk"; font-weight:400; font-display:swap; src:url("/static/fonts/space-grotesk-400.woff2") format("woff2"); }
@font-face { font-family:"Space Grotesk"; font-weight:500; font-display:swap; src:url("/static/fonts/space-grotesk-500.woff2") format("woff2"); }
@font-face { font-family:"Space Grotesk"; font-weight:600; font-display:swap; src:url("/static/fonts/space-grotesk-600.woff2") format("woff2"); }
@font-face { font-family:"Space Grotesk"; font-weight:700; font-display:swap; src:url("/static/fonts/space-grotesk-700.woff2") format("woff2"); }

/* Fairlead — daytime chart (light) */
:root {
  --bg: #e7eef2;
  --surface: #ffffff;
  --surface-2: #eef4f7;
  --line: #d2dfe8;
  --line-2: #e6eef3;
  --txt: #0a2236;
  --txt-2: #4d6577;
  --muted: #5b7488;
  --accent: #0c9aa0;
  --accent-hover: #0a868c;
  --accent-soft: #0c9aa016;
  --accent-ring: #0c9aa033;
  --ok: #0f9d6b;
  --ok-soft: #0f9d6b16;
  --warn: #c98314;
  --danger: #df4747;
  --danger-soft: #df474714;
  --violet: #6d5ae0;
  --brass: #ad7a26;
  --brass-soft: #ad7a2618;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(10,34,54,.07), 0 1px 3px rgba(10,34,54,.05);
  --shadow: 0 2px 4px rgba(10,34,54,.06), 0 12px 30px rgba(10,34,54,.10);
  --shadow-lg: 0 18px 54px rgba(10,34,54,.20);
  --glow: 0 0 22px -7px var(--accent);
  --sysbar-bg: #0a1f33;
  --sysbar-txt: #bccfdd;
  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
/* Fairlead — helm at night (dark, primary identity) */
:root[data-theme="dark"] {
  --bg: #07182a;
  --surface: #0e2339;
  --surface-2: #16334e;
  --line: #234462;
  --line-2: #1a3450;
  --txt: #e6f1f8;
  --txt-2: #8eabc2;
  --muted: #7f99af;
  --accent: #22cebf;
  --accent-hover: #46dccd;
  --accent-soft: #22cebf1e;
  --accent-ring: #22cebf45;
  --ok: #2ddc9f;
  --ok-soft: #2ddc9f1c;
  --warn: #f4c45a;
  --danger: #ff6b6b;
  --danger-soft: #ff6b6b1c;
  --violet: #8f7cff;
  --brass: #e8b86f;
  --brass-soft: #e8b86f1e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow: 0 2px 8px rgba(0,0,0,.45), 0 14px 34px rgba(2,10,20,.55);
  --shadow-lg: 0 20px 60px rgba(2,8,16,.66);
  --sysbar-bg: #040f1d;
  --sysbar-txt: #9db5cb;
}
:root[data-theme="dark"] .note { border-color: #234462; color: #b9c8e6; }
:root[data-theme="dark"] .placeholder { border-color: #234462; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1 { letter-spacing: -.01em; }

/* ---- auth ---- */
.login-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #e8efff 0%, var(--bg) 55%);
}
.login-card {
  width: 360px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-lg);
}
.login-brand { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.login-sub { color: var(--muted); margin: 0 0 14px; }
.login-card label { font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 500; }
.login-card input {
  background: var(--surface); border: 1px solid var(--line); color: var(--txt);
  border-radius: var(--radius-sm); padding: 11px 13px; outline: none; transition: .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.login-error { background: var(--danger-soft); color: var(--danger);
  border: 1px solid #f7caca; padding: 9px 11px; border-radius: var(--radius-sm); font-size: 13px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--txt); padding: 9px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 500; transition: .15s; box-shadow: var(--shadow-sm); }
.btn:hover { border-color: #d4dbe6; background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff;
  margin-top: 18px; justify-content: center; padding: 11px 14px; box-shadow: 0 2px 8px var(--accent-ring); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--txt); }

/* ---- app shell ---- */
.layout { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 14px; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 9px; padding: 6px 8px 18px; }
.brand-logo { max-height: 42px; max-width: 200px; display: block; object-fit: contain; }
.logo-preview { margin: 8px 0 14px; }
.logo-preview img { max-height: 52px; max-width: 220px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px; background: var(--surface-2); }
.brand-mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #4f86ff); color: #fff; font-size: 15px;
  box-shadow: 0 2px 8px var(--accent-ring);
}
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--txt); margin-bottom: 2px; font-weight: 500; transition: .12s; }
.nav-item:hover { background: var(--line-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: var(--line-2); color: var(--muted); font-size: 13px; flex: 0 0 auto; transition: .12s; }
.nav-item:hover .nav-icon { color: var(--accent); }
.nav-item.active .nav-icon { background: var(--accent); color: #fff; }

/* collapsible groups */
.nav-group { margin-top: 4px; }
.nav-group-head { display: flex; align-items: center; border-radius: var(--radius-sm); transition: .12s; }
.nav-group-head:hover { background: var(--line-2); }
.nav-group-head.active { background: var(--accent-soft); }
.nav-group-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border: 0; background: none; font: inherit; color: var(--muted); font-weight: 600; cursor: pointer;
  text-align: left; border-radius: var(--radius-sm); }
.nav-group-head.active .nav-group-link { color: var(--accent); }
.chev { margin-left: auto; flex: none; border: 0; background: none; cursor: pointer; padding: 9px 10px;
  transition: transform .18s ease; font-size: 11px; color: var(--txt-2); }
.chev.open { transform: rotate(90deg); }
.nav-group-items { display: none; margin: 2px 0 6px 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.nav-group-items.open { display: block; }
.nav-group-items .nav-item { font-weight: 450; }
.nav-group-items .nav-icon { width: 22px; height: 22px; font-size: 12px; background: transparent; }
.nav-group-items .nav-item:hover .nav-icon { background: var(--line-2); }
/* nested subgroup (3rd level) — slightly smaller header */
.nav-group-items .nav-group-link { font-weight: 550; font-size: 13px; }

.main { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 13px 28px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 5; }
.ctx-selector { display: flex; align-items: center; gap: 8px; }
.ctx-selector label { font-size: 12px; color: var(--muted); }
.ctx-selector select { background: var(--surface); color: var(--txt); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 7px 11px; }
.ctx-hint { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* theme toggle */
.theme-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 15px; transition: .15s; box-shadow: var(--shadow-sm); }
.theme-btn:hover { color: var(--accent); border-color: #d4dbe6; }
:root[data-theme="dark"] .theme-btn:hover { border-color: #36414f; }
.theme-btn .t-sun { display: none; }
.theme-btn .t-moon { display: inline; }
:root[data-theme="dark"] .theme-btn .t-sun { display: inline; color: var(--warn); }
:root[data-theme="dark"] .theme-btn .t-moon { display: none; }
.login-corner { position: fixed; top: 18px; right: 18px; z-index: 10; }
.who { font-size: 13px; color: var(--muted); }
.role-tag { background: var(--accent-soft); color: var(--accent); padding: 2px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 600; }
.role-tag.user { background: var(--ok-soft); color: var(--ok); }

.flash { background: var(--accent-soft); border-bottom: 1px solid var(--line);
  padding: 9px 28px; color: var(--accent); font-size: 13px; }

.content { padding: 24px 30px 44px; max-width: none; }
.content h1 { margin: 0 0 5px; font-size: 25px; font-weight: 680; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head p { margin: 0; }
.page-head .btn { flex: 0 0 auto; margin-top: 2px; }
/* eyebrow label for grouping sections */
.eyebrow { text-transform: uppercase; font-size: 11px; letter-spacing: .07em; font-weight: 700;
  color: var(--muted); margin: 26px 0 10px; }
.muted { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px,1fr)); gap: 16px; margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--line); }
.card-k { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-v { font-size: 19px; font-weight: 680; margin-top: 4px; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }

/* stat cards with icon chip */
.card.stat { display: flex; align-items: flex-start; gap: 13px; }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.stat-body { min-width: 0; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* progress bars */
.bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px 28px; margin: 4px 0; }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; font-weight: 500; }
.bar { height: 9px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.tone-ok { background: linear-gradient(90deg, var(--accent), #4f86ff); }
.tone-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.tone-danger { background: linear-gradient(90deg, #ef4444, #f87171); }

.note { background: var(--accent-soft); border: 1px solid #dbe6ff; border-radius: var(--radius);
  padding: 15px 17px; color: #33507f; margin-top: 8px; }

/* forms */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin: 0 0 20px; }
.form-title { margin: 0 0 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line-2);
  font-size: 15px; font-weight: 650; }
/* when a title leads straight into tabs, the tabs row is the divider instead */
.form-title:has(+ .tabs) { border-bottom: none; padding-bottom: 0; margin-bottom: 14px; }
.form-sub { margin: 20px 0 6px; font-size: 13px; font-weight: 600; padding-top: 14px; border-top: 1px solid var(--line-2); }
.form-sub .muted { font-weight: 400; font-size: 12px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.form-row:last-of-type { border-bottom: none; }
.form-label > div:first-child { font-weight: 500; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 3px; max-width: 420px; }
.input { background: var(--surface); border: 1px solid var(--line); color: var(--txt);
  border-radius: var(--radius-sm); padding: 9px 12px; outline: none; min-width: 200px; transition: .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.ip-checks { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; }
.ip-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 11px; }
.ip-check input { accent-color: var(--accent); }
.form-actions { margin-top: 18px; }
.form-actions .btn.primary { margin-top: 0; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* primary buttons carry a margin-top (for form submits); never let it misalign a row */
.btn-row .btn, .inline-form .btn, .page-head .btn { margin-top: 0; }
/* toasts */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); color: var(--txt); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 11px 16px; font-size: 13px; font-weight: 500; min-width: 200px;
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.err { border-left-color: var(--danger); }
.code-area { width: 100%; min-height: 280px; resize: vertical; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; white-space: pre; }
/* apache module toggle grid */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 28px; margin: 4px 0; }
.mod-item { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 2px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.mod-info { min-width: 0; }
.mod-name { font-weight: 500; font-size: 13px; }
.mod-item .form-hint { margin-top: 1px; }
.kv { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
/* read-only facts: tidy responsive 2-column grid */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 32px; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13px; }
.fact span { color: var(--muted); }
.fact b { font-weight: 600; text-align: right; word-break: break-word; }

/* grid form + table */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 18px; margin: 8px 0 6px; max-width: 800px; }
.grid-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.grid-form .input { min-width: 0; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.btn.danger:hover { filter: brightness(.95); background: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
/* quiet icon-only action (e.g. view log) — secondary, doesn't compete with buttons */
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); cursor: pointer; transition: .12s; vertical-align: middle; }
.icon-btn:hover { color: var(--accent); background: var(--line-2); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.icon-btn svg { display: block; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 6px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }
.inline-form { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }
.inline-form .rm { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.pill.err { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: #fbe6c8; color: #9a6a06; }
:root[data-theme="dark"] .pill.warn { background: #3a2c0e; color: var(--warn); }
.joblog { background: #0e1219; color: #d7dde8; border-radius: var(--radius); padding: 14px 16px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 360px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 8px 0; border: 1px solid var(--line); }

/* modal (log viewer) */
[x-cloak] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(8,12,20,.55); }
.modal-card { position: relative; z-index: 1; width: min(920px, 100%); max-height: 82vh;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 14px; }
.modal-log { margin: 0; border: 0; border-radius: 0; max-height: none; flex: 1; }

/* radio variant rows (server stack) */
.radio-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin: 10px 0;
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: .12s; }
.radio-row:hover { border-color: #cdd6e4; }
.radio-row.active { border-color: var(--accent); background: var(--accent-soft); }
.radio-row input { margin-top: 3px; accent-color: var(--accent); }
.radio-title { font-weight: 600; }
.pkgs { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: ui-monospace, monospace; }
.uninstall-form { display: inline; margin-left: 8px; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; cursor: pointer; background: var(--line); border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; height: 19px; width: 19px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(19px); }

.placeholder { background: var(--surface); border: 1px dashed #d4dbe6; border-radius: var(--radius);
  padding: 48px; text-align: center; margin-top: 18px; box-shadow: var(--shadow-sm); }
.placeholder-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 26px; }

/* ---- top status bar (server vitals — the cockpit strip) ---- */
.sysbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--sysbar-bg); color: var(--sysbar-txt); padding: 6px 28px;
  font: 12px/1 var(--mono); font-variant-numeric: tabular-nums; }
.sysbar-vitals { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.vital { display: inline-flex; align-items: baseline; gap: 6px; letter-spacing: .02em; }
.vital i { font-style: normal; color: #79859e; text-transform: uppercase; font-size: 10px; letter-spacing: .06em; }
.vital b { color: var(--sysbar-txt); font-weight: 600; }
.vital b.v-warm { color: var(--warn); }
.vital b.v-hot { color: var(--danger); }
.has-pop { position: relative; cursor: default; outline: none; }
.sysbar-pop { position: absolute; top: 100%; left: 0; z-index: 30; display: none;
  background: var(--surface); color: var(--txt); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 7px; margin-top: 6px;
  min-width: 320px; font: 12px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.has-pop:hover .sysbar-pop, .has-pop:focus-within .sysbar-pop { display: block; }
.dl-head { font-family: inherit; text-transform: uppercase; font-size: 10px; letter-spacing: .06em;
  color: var(--muted); padding: 3px 8px 6px; }
.dl-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; align-items: baseline;
  padding: 5px 8px; border-radius: 6px; white-space: nowrap; }
.dl-row:hover { background: var(--line-2); }
.dl-dev { color: var(--txt); font-weight: 600; }
.dl-mt { color: var(--muted); }
.dl-sz { color: var(--txt); text-align: right; }
.dl-pc { color: var(--muted); text-align: right; min-width: 34px; }
.dl-pc.v-warm { color: var(--warn); }
.dl-pc.v-hot { color: var(--danger); }
.sysbar-clock { display: inline-flex; align-items: center; gap: 8px; color: var(--sysbar-txt); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3a4761; display: inline-block; flex: 0 0 auto; }
.dot.live { background: var(--ok); animation: sb-pulse 2.4s infinite; }
@keyframes sb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  70% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

/* ---- tabs (split big editors: plans, settings) ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 0; overflow-x: auto; }
.tab { padding: 10px 15px; font-size: 13px; font-weight: 550; color: var(--muted);
  border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--txt); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding-top: 20px; }
.tab-panel.active { display: block; }

/* ---- elevation + color life (de-bleach) ---- */
.card, .form-card { border-color: var(--line); }
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .form-card { box-shadow: inset 0 1px 0 rgba(255,255,255,.045), var(--shadow-sm); }
.cards .card:nth-child(4n+1) .stat-icon { background: #e8f0ff; color: #2563eb; }
.cards .card:nth-child(4n+2) .stat-icon { background: #e6f8f0; color: #0ea871; }
.cards .card:nth-child(4n+3) .stat-icon { background: #f2ecfe; color: #7c3aed; }
.cards .card:nth-child(4n+4) .stat-icon { background: #fff0e3; color: #ea8a08; }
:root[data-theme="dark"] .cards .card:nth-child(4n+1) .stat-icon { background: #16284a; color: #7aa2ff; }
:root[data-theme="dark"] .cards .card:nth-child(4n+2) .stat-icon { background: #103127; color: #34d399; }
:root[data-theme="dark"] .cards .card:nth-child(4n+3) .stat-icon { background: #261a44; color: #b794ff; }
:root[data-theme="dark"] .cards .card:nth-child(4n+4) .stat-icon { background: #34230f; color: #fbbf24; }

/* Apache per-module panes */
.pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 2px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.pane-off { opacity: .5; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 2px; border-bottom: 1px solid var(--line-2); }
.rule-row .mod-name { font-weight: 500; font-size: 13px; }

/* Sites */
.mono { font-family: var(--mono); }
.site-head { display: flex; align-items: center; gap: 12px; }
.site-head .back { color: var(--muted); }

/* Site file manager */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 13px; }
.crumbs a { color: var(--accent); cursor: pointer; }
.fm-name a { cursor: pointer; }
/* canonical padded, scrollable modal body — holds forms/textareas consistently */
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
/* any code editor inside a modal fills the width (no more cols-based shrink) */
.modal-card .code-area { width: 100%; margin: 0; box-sizing: border-box; }
/* a form-actions row that is a DIRECT child of the card is the modal footer: it
   must carry the card's horizontal padding so buttons never touch the edge */
.modal-card > .form-actions { margin: 0; padding: 14px 18px; border-top: 1px solid var(--border); }
/* modal size variants (snapped to a small scale; default card is min(920px,100%)).
   Declared after .modal-card so source order wins when both classes are present. */
.size-sm { width: min(460px, 94%); }
.size-md { width: min(560px, 96%); }
.size-lg { width: min(700px, 96%); }
.size-xl { width: min(860px, 97%); }

/* Visual file manager (Explorer-like) */
.fm-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.fm-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; font-size: 13px; margin-bottom: 12px; }
.fm-path a { color: var(--accent); cursor: pointer; }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 4px; }
.fm-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 6px;
  border-radius: 10px; cursor: pointer; user-select: none; border: 1px solid transparent; text-align: center; transition: .1s; }
.fm-item:hover { background: var(--accent-soft); }
.fm-item.sel { background: var(--accent-soft); border-color: var(--accent); }
.fm-ic { font-size: 42px; line-height: 1; }
.fm-label { font-size: 12px; word-break: break-word; max-width: 100%; }
.fm-empty { padding: 44px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.ctx-menu { position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 176px; }
.ctx-menu button { display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 7px 12px; border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.ctx-menu button:hover { background: var(--accent-soft); }
.ctx-menu button.danger-text { color: var(--danger); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* File manager — view toggle + drag & drop states */
.fm-viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.fm-viewtoggle button { border: 0; background: var(--surface); padding: 5px 11px; cursor: pointer; font-size: 15px; color: var(--muted); }
.fm-viewtoggle button.active { background: var(--accent-soft); color: var(--accent); }
.fm-stage { position: relative; min-height: 120px; }
.fm-grid.dragover, .fm-empty.dragover, .fm-list.dragover { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); border-radius: 12px; }
.fm-item.dropok, .fm-list tr.dropok > td { background: var(--accent-soft); }
.fm-item.dropok { outline: 2px solid var(--accent); }
.fm-item[draggable="true"], .fm-list tr[draggable="true"] { -webkit-user-drag: element; }
.fm-list tr { cursor: pointer; user-select: none; }
.fm-list tr.sel > td { background: var(--accent-soft); }
.fm-list th { cursor: pointer; user-select: none; white-space: nowrap; }
.fm-path a.dropok { background: var(--accent); color: #fff; border-radius: 4px; padding: 0 5px; }

/* DB permissions */
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.chk input { accent-color: var(--accent); }
.priv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; margin: 4px 0 8px; }

/* Theme-aware warning / callout card */
.warn-card { background: #fdf1da; border-color: #eec585; color: #7a5206; box-shadow: none; }
.warn-card b { color: #6e4a05; }
.warn-card .form-hint, .warn-card .muted { color: #7a5206; opacity: .85; }
.warn-card a { color: #875806; text-decoration: underline; }
:root[data-theme="dark"] .warn-card { background: #332710; border-color: #6e5417; color: #f1c684; }
:root[data-theme="dark"] .warn-card b { color: #ffd590; }
:root[data-theme="dark"] .warn-card .form-hint, :root[data-theme="dark"] .warn-card .muted { color: #e7bd78; }
:root[data-theme="dark"] .warn-card a { color: #ffda93; }

/* Prefixed input (user_ + name) */
.prefixed { display: flex; align-items: stretch; }
.prefixed .pfx { display: flex; align-items: center; padding: 0 11px; background: var(--accent-soft);
  border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; font-family: var(--mono);
  font-size: 13px; color: var(--muted); white-space: nowrap; }
.prefixed .input { border-top-left-radius: 0; border-bottom-left-radius: 0; min-width: 0; }

/* ---- form polish: label spacing + dark-friendly checkboxes ---- */
label > .input, label > select.input, label > textarea.input { display: block; width: 100%; margin-top: 6px; }
label > .prefixed { margin-top: 6px; }
/* Bottom-align inputs in a grid row so varying hint lengths don't make fields drift. */
.grid-form label > .input, .grid-form label > select.input, .grid-form label > .prefixed { margin-top: auto; }
.prefixed > .input { margin-top: 0; }
.field { display: block; margin-bottom: 14px; font-size: 12px; font-weight: 500; color: var(--muted); }

.chk input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; margin: 0; flex: 0 0 auto;
  width: 16px; height: 16px; border: 1.5px solid var(--line); border-radius: 4px;
  background: var(--surface); cursor: pointer; position: relative; transition: border-color .12s, background .12s; }
.chk input[type="checkbox"]:hover { border-color: var(--accent); }
.chk input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.chk input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.chk input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

/* ===== SQL UI ===== */
.sql-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 13px; cursor: pointer; color: var(--muted); font: inherit; }
.seg button.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.sql-body { display: grid; grid-template-columns: 230px 1fr; gap: 14px; align-items: start; }
.sql-side { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; position: sticky; top: 12px; max-height: 82vh; overflow: auto; }
.sql-side-head { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.sql-tables { list-style: none; margin: 0; padding: 0; }
.sql-tables li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sql-tables li:hover { background: var(--accent-soft); }
.sql-tables li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sql-main { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sql-grid-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; max-width: 100%; }
.sql-grid { margin: 0; font-size: 13px; white-space: nowrap; }
.sql-grid th { cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.nullc { color: var(--muted); font-style: italic; opacity: .7; }
.rowact { white-space: nowrap; }
.rowact button { background: none; border: 0; cursor: pointer; padding: 2px 5px; font-size: 14px; opacity: .65; }
.rowact button:hover { opacity: 1; }
.sql-msg { padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-size: 13px; }
.sql-msg.err { background: var(--danger-soft); color: var(--danger); }
.sql-msg.ok { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 760px){ .sql-body { grid-template-columns: 1fr; } .sql-side { position: static; max-height: none; } }

/* SQL UI — tree + builders */
.sql-tree { list-style: none; margin: 0; padding: 0; }
.sql-tree .dbrow { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; border: 1px solid transparent; transition: background .12s, border-color .12s; }
.sql-tree .dbrow:hover { background: var(--surface-2); border-color: var(--line); }
.sql-tree .dbrow.active { color: var(--accent); background: var(--accent-soft); }
.sql-tree .twist { width: 11px; font-size: 11px; color: var(--accent); transition: transform .15s; flex: 0 0 auto; }
.sql-tree .dbrow.open .twist { transform: rotate(90deg); }
.db-ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; opacity: .82; flex: 0 0 auto; }
.dbcount { font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 1px 7px; font-family: var(--mono); }
.sql-tree .tbls { list-style: none; margin: 1px 0 4px 16px; padding: 0; border-left: 1px solid var(--line); }
.sql-tree .tbls li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-radius: 5px; cursor: pointer; font-size: 12.5px; }
.sql-tree .tbls li:hover { background: var(--accent-soft); }
.sql-tree .tbls li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.colrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.colrow .input, .colrow select.input { margin-top: 0; }
.sel-bar { display: flex; gap: 8px; align-items: center; background: var(--accent-soft); padding: 6px 10px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }

.rowact button { color: var(--txt); opacity: .75; }
.rowact button:hover { opacity: 1; color: var(--accent); }

/* ===== SQL desktop grid ===== */
.sgrid { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.sgrid-bar { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.sgrid-scroll { overflow: auto; height: 62vh; position: relative; outline: none; }
.sgrid-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-ring); }
.sgrid-inner { position: relative; }
.sgrid-head { position: sticky; top: 0; z-index: 4; display: flex; height: 36px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sgrid-hcell { position: relative; flex: 0 0 auto; padding: 9px 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; box-sizing: border-box; }
.sgrid-hcell.sticky { position: sticky; left: 0; z-index: 5; background: var(--surface); text-align: center; }
.sgrid-htext { cursor: pointer; }
.sgrid-htext:hover { color: var(--accent); }
.sgrid-resize { position: absolute; right: -3px; top: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 6; }
.sgrid-resize:hover { background: var(--accent); opacity: .4; }
.sgrid-rows { position: absolute; left: 0; top: 0; will-change: transform; }
.sgrid-row { display: flex; height: 30px; }
.sgrid-row:hover .sgrid-cell { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.sgrid-cell { user-select: none; flex: 0 0 auto; padding: 6px 8px; font-size: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; cursor: cell; background: var(--surface); }
.sgrid-cell.sticky { position: sticky; left: 0; z-index: 2; text-align: center; color: var(--muted); cursor: default; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.sgrid-cell.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.sgrid-cell.dirty { background: color-mix(in srgb, #f5c842 22%, var(--surface)); }
.sgrid-cell.loading { color: var(--muted); opacity: .5; }
.sgrid-cell .nullc { color: var(--muted); font-style: italic; opacity: .65; }
.sgrid-cell.gutter .gnum { flex: 1; text-align: left; font-size: 11px; }
.sgrid-cell.gutter .gacts { display: none; gap: 1px; }
.sgrid-row:hover .gutter .gacts { display: inline-flex; }
.sgrid-row:hover .gutter .gnum { display: none; }
.gact { background: none; border: 0; cursor: pointer; padding: 0 3px; font-size: 13px; color: var(--txt); opacity: .7; }
.gact:hover { opacity: 1; color: var(--accent); }
.sgrid-edit { position: absolute; z-index: 10; box-sizing: border-box; border: 2px solid var(--accent); border-radius: 0; padding: 5px 7px; font-size: 13px; font-family: inherit; background: var(--surface); color: var(--txt); outline: none; }

/* SQL autocomplete popup */
.sql-ac { position: absolute; z-index: 1000; min-width: 160px; max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 13px; padding: 4px; }
.sql-ac-item { padding: 5px 9px; border-radius: 5px; cursor: pointer; font-family: var(--mono, monospace); }
.sql-ac-item.on, .sql-ac-item:hover { background: var(--accent-soft); color: var(--accent); }

/* ===== Fairlead branding ===== */
.brand-plate { display: inline-flex; align-items: center; }
.login-logo { max-width: 248px; width: 100%; height: auto; display: block; }
/* On dark themes the navy wordmark needs a light plate to stay legible */
:root[data-theme="dark"] .brand-plate { background: #eef3f8; border-radius: 11px; padding: 7px 12px; box-shadow: var(--shadow-sm); }
.login-brand { justify-content: center; }

/* toolbar field: single-row label+control that lines up with buttons */
.tb-field { display: inline-flex; align-items: center; gap: 7px; }
.tb-lab { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
/* the one canonical filter/selector bar (account picker + search), used everywhere */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-bar .tb-field .input { min-width: 180px; }

/* ============================================================
   FAIRLEAD design layer — helm console identity
   ============================================================ */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background-image: radial-gradient(820px 440px at 106% -12%, var(--accent-soft), transparent 60%);
  background-attachment: fixed;
}
h1, h2, .form-title, .page-head h1, .eyebrow, .brand-word, .modal-head b, .login-word {
  font-family: var(--display);
}
.content h1 { font-weight: 600; letter-spacing: -.022em; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 600; color: var(--accent); }

/* nicer scrollbars (instrument feel) */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 7px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ---- sidebar = hull ---- */
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 13px; }
:root[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #0f2740, var(--surface) 42%); }
.brand { gap: 11px; padding: 2px 8px 22px; align-items: center; }
.fl-mark { display: block; }
.brand-icon { width: 32px; height: 32px; flex: 0 0 auto; color: var(--txt); }
.brand-word { font-weight: 600; font-size: 19px; line-height: 1; letter-spacing: -.01em; color: var(--txt); }
.brand-word .sub { color: var(--accent); font-weight: 500; }

.nav-item { border-radius: 9px; gap: 11px; padding: 9px 11px; font-weight: 500; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.nav-icon { background: var(--surface-2); border-radius: 8px; }
.nav-item:hover .nav-icon { color: var(--accent); }
.nav-item.active .nav-icon { background: var(--accent); color: var(--surface); box-shadow: 0 0 14px -3px var(--accent); }
.nav-group-link { font-family: inherit; text-transform: none; letter-spacing: normal; font-size: 14px; font-weight: 600; color: var(--txt); }
.nav-group-items .nav-group-link { font-size: 13px; font-weight: 550; }
.nav-group-items { border-left: 1px solid var(--line); }
.nav-group-head.active .nav-icon { background: var(--accent); color: var(--surface); }

/* ---- topbar ---- */
.topbar { padding: 12px 28px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.role-tag { font-family: var(--mono); letter-spacing: .03em; }

/* ---- cards = hull panels with a struck top edge ---- */
.form-card, .card { border-radius: 14px; box-shadow: var(--shadow-sm), inset 0 1px 0 color-mix(in srgb, var(--accent) 13%, transparent); }
:root[data-theme="dark"] .form-card { box-shadow: var(--shadow-sm), inset 0 1px 0 color-mix(in srgb, var(--accent) 18%, transparent); }
.form-title { font-weight: 600; letter-spacing: -.01em; }

/* ---- buttons: one consistent interaction model (lift + shadow + colour shift) ---- */
.btn { border-radius: 9px; font-weight: 500;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease; }
.btn:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 7px 18px -7px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 11px 26px -8px var(--accent); }
.btn.primary:active { transform: translateY(0); box-shadow: 0 4px 12px -6px var(--accent); }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .btn.primary:hover { color: #052019; }

.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: 0 6px 16px -8px var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: #ffcdcd; color: #fff; filter: brightness(.94); transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 11px 24px -8px var(--danger); }
.btn.danger:active { transform: translateY(0); filter: brightness(.88); box-shadow: 0 4px 10px -6px var(--danger); }
.btn.ghost { box-shadow: none; }
.btn.ghost:hover { transform: none; box-shadow: none; background: var(--surface-2); }

/* ---- inputs: teal focus ---- */
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); outline: none; }

/* ---- tables = instrument readout ---- */
.tbl thead th { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.tbl tbody tr:hover > td { background: var(--accent-soft); }
.pill { font-family: var(--mono); font-size: 11px; letter-spacing: .02em; }
.pill.on, .pill.connected { background: var(--accent-soft); color: var(--accent); }

/* ---- tabs / segments ---- */
.tab.active, .tabs .active { color: var(--accent); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }

/* ============ LOGIN — the helm at night ============ */
.login-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 700px at 50% -20%, #114054 0%, #0a2740 32%, #06182a 100%);
  color: #e6f1f8;
}
.login-aura {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(620px 320px at 50% 14%, rgba(34,206,191,.18), transparent 70%);
  animation: auraDrift 9s ease-in-out infinite alternate;
}
@keyframes auraDrift { from { transform: translateY(-8px) scale(1); } to { transform: translateY(12px) scale(1.06); } }
.login-card {
  position: relative; width: 384px; max-width: 92vw; padding: 34px 32px 30px; border-radius: 20px;
  background: rgba(13,33,55,.74); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 34px 90px -24px rgba(2,12,22,.85), inset 0 1px 0 rgba(255,255,255,.10);
  display: flex; flex-direction: column; gap: 9px;
}
.login-mark { width: 104px; margin: 2px auto 12px; filter: drop-shadow(0 8px 18px rgba(2,12,22,.55)); }
.login-mark .fl-mark { width: 100%; height: auto; color: #e9f1f6; }
.login-mark .fl-cable { stroke-dasharray: 62; stroke-dashoffset: 62; animation: cableDraw 1.5s .3s cubic-bezier(.55,0,.2,1) forwards; }
@keyframes cableDraw { to { stroke-dashoffset: 0; } }
.login-word { font-weight: 600; font-size: 27px; letter-spacing: -.015em; text-align: center; color: #eaf3f8; }
.login-word span { color: var(--accent); }
.login-sub { color: #9fbace; margin: 0 0 16px; text-align: center; font-size: 13px; }
.login-card label { font-size: 12px; color: #9fbace; margin-top: 8px; font-weight: 500; font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.login-card input {
  background: rgba(5,18,30,.55); border: 1px solid rgba(255,255,255,.12); color: #eaf3f8;
  border-radius: 10px; padding: 12px 14px; outline: none; transition: .15s; font-size: 14px;
}
.login-card input::placeholder { color: #5f7d93; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,206,191,.28); background: rgba(5,18,30,.8); }
.login-card .btn.primary { margin-top: 20px; color: #052019; box-shadow: 0 10px 28px -8px rgba(34,206,191,.7); }
.login-error { background: rgba(255,107,107,.14); color: #ff9d9d; border: 1px solid rgba(255,107,107,.4); padding: 9px 12px; border-radius: 10px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) {
  .login-aura { animation: none; }
  .login-mark .fl-cable { animation: none; stroke-dashoffset: 0; }
}

/* ===== Fairlead full logo (lockup), theme-swapped ===== */
.brand { padding: 6px 6px 20px; align-items: center; }
.brand-logo { width: 198px; max-width: 100%; max-height: none; height: auto; display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.login-logo { width: 300px; max-width: 86%; height: auto; display: block; margin: 2px auto 16px; animation: loIn .7s cubic-bezier(.2,.7,.2,1) both; }
.login-sub { animation: loIn .7s .09s cubic-bezier(.2,.7,.2,1) both; }
.login-card { animation: cardIn .55s cubic-bezier(.2,.7,.2,1) both; }
@keyframes loIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce){ .login-logo, .login-sub, .login-card { animation: none; } }

/* ===== login polish pass ===== */
.login-wrap { background: radial-gradient(1300px 720px at 50% -22%, #164a60 0%, #0b2a44 30%, #05162a 78%); }
.login-aura { background: radial-gradient(700px 360px at 50% 10%, rgba(34,206,191,.20), transparent 72%); }
.login-card { width: 392px; padding: 36px 34px 30px; border-radius: 22px; background: rgba(13,34,56,.82);
  border: 1px solid rgba(132,172,202,.18); box-shadow: 0 46px 110px -34px rgba(1,9,18,.92), inset 0 1px 0 rgba(255,255,255,.09); }
.login-logo { width: 322px; }
.login-sub { color: #93b1c6; margin: 0 0 20px; letter-spacing: .01em; }
.login-card label { color: #9cbace; letter-spacing: .06em; }
.login-card input { background: rgba(255,255,255,.045); border: 1px solid rgba(152,184,208,.24); }
.login-card input:focus { background: rgba(255,255,255,.08); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34,206,191,.3); }
.login-card .btn.primary { margin-top: 22px; padding: 12px; font-weight: 600; }

/* ===== login — light theme (the dark styles above are var-free, so light needs
   explicit overrides; otherwise the theme toggle does nothing on /login) ===== */
:root[data-theme="light"] .login-wrap { background: radial-gradient(1300px 720px at 50% -22%, #d6e8f0 0%, #e9f1f5 38%, #e7eef2 80%); color: var(--txt); }
:root[data-theme="light"] .login-aura { background: radial-gradient(700px 360px at 50% 10%, rgba(12,154,160,.16), transparent 72%); }
:root[data-theme="light"] .login-card { background: rgba(255,255,255,.92); border-color: var(--line);
  box-shadow: 0 30px 70px -28px rgba(10,34,54,.28), inset 0 1px 0 rgba(255,255,255,.7); }
:root[data-theme="light"] .login-word { color: var(--txt); }
:root[data-theme="light"] .login-sub { color: var(--muted); }
:root[data-theme="light"] .login-card label { color: var(--muted); }
:root[data-theme="light"] .login-card input { background: #fff; border-color: var(--line); color: var(--txt); }
:root[data-theme="light"] .login-card input::placeholder { color: #98aebd; }
:root[data-theme="light"] .login-card input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
:root[data-theme="light"] .login-card .btn.primary { color: #fff; }
:root[data-theme="light"] .login-error { background: var(--danger-soft); color: var(--danger); border-color: #f7caca; }

/* login logo: theme-swapped (two-class selectors beat plain .login-logo) */
.login-logo.logo-dark { display: none; }
:root[data-theme="dark"] .login-logo.logo-light { display: none; }
:root[data-theme="dark"] .login-logo.logo-dark { display: block; }

/* section divider inside a card (e.g. Apache handlers: CGI vs ITK) */
.pane-div { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.grid-form label.span-2 { grid-column: 1 / -1; }

/* reveal: distinct, clearly-clickable collapsible sections */
.reveal { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: var(--surface); overflow: hidden; }
.reveal > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; font-size: 13px; color: var(--txt);
  list-style: none; display: flex; align-items: center; gap: 9px; user-select: none; transition: background .12s; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal > summary::before { content: "▸"; color: var(--accent); font-size: 11px; transition: transform .15s; }
.reveal[open] > summary::before { transform: rotate(90deg); }
.reveal > summary:hover { background: var(--surface-2); }
.reveal[open] > summary { border-bottom: 1px solid var(--line); }
.reveal > form, .reveal > .reveal-body { padding: 14px; }

/* SQL UI boot loader (avoids flashing the default view on refresh) */
.sql-booting { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px; color: var(--muted); font-size: 14px; }
.sql-booting .spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== file manager: Explorer-style directory tree ===== */
.fm-layout { display: grid; grid-template-columns: 234px 1fr; gap: 14px; align-items: start; }
.fm-tree { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px; max-height: 64vh; overflow: auto; }
.fm-tnode { display: flex; align-items: center; gap: 5px; padding: 5px 6px; border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap; color: var(--txt); }
.fm-tnode:hover { background: var(--surface); }
.fm-tnode.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.fm-tnode.dropok { outline: 2px dashed var(--accent); outline-offset: -2px; }
.fm-twist { width: 12px; font-size: 10px; color: var(--accent); transition: transform .12s; flex: 0 0 auto; text-align: center; }
.fm-twist.open { transform: rotate(90deg); }
.fm-tfo { font-size: 13px; flex: 0 0 auto; }
.fm-tname { overflow: hidden; text-overflow: ellipsis; }
.fm-right { min-width: 0; }
@media (max-width: 860px){ .fm-layout { grid-template-columns: 1fr; } .fm-tree { max-height: 200px; } }

/* simple readable bulleted list for descriptive copy */
.plain-list { margin: 6px 0 0; padding-left: 18px; color: var(--txt-2); line-height: 1.7; max-width: 760px; }
.plain-list li { margin: 2px 0; }
.plain-list b { color: var(--txt); }

/* checkbox rows (e.g. DNS listen IPs) */
.check-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; font-size: 14px; }
.check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* inset sub-card for a grouped form within a card (e.g. DNS remote switch) */
.subcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--surface-2); max-width: 820px; }

/* DNS zone record editor (WYSIWYG) */
.input.sm { padding: 6px 9px; font-size: 13px; width: 100%; }
.rec-edit td { padding: 5px 8px; vertical-align: middle; }
.rec-edit th { padding: 6px 8px; }
.rec-name { display: flex; align-items: center; gap: 2px; min-width: 0; }
.rec-name .input { flex: 1 1 auto; min-width: 60px; }
.rec-suffix { color: var(--muted); font-size: 12px; white-space: nowrap; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }

/* user editor — plan overrides table */
.ov-table th, .ov-table td { padding: 7px 10px; vertical-align: middle; }
.ov-table .ov-sec td { padding-top: 16px; border-bottom: 1px solid var(--line); }
.ov-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.ov-table .input.sm { max-width: 140px; padding: 5px 8px; }
.ov-table th:last-child, .ov-table td:last-child { text-align: right; }
.ov-table td:first-child { text-align: center; }
.ip-pick { display:inline-flex; align-items:center; gap:5px; margin:0 14px 4px 0; font-size:13px; white-space:nowrap; }
.ip-pick input[type=checkbox] { width:15px; height:15px; }
.ta-center { text-align: center; }

/* ============================================================================
   Utility layer — moved out of per-page inline styles (smaller HTML, cached CSS,
   one source of truth for spacing). Spacing is snapped to a small scale.
   ============================================================================ */
.mt-0{margin-top:0}.mt-2{margin-top:2px}.mt-4{margin-top:4px}.mt-6{margin-top:6px}
.mt-8{margin-top:8px}.mt-10{margin-top:10px}.mt-12{margin-top:12px}.mt-14{margin-top:14px}
.mt-16{margin-top:16px}.mt-18{margin-top:18px}
.mb-0{margin-bottom:0}.mb-4{margin-bottom:4px}.mb-6{margin-bottom:6px}.mb-8{margin-bottom:8px}
.mb-10{margin-bottom:10px}.mb-12{margin-bottom:12px}.mb-14{margin-bottom:14px}.mb-16{margin-bottom:16px}
.m-0{margin:0}
.w-full{width:100%}
.flex-1{flex:1}
.spacer{flex:1 1 auto}
.d-block{display:block}
.d-inline{display:inline}
.fs-12{font-size:12px}
.mw-240{min-width:240px}
.nowrap{white-space:nowrap}
/* a form-hint that leads a section (sits just under a title/eyebrow) */
.lead-hint{margin:2px 0 12px}
/* a centered, readable-width content column */
.narrow{max-width:680px;margin:0}
.no-underline{text-decoration:none}
.cursor-default{cursor:default}
.fs-11{font-size:11px}
.fw-400{font-weight:400}
.text-danger{color:var(--danger)}
.mw-0{min-width:0}
.tight-hint{margin:-4px 0 10px}
.float-action{float:right;cursor:pointer}
