:root {
  --bg: #eef1f5;
  --bg-soft: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f2f4f7;
  --line: #d5dbe3;
  --line-soft: #e6ebf1;
  --text: #1a2332;
  --muted: #5c6b7e;
  --muted-2: #6d7c90;
  --accent: #1e4b7a;
  --accent-ink: #ffffff;
  --accent-soft: #e7eef6;
  --ok: #0e7a45;
  --warn: #8a5a00;
  --danger: #b42318;
  --l0: #0e7a45;
  --l1: #8a5a00;
  --l2: #b45309;
  --l3: #075985;
  --l35: #9d174d;
  --l4: #3730a3;
  --l5: #5b21b6;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --control: 36px;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* one focus token for every control, row and chip — keyboard users get the same
   "where am I" signal that hover already gives the mouse */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* rows sit flush against table borders, so their ring goes inside */
tbody tr:focus-visible { outline-offset: -2px; }
.zone-item:focus-visible, .zone-box-head:focus-visible, .ip-field-row:focus-visible { outline-offset: 1px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ---------- top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr);
  grid-template-areas: "brand project" "actions actions";
  align-items: center;
  column-gap: 20px;
  row-gap: 8px;
  padding: 10px 20px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  /* above the inspector drawer, which starts life as a slide-over at 45 */
  position: sticky; top: 0; z-index: 55;
}
.brand { grid-area: brand; }
.project-block { grid-area: project; }
.top-actions { grid-area: actions; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 15px;
}

.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11px; color: var(--muted-2); letter-spacing: 0.02em; }

.project-block { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.project-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted-2); }

.project-input {
  flex: 1; max-width: 420px; min-width: 0;
  height: var(--control);
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 550;
}
.project-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.save-state { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.save-state.flash { color: var(--ok); }

.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.top-actions #btnDeleteDesign { margin-left: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--control);
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #e4e9ef; }
.btn:active { transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #163a5f; }
.btn-ghost { background: var(--panel); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel-2); border-color: #b7c2d0; }
.btn-danger { color: var(--danger); border-color: #e7b8b2; }
.btn-danger:hover { background: #fdf2f0; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-sm { min-height: 28px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- export cluster ---------- */
/* one primary action, every single file one click behind it */
.export-cluster { display: flex; align-items: center; gap: 6px; }
.export-cluster.block { display: grid; gap: 8px; margin-top: 10px; }
.export-cluster.block .btn, .export-cluster.block summary { width: 100%; justify-content: center; }

.export-more { position: relative; display: inline-flex; }
.export-more > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.export-more > summary::-webkit-details-marker { display: none; }
.export-more > summary::after { content: '▾'; margin-left: 6px; font-size: 9px; opacity: 0.75; }
.export-more[open] > summary { border-color: var(--accent); color: var(--text); }

.export-more-list {
  position: absolute; right: 0; top: calc(100% + 6px);
  z-index: 60;
  display: grid; gap: 4px;
  min-width: 182px; padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(2, 8, 20, 0.55);
}
.export-more-list .btn { justify-content: flex-start; text-align: left; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px;
  align-items: start;
}

.sidebar, .inspector {
  position: sticky; top: 112px;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding-right: 2px;
}

.sidebar::-webkit-scrollbar, .inspector::-webkit-scrollbar, .main::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .inspector::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb {
  background: #c5ced8; border-radius: 8px;
}

.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.count {
  font-size: 11px; font-family: var(--mono);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 7px; border-radius: 20px; color: var(--muted);
}

.panel-hint { font-size: 12px; color: var(--muted); }
.panel-hint p { margin: 0 0 8px; }

.level-key { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.level-key li { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.level-key .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.level-key .lk-name { color: var(--text); font-weight: 600; }
.level-key .lk-desc { color: var(--muted-2); font-size: 10.5px; }
.level-note { margin: 10px 0 0; font-size: 10px; line-height: 1.4; color: var(--muted-2); }
.hint-tag {
  margin-left: 4px; padding: 1px 6px; border-radius: 5px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid #c5d4e6; vertical-align: 1px;
}

/* ---------- steps nav ---------- */
.steps { display: flex; flex-direction: column; gap: 4px; }

.step-btn {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left; cursor: pointer;
  color: var(--muted);
  font-size: 12.5px; font-weight: 550;
}
.step-btn:hover { background: rgba(29, 45, 73, 0.55); color: var(--text); }
.step-btn.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--text); }

.step-num {
  width: 22px; height: 22px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11px; font-family: var(--mono);
}
.step-btn.active .step-num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.step-btn.done .step-num { background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.4); color: var(--ok); }

.step-sep { display: block; height: 1px; background: var(--line-soft); margin: 8px 4px; }

/* ---------- zone list ---------- */
.zone-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.zone-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  cursor: pointer; font-size: 12px;
}
.zone-item:hover { border-color: #2c4468; }
.zone-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.zone-item .bar { width: 4px; align-self: stretch; border-radius: 4px; flex: 0 0 auto; }
.zone-item .zi-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.zone-item .zi-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-item .zi-meta { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }
.zone-item .zi-n { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.empty-note { color: var(--muted-2); font-size: 12px; font-style: italic; padding: 6px 2px; }

/* ---------- kpi ---------- */
.kpi-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-list div { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px; }
.kpi-list dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); }
.kpi-list dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; font-family: var(--mono); }

/* ---------- views ---------- */
.view { display: none; }
.view.active { display: block; animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.eyebrow {
  margin: 0 0 4px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--accent); font-weight: 700;
}
.view-head h1 { font-size: 22px; scroll-margin-top: 120px; }
.view-sub { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); max-width: 70ch; }

