/* DFS Forge console. Portal palette (brand-guide.md: Portal blue #2563eb on navy rail), Poppins. */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #eef2f9; --border: #e1e6f0;
  --text: #131a2d; --text-2: #4a5068; --text-3: #6f7690;
  --accent: #2563eb; --accent-soft: #e5edfe; --accent-ink: #ffffff;
  --rail: #1f2538; --rail-2: #2c3450; --rail-text: #cdd5e8; --rail-muted: #929cb8;
  --good: #0c9466; --good-soft: #e1f5ec; --warn: #b26e00; --warn-soft: #fcf0d8; --bad: #d23a3a; --bad-soft: #fce6e6;
  --map-land: #e7ecf5; --map-line: #ffffff; --scrim: rgba(12, 19, 39, .45);
  --font-ui: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0a0f1d; --surface: #111a2d; --surface-2: #172138; --border: #222d48;
  --text: #e7ebf5; --text-2: #b0b9cf; --text-3: #8a94b0;
  --accent: #5b8cff; --accent-soft: #1a2a51; --accent-ink: #0a0f1d;
  --rail: #1f2538; --rail-2: #2c3450;
  --good: #3ccf95; --good-soft: #10342a; --warn: #f0b443; --warn-soft: #382a0d; --bad: #f36d6d; --bad-soft: #3b1718;
  --map-land: #1b2540; --map-line: #0a0f1d; --scrim: rgba(0, 0, 0, .6); color-scheme: dark;
} }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 12px; }
a { color: var(--accent); }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 22px; height: 22px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card { display: grid; place-items: center; min-height: 220px; }
.load-error { color: var(--bad); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.signin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.signin-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 600; }
.signin-card p { margin: 0; color: var(--text-2); }
.signin-msg { color: var(--bad) !important; font-size: 13px; min-height: 1em; }

.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; gap: 24px; padding: 22px 16px 22px max(16px, env(safe-area-inset-left, 0px)); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding-inline: 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #2563eb, #7c3aed); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-mark.big { width: 48px; height: 48px; border-radius: 12px; }
.brand-mark.big svg { width: 24px; height: 24px; }
.brand b { font-weight: 600; font-size: 15px; color: #fff; display: block; line-height: 1.2; }
.brand span { font-size: 11px; color: var(--rail-muted); letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--rail-text); text-align: left; font-size: 13.5px; white-space: nowrap; }
.nav button svg { width: 17px; height: 17px; flex: none; opacity: .75; }
.nav button:hover { background: var(--rail-2); }
.nav button[aria-current="page"] { background: var(--rail-2); color: #fff; box-shadow: inset 2px 0 0 #5b8cff; }
.nav .count { margin-left: auto; background: #f59e0b; color: #1a1300; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12px; padding-inline: 6px; color: var(--rail-muted); overflow-wrap: anywhere; }
.link-btn { border: 0; background: none; padding: 0; color: #9db8ff; text-align: left; font-size: 12px; }

.main { min-width: 0; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px clamp(0px, 2vw, 16px) 0; display: flex; flex-direction: column; gap: 16px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.card .sub { margin: 0 0 14px; color: var(--text-3); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-map { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi .foot { font-size: 12.5px; color: var(--text-2); }
.kpi button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; font-size: 12.5px; text-align: left; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 99px; white-space: nowrap; line-height: 18px; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.mute { background: var(--surface-2); color: var(--text-2); }
.filter { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; color: var(--text-2); }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter .num { opacity: .7; margin-left: 4px; }
select, input[type="text"], input[type="search"], input[type="number"], textarea {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
textarea { width: 100%; resize: vertical; min-height: 60px; }
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 500; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }

.table-wrap { overflow-x: auto; margin-inline: -18px; padding-inline: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 500; padding: 0 12px 10px 0; white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--surface-2); }
.biz b { display: block; font-weight: 500; }
.biz span, .muted { color: var(--text-3); font-size: 12px; }
.score { display: inline-flex; align-items: center; gap: 8px; }
.score svg { width: 26px; height: 26px; }
.empty { color: var(--text-3); padding: 20px 0; }

/* Map */
.map { position: relative; }
.map svg { width: 100%; height: auto; display: block; }
.map .state { fill: var(--map-land); stroke: var(--map-line); stroke-width: .8; }
.map .dot { cursor: pointer; stroke: var(--surface); stroke-width: 1.5; transition: r .15s; }
.map .dot.on { fill: var(--good); }
.map .dot.manual { fill: var(--accent); }
.map .dot.new { fill: var(--surface); stroke: var(--text-3); stroke-width: 2; stroke-dasharray: 3 2; }
.map .dot:hover, .map .dot:focus { stroke: var(--text); stroke-width: 2; outline: none; }
.map-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.4; max-width: 240px; transform: translate(-50%, calc(-100% - 12px)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .on { background: var(--good); } .legend .manual { background: var(--accent); }
.legend .new { border: 2px dashed var(--text-3); width: 11px; height: 11px; }
.state-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.state-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.state-row .bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.state-row .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Drawer, modal, toast */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: var(--surface); z-index: 41; overflow-y: auto; border-left: 1px solid var(--border);
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.drawer-head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.x { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.x svg { width: 16px; height: 16px; }
.sect h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 500; margin: 0 0 8px; }
.signal { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-size: 14px; font-weight: 500; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.decide { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; margin-top: auto; }
.decide .chip-row { justify-content: flex-end; }
.modal { position: fixed; z-index: 42; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100% - 32px)); background: var(--surface); border-radius: 14px; border: 1px solid var(--border); padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; max-width: calc(100% - 32px); }
.toast.err { background: var(--bad); color: #fff; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-3); }
.form-msg { font-size: 13px; color: var(--bad); min-height: 1em; margin: 8px 0 0; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 99px; border: 0; background: var(--border); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

@media (max-width: 1020px) { .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-map { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; height: auto; z-index: 20; flex-direction: row; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .brand span, .rail-foot { display: none; }
  .nav { flex-direction: row; overflow-x: auto; min-width: 0; scrollbar-width: none; }
  .nav button svg { display: none; }
  .nav button[aria-current="page"] { box-shadow: inset 0 -2px 0 #5b8cff; }
}
@media (max-width: 460px) {
  .card { padding: 14px; }
  .table-wrap { margin-inline: -14px; padding-inline: 14px; }
  .kpi .value { font-size: 24px; }
  .kpi .label { font-size: 10.5px; }
}
@media (max-width: 330px) { .g-kpi { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  /* No spinning: a static ring that gently fades still reads as "working". */
  .spinner { animation: fade 1.6s ease-in-out infinite alternate; }
  @keyframes fade { from { opacity: 1; } to { opacity: .35; } }
}
