/* Layout modeled on network-monitoring consoles (module menu bar, summary page of resource panels).
   Colors: Velora palette - neutral charcoal (never navy), Velora orange accent, no blue/yellow UI states. */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --chrome: #161616;          /* top bar + menu bar: always dark */
  --chrome-2: #1f1f1f;
  --chrome-border: #2c2c2c;
  --surface-0: #101010;       /* page */
  --surface-1: #181818;       /* panels */
  --surface-2: #202020;       /* panel headers, inputs */
  --surface-3: #2a2a2a;
  --hover: #242424;
  --border: #2e2e2e;
  --border-strong: #444;
  --text: #ececec;
  --text-muted: #b0b0b0;
  --text-dim: #8a8a8a;
  --primary: #f7941d;
  --primary-hover: #fbb040;
  --primary-active: #e8650a;
  --accent-soft: rgba(247, 148, 29, .12);
  --up: #3fbf7f;              /* status: up / ok */
  --warn: #f7941d;            /* status: warning (orange, not amber) */
  --down: #e5484d;            /* status: down / critical */
  --unknown: #7a7a7a;         /* status: unknown / info (grey, not blue) */
  --radius: 6px;
  --t: 120ms cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--surface-0); color: var(--text); font: 13px/1.4 var(--font-ui); font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; }
* { scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 8px; }
a { color: var(--primary-hover); text-decoration: none; } a:hover { color: var(--primary); text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--text-muted); } .dim { color: var(--text-dim); } .small { font-size: 12px; }
.mono, code, td.num, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
svg.lucide { width: 15px; height: 15px; stroke-width: 2; flex: none; }