.view-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.drawing-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 168px);
}
.drawing-frame svg { display: block; width: auto; max-width: none; height: auto; }
.filter { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted-2); }
.filter input, .select {
  height: var(--control);
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  min-width: 150px;
}
.filter input:focus, .select:focus { outline: none; border-color: var(--accent); }
.select { min-width: 126px; }

/* ---------- flow ---------- */
.flow-progress { display: flex; gap: 5px; align-items: center; }
.flow-progress .pip { width: 30px; height: 4px; border-radius: 4px; background: var(--line); }
.flow-progress .pip.on { background: var(--accent); }

.flow-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
}
.flow-card + .flow-card { margin-top: 12px; }
.conduit-card { margin-top: 14px; }
.conduit-card h2 { font-size: 13px; margin: 0; }
.conduit-table tr { cursor: pointer; }
.conduit-table tr.selected td { background: var(--accent-soft); }
.conduit-table td { vertical-align: top; }
.conduit-table .row-acts { white-space: nowrap; text-align: right; width: 1%; }

/* ---------- saved plans ---------- */
.plan-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
}
.plan-card + .plan-card { margin-top: 12px; }

.plan-current { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-current-main { min-width: 0; }
.plan-current .eyebrow { margin-bottom: 2px; }
.plan-current h2 { font-size: 16px; overflow-wrap: anywhere; }

.plan-meta { display: block; margin: 3px 0 0; font-size: 11.5px; color: var(--muted-2); overflow-wrap: anywhere; }
.plan-total { font-size: 11px; color: var(--muted-2); font-family: var(--mono); }

.plan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.plan-row:hover { border-color: #2c4468; }
.plan-row.current { border-color: var(--accent-soft); background: var(--accent-soft); }

.plan-row-main { display: flex; flex-direction: column; min-width: 0; }
.plan-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.plan-badge {
  padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
}
.plan-row-acts { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.plan-rev {
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 0 8px;
}
.plan-diff { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.plan-diff h3 { font-size: 13px; margin: 4px 0 6px; }
.plan-diff ul { margin: 0; padding-left: 18px; }
.plan-diff li { font-size: 12.5px; margin: 2px 0; }
.net-row { margin-top: 8px; }
.net-row .field { margin-bottom: 0; }

@media (max-width: 620px) {
  .plan-row { flex-direction: column; align-items: stretch; }
  .plan-row-acts { justify-content: flex-end; }
}

/* ---------- how-to guide ---------- */
.guide-card { padding: 0; }
.guide-card[open] { padding-bottom: 14px; }
.guide-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; cursor: pointer; list-style: none;
}
.guide-head::-webkit-details-marker { display: none; }
.guide-head-text { display: flex; flex-direction: column; min-width: 0; }
.guide-head-text strong { font-size: 13px; }
.guide-head-text span { font-size: 11.5px; color: var(--muted-2); }
.guide-head-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.guide-count {
  font-size: 11px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
  padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft);
}
.guide-caret { color: var(--muted-2); font-size: 11px; transition: transform 0.16s; }
.guide-card[open] .guide-caret { transform: rotate(180deg); }

.guide-list { list-style: none; margin: 0; padding: 0 14px; display: grid; gap: 7px; }
.guide-step {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft); border-radius: 10px;
}
.guide-step.next { border-color: var(--accent-soft); background: var(--accent-soft); }
.guide-step.done .guide-text strong { color: var(--muted); }
.guide-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.guide-step.next .guide-num { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.guide-step.done .guide-num { background: rgba(52, 211, 153, 0.15); color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }
.guide-text { display: flex; flex-direction: column; min-width: 0; }
.guide-text strong { font-size: 12.5px; font-weight: 600; }
.guide-text span { font-size: 11.5px; color: var(--muted-2); }
.guide-flag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-2); white-space: nowrap;
}
.guide-step.next .guide-flag { color: var(--accent); }
.guide-step.done .guide-flag { color: var(--ok); }
.guide-more { display: flex; justify-content: flex-end; padding: 10px 14px 0; }

