/* ===========================================================================
   North Pole Hosting Services / SantaGPT-9000
   Modern AI-SaaS dashboard x light Scandinavian Christmas.
   All assets local. No external fonts or CDNs.
   ========================================================================== */

:root {
  --bg:        #fbf6ee;
  --bg-2:      #f3ece0;
  --surface:   #fffdf9;
  --surface-2: #fbf7f0;
  --ink:       #26201a;
  --ink-soft:  #6b5f52;
  --line:      #e7ddcc;

  --green:     #1e6f3c;
  --green-d:   #14532d;
  --green-l:   #e6f1ea;
  --red:       #c0392b;
  --red-d:     #9c2b20;
  --red-l:     #fbeae8;
  --gold:      #c79a3a;
  --gold-l:    #f7eccb;

  --hi:        #d4af37;
  --sev-high:  #c0392b;
  --sev-med:   #d98324;
  --sev-low:   #2f80c4;
  --sev-info:  #7a8a99;

  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(40,30,20,.05), 0 8px 24px rgba(40,30,20,.07);
  --shadow-lg: 0 12px 40px rgba(40,30,20,.16);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "Consolas", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, #fff 0%, var(--bg) 55%),
              var(--bg);
  overflow: hidden;
}
a { color: var(--red); }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.2; }
button { font-family: inherit; }

#snow { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---------- layout ---------- */
.app { position: relative; z-index: 1; display: grid;
  grid-template-columns: 248px 1fr; grid-template-rows: 60px 1fr;
  grid-template-areas: "brand topbar" "nav main"; height: 100vh; }

.brand { grid-area: brand; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; background: var(--green-d); color: #fff;
  border-right: 1px solid rgba(0,0,0,.1); }
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand b { font-size: 15px; letter-spacing: .2px; display:block; }
.brand small { color: #bfe3cd; font-size: 10.5px; letter-spacing: .3px; }

.topbar { grid-area: topbar; display: flex; align-items: center; gap: 14px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow); }
.ticker { flex: 1; overflow: hidden; white-space: nowrap; color: var(--ink-soft);
  font-size: 12.5px; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker span { display: inline-block; padding-left: 100%; animation: scroll 26s linear infinite; }
.ticker b { color: var(--green); }
@keyframes scroll { to { transform: translateX(-100%); } }

.pill { font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px var(--green-l); }
.pill.warn { color: var(--red-d); border-color: #f0cfc9; background: var(--red-l); }
.pill.warn .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-l); }
.pill.gold { color: #8a6a12; border-color: var(--gold); background: var(--gold-l); }

/* ---------- nav ---------- */
.nav { grid-area: nav; background: var(--surface); border-right: 1px solid var(--line);
  padding: 14px 10px; overflow-y: auto; }
.nav h5 { color: var(--ink-soft); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .8px; margin: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-s); color: var(--ink); text-decoration: none;
  font-size: 13.5px; font-weight: 500; cursor: pointer; margin-bottom: 2px; }