/* ---------- top chrome ---------- */
.topbar { background: var(--chrome); border-bottom: 1px solid var(--chrome-border); height: 48px; display: flex; align-items: center; padding: 0 18px; gap: 16px; position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; color: #fff; }
.mark { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: linear-gradient(135deg, #fbb040 0%, #f7941d 45%, #e8650a 100%); color: #1a1a1a; flex: none; }
.mark svg.lucide { width: 16px; height: 16px; stroke-width: 2.4; }
.brand .sub { font-weight: 400; color: var(--text-dim); font-size: 12px; margin-left: 2px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--text-muted); font-size: 12px; }
.topbar .right a, .topbar .right button { color: var(--text-muted); }
.topbar .user { display: flex; align-items: center; gap: 6px; }
.menubar { background: var(--chrome-2); border-bottom: 1px solid var(--chrome-border); display: flex; padding: 0 12px; overflow-x: auto; position: sticky; top: 48px; z-index: 29; }
.menubar a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.menubar a:hover { color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .03); }
.menubar a.on { color: #fff; border-bottom-color: var(--primary); }
.menubar a.on svg { color: var(--primary); }

main { padding: 16px 20px 50px; max-width: 1500px; margin: 0 auto; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.pagehead .tools { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-dim); }
.pagehead .tools a { display: inline-flex; align-items: center; gap: 5px; }
.crumb { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }

/* notification strip */
.notice { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border: 1px solid rgba(247, 148, 29, .35); color: #f6c590; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: 12.5px; }
.notice svg { color: var(--primary); }
.notice.ok { background: rgba(63, 191, 127, .08); border-color: rgba(63, 191, 127, .3); color: #9fdcbd; } .notice.ok svg { color: var(--up); }
.notice.bad { background: rgba(229, 72, 77, .08); border-color: rgba(229, 72, 77, .35); color: #f2a6a8; } .notice.bad svg { color: var(--down); }

/* ---------- resource panels ---------- */
.cols { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.span2 { grid-column: span 2; } .spanall { grid-column: 1 / -1; }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; margin-bottom: 14px; }
.cols .panel, .col .panel { margin-bottom: 0; }
.panel > .ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.ph .t { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text); display: flex; align-items: center; gap: 7px; }
.ph .t svg { color: var(--primary); }
.ph .sub { font-size: 11px; color: var(--text-dim); font-weight: 400; text-transform: none; letter-spacing: 0; }
.ph .acts { display: flex; gap: 4px; }
.ph .acts button, .ph .acts a { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 4px; background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }
.ph .acts button:hover, .ph .acts a:hover { color: #fff; border-color: #666; text-decoration: none; }
.panel > .pb { padding: 12px; }
.panel > .pb.flush { padding: 0; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; border-left: 3px solid var(--unknown); }
.tile b { display: block; font: 600 26px/1.15 var(--font-mono); font-variant-numeric: tabular-nums; }
.tile span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.tile.up { border-left-color: var(--up); } .tile.warn { border-left-color: var(--warn); } .tile.down { border-left-color: var(--down); } .tile.brand { border-left-color: var(--primary); }

/* donut widget */
.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut svg { flex: none; }
.legend { display: grid; gap: 6px; font-size: 12.5px; min-width: 150px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend .n { font-family: var(--font-mono); margin-left: auto; padding-left: 14px; color: var(--text); }
.sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }

/* bars widget */
.bars { display: grid; gap: 8px; }
.bars .bar { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; font-size: 12px; }
.bars .bar b { font-family: var(--font-mono); font-weight: 500; text-align: right; }
.bars .track { height: 9px; background: var(--surface-3); border-radius: 2px; overflow: hidden; position: relative; }
.bars .track > i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.bars .lbl { grid-column: 2; color: var(--text-muted); margin-top: -6px; }

/* status indicators */
.st { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; flex: none; }
.st.up { background: var(--up); } .st.warn { background: var(--warn); } .st.down { background: var(--down); } .st.unknown { background: var(--unknown); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* tree */
.tree { list-style: none; margin: 0; padding: 0; }
.tree li { padding: 3px 0; }
.tree details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 4px 4px; border-radius: 4px; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary:hover { background: var(--hover); }
.tree details > summary::before { content: '+'; width: 13px; height: 13px; border: 1px solid var(--border-strong); border-radius: 2px; font: 600 10px/11px var(--font-mono); text-align: center; color: var(--text-muted); }
.tree details[open] > summary::before { content: '-'; }
.tree ul { list-style: none; margin: 0 0 0 22px; padding: 0; }
.tree .leaf { display: flex; align-items: center; gap: 7px; padding: 3px 4px; }
.tree .cnt { margin-left: auto; font-family: var(--font-mono); color: var(--text-dim); font-size: 11.5px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-1); position: sticky; top: 0; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .012); }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--hover); }
td b { font-weight: 600; }
.scroll { max-height: 420px; overflow: auto; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid; text-transform: capitalize; }
.b-critical { background: rgba(229, 72, 77, .12); color: #ff8a8e; border-color: rgba(229, 72, 77, .4); }
.b-high { background: rgba(232, 101, 10, .14); color: #ff9a55; border-color: rgba(232, 101, 10, .45); }
.b-medium { background: rgba(247, 148, 29, .1); color: #fbb040; border-color: rgba(247, 148, 29, .35); }
.b-low, .b-ok { background: rgba(63, 191, 127, .1); color: #7fdcac; border-color: rgba(63, 191, 127, .35); }
.b-info, .b-na, .b-off { background: rgba(255, 255, 255, .05); color: var(--text-muted); border-color: var(--border-strong); }

/* controls */
button, .btn { font: 500 12.5px var(--font-ui); color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background var(--t), border-color var(--t); }
button:hover, .btn:hover { background: var(--surface-3); border-color: #5a5a5a; text-decoration: none; color: var(--text); }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #1a1a1a; font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #1a1a1a; }
button.danger { color: #ff8a8e; border-color: rgba(229, 72, 77, .45); background: transparent; }
button.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .btn:focus-visible, input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-hover); outline-offset: 1px; }
input, select, textarea { font: 13px var(--font-ui); color: var(--text); background: var(--surface-0); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 9px; width: 100%; }
textarea { resize: vertical; min-height: 32px; }
label { display: block; font-size: 11.5px; color: var(--text-dim); margin: 0 0 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 13px; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: #fff; border-bottom-color: var(--primary); }

.cmd { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.cmd code { flex: 1; background: var(--surface-0); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; overflow-x: auto; white-space: nowrap; color: var(--primary-hover); }

.q { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
.q:last-child { border-bottom: 0; }
.q .cite { font: 11px var(--font-mono); color: var(--text-dim); margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; margin-bottom: 6px; }
.seg button { border: 0; border-radius: 0; padding: 4px 11px; background: transparent; color: var(--text-muted); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on.yes { background: rgba(63, 191, 127, .18); color: #7fdcac; } .seg button.on.partial { background: rgba(247, 148, 29, .16); color: #fbb040; }
.seg button.on.no { background: rgba(229, 72, 77, .18); color: #ff8a8e; } .seg button.on.na { background: rgba(255, 255, 255, .08); color: var(--text); }
.progress { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(60% 50% at 50% 0%, rgba(247, 148, 29, .07), transparent 70%), var(--surface-0); }
.login .panel { width: 100%; max-width: 360px; }
.login .brand { justify-content: center; font-size: 17px; margin-bottom: 4px; }
.login .mark { width: 34px; height: 34px; } .login .mark svg.lucide { width: 20px; height: 20px; }
.err { color: #ff8a8e; font-size: 12.5px; min-height: 18px; }
.empty { text-align: center; color: var(--text-dim); padding: 26px 10px; }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 9px 14px; z-index: 70; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.risk-edit input, .risk-edit select { padding: 3px 6px; font-size: 12.5px; }
input.num { width: 54px; }

@media (max-width: 1000px) { .cols, .cols.c3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } .q { grid-template-columns: 1fr; } }
@media (max-width: 640px) { main { padding: 12px 16px 40px; } .topbar .brand .sub, .topbar .user span { display: none; } .grid2 { grid-template-columns: 1fr; } }