.guide-modal { display: grid; gap: 10px; }
.guide-block { padding: 12px 14px; background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 12px; }
.guide-block.next { border-color: var(--accent-soft); }
.guide-block.done .guide-block-head h3 { color: var(--muted); }
.guide-block-head { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.guide-block-head h3 { font-size: 13px; }
.guide-block-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted-2); }
.guide-block.done .guide-num { background: rgba(52, 211, 153, 0.15); color: var(--ok); border-color: rgba(52, 211, 153, 0.35); }
.guide-block.next .guide-num { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.guide-block .hint-list { margin-top: 8px; }

@media (max-width: 700px) {
  .guide-step { grid-template-columns: 22px minmax(0, 1fr); }
  .guide-flag, .guide-step .btn { grid-column: 2; justify-self: start; }
  .guide-block-head { grid-template-columns: 22px minmax(0, 1fr); }
  .guide-block-head .btn { grid-column: 2; justify-self: start; }
}

.flow-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.flow-foot-end { display: flex; align-items: center; gap: 10px; }

/* readiness pill: the footer answer to "can I export this yet?" */
.ready-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px; font-weight: 650;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.ready-chip:hover { border-color: var(--accent); }
.ready-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ready-chip.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.1); }
.ready-chip.warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); }
.ready-chip.blocked { color: var(--danger); border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.1); }
.ready-chip[hidden] { display: none; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field[hidden], .grid-2[hidden], .grid-3[hidden], .field-block[hidden] { display: none !important; }

/* ---------- level 0 physical connection ---------- */
.field-block {
  margin-top: 14px; padding: 12px 14px;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.22); border-radius: 12px;
}
.field-block-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  margin-bottom: 11px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em;
  color: #075985;
}
.field-block-head span {
  flex: 1 1 220px; min-width: 0;
  font-size: 10.5px; font-weight: 400; text-transform: none; letter-spacing: 0;
  line-height: 1.35; color: var(--muted-2);
}
.field-block .hint { font-size: 10.5px; }
.link-cell { font-family: var(--mono); font-size: 10.5px; color: #075985; white-space: nowrap; }
.insp-note {
  margin: 0 0 12px; padding: 8px 10px;
  font-size: 10.5px; line-height: 1.4; color: #075985;
  background: #f0f7fb;
  border: 1px solid #d3e4f0; border-radius: 8px;
}

/* field devices listed beside the IP table — they hold no address */
.ip-field-list { margin: 0 14px 12px; padding: 9px 10px; border: 1px dashed rgba(56, 189, 248, 0.28); border-radius: 9px; background: rgba(56, 189, 248, 0.04); }
.ip-field-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #075985; margin-bottom: 6px; }
.ip-field-row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 3px 0; cursor: pointer; }
.ip-field-row:hover { background: rgba(56, 189, 248, 0.06); }
.ip-field-row .mono { font-size: 10px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-field-row span:last-child { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.field .hint { font-size: 11px; color: var(--muted-2); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: var(--control);
  padding: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}
.grid-2 > .field, .grid-3 > .field { margin-bottom: 0; }
.grid-2, .grid-3 { align-items: start; margin-bottom: 12px; }
.grid-2:last-child, .grid-3:last-child { margin-bottom: 0; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input.invalid, .field select.invalid { border-color: var(--danger); }
.field-error { font-size: 11px; color: var(--danger); }
.mono { font-family: var(--mono); }

/* ---------- tables ---------- */
.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: auto;
  background: var(--panel);
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

thead th {
  position: sticky; top: 0;
  background: var(--panel-2);
  text-align: left;
  padding: 10px 12px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap; z-index: 1;
}

tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr.selected { background: var(--accent-soft); }

.num { font-family: var(--mono); font-size: 11.5px; }
.dim { color: var(--muted); }
.muted-cell { color: var(--muted-2); font-size: 11.5px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10.5px; font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-block;
  font-family: var(--mono); font-size: 10.5px;
  padding: 1px 6px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- diagram ---------- */
.diagram { display: flex; flex-direction: column; gap: 10px; }

.band {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  position: relative; overflow: hidden;
}
.band::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--band-color, var(--muted-2));
}
.band.dmz { background: repeating-linear-gradient(135deg, rgba(157, 23, 77, 0.05) 0 10px, transparent 10px 20px), var(--panel); }

.band-label { display: flex; flex-direction: column; gap: 3px; padding-left: 6px; }
.band-code { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--band-color, var(--muted)); }
.band-name { font-size: 12px; font-weight: 600; }
.band-pera { font-size: 11px; color: var(--muted-2); line-height: 1.3; letter-spacing: 0.01em; }
.band-desc { font-size: 10.5px; color: var(--muted-2); line-height: 1.35; }

.band-zones { display: flex; gap: 10px; align-items: stretch; overflow-x: auto; padding-bottom: 2px; }

.zone-box {
  flex: 1 1 210px; min-width: 196px;
  border: 1px dashed rgba(139, 161, 194, 0.25);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg-soft);
  display: flex; flex-direction: column; gap: 7px;
}
.zone-box.selected { border-color: var(--accent); background: var(--accent-soft); }

