/* ==========================================================================
   J.A.R.V.I.S. — HUD design system
   Dark engineering aesthetic: near-black surfaces, 1px hairlines, layered
   glow, mono readouts, ambient multi-layer motion. No frameworks.
   ========================================================================== */

:root {
    --bg: #04070d;
    --bg-2: #070c15;
    --surface: #0a1120;
    --surface-2: #0d1526;
    --line: rgba(0, 212, 255, 0.14);
    --line-strong: rgba(0, 212, 255, 0.35);
    --cyan: #00d4ff;
    --cyan-dim: rgba(0, 212, 255, 0.55);
    --gold: #ffb400;
    --gold-dim: rgba(255, 180, 0, 0.55);
    --red: #ff3b5c;
    --green: #3dffa0;
    --purple: #a06bff;
    --orange: #ff8c42;
    --text: #e8f4ff;
    --muted: #9db4c8;
    --faint: #5a7186;
    --glow-cyan: 0 0 16px rgba(0, 212, 255, 0.18), 0 0 42px rgba(0, 212, 255, 0.08);
    --glow-gold: 0 0 16px rgba(255, 180, 0, 0.22), 0 0 42px rgba(255, 180, 0, 0.1);
    --glow-red: 0 0 16px rgba(255, 59, 92, 0.25), 0 0 42px rgba(255, 59, 92, 0.12);
    --r-xs: 3px; --r-sm: 6px; --r-md: 10px;
    --font-ui: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Orbitron', 'Rajdhani', system-ui, sans-serif;
    --font-mono: 'Share Tech Mono', 'Consolas', monospace;
    --ease-reveal: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.45;
    min-height: 100vh;
    overflow-x: hidden;
}
::selection { background: rgba(0, 212, 255, 0.3); color: #fff; }

/* custom scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.22); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 255, 0.45); }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #7fe8ff; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* focus rings in signal color */
:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

/* ---------- ambient background layers ---------- */
#bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
}
.scanlines {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px);
    mix-blend-mode: overlay;
}
.scanlines::after {
    content: ''; position: absolute; left: 0; right: 0; height: 140px;
    background: linear-gradient(180deg, transparent, rgba(0,212,255,0.045), transparent);
    animation: scan-sweep 9s linear infinite;
}
@keyframes scan-sweep { 0% { top: -20%; } 100% { top: 120%; } }

/* ---------- layout shell ---------- */
.app-shell { position: relative; z-index: 2; min-height: 100vh; display: flex; flex-direction: column; }
.app-main { display: flex; flex: 1; min-height: 0; }
.content { flex: 1; padding: 22px 26px 60px; min-width: 0; max-width: 1680px; }