.nav a .ic { width: 18px; text-align: center; opacity: .8; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--green-l); color: var(--green-d); font-weight: 600; }
.nav a .badge { margin-left: auto; font-size: 10.5px; background: var(--red);
  color: #fff; border-radius: 999px; padding: 1px 7px; }

.fairplay { margin: 16px 8px 4px; padding: 11px 12px; border: 1px dashed var(--gold);
  background: var(--gold-l); border-radius: var(--radius-s); font-size: 11px;
  color: #7a5e18; line-height: 1.5; }
.fairplay b { display: block; color: #8a6a12; letter-spacing: .4px; margin-bottom: 4px; }

/* ---------- main ---------- */
.main { grid-area: main; overflow-y: auto; padding: 22px 26px 60px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.page-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px)  { .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { margin-left: auto; font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.card .muted { color: var(--ink-soft); font-size: 12.5px; }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .num { font-size: 30px; font-weight: 700; color: var(--green-d); line-height: 1; }
.kpi .lbl { color: var(--ink-soft); font-size: 12px; }
.kpi .num.red { color: var(--red); }
.kpi .num.gold { color: var(--gold); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius-s); font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: .12s; }
.btn:hover { border-color: var(--green); color: var(--green-d); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: var(--green-d); color: #fff; }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); }
.btn.red:hover { background: var(--red-d); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 22px; right: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--green-d); color: #fff; padding: 11px 16px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 13px; animation: pop .2s ease; max-width: 340px; }
.toast.err { background: var(--red-d); }
.toast.gold { background: #8a6a12; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ---------- files / editor ---------- */
.editor-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.filelist { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; height: 540px;
  display: flex; flex-direction: column; }
.filelist .hd { padding: 11px 13px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-soft); display:flex; align-items:center; }
.filelist ul { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.filelist li { padding: 7px 10px; border-radius: 7px; font-size: 12.5px; cursor: pointer;
  font-family: var(--mono); display: flex; align-items: center; gap: 7px; }
.filelist li:hover { background: var(--surface-2); }
.filelist li.active { background: var(--green-l); color: var(--green-d); font-weight: 600; }
.filelist li .x { margin-left: auto; opacity: 0; color: var(--red); }
.filelist li:hover .x { opacity: .7; }

.editor { background: #1f2a24; border: 1px solid var(--green-d); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; height: 540px; display: flex; flex-direction: column; }
.editor .bar { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: #18211c; border-bottom: 1px solid #0d130f; }
.editor .bar .fname { font-family: var(--mono); color: #cfe8d8; font-size: 12.5px; }
.editor .bar .dots { display: flex; gap: 6px; }
.editor .bar .dots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.editor .bar .spacer { flex: 1; }
.code-area { position: relative; flex: 1; overflow: auto; }
.code-area textarea, .code-area pre {
  margin: 0; padding: 12px 14px 12px 52px; font-family: var(--mono);
  font-size: 13px; line-height: 1.55; tab-size: 2; white-space: pre; overflow-wrap: normal;
  border: 0; }
.code-area pre { position: absolute; inset: 0; pointer-events: none; color: #e8f2ec;
  background: transparent; }
.code-area textarea { position: absolute; inset: 0; width: 100%; height: 100%;
  resize: none; background: transparent; color: transparent; caret-color: #fff;
  outline: none; }
.code-area .gutter { position: absolute; left: 0; top: 0; width: 42px; padding: 12px 6px;
  text-align: right; color: #5c7366; font-family: var(--mono); font-size: 13px;
  line-height: 1.55; user-select: none; border-right: 1px solid #0d130f; background: #18211c; }

/* syntax tokens */
.tok-tag { color: #7fd1a0; } .tok-attr { color: #e6c565; }
.tok-str { color: #e79a86; } .tok-com { color: #6d8778; font-style: italic; }
.tok-kw { color: #7fb2e6; } .tok-num { color: #d7a0e6; }
.tok-punct { color: #9fb3a8; }

/* ---------- forms ---------- */
label.fld { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft);
  margin: 12px 0 5px; }
input[type=text], input[type=number], select, textarea.inp {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-s);
  font-size: 13px; font-family: var(--font); background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-l); border-color: var(--green); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > * { flex: 1; min-width: 120px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; background: var(--line);
  border-radius: 999px; position: relative; cursor: pointer; transition: .15s; flex: none; }
.switch input:checked { background: var(--green); }
.switch input::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 2px; left: 2px; transition: .15s; }
.switch input:checked::after { left: 20px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--mono); font-size: 12px; }
.tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.tag.sys { background: var(--bg-2); color: var(--ink-soft); }
.tag.scope-in { background: var(--green-l); color: var(--green-d); }
.tag.scope-restricted { background: var(--red-l); color: var(--red-d); }
.tag.scope-out { background: #eef1f4; color: #5a6b7a; }

/* ---------- assessment ---------- */
.assess-head { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.progress { height: 12px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress > i { display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green), var(--gold)); transition: width .4s ease; }
.phases { list-style: none; margin: 10px 0 0; padding: 0; }
.phases li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--ink-soft); }
.phases li .ph-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 11px; flex: none; }
.phases li.done { color: var(--ink); }
.phases li.done .ph-dot { background: var(--green); border-color: var(--green); color: #fff; }
.phases li.active { color: var(--green-d); font-weight: 600; }
.phases li.active .ph-dot { border-color: var(--green); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px var(--green-l); } }

.feed { background: #11160f; border-radius: var(--radius); padding: 12px 14px; height: 300px;
  overflow-y: auto; font-family: var(--mono); font-size: 12px; color: #bfe3cd; line-height: 1.55; }
.feed div { padding: 1px 0; }
.feed .ph { color: #e6c565; }
.feed .brag { color: #ff9f8a; }

.confidence { text-align: center; }
.confidence .gauge { font-size: 46px; font-weight: 800; color: var(--green); }
.confidence .sub { color: var(--ink-soft); font-size: 12px; }

/* ---------- donut ---------- */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.legend { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }
.legend b { margin-left: auto; }

/* ---------- findings ---------- */
.finding { border: 1px solid var(--line); border-left: 4px solid var(--sev-info);
  border-radius: var(--radius-s); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.finding.high { border-left-color: var(--sev-high); }
.finding.medium { border-left-color: var(--sev-med); }
.finding.low { border-left-color: var(--sev-low); }
.finding .ttl { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 13.5px; }
.sev { font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 2px 8px;
  border-radius: 999px; color: #fff; letter-spacing: .4px; }
.sev.high { background: var(--sev-high); } .sev.medium { background: var(--sev-med); }
.sev.low { background: var(--sev-low); } .sev.info { background: var(--sev-info); }
.finding .desc { font-size: 12.5px; color: var(--ink); margin: 6px 0; }
.finding .ev { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: var(--ink-soft);
  white-space: pre-wrap; word-break: break-all; }
.finding .rec { font-size: 12px; color: var(--green-d); margin-top: 6px; }

/* ---------- traffic inspector ---------- */
.ti { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; height: 560px; }
.ti .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.ti .toolbar { padding: 10px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.ti .toolbar input { flex: 1; min-width: 120px; }
.ti .toolbar select { flex: none; width: auto; }
.ti .rows { overflow-y: auto; flex: 1; }
.ti table td { cursor: pointer; }
.ti tr.sel td { background: var(--green-l); }
.ti tr.vault td { background: var(--red-l); }
.status-pill { font-family: var(--mono); font-weight: 700; }
.s2 { color: var(--green); } .s3 { color: var(--sev-low); } .s4 { color: var(--sev-med); }
.s5 { color: var(--red); } .sx { color: var(--ink-soft); }
.vdot { font-weight: 700; }
.vok { color: var(--green); } .vblock { color: var(--red); }

.ti .detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-y: auto; padding: 16px; }
.ti .detail h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft);
  margin: 16px 0 6px; }
.ti .detail h4:first-child { margin-top: 0; }
.kv-table { font-family: var(--mono); font-size: 11.5px; }
.kv-table .k { color: var(--green-d); }
pre.body { background: #11160f; color: #cfe8d8; font-family: var(--mono); font-size: 11.5px;
  padding: 11px; border-radius: 8px; overflow: auto; max-height: 240px; white-space: pre-wrap; word-break: break-word; }
.netev { font-family: var(--mono); font-size: 11px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.netev .k-DNS { color: var(--sev-low); } .netev .k-SCOPE { color: var(--gold); }
.netev .k-PROXY { color: var(--green); } .netev .k-BLOCK { color: var(--red); font-weight: 700; }

/* ---------- docs / log ---------- */
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 26px; max-width: 820px; line-height: 1.65; font-size: 14px; }
.doc h1 { font-size: 20px; color: var(--green-d); } .doc h2,.doc h3 { color: var(--green-d); margin-top: 1.2em; }
.doc code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.doc pre { background: #11160f; color: #cfe8d8; padding: 12px; border-radius: 8px; overflow: auto; }
.doc table { margin: 10px 0; } .doc blockquote { border-left: 3px solid var(--gold); margin: 1em 0;
  padding: .3em 1em; color: var(--ink-soft); background: var(--gold-l); border-radius: 0 8px 8px 0; }
.doc-tabs { display: flex; gap: 8px; margin-bottom: 14px; }

.logrow { display: grid; grid-template-columns: 150px 130px 1fr; gap: 10px; font-size: 12px;
  padding: 7px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.logrow .cat { font-weight: 700; } .logrow .ts { color: var(--ink-soft); }
.cat-website_change,.cat-http_config_change,.cat-dns_change { color: var(--sev-low); }
.cat-assessment_launch,.cat-assessment,.cat-agent_activity { color: var(--green); }
.cat-network_event { color: var(--gold); } .cat-completion { color: var(--red); font-weight: 800; }
.cat-state,.cat-traffic_inspection { color: var(--ink-soft); }

/* ---------- incident overlay ---------- */
#incident { position: fixed; inset: 0; z-index: 100; display: none;
  background: radial-gradient(900px 500px at 50% 0%, #2a0d0d, #140606 70%); color: #fff;
  overflow-y: auto; }
#incident.show { display: block; animation: fade .4s ease; }
.incident-inner { max-width: 880px; margin: 0 auto; padding: 48px 28px 80px; text-align: center; }
.incident-badge { display: inline-flex; align-items: center; gap: 10px; background: #c0392b;
  color: #fff; font-weight: 800; letter-spacing: 1px; padding: 9px 20px; border-radius: 999px;
  box-shadow: 0 0 0 6px rgba(192,57,43,.25); animation: siren 1.1s infinite; font-size: 13px; }
@keyframes siren { 50% { box-shadow: 0 0 0 14px rgba(192,57,43,0); } }
#incident h1 { font-size: 48px; margin: 22px 0 6px; text-shadow: 0 2px 20px rgba(0,0,0,.5); letter-spacing: 1px; }
#incident h2 { font-size: 24px; color: #ffd27a; font-weight: 700; }
.incident-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 28px 0; }
.incident-stats .s { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 16px; }
.incident-stats .s .n { font-size: 28px; font-weight: 800; }
.incident-stats .s.good .n { color: #7fd1a0; } .incident-stats .s.bad .n { color: #ff7a6a; }
.incident-stats .s .l { color: #d8c9c0; font-size: 12px; margin-top: 4px; }
.flag-box { background: #0c3d22; border: 2px dashed #7fd1a0; border-radius: var(--radius);
  padding: 22px; margin: 22px 0; }
.flag-box .lbl { color: #7fd1a0; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.flag-box .flag { font-family: var(--mono); font-size: 22px; font-weight: 700; color: #fff;
  margin: 10px 0; word-break: break-all; }
.incident-note { color: #d8c9c0; font-size: 14px; line-height: 1.7; max-width: 620px; margin: 0 auto; }
.incident-note b { color: #ffd27a; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .6; }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