.zone-box-head { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.zone-box[draggable="true"],
.zone-box[draggable="true"] .zone-box-head { cursor: grab; }
.zone-box[draggable="true"] .add-chip { cursor: pointer; }
.zone-box-head .zb-name { font-size: 11.5px; font-weight: 650; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-box-head .zb-cidr { font-family: var(--mono); font-size: 10px; color: var(--muted-2); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 8px 5px 5px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer; max-width: 100%;
  transition: border-color 0.15s, transform 0.1s;
}
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chip.flagged { border-color: rgba(251, 113, 133, 0.6); }

.chip-mark {
  width: 22px; height: 22px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 6px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.chip { cursor: grab; }
.chip:active { cursor: grabbing; }
.chip.dragging { opacity: 0.4; cursor: grabbing; }
.zone-box { transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.zone-box .chips { min-height: 30px; }
.zone-box.drop-target, .band.drop-target {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-soft), 0 0 0 3px var(--accent-soft);
}
.place-board { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.asset-tray {
  position: sticky; top: 0;
  max-height: calc(100vh - 148px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tray-head h2 { margin: 0; font-size: 14px; }
.tray-fields { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 10px 0; }
.tray-fields .field { margin: 0; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.vlan-card { border: 1px solid var(--line-soft); border-radius: 10px; margin-top: 10px; background: var(--bg-soft); }
.vlan-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; cursor: grab; }
.vlan-head:active { cursor: grabbing; }
.vlan-title { font-size: 12px; font-weight: 700; }
.vlan-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); }
.asset-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 6px 8px; border-top: 1px solid var(--line-soft); cursor: grab; }
.asset-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-ip { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); }
.asset-choice { margin-top: 8px; }
.asset-tray .admin-bulk { margin-top: 8px; }
.asset-tray textarea { width: 100%; margin: 8px 0; }
.zone-box.drop-target .chips::after {
  content: 'drop to move here';
  font-size: 10px; font-style: italic; color: var(--accent);
  align-self: center; padding: 3px 6px;
  border: 1px dashed var(--accent-soft); border-radius: 6px;
}
.chip-mark.cat-it { background: #e8eaf6; color: #3730a3; }
.chip-mark.cat-network { background: #e0f2fe; color: #075985; }
.chip-mark.cat-control { background: #fef3c7; color: #92400e; }
.chip-mark.cat-supervisory { background: #ffedd5; color: #9a3412; }
.chip-mark.cat-dmz { background: #fce7f3; color: #9d174d; }

.chip-body { display: flex; flex-direction: column; min-width: 0; }
.chip-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.chip-ip { font-family: var(--mono); font-size: 9.5px; color: var(--muted-2); }

.add-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  border-radius: 7px;
  border: 1px dashed rgba(139, 161, 194, 0.35);
  background: transparent;
  color: var(--muted); font-size: 11px;
  cursor: pointer;
}
.add-chip:hover { border-color: var(--accent); color: var(--accent); }
.band-empty { color: var(--muted-2); font-size: 11px; font-style: italic; align-self: center; }

/* ---------- ip plan ---------- */
.ip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

.ip-card {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.ip-card-head { display: flex; flex-direction: column; gap: 8px; padding: 12px 13px; border-bottom: 1px solid var(--line-soft); }
.ip-card-title { display: flex; align-items: center; gap: 8px; }
.ip-card-title strong { font-size: 13px; flex: 1; }
.ip-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.util { height: 6px; border-radius: 6px; background: var(--line-soft); overflow: hidden; }
.util span { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.util.warn span { background: var(--warn); }
.util.crit span { background: var(--danger); }
.util-row { display: flex; align-items: center; gap: 9px; font-size: 10.5px; color: var(--muted-2); }
.util-row .util { flex: 1; }

.ip-table { width: 100%; font-size: 11.5px; }
.ip-table td { padding: 6px 11px; border-bottom: 1px solid var(--line-soft); }
.ip-table tr:last-child td { border-bottom: none; }
.ip-table td:first-child { font-family: var(--mono); color: var(--accent); width: 126px; }
.ip-table td:last-child { text-align: right; color: var(--muted-2); }

.free-note { padding: 10px 13px; font-size: 11px; color: var(--muted-2); border-top: 1px dashed var(--line-soft); }
.free-note code { font-family: var(--mono); color: var(--muted); }

/* ---------- checks ---------- */
.check-group { margin-bottom: 16px; }
.check-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }

.check-item {
  display: flex; gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--muted-2);
  border-radius: 10px;
  background: var(--panel);
  margin-bottom: 7px;
  cursor: pointer;
}
.check-item:hover { background: var(--panel-2); }
.check-item.sev-error { border-left-color: var(--danger); }
.check-item.sev-warn { border-left-color: var(--warn); }
.check-item.sev-info { border-left-color: #60a5fa; }
.check-item.sev-ok { border-left-color: var(--ok); }

.check-icon {
  width: 20px; height: 20px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 6px;
  font-size: 11px; font-weight: 800;
  background: var(--panel-2);
}
.sev-error .check-icon { color: var(--danger); background: rgba(251, 113, 133, 0.14); }
.sev-warn .check-icon { color: var(--warn); background: rgba(251, 191, 36, 0.14); }
.sev-info .check-icon { color: #60a5fa; background: rgba(96, 165, 250, 0.14); }
.sev-ok .check-icon { color: var(--ok); background: rgba(52, 211, 153, 0.14); }

.check-body { display: flex; flex-direction: column; gap: 2px; }
.check-title { font-size: 12.5px; font-weight: 600; }
.check-detail { font-size: 11.5px; color: var(--muted); }
.check-subjects { font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); }

/* ---------- inspector ---------- */
.inspector .panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.inspector .panel-title h2 { font-size: 13px; }

.insp-title-wrap { display: flex; flex-direction: column; min-width: 0; }
.insp-title-wrap span { font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.08em; }

.insp-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.insp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding-bottom: 7px; border-bottom: 1px dashed var(--line-soft); }
.insp-row:last-child { border-bottom: none; }
.insp-row .k { color: var(--muted-2); }
.insp-row .v { font-weight: 600; text-align: right; word-break: break-word; }

.insp-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.insp-empty { text-align: center; padding: 26px 10px; color: var(--muted-2); }
.insp-empty .glyph {
  width: 42px; height: 42px; margin: 0 auto 10px;
  border-radius: 12px; display: grid; place-items: center;
  border: 1px dashed var(--line); color: var(--muted); font-size: 18px;
}
.insp-empty p { margin: 0; font-size: 12px; line-height: 1.5; }

.hint-list { margin: 10px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--muted-2); line-height: 1.6; }
.hint-list li { margin-bottom: 4px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 9, 17, 0.72);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 0.16s ease;
}
.modal {
  width: min(700px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.modal-head h2 { font-size: 16px; }
.modal-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.modal-close {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; line-height: 1; flex: 0 0 auto;
}
.modal-close:hover { color: var(--text); border-color: var(--danger); }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 14px 20px 18px; border-top: 1px solid var(--line-soft);
  position: sticky; bottom: 0; background: var(--panel);
}
.modal-foot .right { display: flex; gap: 8px; }

.type-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 7px; max-height: 244px; overflow-y: auto; padding: 4px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--bg-soft);
}

.type-opt {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 44px; height: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  font-size: 11px;
}
.type-opt:hover { border-color: #2c4468; }
.type-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.type-opt .chip-mark { width: 20px; height: 20px; font-size: 9px; }

.type-group-label {
  grid-column: 1 / -1;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted-2); padding: 6px 2px 0;
}

.zone-form-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }

/* ---------- toast ---------- */
.toast-stack {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.has-act { display: flex; align-items: center; gap: 12px; }
.toast-act {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer;
}
.toast-act:hover { background: var(--accent-soft); }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* inspector close control: only exists while the slide-over is in play */
.insp-close {
  align-self: flex-end;
  width: 26px; height: 26px;
  margin-bottom: -4px;
  display: none; place-items: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 15px; line-height: 1;
  cursor: pointer;
}
.insp-close:hover { color: var(--text); border-color: var(--accent); }

/* ---------- legibility floor ---------- */
/* 9.5–10.5px is kept for uppercase micro-labels only (eyebrows, badges, chips of
   chrome). Anything that reads as a value, a name or a sentence is 11px. */
.level-key .lk-desc, .level-note, .zone-item .zi-meta, .zone-item .zi-n,
.kpi-list dt, .band-desc, .zone-box-head .zb-cidr, .chip-ip, .util-row,
.check-subjects, .insp-title-wrap span, .ip-field-row .mono, .detect-why,
.detect-group, .link-cell, .field-block .hint, .field-block-head span,
.insp-note, thead th { font-size: 11px; }
.zone-box.drop-target .chips::after { font-size: 11px; }

/* ---------- responsive ---------- */
/* below 1500px the inspector leaves the grid and becomes a slide-over, so the
   topology keeps the width a band needs instead of losing ~340px to a column */
@media (max-width: 1499px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .inspector {
    position: fixed; top: 112px; right: 0; bottom: 0;
    width: 348px; max-height: none;
    z-index: 45;
    padding: 14px 14px 22px;
    background: var(--bg-soft);
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 28px rgba(16, 24, 40, 0.12);
    overflow-y: auto;
    transform: translateX(102%);
    transition: transform 0.18s ease;
  }
  .inspector.open { transform: none; }
  .insp-close { display: grid; }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .sidebar { position: static; max-height: none; flex-direction: row; overflow-x: auto; align-items: flex-start; }
  .sidebar .panel { min-width: 240px; }
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "brand" "project" "actions";
  }
  .brand-text span { display: none; }
  .brand-text strong { white-space: nowrap; }
  .project-block { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "label save" "input input"; align-items: center; }
  .project-label { grid-area: label; }
  .save-state { grid-area: save; justify-self: end; }
  .project-input { grid-area: input; max-width: none; width: 100%; }
  .top-actions { justify-content: flex-start; }
  .grid-2, .grid-3, .zone-form-row { grid-template-columns: minmax(0, 1fr); }
  .band { grid-template-columns: minmax(0, 1fr); }
  .place-board { grid-template-columns: minmax(0, 1fr); }
  .asset-tray { position: static; max-height: none; }
  .brand { min-width: 0; }
}

/* ---------- site questionnaire ---------- */
.intake-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.intake-head h3 { margin: 0; font-size: 14px; }
.intake-step {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
}
.intake-note { margin-left: auto; font-size: 11px; color: var(--muted-2); }
.req { color: var(--danger); }
.intake-error {
  margin: 0 0 12px; padding: 9px 11px;
  border: 1px solid #e7b8b2; border-radius: 6px;
  background: #fdf2f0; color: var(--danger); font-size: 12px;
}
.intake-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 14px;
}
.intake-actions-right { display: flex; gap: 8px; }
.intake-table { width: 100%; font-size: 12px; }
.intake-table th { white-space: nowrap; }
.intake-table td { padding: 6px 8px; vertical-align: middle; }
.intake-table .cell-input {
  width: 100%; padding: 6px 8px;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 7px; color: inherit; font-size: 12px;
}
.intake-table .cell-input:focus { outline: none; border-color: var(--accent); }
.intake-table .cell-num { width: 78px; font-family: var(--mono); text-align: right; }
.intake-table td:first-child { width: 26px; }
.intake-table .btn[disabled] { opacity: 0.35; cursor: not-allowed; }

/* ---------- admin page ---------- */
.admin-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 14px; align-items: start; }
.admin-cols .flow-card { min-width: 0; }
.admin-form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-row-actions { display: flex; gap: 4px; justify-content: flex-end; white-space: nowrap; }
.admin-row-actions .btn-sm { padding: 3px 7px; font-size: 11px; }
.admin-bad { color: var(--danger); }
.detect-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; min-height: 18px; }
.detect {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.6;
  border: 1px solid transparent;
}
.detect strong { font-weight: 600; }
.detect-hit { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft); }
.detect-guess { color: var(--warn); background: #fbf6ea; border-color: #ead7a6; }
.detect-manual { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.28); }
.detect-miss { color: var(--danger); background: #fdf2f0; border-color: #e7b8b2; }
.detect-meta { opacity: 1; }
.detect-why { font-family: var(--mono); font-size: 11px; color: var(--muted-2); }
.detect-group { font-size: 11px; color: var(--muted-2); }
.link-btn {
  background: none; border: 0; padding: 0 0 0 2px; cursor: pointer;
  color: var(--accent); font-size: 11px; text-decoration: underline; font-family: inherit;
}
.link-btn:hover { color: #163a5f; }
select.needs-manual {
  border-color: rgba(251, 113, 133, 0.65);
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.12);
}
.admin-bulk {
  margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--bg-soft);
}
.admin-bulk summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.admin-bulk textarea {
  width: 100%; margin: 10px 0 8px; padding: 8px 10px;
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 8px;
  color: inherit; font-family: var(--mono); font-size: 11.5px; resize: vertical;
}
.admin-bulk textarea:focus { outline: none; border-color: var(--accent); }

