/* Terrafox NOC — dark, bold, a little bit buggy. ------------------------- */
:root {
    --bg: #07080D;
    --bg-2: #0B0D14;
    --surface: #0F1119;
    --surface-2: #151826;
    --surface-3: #1B1F2E;
    --line: #1F2434;
    --line-2: #2E3550;
    --text: #EEF0F7;
    --dim: #8A92A8;
    --faint: #5B6379;
    --cyan: #3ED2FF;
    --pink: #FF5CCB;
    --purple: #B794FF;
    --red: #FF4D5E;
    --yellow: #FFD60A;
    --lime: #A8F029;
    --orange: #FFA24A;
    --mint: #7CFFCB;
    --allowed: var(--cyan);
    --blocked: var(--red);
    --flagged: var(--yellow);
    --ok: var(--lime);
    --grad: linear-gradient(135deg, #FF5CCB, #B794FF 55%, #3ED2FF);
    --font-ui: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-2) transparent; }
body {
    margin: 0; min-height: 100vh;
    background: var(--bg); color: var(--text);
    font-family: var(--font-ui); font-size: 15px; line-height: 1.5;
}
/* Grid wallpaper + two neon glows: the room the wall hangs in. */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(1100px 600px at 100% -10%, rgba(255,92,203,.10), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(62,210,255,.09), transparent 60%),
        linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px),
        var(--bg);
    background-size: auto, auto, 42px 42px, 42px 42px, auto;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, rgba(0,0,0,.55) 100%);
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; }
.hl { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark { font-weight: 800; letter-spacing: .12em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--dim); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.mt1 { margin-top: 1rem; } .mt2 { margin-top: 1.6rem; } .mb1 { margin-bottom: 1rem; }
.wide { width: 100%; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 1.4rem 1.4rem 4rem; }

/* ---- nav ---------------------------------------------------------------- */
nav.top {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
    padding: .55rem 1.4rem;
    background: rgba(7,8,13,.84); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
nav.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--grad); opacity: .45; }
.logo { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; margin-right: .5rem; }
.logo img { width: 26px; height: 26px; border-radius: 7px; }
.logo .wordmark { font-size: 1.05rem; }
.logo .brand { font-size: .72rem; color: var(--faint); letter-spacing: .18em; text-transform: uppercase; margin-top: 2px; }
.navlinks { display: flex; gap: .15rem; align-items: center; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: .45rem;
    border: 1px solid transparent; border-radius: 9px;
    padding: .32rem .75rem; font-weight: 500; font-size: .86rem;
    color: var(--dim); text-decoration: none; white-space: nowrap; cursor: pointer;
    background: none; font-family: inherit;
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.active { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.chip .dot, i.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 8px currentColor; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.who { cursor: default; }
.avatar { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); }
.live { display: inline-flex; align-items: center; gap: .4rem; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s infinite; }
.live.stale i { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); animation: none; }
.live.dead i { background: var(--red); box-shadow: 0 0 10px var(--red); animation: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(168,240,41,.55);} 50% { box-shadow: 0 0 0 7px rgba(168,240,41,0);} }

/* ---- buttons / forms ---------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font-family: var(--font-ui); font-weight: 600; font-size: .88rem;
    color: var(--text); background: var(--surface-2);
    border: 1px solid var(--line-2); border-radius: 9px; padding: .48rem 1rem;
    cursor: pointer; text-decoration: none; transition: border-color .12s, background .12s, box-shadow .12s;
}
.btn:hover { border-color: #4B5470; background: #1E2233; }
.btn-sm { padding: .28rem .65rem; font-size: .8rem; }
.btn-big { font-size: .98rem; padding: .7rem 1.35rem; width: 100%; }
.btn-ghost { background: transparent; }
.btn-tv { border-color: rgba(62,210,255,.45); color: var(--cyan); }
.btn-tv:hover { box-shadow: 0 0 16px rgba(62,210,255,.25); }
.btn-grad { background: var(--grad); border: none; color: #07080D; font-weight: 700; }
.btn-grad:hover { background: var(--grad); box-shadow: 0 0 22px rgba(255,92,203,.4); }
label.lbl { display: block; font-weight: 600; font-size: .82rem; margin: .9rem 0 .3rem; color: var(--dim); }
.field {
    width: 100%; font-family: var(--font-ui); font-size: .9rem;
    border: 1px solid var(--line-2); border-radius: 9px; padding: .48rem .7rem;
    background: #0A0C13; color: var(--text);
}
.field:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(62,210,255,.18); }
select.field { appearance: none; padding-right: 1.8rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A92A8' stroke-width='1.8' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; }
.help { font-size: .8rem; color: var(--dim); margin: .6rem 0 0; }
.errors { background: rgba(255,77,94,.1); border: 1px solid rgba(255,77,94,.45); color: #FFB4BB; border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; font-size: .88rem; font-weight: 500; }
.divider { display: flex; align-items: center; gap: .8rem; margin: 1.2rem 0 .4rem; color: var(--faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line-2); }

/* ---- login -------------------------------------------------------------- */
.login { max-width: 400px; margin: 9vh auto 0; }
.login-mark { text-align: center; margin-bottom: 1.4rem; }
.login-mark img { border-radius: 20px; box-shadow: 0 0 40px rgba(183,148,255,.25); }
.login-mark h1 { font-size: 2.2rem; margin-top: .6rem; }
.login-card { padding: 1.4rem; }

