@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg:#06101c; --bg2:#0a1828; --surface:#0e1f33; --surface2:#14273f;
  --border:#1e3658; --border2:#2a4670; --accent:#00b8d9; --accent2:#0099b3;
  --accent-light:rgba(0,184,217,0.10); --gold:#f5a623; --gold-light:rgba(245,166,35,0.12);
  --red:#ff3b5c; --red-light:rgba(255,59,92,0.12); --green:#00d088; --green-light:rgba(0,208,136,0.10);
  --amber:#ffb020; --violet:#9f7aea; --sky:#38bdf8; --text:#e8f0fe; --text2:#b8c8e8;
  --muted:#6b7fa8; --muted2:#4a5a7a; --shadow:0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg:0 12px 48px rgba(0,0,0,0.7); --glow-blue:0 0 32px rgba(0,184,217,0.2);
  --glow-red:0 0 32px rgba(255,59,92,0.25);
}

* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  background:linear-gradient(160deg,#06101c 0%,#0a1828 50%,#06101c 100%);
  background-attachment:fixed; min-height:100vh;
  font-family:'DM Sans',sans-serif; color:var(--text);
}
h1,h2,h3 { font-family:'Syne',sans-serif; color:var(--text); }
a { color:var(--accent); }
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }

/* ── LAYOUT ── */
.layout { display:flex; min-height:100vh; }
.sidebar {
  width:300px; flex-shrink:0; background:linear-gradient(180deg,#050b14 0%,#0a1828 60%,#050b14 100%);
  border-right:1px solid var(--border); padding:0 16px 24px; overflow-y:auto;
  height:100vh; position:sticky; top:0;
}
.main { flex:1; padding:24px 32px; min-width:0; }
@media (max-width:900px){ .layout{flex-direction:column;} .sidebar{width:100%;height:auto;position:static;} }

.sidebar-brand { padding:24px 16px 20px; text-align:center; border-bottom:1px solid rgba(255,255,255,0.06); }
.sidebar-label { font-family:'Space Mono',monospace; font-size:8.5px; letter-spacing:2px; color:var(--accent); text-transform:uppercase; margin:16px 0 8px; padding-left:4px; }
.sidebar select, .sidebar input {
  width:100%; background:#142340; border:1px solid #234060; border-radius:8px;
  color:#e8f0fe; font-size:12.5px; padding:9px 10px; font-family:'DM Sans',sans-serif;
}
.sidebar .row2 { display:flex; gap:8px; }
.marsec-divider { border:none; border-top:1px solid var(--border); margin:14px 0; }

/* ── BUTTONS ── */
button.btn {
  background:linear-gradient(135deg,#00b4cc 0%,#0070a0 100%); color:#fff; border:none;
  border-radius:10px; font-family:'Syne',sans-serif; font-weight:700; letter-spacing:0.5px;
  padding:12px 28px; box-shadow:0 4px 18px rgba(0,180,204,0.3); cursor:pointer; width:100%;
  font-size:13px; transition:transform .12s, box-shadow .12s;
}
button.btn:hover:not(:disabled) { transform:translateY(-1px); box-shadow:0 6px 24px rgba(0,180,204,0.5); }
button.btn:disabled { opacity:.5; cursor:not-allowed; }
button.btn.ghost { background:rgba(0,184,217,0.08); border:1px solid rgba(0,184,217,0.3); box-shadow:none; color:var(--accent); }

/* ── HERO HEADER ── */
.page-header {
  background:linear-gradient(135deg,#061321 0%,#0d203b 50%,#061321 100%);
  border:1px solid var(--border); border-top:3px solid var(--accent); border-radius:16px;
  padding:28px 36px; margin-bottom:24px; position:relative; overflow:hidden; box-shadow:var(--shadow-lg);
}
.page-header::after { content:'MARSEC'; position:absolute; font-family:'Syne',sans-serif; font-size:160px; font-weight:800; color:rgba(255,255,255,0.018); right:10px; bottom:-40px; line-height:1; }
.header-title { font-family:'Syne',sans-serif; font-size:28px; font-weight:800; color:#fff; margin-bottom:4px; letter-spacing:-0.5px; }
.header-sub { font-family:'Space Mono',monospace; font-size:9px; letter-spacing:3px; color:var(--accent); text-transform:uppercase; }
.header-date { font-family:'Space Mono',monospace; font-size:11px; color:var(--muted); margin-top:6px; }
.header-tag { display:inline-block; background:var(--accent-light); border:1px solid rgba(0,184,217,0.3); color:var(--accent); font-family:'Space Mono',monospace; font-size:9px; letter-spacing:1.5px; padding:3px 10px; border-radius:20px; margin-top:10px; margin-right:6px; }
.header-tag.red { background:var(--red-light); border-color:rgba(255,59,92,0.3); color:var(--red); }
.header-tag.gold { background:var(--gold-light); border-color:rgba(245,166,35,0.3); color:var(--gold); }

/* ── METRIC GRID ── */
.metric-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin-bottom:12px; }
@media (max-width:1100px){ .metric-grid{grid-template-columns:repeat(2,1fr);} }
.metric-card { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:16px 20px; position:relative; overflow:hidden; box-shadow:var(--shadow); }
.metric-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; }
.metric-card.blue::before { background:linear-gradient(90deg,#00b8d9,#38bdf8); }
.metric-card.red::before { background:linear-gradient(90deg,#ff3b5c,#f87171); }
.metric-card.gold::before { background:linear-gradient(90deg,#f5a623,#fbbf24); }
.metric-card.green::before { background:linear-gradient(90deg,#00d088,#34d399); }
.metric-card.violet::before { background:linear-gradient(90deg,#9f7aea,#c084fc); }
.metric-label { font-family:'Space Mono',monospace; font-size:8.5px; letter-spacing:2px; color:var(--muted); text-transform:uppercase; margin-bottom:8px; }
.metric-value { font-family:'Syne',sans-serif; font-size:2rem; font-weight:800; line-height:1; color:var(--accent); }

/* ── SCORE HERO ── */
.score-row { display:grid; grid-template-columns:1.4fr 0.9fr 1.8fr; gap:14px; margin-bottom:12px; }
@media (max-width:1100px){ .score-row{grid-template-columns:1fr;} }
.marsec-hero { background:linear-gradient(135deg,var(--surface) 0%,var(--surface2) 100%); border:1px solid var(--border); border-radius:16px; padding:28px 24px; text-align:center; position:relative; overflow:hidden; box-shadow:var(--shadow); }
.marsec-label { font-family:'Space Mono',monospace; font-size:9px; letter-spacing:3px; color:var(--muted); text-transform:uppercase; margin-bottom:10px; }
.marsec-score { font-family:'Syne',sans-serif; font-size:5.5rem; font-weight:800; line-height:1; }
.marsec-level { font-family:'Space Mono',monospace; font-size:13px; letter-spacing:3px; margin-top:8px; font-weight:700; }
.marsec-timestamp { font-size:10px; color:var(--muted2); margin-top:6px; font-family:'Space Mono',monospace; }
.info-card { background:linear-gradient(135deg,#0e1f33 0%,#14273f 100%); border:1px solid #1e3658; border-radius:14px; padding:18px; max-height:240px; overflow-y:auto; }

/* ── SECTION HEADERS ── */
.section-header { display:flex; align-items:center; gap:10px; margin:28px 0 16px; }
.section-title { font-family:'Syne',sans-serif; font-size:16px; font-weight:700; color:var(--text); }
.section-pill { background:var(--accent-light); color:var(--accent); font-family:'Space Mono',monospace; font-size:8.5px; letter-spacing:1.5px; padding:3px 10px; border-radius:20px; border:1px solid rgba(0,184,217,0.25); }
.section-pill.red { background:var(--red-light); color:var(--red); border-color:rgba(255,59,92,0.25); }
.section-pill.gold { background:var(--gold-light); color:var(--gold); border-color:rgba(245,166,35,0.3); }

/* ── BOXES ── */
.synth-box { background:linear-gradient(135deg,var(--surface) 0%,var(--surface2) 100%); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:12px; padding:18px; font-size:13px; color:var(--text2); line-height:1.8; box-shadow:var(--shadow); }
.incident-item { background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--accent); border-radius:8px; padding:10px 14px; margin-bottom:8px; font-size:12.5px; color:var(--text2); line-height:1.6; }
.incident-date { font-family:'Space Mono',monospace; font-size:9px; letter-spacing:1.2px; color:var(--accent); margin-bottom:4px; }
.incident-source { font-family:'Space Mono',monospace; font-size:9px; color:var(--muted2); margin-top:4px; text-transform:uppercase; letter-spacing:1px; }
.nota-box { background:linear-gradient(135deg,var(--surface) 0%,var(--surface2) 100%); border:1px solid var(--border); border-left:3px solid var(--gold); border-radius:10px; padding:14px 18px; font-size:12.5px; color:var(--text2); line-height:1.7; margin-top:10px; }
.nota-label { font-family:'Space Mono',monospace; font-size:9px; letter-spacing:2px; color:var(--gold); text-transform:uppercase; margin-bottom:6px; font-weight:700; }

/* ── ALERTS ── */
.alert-banner { border-radius:10px; padding:12px 16px; margin-bottom:10px; display:flex; align-items:flex-start; gap:10px; font-size:13px; }
.alert-stable { background:rgba(0,208,136,0.07); border:1px solid rgba(0,208,136,0.3); color:#00d088; }
.alert-moderate { background:rgba(0,184,217,0.07); border:1px solid rgba(0,184,217,0.3); color:#00b8d9; }
.alert-high { background:rgba(255,176,32,0.07); border:1px solid rgba(255,176,32,0.3); color:#ffb020; }
.alert-critical { background:rgba(255,59,92,0.07); border:1px solid rgba(255,59,92,0.3); color:#ff3b5c; }
.alert-running { background:rgba(245,166,35,0.07); border:1px solid rgba(245,166,35,0.3); color:#f5a623; }

/* ── PROGRESS ── */
.progress-track { height:8px; background:#1e3658; border-radius:4px; overflow:hidden; margin:8px 0; }
.progress-fill { height:100%; background:linear-gradient(90deg,#00b4cc,#38bdf8); border-radius:4px; transition:width .3s; }
.progress-text { font-family:'Space Mono',monospace; font-size:10px; color:var(--muted); }

/* ── EXPANDER ── */
.expander { background:var(--surface); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); margin-bottom:10px; overflow:hidden; }
.expander > summary { color:var(--text); padding:14px 18px; cursor:pointer; font-size:13px; font-weight:600; list-style:none; }
.expander > summary::-webkit-details-marker { display:none; }
.expander > summary:hover { background:rgba(255,255,255,0.02); }
.expander[open] > summary { border-bottom:1px solid var(--border); }
.expander .exp-body { padding:14px 18px; }

/* ── LOG CONSOLE ── */
.log-console { background:#03080f; border:1px solid #122038; border-radius:12px; padding:14px 18px; font-family:'Space Mono',monospace; font-size:10.5px; color:#4a6090; max-height:260px; overflow-y:auto; line-height:2; box-shadow:inset 0 2px 12px rgba(0,0,0,0.5); }
.log-time { color:#2d4a8a; } .log-agent { color:#00b4cc; } .log-ok { color:#00c478; } .log-warn { color:#e8940a; } .log-err { color:#e83050; }

.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.grid3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
@media (max-width:800px){ .grid2,.grid3{grid-template-columns:1fr;} }

.marsec-footer { margin-top:56px; border-top:1px solid var(--border); padding-top:16px; text-align:center; font-family:'Space Mono',monospace; font-size:9.5px; color:var(--muted2); line-height:1.8; }

/* ── LOGIN ── */
#login-screen { display:flex; align-items:flex-start; justify-content:center; min-height:100vh; padding:6vh 16px;
  background:radial-gradient(ellipse at 20% 10%,rgba(0,184,217,0.08) 0%,transparent 50%),radial-gradient(ellipse at 80% 80%,rgba(159,122,234,0.06) 0%,transparent 50%),linear-gradient(160deg,#06101c 0%,#0a1828 50%,#06101c 100%); }
.login-card { width:100%; max-width:460px; background:linear-gradient(135deg,#0e1f33 0%,#14273f 100%); border:1px solid #1e3658; border-top:3px solid #00b8d9; border-radius:16px; padding:36px; box-shadow:0 24px 64px rgba(0,0,0,0.7),0 0 60px rgba(0,184,217,0.05); position:relative; overflow:hidden; }
.login-card::after { content:'MARSEC'; position:absolute; font-family:'Syne',sans-serif; font-size:110px; font-weight:800; color:rgba(255,255,255,0.015); right:-10px; bottom:-28px; line-height:1; pointer-events:none; }
.login-classified { position:absolute; top:12px; right:14px; font-family:'Space Mono',monospace; font-size:7.5px; letter-spacing:1.8px; color:#ff3b5c; border:1px solid rgba(255,59,92,0.4); background:rgba(255,59,92,0.06); padding:2px 8px; border-radius:4px; text-transform:uppercase; }
.login-logo { text-align:center; font-size:56px; line-height:1; margin:6px 0; filter:drop-shadow(0 0 14px rgba(0,184,217,0.35)); }
.login-title { font-family:'Syne',sans-serif; font-size:30px; font-weight:800; color:#e8f0fe; text-align:center; letter-spacing:-0.5px; margin:0; }
.login-sub { font-family:'Space Mono',monospace; font-size:9.5px; letter-spacing:3px; color:#00b8d9; text-align:center; text-transform:uppercase; margin-top:4px; }
.login-tag { text-align:center; font-size:11px; color:#6b7fa8; margin:16px 0 4px; line-height:1.7; }
.login-divider { height:1px; background:linear-gradient(90deg,transparent,#1e3658 30%,#1e3658 70%,transparent); margin:18px 0 14px; }
.login-form-label { font-family:'Space Mono',monospace; font-size:8.5px; letter-spacing:2px; color:#00b8d9; text-transform:uppercase; margin:10px 0 4px; }
.login-card input { width:100%; background:#142340; border:1px solid #234060; border-radius:8px; color:#e8f0fe; font-size:13px; padding:11px 12px; }
.login-card input:focus { border-color:#00b8d9; box-shadow:0 0 0 2px rgba(0,184,217,0.15); outline:none; }
.login-error { margin-top:10px; padding:10px 14px; background:rgba(255,59,92,0.08); border:1px solid rgba(255,59,92,0.3); border-radius:8px; color:#ff3b5c; font-size:12px; text-align:center; }
.login-footer { text-align:center; font-family:'Space Mono',monospace; font-size:8.5px; letter-spacing:1.5px; color:#2d4a6a; margin-top:18px; line-height:1.9; }
.hidden { display:none !important; }
