/* Nexus FAA console — dark forensic workstation theme with light mode */
:root {
  --bg: #0a0f1a; --bg2: #0f1626; --panel: #121a2c; --panel2: #172036; --line: #23304a; --line2: #2d3b59;
  --fg: #e6ebf5; --fg2: #a9b4c8; --fg3: #6f7d96; --brand: #3b82f6; --brand2: #22d3ee;
  --crit: #f43f5e; --high: #f97316; --med: #eab308; --low: #38bdf8; --info: #64748b; --ok: #22c55e;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px; --shadow: 0 10px 30px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  --bg: #f4f6fb; --bg2: #eef1f8; --panel: #ffffff; --panel2: #f7f9fd; --line: #e1e6f0; --line2: #cfd7e6;
  --fg: #0f172a; --fg2: #475569; --fg3: #7b879c; --shadow: 0 10px 30px rgba(15,23,42,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(59,130,246,.35); }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: radial-gradient(circle at 30% 30%, var(--brand2), var(--brand)); display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: -.5px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { color: var(--fg3); font-size: 11px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--fg2); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--fg); text-decoration: none; }
.nav a.on { background: rgba(59,130,246,.14); color: var(--fg); box-shadow: inset 2px 0 0 var(--brand); }
.nav .sec { color: var(--fg3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; padding: 14px 12px 4px; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side .who { border-top: 1px solid var(--line); padding: 12px 14px; font-size: 12px; color: var(--fg2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side .who b { color: var(--fg); display: block; font-size: 13px; }
.main { min-width: 0; }
.top { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 16px; margin: 0; font-weight: 650; }
.crumbs { color: var(--fg3); font-size: 12px; }
.content { padding: 22px 24px 60px; max-width: 1600px; }

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card > .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card > .hd select { max-width: 210px; }
.card > .hd h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.card > .bd { padding: 14px 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.kpi { padding: 16px; }
.kpi .v { font-size: 26px; font-weight: 750; letter-spacing: -.5px; }
.kpi .l { color: var(--fg3); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.muted { color: var(--fg3); }
.small { font-size: 12px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 550; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { filter: brightness(1.1); }
.btn.danger { color: var(--crit); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=datetime-local], input[type=number], select, textarea {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
textarea { width: 100%; min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--fg2); }
label.f input, label.f select, label.f textarea { width: 100%; }
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: 1fr 1fr; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--fg3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: var(--panel2); }
table.t tr.sel td { background: rgba(59,130,246,.10); }
.tl td.desc { font-family: var(--mono); font-size: 12px; word-break: break-word; }
.tl td.ts { white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--fg2); }
.scroll { overflow: auto; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; border: 1px solid var(--line2); color: var(--fg2); white-space: nowrap; }
.sev { color: #fff; border: 0; text-transform: uppercase; letter-spacing: .4px; font-size: 10.5px; }
.sev.critical { background: var(--crit); } .sev.high { background: var(--high); } .sev.medium { background: var(--med); color: #1a1a1a; }
.sev.low { background: var(--low); color: #04202e; } .sev.info { background: var(--info); }
.st-analyzed { color: var(--ok); border-color: rgba(34,197,94,.4); } .st-failed { color: var(--crit); border-color: rgba(244,63,94,.4); }
.st-processing, .st-queued { color: var(--brand2); border-color: rgba(34,211,238,.4); }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line2); cursor: pointer; font-size: 12px; }
.chip.on { background: rgba(59,130,246,.18); border-color: var(--brand); }
.chip .n { color: var(--fg3); font-family: var(--mono); font-size: 11px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--fg2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--brand); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand2)); }
.sevbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--line); }
.sevbar i { display: block; height: 100%; }
pre.json { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; max-height: 420px; font: 12px/1.45 var(--mono); margin: 0; white-space: pre-wrap; word-break: break-word; }
.hash { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--fg2); }
.empty { padding: 40px; text-align: center; color: var(--fg3); }
.finding { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; }
.finding:last-child { border-bottom: 0; }
.finding h4 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.finding .meta { font-size: 11.5px; color: var(--fg3); }
.finding .desc { font-size: 12.5px; color: var(--fg2); margin-top: 6px; white-space: pre-wrap; word-break: break-word; max-height: 140px; overflow: auto; font-family: var(--mono); }
.attack { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.attack .col h5 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--fg3); padding: 6px 8px; background: var(--panel2); border-radius: 6px; }
.attack .tech { border-radius: 7px; padding: 7px 9px; margin-bottom: 6px; font-size: 12px; border: 1px solid var(--line2); background: var(--panel); }
.attack .tech b { display: block; font-family: var(--mono); font-size: 11px; }
.attack .tech.critical { border-color: var(--crit); box-shadow: inset 3px 0 0 var(--crit); } .attack .tech.high { box-shadow: inset 3px 0 0 var(--high); }
.attack .tech.medium { box-shadow: inset 3px 0 0 var(--med); } .attack .tech.low { box-shadow: inset 3px 0 0 var(--low); }
.drop { border: 2px dashed var(--line2); border-radius: 12px; padding: 26px; text-align: center; color: var(--fg2); transition: .15s; cursor: pointer; }
.drop.over { border-color: var(--brand); background: rgba(59,130,246,.06); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 96vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s; }
.drawer.open { transform: none; }
.drawer .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer .bd { padding: 16px 18px; overflow: auto; flex: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(2,6,15,.6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(620px, 100%); max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .hd h3 { margin: 0; font-size: 15px; }
.modal .bd { padding: 16px 18px; }
.modal .ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel); border: 1px solid var(--line2); border-left: 4px solid var(--brand); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; font-size: 13px; }
.toast.err { border-left-color: var(--crit); } .toast.ok { border-left-color: var(--ok); }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: radial-gradient(1200px 600px at 10% 20%, rgba(59,130,246,.25), transparent), radial-gradient(700px 500px at 90% 90%, rgba(34,211,238,.18), transparent), var(--bg2); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); }
.login .art h2 { font-size: 40px; line-height: 1.1; margin: 0 0 14px; letter-spacing: -1px; }
.login .art p { color: var(--fg2); max-width: 520px; }
.login .art ul { color: var(--fg2); padding-left: 18px; line-height: 1.9; }
.login .box { display: grid; place-items: center; padding: 30px; }
.login form { width: min(380px, 100%); }
.histo { display: flex; align-items: flex-end; gap: 1px; height: 70px; padding: 4px 0; }
.histo i { flex: 1; background: var(--brand); opacity: .55; min-height: 1px; border-radius: 2px 2px 0 0; position: relative; cursor: pointer; }
.histo i.a { background: var(--high); opacity: .85; }
.histo i:hover { opacity: 1; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--fg3); }
.ledger { border-left: 2px solid var(--line2); margin-left: 6px; padding-left: 14px; }
.ledger .e { position: relative; padding: 0 0 12px; font-size: 12.5px; }
.ledger .e::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--panel); }
.ledger .e .h { font-family: var(--mono); font-size: 10.5px; color: var(--fg3); }
.star { cursor: pointer; color: var(--fg3); font-size: 16px; line-height: 1; background: none; border: 0; padding: 0; }
.star.on { color: #fbbf24; }
.tree { padding-left: 18px; border-left: 1px dashed var(--line2); margin-left: 8px; }
@media (max-width: 1100px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .nav { flex-direction: row; overflow-x: auto; } .nav .sec { display: none; }
  .g2, .g3, .g4, .g5, .form.cols { grid-template-columns: 1fr; } .login { grid-template-columns: 1fr; } .login .art { display: none; }
  .content { padding: 16px; } .finding { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- 2.0 additions */
.err { color: var(--crit); }
.banner { background: rgba(234,179,8,.14); border: 1px solid rgba(234,179,8,.45); color: var(--fg); padding: 8px 14px; border-radius: 8px; margin: 10px 24px 0; font-size: 13px; }
.login .banner { margin: 0 0 10px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.linkbtn:hover { text-decoration: underline; }
button.pill.linkbtn { color: var(--fg2); border: 1px solid var(--line2); padding: 1px 8px; }
button.tech { display: block; width: 100%; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.btn.busy { opacity: .6; pointer-events: none; }
:root.compact table.t td, :root.compact table.t th { padding: 4px 8px; }
:root.compact .content { padding: 14px 16px 40px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
legend { color: var(--fg2); font-size: 12px; padding: 0 6px; }
h4 { margin: 16px 0 8px; font-size: 13px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(59,130,246,.35); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
.setnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 70px; }
.setnav a { padding: 7px 12px; border-radius: 8px; color: var(--fg2); }
.setnav a.on { background: rgba(59,130,246,.14); color: var(--fg); box-shadow: inset 2px 0 0 var(--brand); }
.setting { display: grid; grid-template-columns: 1fr 340px; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: center; }
.setting:last-child { border-bottom: 0; }
.setting-in { display: flex; gap: 10px; align-items: center; }
.setting-in input:not([type=checkbox]):not([type=color]), .setting-in select, .setting-in textarea { width: 100%; }
h4.grp { margin: 18px 0 4px; padding-top: 10px; border-top: 1px solid var(--line2); display: flex; align-items: center; gap: 10px; }
h4.grp:first-child { border-top: 0; margin-top: 0; }
.chart { width: 100%; height: auto; }
.chart .ax { fill: var(--fg3); font-size: 9px; }
.chart .dv, svg .dv { fill: var(--fg); font-size: 18px; font-weight: 700; }
.hbars { display: flex; flex-direction: column; gap: 5px; }
.hb { display: grid; grid-template-columns: 150px 1fr 90px; gap: 8px; align-items: center; font-size: 12px; }
.hb .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb .b { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.hb .b i { display: block; height: 100%; border-radius: 99px; }
.hb .v { text-align: right; color: var(--fg2); font-family: var(--mono); font-size: 11.5px; }
svg.graph { width: 100%; height: auto; background: var(--bg2); border-radius: 0 0 var(--r) var(--r); }
svg.graph line { stroke: var(--line2); stroke-opacity: .8; }
svg.graph text { fill: var(--fg2); font-size: 10px; pointer-events: none; }
svg.graph .gn { cursor: pointer; } svg.graph .gn:focus circle, svg.graph .gn:hover circle { stroke: var(--fg); stroke-width: 2; }
svg.geo { width: 100%; height: auto; background: var(--bg2); border-radius: 8px; }
svg.geo .grid line { stroke: var(--line); } svg.geo .grid text { fill: var(--fg3); font-size: 9px; }
svg.geo .pt { fill: var(--brand2); stroke: var(--bg); stroke-width: 1; } svg.geo .pt.cell_site { fill: var(--high); } svg.geo .pt.photo_exif { fill: #a78bfa; }
svg.geo .cl { fill: rgba(59,130,246,.10); stroke: var(--brand); stroke-dasharray: 4 3; }
svg.geo .pth { fill: none; stroke: var(--brand); stroke-width: 1.5; stroke-opacity: .7; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; }
.gallery img { width: 100%; height: 140px; object-fit: cover; display: block; transition: filter .2s; }
.gallery.blur figure:not(.reveal) img { filter: blur(14px) grayscale(.6); }
.gallery figcaption { padding: 6px 8px; word-break: break-all; }
.gallery .noimg { height: 140px; display: grid; place-items: center; color: var(--fg3); }
.aria .bd#chat { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.msg.user { align-self: flex-end; background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.35); }
.msg .who { font-size: 11px; color: var(--fg3); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.msg .txt { white-space: pre-wrap; word-break: break-word; }
.msg .cites { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.qr svg { width: 168px; height: 168px; background: #fff; border-radius: 6px; }
.label-print { display: flex; gap: 16px; align-items: center; }
@media print {
  body > *:not(.modal-bg) { display: none !important; }
  .modal-bg { position: static; background: none; } .modal { box-shadow: none; border: 0; } .modal .hd, .modal .ft { display: none; }
  .label-print { color: #000; }
}
@media (max-width: 1100px) { .settings { grid-template-columns: 1fr; } .setnav { flex-direction: row; overflow-x: auto; position: static; } .setting { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 2.1 mobile workspace */
.convo { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 12px; align-items: start; }
.threads { max-height: 640px; overflow: auto; display: flex; flex-direction: column; }
.thread { text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; color: var(--fg); display: grid; gap: 3px; }
.thread:hover, .thread.on { background: var(--panel2); }
.chatlog { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow: auto; }
.chatlog .tr:empty { display: none; }
.callrow { align-self: center; }
@media (max-width: 860px) { .convo { grid-template-columns: 1fr; } }
.chk { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 3px 0; }
fieldset.f { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; } fieldset.f legend { font-size: 12px; color: var(--fg3); padding: 0 4px; }