/* ---------- access gate ---------- */
body.auth-locked #app { display: none; }

.auth-screen {
  position: fixed; inset: 0; z-index: 200; overflow: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 32px 16px;
  background: var(--bg);
}

.auth-brand {
  padding: 0; display: flex; min-width: 0;
  border: 0;
}
.auth-brand-top { display: flex; align-items: center; gap: 12px; }
.auth-brand-top strong { display: block; font-size: 14px; letter-spacing: -0.01em; }
.auth-brand-top span { display: block; font-size: 11.5px; color: var(--muted-2); }
.auth-brand h1 {
  margin: 10px 0 0; font-size: 30px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700;
}
.auth-lede { margin: 0; max-width: 46ch; color: var(--muted); font-size: 13px; }
.auth-levels { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; max-width: 400px; }
.auth-levels li { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.auth-levels .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.auth-lvl-code { font-family: var(--mono); font-size: 11px; color: var(--muted-2); width: 34px; }
.auth-lvl-name { color: var(--muted); }
.auth-foot { margin: auto 0 0; font-size: 11px; color: var(--muted-2); }

.auth-panel { display: grid; place-items: center; padding: 0; width: min(430px, 100%); }
.auth-card {
  width: min(430px, 100%); padding: 26px 26px 22px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow);
}
.auth-card h2 { margin: 2px 0 4px; font-size: 20px; letter-spacing: -0.02em; }
.auth-card .eyebrow { margin: 0; }
.auth-sub { margin: 0 0 16px; font-size: 12px; color: var(--muted-2); }
.auth-card .field + .field, .auth-card .grid-2 { margin-top: 10px; }
.auth-error {
  margin: 0 0 12px; padding: 9px 11px;
  border: 1px solid #e7b8b2; border-radius: 6px;
  background: #fdf2f0; color: var(--danger); font-size: 12px;
}
.btn-block { width: 100%; margin-top: 14px; justify-content: center; }
.auth-remember {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 12px; color: var(--muted);
}
.auth-remember input { accent-color: var(--accent); }
.auth-note { margin: 14px 0 0; font-size: 11px; color: var(--muted-2); }
.auth-wipe {
  margin: 10px 0 0; padding: 10px 12px; font-size: 11px; line-height: 1.6;
  color: var(--danger); background: #fdf2f0;
  border: 1px solid #e7b8b2; border-radius: 9px;
}
.auth-wipe .btn { margin-top: 8px; }
.auth-secret {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 9px;
}
.auth-secret span { font-size: 11px; color: var(--muted-2); }
.auth-secret code { font-family: var(--mono); font-size: 12.5px; color: var(--accent); }