/* ---------- topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 18px;
    padding: 0 20px; height: 60px;
    background: linear-gradient(180deg, rgba(10,17,32,0.95), rgba(7,12,21,0.92));
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 50;
}
.topbar-burger { display: none; background: none; border: 1px solid var(--line); color: var(--cyan); border-radius: var(--r-xs); padding: 6px; }
.topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-emblem { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(0,212,255,0.5)); animation: emblem-spin 24s linear infinite; }
@keyframes emblem-spin { to { transform: rotate(360deg); } }
.brand-word {
    font-family: var(--font-display); font-weight: 800; letter-spacing: 0.22em; font-size: 15px; color: var(--text);
    text-shadow: 0 0 14px rgba(0,212,255,0.55);
}
.brand-co { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--faint); text-transform: uppercase; border-left: 1px solid var(--line); padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-clock { text-align: right; line-height: 1.15; }
.clock-time { display: block; font-family: var(--font-mono); font-size: 15px; color: var(--cyan); text-shadow: 0 0 10px rgba(0,212,255,0.5); }
.clock-date { display: block; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.18em; color: var(--faint); text-transform: uppercase; }
.sound-toggle { background: none; border: none; color: var(--muted); padding: 4px; transition: color .2s; }
.sound-toggle:hover { color: var(--cyan); }
.sound-toggle.muted { color: var(--faint); }

.xp-chip { display: flex; align-items: center; gap: 8px; color: var(--text); }
.xp-ring { width: 40px; height: 40px; transform: rotate(-90deg); }
.xp-ring-bg { fill: none; stroke: rgba(0,212,255,0.12); stroke-width: 3; }
.xp-ring-fg { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(0,212,255,0.7)); transition: stroke-dashoffset 1s var(--ease-reveal); }
.xp-ring-num { fill: var(--text); font-family: var(--font-display); font-size: 11px; font-weight: 700; text-anchor: middle; transform: rotate(90deg); transform-origin: 20px 20px; }
.xp-chip-info { display: flex; flex-direction: column; line-height: 1.1; }
.xp-chip-info strong { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.12em; color: var(--gold); text-transform: uppercase; }
.xp-chip-info small { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.streak-chip { display: flex; align-items: center; gap: 4px; color: var(--orange); font-family: var(--font-display); font-size: 12px; text-shadow: 0 0 10px rgba(255,140,66,0.6); }
.streak-chip .ico { width: 15px; height: 15px; }
.user-chip { display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--line); padding-left: 14px; }
.user-name { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.user-name em { font-style: normal; font-family: var(--font-mono); font-size: 8px; color: var(--gold); border: 1px solid var(--gold-dim); padding: 1px 4px; border-radius: 2px; vertical-align: 2px; letter-spacing: 0.15em; }
.user-logout { color: var(--faint); display: flex; }
.user-logout:hover { color: var(--red); }

/* ---------- side nav ---------- */
.sidenav {
    width: 218px; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(10,17,32,0.6), rgba(5,8,13,0.85));
    border-right: 1px solid var(--line);
    padding: 18px 10px; display: flex; flex-direction: column; gap: 2px;
}
.snav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: var(--r-xs);
    color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
    border: 1px solid transparent; position: relative;
    transition: color .18s, background .18s, border-color .18s;
}
.snav-link .ico { width: 17px; height: 17px; flex-shrink: 0; }
.snav-idx { margin-left: auto; font-family: var(--font-mono); font-style: normal; font-size: 9px; color: var(--faint); letter-spacing: 0.1em; }
.snav-link:hover { color: var(--text); background: rgba(0,212,255,0.05); }
.snav-link.active {
    color: var(--cyan); background: rgba(0,212,255,0.07);
    border-color: var(--line);
    box-shadow: inset 0 0 18px rgba(0,212,255,0.06), 0 0 12px rgba(0,212,255,0.1);
}
.snav-link.active::before {
    content: ''; position: absolute; left: -10px; top: 20%; bottom: 20%;
    width: 2px; background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
}
.sidenav-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--line); }
.sidenav-sysline { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.18em; color: var(--faint); padding: 2px 0; }
.sidenav-sysline.dim { color: rgba(61,255,160,0.4); animation: blink-soft 3.4s ease-in-out infinite; }
@keyframes blink-soft { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- HUD panels ---------- */
.hud-panel {
    position: relative;
    background: linear-gradient(160deg, rgba(13,21,38,0.85), rgba(8,13,24,0.9));
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 18px;
    box-shadow: inset 0 0 40px rgba(0,212,255,0.025);
}
.panel-corner { position: absolute; width: 14px; height: 14px; border: 1px solid var(--cyan-dim); pointer-events: none; }
.panel-corner.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.panel-corner.tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.panel-corner.bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.panel-corner.br { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.panel-title {
    font-family: var(--font-display); font-size: 12px; font-weight: 700;
    letter-spacing: 0.28em; text-transform: uppercase; color: var(--cyan);
    text-shadow: 0 0 12px rgba(0,212,255,0.4);
    margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.panel-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.panel-title .ico { width: 16px; height: 16px; }
.panel-title .pt-right { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--faint); font-weight: 400; }

/* section headers with numbered markers */
.page-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--gold); text-transform: uppercase; }
.page-title { font-family: var(--font-display); font-size: clamp(19px, 2.4vw, 26px); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.page-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border-radius: var(--r-xs);
    font-family: var(--font-ui); font-size: 14px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    border: 1px solid var(--line-strong); background: rgba(0,212,255,0.06); color: var(--cyan);
    transition: box-shadow .25s, background .25s, color .25s, transform .15s;
    position: relative; overflow: hidden;
}
.btn .ico { width: 15px; height: 15px; }
.btn:hover { background: rgba(0,212,255,0.14); box-shadow: var(--glow-cyan); color: #baf3ff; }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(180deg, rgba(0,212,255,0.22), rgba(0,212,255,0.1));
    border-color: var(--cyan); color: #dffbff;
    text-shadow: 0 0 8px rgba(0,212,255,0.6);
    animation: cta-breathe 3.4s ease-in-out infinite;
}
@keyframes cta-breathe {
    0%, 100% { box-shadow: 0 0 8px rgba(0,212,255,0.15), inset 0 0 12px rgba(0,212,255,0.05); }
    50% { box-shadow: 0 0 22px rgba(0,212,255,0.4), inset 0 0 18px rgba(0,212,255,0.12); }
}
.btn-gold { border-color: var(--gold-dim); background: rgba(255,180,0,0.07); color: var(--gold); }
.btn-gold:hover { background: rgba(255,180,0,0.16); box-shadow: var(--glow-gold); color: #ffe1a1; }
.btn-danger { border-color: rgba(255,59,92,0.4); background: rgba(255,59,92,0.07); color: var(--red); }
.btn-danger:hover { background: rgba(255,59,92,0.15); box-shadow: var(--glow-red); }
.btn-ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(0,212,255,0.05); box-shadow: none; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.hud-form label { display: block; margin-bottom: 13px; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.hud-form input, .hud-form select, .hud-form textarea {
    display: block; width: 100%; margin-top: 5px;
    background: rgba(4,8,15,0.8); border: 1px solid var(--line); border-radius: var(--r-xs);
    color: var(--text); padding: 9px 12px; font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
}
.hud-form input:focus, .hud-form select:focus, .hud-form textarea:focus {
    border-color: var(--cyan); box-shadow: 0 0 0 1px rgba(0,212,255,0.25), 0 0 18px rgba(0,212,255,0.12); outline: none;
}
.hud-form textarea { min-height: 90px; resize: vertical; }
.hud-form select option { background: var(--surface); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.field-hint { font-size: 12px; color: var(--faint); letter-spacing: 0.04em; margin: -6px 0 12px; text-transform: none; font-weight: 400; }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--r-xs); font-size: 14px; margin-bottom: 14px; border: 1px solid; letter-spacing: 0.04em; }
.alert-danger { border-color: rgba(255,59,92,0.45); background: rgba(255,59,92,0.09); color: #ffb3c1; box-shadow: var(--glow-red); }
.alert-ok { border-color: rgba(61,255,160,0.4); background: rgba(61,255,160,0.07); color: #b9ffdd; }
.alert-info { border-color: var(--line-strong); background: rgba(0,212,255,0.06); color: #bdefff; }

/* ---------- generic table ---------- */
.hud-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.hud-table th {
    text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.hud-table td { padding: 9px 10px; border-bottom: 1px solid rgba(0,212,255,0.07); vertical-align: middle; }
.hud-table tr:hover td { background: rgba(0,212,255,0.035); }
.hud-table .num { font-family: var(--font-mono); text-align: right; }

/* tags & chips */
.tag { display: inline-block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; padding: 2px 7px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); margin: 1px 2px 1px 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 2px; border: 1px solid; }
.chip .ico { width: 12px; height: 12px; }

/* priority threat chips */
.prio-low { color: var(--faint); border-color: rgba(90,113,134,0.4); background: rgba(90,113,134,0.08); }
.prio-medium { color: var(--cyan); border-color: var(--line-strong); background: rgba(0,212,255,0.07); }
.prio-high { color: var(--gold); border-color: var(--gold-dim); background: rgba(255,180,0,0.08); }
.prio-critical { color: var(--red); border-color: rgba(255,59,92,0.55); background: rgba(255,59,92,0.1); box-shadow: var(--glow-red); animation: blink-soft 2.2s ease-in-out infinite; }

/* stat readout cards */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { position: relative; padding: 15px 16px 13px; background: linear-gradient(160deg, rgba(13,21,38,0.85), rgba(8,13,24,0.9)); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan-dim), transparent); }
.stat-label { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--faint); margin-bottom: 7px; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); text-shadow: 0 0 16px rgba(0,212,255,0.35); line-height: 1.1; }
.stat-value.gold { color: var(--gold); text-shadow: 0 0 16px rgba(255,180,0,0.4); }
.stat-value.red { color: var(--red); text-shadow: 0 0 16px rgba(255,59,92,0.4); }
.stat-value.green { color: var(--green); text-shadow: 0 0 16px rgba(61,255,160,0.35); }
.stat-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 5px; }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200; background: rgba(2,4,8,0.78); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 18px;
    animation: fade-in .18s ease-out;
}
.modal-backdrop[hidden], .popup-overlay[hidden] { display: none !important; }
@keyframes fade-in { from { opacity: 0; } }
.modal {
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    background: linear-gradient(165deg, #0c1425, #070c16);
    border: 1px solid var(--line-strong); border-radius: var(--r-md);
    padding: 22px; box-shadow: var(--glow-cyan), 0 30px 80px rgba(0,0,0,0.6);
    animation: modal-in .3s var(--ease-reveal);
}
.modal.wide { max-width: 760px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.modal-head { display: flex; align-items: center; margin-bottom: 16px; }
.modal-title { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--cyan); }
.modal-close { margin-left: auto; background: none; border: none; color: var(--faint); padding: 4px; }
.modal-close:hover { color: var(--red); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---------- toasts (XP) ---------- */
#toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 400; display: flex; flex-direction: column; gap: 8px; }
.xp-toast {
    display: flex; align-items: center; gap: 10px;
    background: linear-gradient(90deg, rgba(10,20,36,0.97), rgba(7,12,21,0.97));
    border: 1px solid var(--line-strong); border-left: 2px solid var(--cyan);
    padding: 10px 16px; border-radius: var(--r-xs);
    box-shadow: var(--glow-cyan);
    animation: toast-in .45s var(--ease-reveal);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } }
.xp-toast.out { animation: toast-out .4s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
.xp-toast .xp-amt { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--gold); text-shadow: 0 0 12px rgba(255,180,0,0.6); }
.xp-toast .xp-lbl { font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- achievement / level popup ---------- */
.popup-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(2,5,10,0.85); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: fade-in .25s ease-out;
}
.popup-card {
    position: relative; text-align: center; max-width: 420px; width: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(0,212,255,0.14), rgba(7,12,21,0.98) 62%);
    border: 1px solid var(--line-strong); border-radius: var(--r-md);
    padding: 44px 30px 30px; box-shadow: 0 0 60px rgba(0,212,255,0.22), 0 30px 90px rgba(0,0,0,0.7);
    animation: popup-in .55s var(--ease-reveal);
}
@keyframes popup-in { 0% { opacity: 0; transform: scale(0.8); } 60% { transform: scale(1.03); } 100% { opacity: 1; transform: scale(1); } }
.popup-ring {
    position: absolute; top: -46px; left: 50%; width: 92px; height: 92px; margin-left: -46px;
    border-radius: 50%; border: 2px solid var(--cyan);
    box-shadow: 0 0 30px rgba(0,212,255,0.6), inset 0 0 24px rgba(0,212,255,0.3);
    animation: ring-pulse 2.4s ease-in-out infinite;
    background: rgba(4,8,15,0.9);
}
.popup-ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 1px dashed rgba(0,212,255,0.5); animation: emblem-spin 14s linear infinite; }
.popup-ring::after { content: ''; position: absolute; inset: 20px; border-radius: 50%; background: radial-gradient(circle, rgba(0,212,255,0.85), rgba(0,212,255,0.1) 70%); filter: blur(1px); }
@keyframes ring-pulse { 0%,100% { box-shadow: 0 0 26px rgba(0,212,255,0.5), inset 0 0 20px rgba(0,212,255,0.25); } 50% { box-shadow: 0 0 52px rgba(0,212,255,0.85), inset 0 0 34px rgba(0,212,255,0.45); } }
.popup-icon { position: relative; width: 48px; height: 48px; margin: -68px auto 44px; color: #04121a; z-index: 2; display: flex; align-items: center; justify-content: center; }
.popup-icon .ico { width: 34px; height: 34px; color: #03202c; filter: none; }
.popup-kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.4em; color: var(--gold); text-transform: uppercase; margin-bottom: 8px; }
.popup-title { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 0 20px rgba(0,212,255,0.6); margin-bottom: 8px; }
.popup-desc { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; }
.popup-xp { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--gold); text-shadow: 0 0 14px rgba(255,180,0,0.6); margin-bottom: 20px; }
.popup-xp:empty { display: none; }

