/* Digital Raven · light record theme */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --sunk: #f8f9fa;
  --line: #e1e4e8;
  --line-2: #c9ced6;
  --ink: #15191f;
  --ink-2: #444c58;
  --ink-3: #6f7886;
  --bar: #171a20;
  --bar-2: #232831;
  --accent: #0b5cad;
  --accent-2: #e8f0fa;
  --accent-ink: #08467f;
  --good: #1d7a4c;
  --good-bg: #e7f4ec;
  --warn: #a96500;
  --warn-bg: #fdf3e2;
  --risk: #c0352b;
  --risk-bg: #fbeceb;
  --held: #6a4bb5;
  --held-bg: #f0ecfa;
  --muted-bg: #eef0f3;
  /* plant media colors (industry convention) */
  --fiber: #e0b400;
  --copper: #2c6fbb;
  --switch: #3c4452;
  --ups: #1f2a36;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 13.5px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: .94em; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.sm { font-size: 12px; }
.xs { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hide { display: none !important; }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-rows: 48px 1fr; grid-template-columns: 216px 1fr; height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; background: var(--bar); color: #e9ecf1; display: flex; align-items: center; gap: 14px; padding: 0 14px 0 0; }
.brand { width: 216px; display: flex; align-items: center; gap: 10px; padding-left: 16px; height: 100%; border-right: 1px solid #2b313b; font-weight: 600; letter-spacing: .14em; font-size: 13px; }
.brand #brandName { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 28px; height: 28px; flex: none; }
.wordmark { white-space: nowrap; font-size: 12.5px; letter-spacing: .22em; }
.wm-light { font-weight: 300; }
.wm-bold { font-weight: 600; }
.tenant { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius); color: #e9ecf1; }
.tenant:hover { background: var(--bar-2); }
.tenant b { font-weight: 600; }
.tenant span { color: #9aa3b0; font-size: 12px; }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bar-2); border: 1px solid #343b46; border-radius: var(--radius); padding: 0 10px; height: 32px; color: #9aa3b0; }
.search input { background: none; border: 0; outline: 0; flex: 1; color: #fff; font-size: 13px; }
.search kbd { font: 11px var(--mono); border: 1px solid #434b57; border-radius: 3px; padding: 0 5px; color: #9aa3b0; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sample-chip.staging { color: #ff8fd0; border-color: #a1306f; }
body.staging { border-top: 4px solid #d6409f; }
.sample-chip { font: 600 10.5px var(--mono); letter-spacing: .08em; color: #f2c46d; border: 1px solid #6b5520; padding: 3px 7px; border-radius: 3px; }
.role-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--radius); color: #e9ecf1; }
.role-btn:hover { background: var(--bar-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #3a4350; display: grid; place-items: center; font-weight: 600; font-size: 11.5px; color: #fff; }
.role-btn small { display: block; color: #9aa3b0; font-size: 11px; line-height: 1.1; }
.god-chip { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #1b1300; background: #f2b632; border-radius: 3px; padding: 0 5px; margin-right: 3px; line-height: 14px; }
.role-btn.god .avatar { box-shadow: 0 0 0 2px #f2b632; }
.role-btn b { display: block; font-weight: 500; font-size: 12.5px; line-height: 1.2; text-align: left; }
.ask-btn { background: var(--accent); color: #fff; height: 32px; padding: 0 12px; border-radius: var(--radius); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.ask-btn:hover { background: #0a4f95; }

.nav { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 0 16px; display: flex; flex-direction: column; }
.nav h6 { font: 600 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 14px 16px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 16px; color: var(--ink-2); font-weight: 450; border-left: 3px solid transparent; }
.nav a:hover { background: var(--sunk); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--accent-2); color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.nav a .count { margin-left: auto; font: 500 11px var(--mono); color: var(--ink-3); background: var(--muted-bg); padding: 0 6px; border-radius: 9px; }
.nav a.on .count { background: #d4e3f5; color: var(--accent-ink); }
.nav .foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main { overflow: auto; position: relative; flex: 1; min-height: 0; }
/* ---------- workspace tabs ---------- */
.tabs-bar { display: flex; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); height: 40px; flex: none; padding: 0 0 0 12px; }
.tabs-bar:empty { display: none; }
.tabstrip { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabstrip::-webkit-scrollbar { display: none; }
.wtab { display: flex; align-items: center; gap: 7px; padding: 0 8px 0 10px; max-width: 210px; min-width: 0; flex: none; color: var(--ink-3); font-size: 12.5px; font-weight: 500; white-space: nowrap; position: relative; box-shadow: inset 0 -2px 0 transparent; }
.wtab:hover { background: var(--sunk); text-decoration: none; color: var(--ink); }
.wtab.on { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.wtab.on svg { color: var(--accent); opacity: 1; }
.wtab svg { width: 14px; height: 14px; flex: none; opacity: .7; }
.wtab .wt-t { overflow: hidden; text-overflow: ellipsis; }
.wtab .wt-t.mono { font-size: 12px; }
.wtab.pinned { padding-right: 12px; }
.wt-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; color: var(--ink-3); flex: none; }
.wt-x svg { width: 11px; height: 11px; }
.wt-x:hover { background: var(--muted-bg); color: var(--ink); }
.wt-dot { width: 8px; height: 8px; border-radius: 50%; background: #e8962e; flex: none; }
.wtab:not(:hover):not(.on) .wt-dot + .wt-x { display: none; }
.wt-more { margin: 0 8px; flex: none; height: 28px; align-self: center; }
.page { padding: 18px 24px 40px; max-width: 1480px; }
.page.full { max-width: none; padding: 0; height: 100%; }
.crumbs { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 6px 0 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: #aab1bc; background: var(--sunk); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0a4f95; }
.btn.danger { color: var(--risk); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .ico { width: 14px; height: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { padding: 0 11px; height: 30px; border-right: 1px solid var(--line); color: var(--ink-2); font-weight: 500; font-size: 12.5px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-2); color: var(--accent-ink); }
input.field, select.field, textarea.field { height: 32px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 10px; background: var(--surface); outline: none; }
textarea.field { height: auto; padding: 8px 10px; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 92, 173, .14); }
label.lbl { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin: 10px 0 4px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 13.5px; font-weight: 600; }
.card-h .sub { color: var(--ink-3); font-size: 12px; }
.card-h .actions { margin-left: auto; display: flex; gap: 6px; }
.card-b { padding: 14px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 360px; }
.g-side-l { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; }
.kpi { padding: 13px 16px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .k { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 3px; }
.kpi .d { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.kpi.alert .v { color: var(--risk); }

/* tables */
.tbl-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; background: var(--sunk); text-align: left; font-weight: 600; color: var(--ink-2); font-size: 11.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--ink); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f6f9fd; }
.tbl tr.sel td { background: var(--accent-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .code { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink); white-space: nowrap; }

/* status */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 1px 8px 1px 6px; border-radius: 10px; white-space: nowrap; border: 1px solid transparent; }
.pill:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.risk { color: var(--risk); background: var(--risk-bg); }
.pill.info { color: var(--accent-ink); background: var(--accent-2); }
.pill.held { color: var(--held); background: var(--held-bg); }
.pill.none { color: var(--ink-3); background: var(--muted-bg); }
.tag { display: inline-block; font: 500 10.5px var(--mono); padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 3px; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.tag.src { border-style: dashed; }
.meter { height: 6px; background: var(--muted-bg); border-radius: 3px; overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter.good i { background: var(--good); }
.meter.warn i { background: var(--warn); }
.meter.risk i { background: var(--risk); }
.mcell { display: flex; align-items: center; gap: 8px; }
.mcell .meter { flex: 1; }
.mcell span { font-variant-numeric: tabular-nums; width: 34px; text-align: right; font-size: 12px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); border: 1px solid; font-size: 12.5px; }
.banner.warn { background: var(--warn-bg); border-color: #f0d9ad; color: #6d4300; }
.banner.risk { background: var(--risk-bg); border-color: #f2c7c3; color: #8a2119; }
.banner.info { background: var(--accent-2); border-color: #c9daf0; color: var(--accent-ink); }
.banner.good { background: var(--good-bg); border-color: #bfe0cc; color: #145a37; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { padding: 9px 12px; color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.empty { padding: 28px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--sunk); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-weight: 600; }

/* checklist */
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.check:last-child { border-bottom: 0; }
.ck { width: 16px; height: 16px; border-radius: 3px; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; }
.ck.y { background: var(--good); color: #fff; }
.ck.n { border: 1.5px solid var(--line-2); }
.ck.x { background: var(--risk); color: #fff; }
.ck.p { background: var(--warn); color: #fff; }

/* ---------- rack elevations ---------- */
.racks { --u: 13px; --rw: 210px; display: flex; align-items: flex-end; gap: 14px; overflow-x: auto; padding: 4px 2px 10px; }
.rack { flex: none; width: var(--rw); }
.rack-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 2px; gap: 6px; white-space: nowrap; overflow: hidden; }
.rack-h > * { overflow: hidden; text-overflow: ellipsis; }
.rack.ghost { width: calc(var(--rw) * .6); }
.elev.has-sel .rack.ghost { width: 30px; overflow: hidden; }
.elev.has-sel .rack.ghost .rack-h, .elev.has-sel .rack.ghost .rack-stats { visibility: hidden; }
.elev.has-sel .rack.ghost .rack-frame { grid-template-columns: 1fr; }
.elev.has-sel .rack.ghost .rails { display: none; }
.elev.has-sel .rack.ghost .bay-note { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; white-space: nowrap; }
.rack-h b { font-family: var(--mono); font-size: 12.5px; }
.rack-stats { display: flex; gap: 8px; color: var(--ink-2); margin-bottom: 6px; height: 16px; white-space: nowrap; overflow: hidden; }
.rack-stats span { overflow: hidden; text-overflow: ellipsis; }
.racks.tight .rack-stats span + span { display: none; }
.racks.tight .rack-h .xs { display: none; }
.rack-stats b { font-weight: 600; color: var(--ink); }
.rack-frame { display: grid; grid-template-columns: 22px 1fr 22px; border: 2px solid #2e3440; border-radius: 2px; background: #fff; }
.rails { display: grid; grid-template-rows: repeat(45, var(--u)); background: #eef0f3; border-right: 1px solid #c9ced6; }
.rails.r { border-right: 0; border-left: 1px solid #c9ced6; }
.rails span { font: 8.5px/var(--u) var(--mono); color: #8a929e; text-align: center; border-bottom: 1px solid #e1e4e8; overflow: hidden; }
.bay { display: grid; grid-template-rows: repeat(45, var(--u)); background: repeating-linear-gradient(#fff 0 calc(var(--u) - 1px), #f1f2f4 calc(var(--u) - 1px) var(--u)); position: relative; min-width: 0; }
.bay > * { grid-column: 1; }
.unit { margin: 1px 2px; border-radius: 2px; font: 500 10px/1 var(--mono); display: flex; align-items: center; padding: 0 6px; gap: 6px; cursor: pointer; border: 1px solid rgba(0, 0, 0, .18); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; z-index: 1; }
.unit:hover { outline: 2px solid var(--accent); outline-offset: 0; }
.unit.on { outline: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(11, 92, 173, .2); }
.unit.fiber { background: #fff4c2; color: #5b4800; border-color: #e0b400; }
.unit.copper { background: #e4eefa; color: #123d6c; border-color: #8db2dc; }
.unit.switch { background: #3c4452; color: #fff; }
.unit.ups { background: #1f2a36; color: #fff; }
.unit.mgr { background: repeating-linear-gradient(90deg, #d7dbe1 0 3px, #eef0f3 3px 6px); color: #6f7886; cursor: default; }
.unit.reserved { background: repeating-linear-gradient(135deg, #f4f5f7 0 6px, #fff 6px 12px); border: 1px dashed #9aa3ae; color: #6f7886; cursor: default; justify-content: center; white-space: normal; text-align: center; font: 500 9.5px/1.25 var(--sans); }
.tag.ok { background: #e3f4e8; color: #1f6b38; border-color: #9fd3b0; }
.tag.warn { background: #fff4de; color: #8a5a00; border-color: #f0cf8a; }
.unit .dots { display: flex; gap: 1.5px; margin-left: auto; }
.unit .dots i { width: 3px; height: 4px; background: currentColor; opacity: .5; }
.racks.tight .unit { font-size: 8.5px; padding: 0 3px; }
.racks.tight .unit .dots, .racks.tight .rails span { font-size: 7px; }
.racks.tight .unit .dots { display: none; }
/* free space, labeled in the rack */
.free { margin: 1px 2px; border: 1px dashed #c3ccd6; border-radius: 2px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.free span { font: 500 9.5px/1.1 var(--sans); color: #7d8794; text-align: center; padding: 0 2px; }
.racks.tight .free span { font-size: 8px; }
.free.fit { background: #e3f4e8; border: 1.5px solid #2f8a4c; }
.free.fit span { color: #1f6b38; font-weight: 600; }
.free.nofit { opacity: .35; }
.bay-note { grid-row: 1 / -1; display: grid; place-items: center; font: 500 11px var(--sans); color: var(--ink-3); text-align: center; padding: 8px; }
.rack.ghost .rack-frame { border-style: dashed; border-color: #9aa3ae; background: transparent; }
.rack.ghost .rails, .rack.ghost .bay { background: transparent; opacity: .55; }
.rack.ghost .rack-h b { color: var(--ink-3); }
.lg-free { border: 1px dashed #c3ccd6; background: #fff; }
.lg-plan { border: 1.5px dashed #0b5cad; background: #e7f0fb; }
.unit.planned { background: #e7f0fb; border: 1.5px dashed #0b5cad; color: #0b4a8c; flex-wrap: wrap; align-content: center; row-gap: 0; z-index: 2; }
.unit.planned .pl-tag { font: 500 8.5px var(--sans); color: #3a6ea8; width: 100%; }
.racks.tight .unit.planned .pl-tag { display: none; }
.slot { margin: 1px 2px; z-index: 3; background: rgba(47, 138, 76, .16); border: 1.5px solid #2f8a4c; border-radius: 2px; cursor: copy; display: flex; align-items: center; justify-content: center; }
.slot span { font: 600 9.5px var(--sans); color: #1f6b38; background: rgba(255, 255, 255, .85); padding: 1px 4px; border-radius: 2px; pointer-events: none; }
.slot:hover { background: rgba(47, 138, 76, .3); }
.banner.info { background: #eef4fb; border-color: #b8d0ea; }
.lg-ghost { border: 1.5px dashed #9aa3ae; background: transparent; }
/* elevation layout: racks full width, unit detail slides in on the right */
.elev-bar { flex-wrap: wrap; gap: 8px 12px; }
.elev-bar .grow { flex: 1; }
.elev .fs { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.elev .fs input { width: 58px; height: 28px; }
.elev-body { display: grid; grid-template-columns: minmax(0, 1fr) 0; transition: grid-template-columns .18s ease; }
.elev.has-sel .elev-body { grid-template-columns: minmax(0, 1fr) 380px; }
.elev-main { padding: 12px 16px; min-width: 0; }
.elev-side { border-left: 1px solid var(--line); overflow: hidden; min-width: 0; }
.elev:not(.has-sel) .elev-side { border: 0; }
.elev-side > .card { border: 0; box-shadow: none; border-radius: 0; }
.elev-side .ports { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
.elev-side .card-h h3 { white-space: nowrap; }
#fsMsg { min-height: 0; margin-bottom: 6px; color: var(--ink-2); }
#fsMsg:empty { display: none; }
@media (max-width: 1180px) { .elev.has-sel .elev-body { grid-template-columns: 1fr; } .elev-side { border-left: 0; border-top: 1px solid var(--line); } }

/* ports */
.ports { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.port { aspect-ratio: 1; border-radius: 2px; font: 500 9px/1 var(--mono); display: grid; place-items: center; cursor: pointer; border: 1px solid transparent; user-select: none; }
.port.in_service { background: #2c6fbb; color: #fff; }
.port.open { background: #fff; border-color: #8a929e; color: var(--ink-2); }
.port.idle { background: repeating-linear-gradient(135deg, #dce6f3 0 3px, #fff 3px 6px); border-color: #8db2dc; color: #123d6c; }
.port.reserved, .port.held { background: var(--held-bg); border-color: var(--held); color: var(--held); }
.port.unterminated { background: var(--muted-bg); color: #aab1bc; border: 1px dashed #aab1bc; }
.port.faulty { background: var(--risk-bg); border-color: var(--risk); color: var(--risk); }
.port.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.port.reco { box-shadow: 0 0 0 2px #f2c46d; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--ink-2); margin: 10px 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* strands */
.strands { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.strand { height: 22px; border-radius: 2px; font: 500 9.5px/22px var(--mono); text-align: center; cursor: pointer; border: 1px solid transparent; }
.strand.lit { background: #2c6fbb; color: #fff; }
.strand.dark { background: #fff; border-color: #6f7886; color: var(--ink-2); }
.strand.reserved { background: var(--held-bg); border-color: var(--held); color: var(--held); }
.strand.unknown { background: var(--muted-bg); color: #9aa3b0; border: 1px dashed #aab1bc; }
.strand.fault { background: var(--risk-bg); border-color: var(--risk); color: var(--risk); }
.strand.pick { outline: 2px solid #e0a100; outline-offset: 1px; }

/* sparkline */
.spark { width: 100%; height: 44px; display: block; }

/* ---------- OSP ---------- */
.osp { display: grid; grid-template-columns: 200px minmax(0, 1fr) 380px; height: 100%; }
.osp-rail { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 12px; }
.osp-rail h6 { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 6px 0 8px; }
.layer { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 3px; cursor: pointer; font-size: 12.5px; }
.layer:hover { background: var(--sunk); }
.layer input { accent-color: var(--accent); }
.layer .sw { width: 18px; height: 4px; border-radius: 2px; margin-left: auto; }
.osp-stage { position: relative; background: #fbfcfd; overflow: hidden; }
.osp-stage svg { width: 100%; height: 100%; display: block; cursor: grab; }
.osp-stage svg:active { cursor: grabbing; }
.osp-tools { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
.osp-note { position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: var(--ink-3); background: rgba(255, 255, 255, .9); padding: 4px 8px; border-radius: 3px; border: 1px solid var(--line); }
.osp-side { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; }
.osp-side .card-b { padding: 14px 16px; }
.bldg-face { stroke: #9aa3ae; stroke-width: .5; }
.bldg:hover .bldg-face, .bldg.on .bldg-face { stroke: var(--accent); stroke-width: 1; }
.lbl-svg { font: 500 10px var(--sans); fill: #2c333d; paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.lbl-svg.mono { font-family: var(--mono); font-size: 8.5px; }
.db-line { fill: none; stroke: #8a6d3b; stroke-width: 2.2; stroke-dasharray: 6 3; cursor: pointer; }
.db-line:hover, .db-line.on { stroke: var(--accent); stroke-width: 3.5; }
.db-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; }
.cmh { cursor: pointer; }
.cmh rect { fill: #fff; stroke: #4a3a1c; stroke-width: 1.4; }
.cmh:hover rect, .cmh.on rect { fill: var(--accent); stroke: var(--accent); }
.route-glow { fill: none; stroke: #f2a900; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .55; pointer-events: none; }
.route-glow.alt { stroke: var(--held); opacity: .45; }
.rr-dot { fill: var(--accent); stroke: #fff; stroke-width: 1.4; cursor: pointer; }

/* butterfly */
.bfly text { font-family: var(--mono); }
.duct { cursor: pointer; }
.duct:hover circle.shell { stroke: var(--accent); stroke-width: 2; }

/* single line */
.sld text { font-family: var(--mono); font-size: 10px; fill: var(--ink); }
.sld .h { font-family: var(--sans); font-weight: 600; font-size: 11px; }

/* ---------- agent drawer ---------- */
.drawer { position: fixed; top: 48px; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .18s ease; display: flex; flex-direction: column; z-index: 40; }
.drawer.on { transform: none; }
@media (min-width: 1200px) {
  .app.docked { grid-template-columns: 216px minmax(0, 1fr) 400px; }
  .app.docked .drawer { position: static; transform: none; box-shadow: none; width: auto; grid-column: 3; grid-row: 2; min-height: 0; }
  .app:not(.docked) .drawer { display: none; }
}
.drawer-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { font-size: 14px; font-weight: 600; }
.drawer-h .x { margin-left: auto; }
.chat { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--sunk); }
.msg { max-width: 100%; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 10px 10px 2px 10px; max-width: 85%; }
.msg.bot { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 12px; box-shadow: var(--shadow); }
.msg.bot .who { font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.msg.bot p { margin: 4px 0; }
.msg.bot .act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg.sys { font-size: 11.5px; color: var(--ink-3); text-align: center; }
.steps-live { font-size: 12px; color: var(--ink-2); }
.steps-live div { padding: 2px 0; }
.steps-live div:before { content: "✓ "; color: var(--good); font-weight: 700; }
.steps-live div.run:before { content: "• "; color: var(--accent); }
.composer { border-top: 1px solid var(--line); padding: 10px; background: var(--surface); }
.composer .row { gap: 6px; }
.composer input[type=text] { flex: 1; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.suggest button { font-size: 11.5px; border: 1px solid var(--line-2); border-radius: 12px; padding: 3px 9px; color: var(--ink-2); background: var(--surface); text-align: left; }
.suggest button:hover { border-color: var(--accent); color: var(--accent); }
.leg { border: 1px solid var(--line); border-radius: 4px; padding: 9px 10px; margin-top: 8px; background: var(--surface); font-size: 12px; }
.leg h5 { font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.leg .meta { color: var(--ink-3); font-size: 11.5px; }

/* stepper */
.stepper { display: flex; gap: 0; margin: 4px 0 14px; overflow-x: auto; }
.stepper div { flex: 1; min-width: 92px; font-size: 11.5px; color: var(--ink-3); padding: 8px 6px 0; border-top: 3px solid var(--line); margin-right: 3px; }
.stepper div.done { border-top-color: var(--good); color: var(--ink-2); }
.stepper div.skip { border-top-style: dashed; color: var(--ink-3); }
.ck.w { background: var(--held-bg); color: var(--held); border: 1.5px solid var(--held); font-size: 9.5px; }
.waive-stamp { display: inline-block; margin-top: 5px; padding: 2px 7px; border: 1.5px solid var(--held); border-radius: 3px; color: var(--held); font: 600 10.5px var(--mono); letter-spacing: .02em; }
.waive-stamp span { font-family: var(--sans, inherit); font-weight: 400; letter-spacing: 0; }
.stepper div.cur { border-top-color: var(--accent); color: var(--ink); font-weight: 600; }
.stepper div.block { border-top-color: var(--risk); color: var(--risk); font-weight: 600; }

/* modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(20, 24, 31, .42); display: none; place-items: center; z-index: 60; padding: 20px; }
.scrim.on { display: grid; }
.modal { background: var(--surface); border-radius: 6px; box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { width: min(1000px, 100%); }
.modal-h { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 15px; font-weight: 600; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 16px; overflow: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--sunk); border-radius: 0 0 6px 6px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bar); color: #fff; padding: 9px 14px; border-radius: 4px; font-size: 12.5px; opacity: 0; transition: .18s; z-index: 80; pointer-events: none; box-shadow: var(--shadow-lg); }
.toast.on { opacity: 1; transform: translateX(-50%); }
.menu { position: fixed; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-lg); z-index: 70; min-width: 260px; padding: 4px; }
.menu button { display: flex; width: 100%; text-align: left; padding: 8px 10px; border-radius: 3px; gap: 10px; align-items: center; }
.menu button:hover { background: var(--sunk); }
.menu button small { display: block; color: var(--ink-3); font-size: 11.5px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.palette { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: min(620px, 94vw); z-index: 75; }
.palette input { width: 100%; height: 46px; font-size: 15px; border: 0; border-bottom: 1px solid var(--line); padding: 0 16px; outline: 0; border-radius: 6px 6px 0 0; }
.palette .res { max-height: 420px; overflow: auto; padding: 4px; }
.palette .res button { display: flex; width: 100%; gap: 10px; padding: 8px 12px; border-radius: 3px; text-align: left; align-items: center; }
.palette .res button.on, .palette .res button:hover { background: var(--accent-2); }
.palette .res .k { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); width: 64px; flex: none; text-transform: uppercase; }

/* receipt / print */
.doc { background: #fff; border: 1px solid var(--line); padding: 28px 32px; font-size: 12.5px; }
.doc h2 { font-size: 18px; margin: 6px 0 2px; }
.doc .docbar { display: flex; justify-content: space-between; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 14px; font: 600 11px var(--mono); letter-spacing: .08em; }
.stamp { display: inline-block; border: 2px solid var(--good); color: var(--good); font: 700 13px var(--mono); padding: 6px 12px; letter-spacing: .1em; transform: rotate(-3deg); }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3) { border-right: 0; }
  .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .g-side, .g-side-l, .g3 { grid-template-columns: 1fr; }
  .osp { grid-template-columns: 200px minmax(0, 1fr); }
  .osp-side { position: absolute; right: 0; top: 0; bottom: 0; width: 380px; box-shadow: var(--shadow-lg); }
  .osp-side:empty { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nav.open { display: flex; position: fixed; top: 48px; bottom: 0; left: 0; width: 240px; z-index: 50; box-shadow: var(--shadow-lg); }
  .brand { width: auto; border-right: 0; }
  .tenant span, .search, .role-btn div, .sample-chip { display: none; }
  .page { padding: 14px 16px 40px; }
  .g2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .osp { grid-template-columns: 1fr; }
  .osp-rail { display: none; }
  .osp-side { width: 100%; top: auto; height: 55%; }
}
@media print {
  body { overflow: visible; background: #fff; }
  .topbar, .nav, .drawer, .toast, .no-print { display: none !important; }
  .app { display: block; height: auto; }
  .main { overflow: visible; }
}
.strand.allocated { background: #e4eefa; border-color: #8db2dc; color: #123d6c; }
.strand.pending { background: var(--warn-bg); border: 1px dashed var(--warn); color: var(--warn); }
.strand.flag { box-shadow: inset 0 -3px 0 var(--warn); }
.strand.unknown { background: var(--muted-bg); }
.osp.nosel { grid-template-columns: 200px minmax(0, 1fr) 0; }
.osp.nosel .osp-side { display: none; }
.osp-stage { user-select: none; -webkit-user-select: none; }

/* sign-in gate = the landing page: sign-in on the left, a slow text carousel on the right */
body.on-gate { overflow: auto; background: var(--surface); }
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); font-size: 14.5px; }
.auth-split { flex: 1 0 auto; display: flex; flex-wrap: wrap; align-items: stretch; }
.auth-side { flex: 0 1 560px; min-width: 300px; box-sizing: border-box; padding: 56px clamp(24px, 6vw, 88px); display: flex; flex-direction: column; justify-content: center; gap: 36px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font: 600 13px var(--sans); letter-spacing: .16em; color: var(--ink); }
.auth-brand .brand-logo { width: 36px; height: 36px; }
.auth-brand .wordmark { font-size: 14px; }
.auth-body { max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth-body h1, .auth-body h2 { margin: 0; font-size: 26px; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; }
.auth-body p { margin: 0; line-height: 1.5; }
.auth-body .lead { color: var(--ink-2); }
.auth-body .note { font-size: 13px; color: var(--ink-3); }
.auth-body .lbl { font-size: 13px; font-weight: 500; color: var(--ink); margin: 0 0 6px; display: block; }
.auth-body .field { height: 44px; font-size: 15px; padding: 0 12px; }
.auth-body textarea.field { height: auto; padding: 10px 12px; }
.auth-body .btn.primary { height: 44px; font-size: 15px; }
.auth-new { max-width: 400px; border-top: 1px solid var(--line); padding-top: 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.auth-new p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.linkbtn { color: var(--accent); font-weight: 500; font-size: 14px; min-height: 28px; padding: 0; }
.linkbtn:hover { color: var(--accent-ink); text-decoration: underline; }

.auth-show { flex: 999 1 480px; min-height: 560px; position: relative; overflow: hidden; background: var(--bar); color: #e9ecf1; display: flex; flex-direction: column; }
.auth-show .traces { position: absolute; left: 0; bottom: 0; width: min(640px, 70%); height: auto; pointer-events: none; }
.slides { position: relative; flex: 1 1 auto; margin: 0 clamp(32px, 7vw, 112px); min-height: 440px; }
.slide { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 24px; opacity: 0; visibility: hidden; transform: translateX(48px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.7,.2,1), visibility 0s linear 700ms; }
.slide.before { transform: translateX(-48px); }
.slide.on { opacity: 1; visibility: visible; transform: none; transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.7,.2,1), visibility 0s; }
.slide .eyebrow { margin: 0; font: 500 12px var(--mono); letter-spacing: .16em; color: #9aa3b0; }
.slide h2 { margin: 0; font-size: clamp(34px, 3.6vw, 52px); font-weight: 400; line-height: 1.1; letter-spacing: -.015em; color: #fff; max-width: 640px; }
.slide p { margin: 0; font-size: 17px; line-height: 1.55; color: #9aa3b0; max-width: 540px; }
.slide .big-mark { width: 132px; height: 132px; }
.slide .big-word { font-size: 30px; letter-spacing: .3em; white-space: nowrap; color: #fff; }
.slide .rules { list-style: none; margin: 0; padding: 0; max-width: 520px; border-top: 1px solid #2b313b; }
.slide .rules li { display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid #2b313b; font-size: 16px; color: #e9ecf1; }
.slide .rules span { font: 500 13px var(--mono); color: #9aa3b0; padding-top: 2px; }
.dots { position: relative; display: flex; gap: 4px; padding: 0 clamp(20px, 6vw, 100px) 40px; }
.dots button { width: 44px; height: 44px; display: grid; place-items: center; }
.dots button i { display: block; width: 14px; height: 3px; border-radius: 2px; background: #4a525e; transition: width 300ms ease, background 300ms ease; }
.dots button[aria-current="true"] i { width: 28px; background: #e9ecf1; }
.dots button:focus-visible { outline: 2px solid #e9ecf1; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .slide, .slide.on, .dots button i { transition: none; } }

.auth-foot { border-top: 1px solid var(--line); padding: 16px clamp(24px, 6vw, 88px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; font-size: 12.5px; color: var(--ink-3); }
.auth-foot nav { display: flex; flex-wrap: wrap; gap: 20px; }
.auth-foot a { color: var(--ink-2); }

/* briefing request (a native <dialog>: focus, Escape and the backdrop come with it) */
.brief { margin: auto; width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 6px; box-shadow: var(--shadow-lg); color: var(--ink); }
.brief::backdrop { background: rgba(21, 25, 31, .6); }
.brief-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 28px 32px 0; }
.brief-head h2 { margin: 0 0 6px; font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.brief-head p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.brief-x { flex: none; width: 44px; height: 44px; margin: -8px -12px 0 0; border-radius: var(--radius); display: grid; place-items: center; color: var(--ink-2); }
.brief-x:hover { background: var(--bg); }
.brief form, .brief .brief-done { display: flex; flex-direction: column; gap: 16px; padding: 24px 32px 28px; position: relative; }
.brief .row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.brief .lbl { font-size: 13px; font-weight: 500; margin: 0 0 6px; display: block; }
.brief .lbl small { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.brief .field { width: 100%; height: 44px; font-size: 15px; padding: 0 12px; }
.brief textarea.field { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.brief .help { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.brief .hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.brief .acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.brief .acts .btn { height: 44px; padding: 0 18px; font-size: 15px; }
.brief .err { color: var(--risk); font-size: 13px; margin: 0; }

/* change condition forms */
.scope-h { font: 600 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.scope-h:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.field:disabled { background: var(--muted-bg); color: var(--ink-2); }

/* ball in court */
.bic { display: inline-block; font-size: 12px; color: var(--ink-2); }
.bic.me { color: var(--accent-ink); font-weight: 600; }
.bic.late { color: var(--risk); font-weight: 600; }

/* form footer and workplan upload */
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.wp-up { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; background: var(--muted-bg); }
.net-tbl td, .net-tbl th { padding: 4px 5px; }
.net-tbl select.field { max-width: 150px; }
/* agent: what the next question refers to (Copilot-style pill above the chat box) */
.ctx { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; min-height: 22px; }
.ctx-pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 4px 2px 8px; border: 1px solid #c9d8ea; background: var(--accent-2); color: var(--accent-ink); border-radius: 12px; font-size: 11.5px; }
.ctx-pill svg { width: 12px; height: 12px; flex: none; }
.ctx-pill a { color: inherit; font-weight: 600; font-size: 11px; }
.ctx-pill .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ctx-pill button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--accent-ink); }
.ctx-pill button:hover { background: #d4e3f5; }
.ctx-pill button svg { width: 10px; height: 10px; }
.ctx-add { font-size: 11.5px; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: 12px; padding: 2px 9px; }
.ctx-add:hover { color: var(--accent); border-color: var(--accent); }
.msg.bot .about { margin: -2px 0 6px; }