/* ---------- user chip / roles ---------- */
.user-chip { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--accent-ink); background: var(--accent);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: 11.5px; font-weight: 600; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.role-chip {
  display: inline-block; padding: 0 6px; border-radius: 999px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid transparent; line-height: 1.7;
}
.role-admin { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-soft); }
.role-engineer { color: #3730a3; background: #e8eaf6; border-color: #c7c9f5; }
.role-viewer { color: var(--muted); background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.26); }

/* ---------- users & access ---------- */
.admin-readonly {
  margin: 0 0 12px; padding: 9px 12px;
  font-size: 11.5px; color: var(--warn);
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.32); border-radius: 9px;
}
.admin-readonly-form input, .admin-readonly-form select { opacity: 0.6; }
.auth-users { margin-top: 14px; }
.auth-users-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.auth-users-bar .hint { margin: 0; }
.auth-users .state-on { color: var(--ok); font-size: 11px; }
.auth-users .state-off { color: var(--danger); font-size: 11px; }
.auth-users tr.user-off td { opacity: 0.55; }
.select-sm { padding: 3px 6px; font-size: 11px; }

@media (max-width: 980px) {
  .auth-screen { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-panel { padding: 28px 18px; }
  .user-meta { display: none; }
}

@media (max-width: 1180px) {
  .admin-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .intake-actions { flex-direction: column; align-items: stretch; }
  .intake-actions-right { flex-direction: column; }
}

@media print {
  .topbar, .sidebar, .inspector, .view-tools, .flow-footer, .intake-actions, .guide-card { display: none !important; }
  .layout { display: block; }
  .view { display: block !important; }
  body { background: #fff; color: #111; }
}