/* empty state */
.empty-state { text-align: center; padding: 44px 20px; color: var(--faint); }
.empty-state .ico { width: 40px; height: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; letter-spacing: 0.08em; }
.empty-state .jarvis-line { font-family: var(--font-mono); font-size: 11px; color: var(--cyan-dim); margin-top: 8px; letter-spacing: 0.1em; }

/* utility */
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.dim { color: var(--faint); } .mono { font-family: var(--font-mono); }
.ico { width: 18px; height: 18px; }
.row-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   LOGIN / INSTALL
   ========================================================================== */
.login-body, .install-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-bg {
    position: fixed; inset: 0; z-index: 0;
    background: url('../img/login-bg.jpg') center/cover no-repeat, var(--bg);
}
.login-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, rgba(4,7,13,0.25), rgba(4,7,13,0.9) 78%); }
.login-scanlines { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 3px); }
.login-wrap { position: relative; z-index: 2; width: 100%; max-width: 400px; text-align: center; animation: reveal-up .7s var(--ease-reveal); }
@keyframes reveal-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.login-emblem-wrap { position: relative; width: 128px; height: 128px; margin: 0 auto 14px; }
.login-emblem { width: 100%; height: 100%; animation: ring-pulse 3s ease-in-out infinite; border-radius: 50%; }
.login-emblem-glow { position: absolute; inset: -26px; border-radius: 50%; background: radial-gradient(circle, rgba(0,212,255,0.22), transparent 65%); pointer-events: none; animation: blink-soft 3s ease-in-out infinite; }
.login-sys { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.42em; color: var(--gold); margin-bottom: 6px; }
.login-title { font-family: var(--font-display); font-size: 34px; font-weight: 900; letter-spacing: 0.3em; text-shadow: 0 0 30px rgba(0,212,255,0.7); margin-bottom: 4px; }
.login-sub { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; margin-bottom: 26px; }
.login-panel { text-align: left; }
.login-foot { margin-top: 14px; text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; color: var(--faint); }