/* ---- panels & tiles ----------------------------------------------------- */
.panel {
    position: relative; background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem;
    min-width: 0;
}
.panel > h3 {
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
    color: var(--dim); margin: 0 0 .7rem; display: flex; align-items: center; gap: .5rem;
}
.panel > h3 .tail { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.grid { display: grid; gap: .9rem; }
.g-sites { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
@media (max-width: 1100px) { .g-sites { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .c8, .c6, .c4, .c3 { grid-column: span 12; } }
@media (max-width: 640px) { .g-sites, .g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wrap { padding: 1rem .8rem 3rem; } nav.top { position: static; } }

.tile { padding: .8rem 1rem; }
.tile .n { font-family: var(--font-mono); font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.tile .l { font-size: .7rem; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin-top: .2rem; }
.tile.hot .n { color: var(--red); text-shadow: 0 0 24px rgba(255,77,94,.45); }
.tile.warm .n { color: var(--yellow); text-shadow: 0 0 20px rgba(255,214,10,.3); }
.tile.cool .n { color: var(--cyan); text-shadow: 0 0 20px rgba(62,210,255,.3); }
.tile.grad .n { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile.ok .n { color: var(--lime); }

/* Site cards */
.site-card { display: flex; flex-direction: column; gap: .55rem; text-decoration: none; overflow: hidden; transition: border-color .15s, transform .12s; }
.site-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent, var(--cyan)); box-shadow: 0 0 18px var(--accent, var(--cyan)); }
.site-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.site-card .head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: nowrap; min-width: 0; }
.site-card .head h2 { font-size: 1.05rem; white-space: nowrap; }
.site-card .head .blurb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.site-card .head .host { color: var(--dim); font-size: .74rem; font-family: var(--font-mono); margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.site-card .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.site-card .nums .n { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.site-card .nums .l { font-size: .64rem; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin-top: .15rem; }
.site-card .nums .hot { color: var(--red); text-shadow: 0 0 16px rgba(255,77,94,.4); }
.site-card .nums .warm { color: var(--yellow); }
.site-card .spark { height: 46px; }
.site-card .foot { display: flex; gap: .5rem; font-size: .7rem; color: var(--faint); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; }
.site-card .foot .lag.live { color: var(--lime); }
.site-card .foot .lag.stale { color: var(--yellow); }
.site-card .foot .lag.dead { color: var(--red); }

/* Posture badges */
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }
.badge {
    display: inline-flex; align-items: center; gap: .35rem; border: 1px solid; border-radius: 999px;
    font-size: .68rem; font-weight: 600; letter-spacing: .02em; padding: .1rem .55rem; white-space: nowrap; line-height: 1.35;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.badge.ok { color: var(--lime); border-color: rgba(168,240,41,.35); background: rgba(168,240,41,.07); }
.badge.warn { color: var(--yellow); border-color: rgba(255,214,10,.4); background: rgba(255,214,10,.08); }
.badge.bad { color: #FF7A87; border-color: rgba(255,77,94,.55); background: rgba(255,77,94,.12); }
.badge.dim { color: var(--dim); border-color: var(--line-2); background: var(--surface-2); }
.badge.dim::before { box-shadow: none; }

/* Horizontal bars */
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .6rem; align-items: center; font-size: .82rem; margin-bottom: .48rem; cursor: pointer; }
.hbar:hover .lab { color: var(--text); }
.hbar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); display: flex; gap: .45rem; align-items: center; }
.hbar .lab .flag { font-size: 1rem; }
.hbar .lab .sub { color: var(--faint); font-size: .7rem; font-family: var(--font-mono); }
.hbar .val { font-family: var(--font-mono); font-weight: 700; font-size: .82rem; }
.hbar .track { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 4px; box-shadow: 0 0 10px currentColor; transition: width .5s ease; }
.pill { display: inline-block; font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .05rem .4rem; border-radius: 5px; border: 1px solid currentColor; line-height: 1.4; }

/* Event rows */
.evt {
    display: grid; grid-template-columns: 62px 10px 26px minmax(110px, 150px) 42px minmax(0, 1fr) auto; gap: .55rem; align-items: center;
    font-family: var(--font-mono); font-size: .76rem; padding: .34rem .35rem; border-bottom: 1px solid var(--line); color: var(--dim);
    cursor: pointer; border-radius: 6px;
}
.evt:hover { background: var(--surface-2); color: var(--text); }
.evt .t { color: var(--faint); }
.evt .sd { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.evt .path { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evt .m { color: var(--faint); font-size: .68rem; }
.evt .k { font-weight: 700; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.evt .lab { justify-self: end; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; font-size: .72rem; }
.empty { border: 1px dashed var(--line-2); border-radius: 12px; padding: 1.6rem 1rem; text-align: center; color: var(--dim); font-size: .88rem; }
.stale-banner { display: none; background: rgba(255,214,10,.08); border: 1px solid rgba(255,214,10,.4); color: var(--yellow); border-radius: 10px; padding: .55rem .9rem; font-size: .84rem; margin-bottom: 1rem; }
.stale-banner.on { display: block; }
.legend { display: flex; gap: .9rem; font-size: .72rem; color: var(--dim); align-items: center; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: .35rem; vertical-align: -1px; box-shadow: 0 0 8px currentColor; }
.window-chips .chip { padding: .25rem .6rem; font-family: var(--font-mono); font-size: .78rem; }
.window-chips .chip.active { border-color: rgba(62,210,255,.5); color: var(--cyan); }
svg text { font-family: var(--font-mono); }
.chart { width: 100%; }
.tooltip { position: fixed; z-index: 70; pointer-events: none; background: #0B0D14; border: 1px solid var(--line-2); border-radius: 8px; padding: .4rem .6rem; font-size: .74rem; font-family: var(--font-mono); color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.5); white-space: nowrap; }

/* Tables (explore, rules) */
table.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.tbl th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); padding: .45rem .5rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.tbl td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr.rowlink { cursor: pointer; }
table.tbl tr.rowlink:hover td { background: var(--surface-2); }
table.tbl .mono { font-size: .76rem; }
.pagination { display: flex; gap: .35rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; font-size: .82rem; color: var(--dim); }
.pagination .pg { border: 1px solid var(--line-2); border-radius: 8px; padding: .22rem .65rem; font-weight: 600; font-size: .82rem; text-decoration: none; color: var(--dim); cursor: pointer; background: none; font-family: inherit; }
.pagination .pg:hover { color: var(--text); background: var(--surface-2); }
.pagination .pg[disabled] { opacity: .35; pointer-events: none; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; align-items: end; }
.filters label { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: .2rem; }
.filters .field { padding: .38rem .6rem; font-size: .84rem; }

/* Drawer (event detail) */
.drawer-back { position: fixed; inset: 0; z-index: 80; background: rgba(4,5,9,.6); backdrop-filter: blur(2px); }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 81; width: min(640px, 100vw);
    background: var(--bg-2); border-left: 1px solid var(--line-2); box-shadow: -20px 0 60px rgba(0,0,0,.6);
    overflow-y: auto; padding: 1.2rem 1.4rem 2rem; animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer h2 { font-size: 1.05rem; display: flex; align-items: center; gap: .6rem; margin-bottom: .2rem; }
.drawer .close { position: absolute; top: .9rem; right: 1rem; }
.drawer h4 { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); margin: 1.2rem 0 .4rem; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: .3rem .8rem; font-size: .82rem; }
.kv dt { color: var(--faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .1rem; }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: .78rem; word-break: break-all; }
.drawer pre { background: #07080D; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; font-size: .7rem; line-height: 1.45; overflow: auto; max-height: 420px; color: #B7C0D8; }
.verdict { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-mono); font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; padding: .2rem .6rem; border-radius: 7px; border: 1px solid currentColor; }
.verdict.blocked { color: var(--red); background: rgba(255,77,94,.12); }
.verdict.flagged { color: var(--yellow); background: rgba(255,214,10,.1); }
.verdict.allowed { color: var(--cyan); background: rgba(62,210,255,.1); }

/* Rule table on the site page */
.rule-kind { font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.rule-mode { font-size: .66rem; font-weight: 700; padding: .06rem .4rem; border-radius: 5px; border: 1px solid; letter-spacing: .06em; }
.rule-mode.enforced { color: var(--lime); border-color: rgba(168,240,41,.4); }
.rule-mode.preview { color: var(--yellow); border-color: rgba(255,214,10,.45); }
.rule-mode.allow { color: var(--cyan); border-color: rgba(62,210,255,.4); }
.expr { font-family: var(--font-mono); font-size: .7rem; color: var(--faint); word-break: break-all; }

/* Keyboard hint */
kbd { font-family: var(--font-mono); font-size: .68rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; color: var(--dim); }