.install-wrap { width: 100%; max-width: 620px; animation: reveal-up .7s var(--ease-reveal); }
.install-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.install-emblem { width: 72px; height: 72px; animation: ring-pulse 3s ease-in-out infinite; border-radius: 50%; flex-shrink: 0; }
.install-sys { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.4em; color: var(--gold); }
.install-title { font-family: var(--font-display); font-size: 27px; font-weight: 900; letter-spacing: 0.28em; text-shadow: 0 0 26px rgba(0,212,255,0.65); }
.install-sub { font-size: 12.5px; color: var(--muted); letter-spacing: 0.06em; }
.inst-lead { color: var(--muted); font-size: 14.5px; margin-bottom: 16px; }
.inst-msg { font-size: 16px; line-height: 1.6; margin-bottom: 16px; }
.inst-warn { font-family: var(--font-mono); font-size: 11.5px; color: var(--gold); margin-bottom: 16px; letter-spacing: 0.05em; }
.inst-done { text-align: center; padding: 14px 6px 6px; }
.inst-ring { width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 50%; border: 2px solid var(--cyan-dim); animation: emblem-spin 10s linear infinite; }
.inst-ring.charged { border-color: var(--cyan); box-shadow: 0 0 40px rgba(0,212,255,0.55), inset 0 0 30px rgba(0,212,255,0.3); animation: ring-pulse 2.6s ease-in-out infinite; }
.checks { margin-bottom: 20px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid rgba(0,212,255,0.07); }
.check-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.check-row.ok .check-dot { background: var(--green); box-shadow: 0 0 10px rgba(61,255,160,0.7); }
.check-row.fail .check-dot { background: var(--red); box-shadow: 0 0 10px rgba(255,59,92,0.7); }
.check-name { font-weight: 600; letter-spacing: 0.05em; }
.check-val { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.radio-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r-xs); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.radio-card:has(input:checked) { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.radio-card input { margin-top: 4px; accent-color: var(--cyan); }
.radio-body strong { display: block; letter-spacing: 0.1em; text-transform: uppercase; font-size: 14px; }
.radio-body small { color: var(--muted); font-size: 12.5px; }
.mysql-fields { display: none; padding: 6px 0 2px; }

/* ==========================================================================
   ARC REACTOR RINGS (SVG progress)
   ========================================================================== */
.reactor-wrap { display: flex; align-items: center; justify-content: center; position: relative; }
.reactor-svg { transform: rotate(-90deg); }
.reactor-track { fill: none; stroke: rgba(0,212,255,0.1); }
.reactor-fill { fill: none; stroke: var(--cyan); stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(0,212,255,0.8)); transition: stroke-dashoffset 1.2s var(--ease-reveal); }
.reactor-fill.gold { stroke: var(--gold); filter: drop-shadow(0 0 6px rgba(255,180,0,0.8)); }
.reactor-fill.red { stroke: var(--red); filter: drop-shadow(0 0 6px rgba(255,59,92,0.8)); }
.reactor-ticks { fill: none; stroke: rgba(0,212,255,0.28); stroke-dasharray: 1 5; animation: emblem-spin 30s linear infinite; transform-origin: center; }
.reactor-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.reactor-num { font-family: var(--font-display); font-weight: 800; line-height: 1; text-shadow: 0 0 18px rgba(0,212,255,0.6); }
.reactor-lbl { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.3em; color: var(--faint); text-transform: uppercase; margin-top: 4px; }

/* ==========================================================================
   DASHBOARD (HELMET VIEW)
   ========================================================================== */
.briefing {
    display: flex; gap: 14px; align-items: flex-start;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm);
    background: linear-gradient(90deg, rgba(0,212,255,0.08), rgba(10,17,32,0.6) 55%);
    padding: 15px 18px; margin-bottom: 20px; box-shadow: var(--glow-cyan);
}
.briefing-core { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: radial-gradient(circle, rgba(0,212,255,0.9), rgba(0,212,255,0.12) 68%); box-shadow: 0 0 22px rgba(0,212,255,0.6); animation: ring-pulse 3s ease-in-out infinite; }
.briefing-text { font-size: 16.5px; line-height: 1.5; letter-spacing: 0.02em; }
.briefing-text strong { color: var(--cyan); }
.briefing-text .alert-word { color: var(--red); font-weight: 700; }
.briefing-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--faint); text-transform: uppercase; margin-top: 5px; }

.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.dg-3 { grid-column: span 3; } .dg-4 { grid-column: span 4; } .dg-5 { grid-column: span 5; }
.dg-6 { grid-column: span 6; } .dg-7 { grid-column: span 7; } .dg-8 { grid-column: span 8; } .dg-12 { grid-column: span 12; }

.agenda-item { display: flex; gap: 12px; padding: 9px 4px; border-bottom: 1px solid rgba(0,212,255,0.07); align-items: center; }
.agenda-item:last-child { border-bottom: none; }
.agenda-time { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); min-width: 46px; }
.agenda-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 8px currentColor; }
.agenda-title { font-weight: 600; font-size: 14.5px; }
.agenda-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.agenda-item.soon { background: rgba(255,180,0,0.06); border-left: 2px solid var(--gold); padding-left: 8px; border-radius: 2px; }

.overdue-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 7px; border: 1px solid rgba(255,59,92,0.35); background: rgba(255,59,92,0.06); border-radius: var(--r-xs); font-size: 14px; }
.overdue-item .due { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--red); white-space: nowrap; }

.feed-item { display: flex; gap: 10px; padding: 7px 2px; font-size: 13.5px; border-bottom: 1px solid rgba(0,212,255,0.05); align-items: baseline; }
.feed-item:last-child { border-bottom: none; }
.feed-icon { color: var(--cyan-dim); flex-shrink: 0; display: flex; align-self: center; }
.feed-icon .ico { width: 14px; height: 14px; }
.feed-time { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--faint); white-space: nowrap; }

.hot-lead { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid rgba(0,212,255,0.07); }
.hot-lead:last-child { border-bottom: none; }
.hot-lead .hl-name { font-weight: 700; font-size: 14px; }
.hot-lead .hl-deal { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.hot-lead .hl-val { margin-left: auto; font-family: var(--font-display); font-size: 13px; color: var(--gold); white-space: nowrap; }

/* missions */
.mission { margin-bottom: 13px; }
.mission-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.mission-title { font-size: 13.5px; font-weight: 700; letter-spacing: 0.06em; }
.mission-prog { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); }
.mission-bar { height: 7px; background: rgba(0,212,255,0.08); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.mission-fill { height: 100%; background: linear-gradient(90deg, rgba(0,212,255,0.5), var(--cyan)); box-shadow: 0 0 12px rgba(0,212,255,0.6); border-radius: 4px; transition: width 1s var(--ease-reveal); }
.mission.done .mission-fill { background: linear-gradient(90deg, rgba(61,255,160,0.5), var(--green)); box-shadow: 0 0 12px rgba(61,255,160,0.6); }
.mission.done .mission-title { color: var(--green); text-decoration: line-through; text-decoration-color: rgba(61,255,160,0.5); }
.mission-reward { font-family: var(--font-mono); font-size: 9.5px; color: var(--gold); letter-spacing: 0.1em; }

/* boss battle HP */
.boss-box { position: relative; }
.boss-name { font-family: var(--font-display); font-size: 14px; font-weight: 800; letter-spacing: 0.18em; color: var(--red); text-shadow: 0 0 14px rgba(255,59,92,0.5); text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.boss-hp-shell { margin-top: 10px; height: 22px; border: 1px solid rgba(255,59,92,0.5); border-radius: 3px; background: rgba(255,59,92,0.05); overflow: hidden; position: relative; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.boss-hp-fill { height: 100%; background: linear-gradient(90deg, #ff3b5c, #ff8c42); box-shadow: 0 0 18px rgba(255,59,92,0.7); transition: width 1.2s var(--ease-reveal); }
.boss-hp-num { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 7px; }
.boss-deadline { color: var(--red); }

/* pinned notes on dashboard */
.pin-note { border: 1px solid var(--gold-dim); background: linear-gradient(160deg, rgba(255,180,0,0.06), rgba(10,17,32,0.7)); border-radius: var(--r-xs); padding: 11px 13px; margin-bottom: 9px; }
.pin-note .pn-title { font-weight: 700; font-size: 13.5px; color: var(--gold); letter-spacing: 0.06em; display: flex; gap: 7px; align-items: center; }
.pin-note .pn-title .ico { width: 12px; height: 12px; }
.pin-note .pn-body { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }

/* ==========================================================================
   KANBAN (funnel + tasks)
   ========================================================================== */
.kanban { display: flex; gap: 13px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { min-width: 258px; width: 258px; flex-shrink: 0; background: rgba(8,13,24,0.65); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; transition: border-color .2s, box-shadow .2s; }
.kanban-col.drag-over { border-color: var(--cyan); box-shadow: var(--glow-cyan), inset 0 0 26px rgba(0,212,255,0.06); }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.kanban-col-title { font-family: var(--font-display); font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; }
.kanban-col-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--faint); border: 1px solid var(--line); padding: 1px 7px; border-radius: 8px; }
.kanban-col-sum { font-family: var(--font-mono); font-size: 10px; color: var(--gold); padding: 0 6px 8px; display: block; }
.deal-card {
    background: linear-gradient(160deg, rgba(13,21,38,0.95), rgba(8,13,24,0.95));
    border: 1px solid var(--line); border-radius: var(--r-xs);
    padding: 11px 12px; margin-bottom: 9px; cursor: grab;
    transition: border-color .2s, box-shadow .25s, transform .15s;
}
.deal-card:hover { border-color: var(--line-strong); box-shadow: var(--glow-cyan); transform: translateY(-1px); }
.deal-card.dragging { opacity: 0.45; cursor: grabbing; }
.deal-card-title { font-weight: 700; font-size: 14.5px; letter-spacing: 0.03em; margin-bottom: 3px; }
.deal-card-client { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.deal-card-meta { display: flex; align-items: center; gap: 8px; }
.deal-card-value { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--gold); text-shadow: 0 0 10px rgba(255,180,0,0.35); }
.deal-card-prob { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--cyan); }
.deal-card-date { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.deal-card-date .ico { width: 11px; height: 11px; }
.deal-card.overdue-close .deal-card-date { color: var(--red); }
.kanban-terminal { min-width: 210px; width: 210px; }
.kanban-terminal.won-col { border-color: rgba(61,255,160,0.3); }
.kanban-terminal.lost-col { border-color: rgba(255,59,92,0.3); }
.kanban-terminal.won-col.drag-over { border-color: var(--green); box-shadow: 0 0 22px rgba(61,255,160,0.25); }
.kanban-terminal.lost-col.drag-over { border-color: var(--red); box-shadow: var(--glow-red); }

/* task cards */
.task-card { background: linear-gradient(160deg, rgba(13,21,38,0.95), rgba(8,13,24,0.95)); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 10px 12px; margin-bottom: 8px; cursor: grab; transition: border-color .2s, box-shadow .25s; }
.task-card:hover { border-color: var(--line-strong); box-shadow: var(--glow-cyan); }
.task-card.dragging { opacity: 0.45; }
.task-card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.task-card.is-done .task-card-title { text-decoration: line-through; color: var(--faint); }
.task-card-foot { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.task-card-foot .due { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.task-card-foot .due.late { color: var(--red); text-shadow: 0 0 8px rgba(255,59,92,0.5); }
.subtask { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.subtask input { accent-color: var(--cyan); }
.subtask.done span { text-decoration: line-through; color: var(--faint); }

/* ==========================================================================
   CALENDAR
   ========================================================================== */
.cal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-title { font-family: var(--font-display); font-size: 17px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.cal-nav { display: flex; gap: 6px; }
.cal-views { margin-left: auto; display: flex; gap: 6px; }
.cal-view-btn { padding: 6px 14px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: var(--r-xs); }
.cal-view-btn.active { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow-cyan); background: rgba(0,212,255,0.07); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); text-align: center; padding: 6px 0; }
.cal-cell { min-height: 108px; border: 1px solid rgba(0,212,255,0.08); border-radius: var(--r-xs); padding: 6px 7px; background: rgba(8,13,24,0.45); transition: border-color .2s, box-shadow .2s; position: relative; }
.cal-cell.other-month { opacity: 0.35; }
.cal-cell.today { border-color: var(--cyan); box-shadow: inset 0 0 22px rgba(0,212,255,0.07), var(--glow-cyan); }
.cal-cell.drag-over { border-color: var(--gold); box-shadow: var(--glow-gold); }
.cal-daynum { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.cal-cell.today .cal-daynum { color: var(--cyan); text-shadow: 0 0 10px rgba(0,212,255,0.6); }
.cal-event { font-size: 11.5px; font-weight: 600; padding: 3px 6px; border-radius: 2px; margin-bottom: 3px; cursor: grab; border-left: 2px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.cal-event:hover { filter: brightness(1.35); }
.cal-more { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); cursor: pointer; }
.ev-meeting { background: rgba(0,212,255,0.1); border-color: var(--cyan); color: #aeeaff; }
.ev-call { background: rgba(61,255,160,0.08); border-color: var(--green); color: #b9ffdd; }
.ev-deadline { background: rgba(255,59,92,0.1); border-color: var(--red); color: #ffc2cd; }
.ev-follow-up { background: rgba(255,180,0,0.1); border-color: var(--gold); color: #ffe1a1; }
.ev-other { background: rgba(160,107,255,0.1); border-color: var(--purple); color: #dcc9ff; }
.cal-week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-week-col { border: 1px solid rgba(0,212,255,0.08); border-radius: var(--r-xs); background: rgba(8,13,24,0.45); min-height: 300px; padding: 8px; }
.cal-week-col.today { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.cal-week-head { text-align: center; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.cal-week-head b { display: block; font-family: var(--font-display); font-size: 15px; color: var(--text); }
.cal-week-col .cal-event { white-space: normal; }
.cal-day-list .day-event { display: flex; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-left-width: 2px; border-radius: var(--r-xs); margin-bottom: 9px; background: rgba(8,13,24,0.55); align-items: center; }
.day-event .de-time { font-family: var(--font-mono); font-size: 13px; min-width: 90px; }
.day-event .de-title { font-weight: 700; font-size: 15px; }
.day-event .de-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.day-event .de-actions { margin-left: auto; display: flex; gap: 6px; }

/* ==========================================================================
   LEADS / CLIENT
   ========================================================================== */
.lead-filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.lead-filters input, .lead-filters select { background: rgba(4,8,15,0.8); border: 1px solid var(--line); border-radius: var(--r-xs); color: var(--text); padding: 8px 12px; font-size: 14px; }
.lead-filters input { flex: 1; min-width: 200px; }
.client-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.client-hex { width: 64px; height: 64px; flex-shrink: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(160deg, rgba(0,212,255,0.35), rgba(0,212,255,0.08)); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 21px; font-weight: 800; color: var(--cyan); text-shadow: 0 0 14px rgba(0,212,255,0.7); }
.client-title { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: 0.1em; }
.client-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.client-meta span { display: flex; align-items: center; gap: 5px; }
.client-meta .ico { width: 12px; height: 12px; color: var(--cyan-dim); }
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 1px; background: linear-gradient(180deg, var(--cyan-dim), rgba(0,212,255,0.05)); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--cyan); box-shadow: 0 0 9px rgba(0,212,255,0.7); }
.tl-item.t-call::before { border-color: var(--green); box-shadow: 0 0 9px rgba(61,255,160,0.7); }
.tl-item.t-meeting::before { border-color: var(--purple); box-shadow: 0 0 9px rgba(160,107,255,0.7); }
.tl-item.t-email::before { border-color: var(--gold); box-shadow: 0 0 9px rgba(255,180,0,0.7); }
.tl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-type { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--cyan); border: 1px solid var(--line-strong); padding: 1px 6px; border-radius: 2px; }
.tl-subject { font-weight: 700; font-size: 14.5px; }
.tl-time { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.tl-body { color: var(--muted); font-size: 13.5px; margin-top: 3px; white-space: pre-wrap; }

/* ==========================================================================
   NOTES
   ========================================================================== */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.note-card { border: 1px solid var(--line); border-radius: var(--r-sm); background: linear-gradient(160deg, rgba(13,21,38,0.9), rgba(8,13,24,0.9)); padding: 14px 15px; position: relative; transition: border-color .2s, box-shadow .25s; display: flex; flex-direction: column; }
.note-card:hover { border-color: var(--line-strong); box-shadow: var(--glow-cyan); }
.note-card.pinned { border-color: var(--gold-dim); background: linear-gradient(160deg, rgba(255,180,0,0.07), rgba(8,13,24,0.92)); }
.note-title { font-weight: 700; font-size: 15px; letter-spacing: 0.04em; padding-right: 26px; }
.note-body { color: var(--muted); font-size: 13.5px; margin: 7px 0 10px; white-space: pre-wrap; flex: 1; }
.note-foot { display: flex; align-items: center; gap: 6px; }
.note-foot .mono { font-size: 9.5px; color: var(--faint); margin-left: auto; }
.note-pin-btn { position: absolute; top: 11px; right: 11px; background: none; border: none; color: var(--faint); padding: 3px; }
.note-pin-btn:hover, .note-pin-btn.pinned { color: var(--gold); }
.icon-btn { background: none; border: none; color: var(--faint); padding: 4px; border-radius: 2px; display: inline-flex; }
.icon-btn:hover { color: var(--cyan); background: rgba(0,212,255,0.08); }
.icon-btn.danger:hover { color: var(--red); background: rgba(255,59,92,0.08); }
.icon-btn .ico { width: 15px; height: 15px; }

/* ==========================================================================
   STATS / ACHIEVEMENTS
   ========================================================================== */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; justify-content: start; }
.hm-cell { width: 13px; height: 13px; border-radius: 2px; background: rgba(0,212,255,0.05); border: 1px solid rgba(0,212,255,0.06); }
.hm-cell.l1 { background: rgba(0,212,255,0.22); }
.hm-cell.l2 { background: rgba(0,212,255,0.45); box-shadow: 0 0 5px rgba(0,212,255,0.25); }
.hm-cell.l3 { background: rgba(0,212,255,0.72); box-shadow: 0 0 7px rgba(0,212,255,0.45); }
.hm-cell.l4 { background: var(--cyan); box-shadow: 0 0 9px rgba(0,212,255,0.8); }
.hm-legend { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); margin-top: 9px; }
.hm-scroll { overflow-x: auto; padding-bottom: 6px; }
.hm-months { display: flex; font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: 0.1em; margin-bottom: 5px; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.ach-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 15px; background: rgba(8,13,24,0.6); position: relative; transition: border-color .2s, box-shadow .25s; }
.ach-card.unlocked { border-color: var(--gold-dim); background: linear-gradient(160deg, rgba(255,180,0,0.07), rgba(8,13,24,0.85)); box-shadow: var(--glow-gold); }
.ach-card.locked { opacity: 0.55; }
.ach-card:hover { border-color: var(--line-strong); }
.ach-icon { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; color: var(--cyan-dim); }
.ach-card.unlocked .ach-icon { color: var(--gold); border-color: var(--gold-dim); box-shadow: 0 0 14px rgba(255,180,0,0.3); background: radial-gradient(circle, rgba(255,180,0,0.18), transparent 70%); }
.ach-name { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.ach-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ach-foot { display: flex; justify-content: space-between; margin-top: 9px; font-family: var(--font-mono); font-size: 9.5px; }
.ach-xp { color: var(--gold); }
.ach-date { color: var(--faint); }

/* level timeline */
.level-track { position: relative; height: 6px; background: rgba(0,212,255,0.08); border-radius: 3px; margin: 26px 0 8px; }
.level-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, rgba(0,212,255,0.4), var(--cyan)); box-shadow: 0 0 14px rgba(0,212,255,0.55); }
.level-marks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; color: var(--faint); letter-spacing: 0.06em; }
.level-marks .reached { color: var(--cyan); }
.level-marks .current { color: var(--gold); text-shadow: 0 0 8px rgba(255,180,0,0.6); }

/* xp breakdown bars */
.xpbar-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 12px; align-items: center; margin-bottom: 9px; }
.xpbar-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.xpbar-shell { height: 9px; background: rgba(0,212,255,0.07); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.xpbar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, rgba(0,212,255,0.45), var(--cyan)); box-shadow: 0 0 10px rgba(0,212,255,0.5); transition: width 1s var(--ease-reveal); }
.xpbar-val { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); text-align: right; }

/* ==========================================================================
   STAGGERED REVEAL
   ========================================================================== */
.reveal { opacity: 0; animation: reveal-up .6s var(--ease-reveal) forwards; animation-delay: var(--rd, 0s); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
    .dg-3 { grid-column: span 6; } .dg-4 { grid-column: span 6; } .dg-5 { grid-column: span 12; }
    .dg-6 { grid-column: span 12; } .dg-7 { grid-column: span 12; } .dg-8 { grid-column: span 12; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .sidenav {
        position: fixed; left: 0; top: 60px; bottom: 0; z-index: 100;
        transform: translateX(-100%); transition: transform .3s var(--ease-reveal);
        background: linear-gradient(180deg, #0a1120, #05080d);
        box-shadow: 20px 0 60px rgba(0,0,0,0.5);
    }
    .sidenav.open { transform: translateX(0); }
    .topbar-burger { display: inline-flex; }
    .brand-co, .topbar-clock, .xp-chip-info { display: none; }
    .content { padding: 16px 14px 60px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .cal-grid { gap: 3px; }
    .cal-cell { min-height: 72px; padding: 4px; }
    .cal-event { font-size: 10px; padding: 2px 4px; }
    .cal-week-grid { grid-template-columns: 1fr; }
    .cal-week-col { min-height: 0; }
    .dg-3 { grid-column: span 12; } .dg-4 { grid-column: span 12; }
    .kanban-col { min-width: 240px; width: 240px; }
    .login-title { font-size: 26px; }
    .stat-row { grid-template-columns: 1fr 1fr; }
    .user-name { display: none; }
    .briefing-text { font-size: 14.5px; }
    .page-title { font-size: 17px; }
}
@media (max-width: 520px) {
    .stat-row { grid-template-columns: 1fr; }
    .modal { padding: 16px; }
    .cal-cell { min-height: 56px; }
}

/* reduced motion: honor user preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    #bg-grid { display: none; }
}
