:root {
    --bg:#070b0d;
    --panel:#0d1417;
    --panel2:#111b20;
    --fg:#d8e7df;
    --muted:#789087;
    --green:#7cff8a;
    --cyan:#59d7ff;
    --red:#ff6b6b;
    --amber:#ffd166;
    --border:#23332d;
}

* {
    box-sizing:border-box;
}

html {
    margin:0;
    padding:0;
    width:100%;
    overflow-x:clip;
}

body {
    margin:0;
    padding:0;
    width:100%;
    min-width:0;
    overflow-x:clip;
    background-color:var(--bg);
    background-image:
        linear-gradient(
            rgba(124,255,138,.025) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(124,255,138,.025) 1px,
            transparent 1px
        );
    background-size:24px 24px;
    color:var(--fg);
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;
    line-height:1.5;
}


/* =========================================================
   LINKS
   ========================================================= */

a {
    color:var(--green);
    text-decoration:none;
}

a:hover {
    text-decoration:underline;
}


/* =========================================================
   HEADER
   ========================================================= */

.topbar {
    position:-webkit-sticky;
    position:sticky;
    top:0;
    z-index:1000;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:24px;
    width:100%;
    max-width:100%;
    min-width:0;
    padding:14px 24px;
    background:rgba(5,9,11,.98);
    border-bottom:1px solid var(--border);
}


/* =========================================================
   LOGO / BRAND
   ========================================================= */

.brand {
    flex:0 1 auto;
    min-width:0;
}

.brand-link {
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
    font-weight:800;
    letter-spacing:.08em;
}

.brand-link:hover {
    text-decoration:none;
}

.brand-icon {
    display:block;
    width:clamp(44px,5vw,70px);
    height:auto;
    max-width:70px;
    object-fit:contain;
    flex-shrink:0;
}

.brand-text {
    display:flex;
    flex-direction:column;
    justify-content:center;
    min-width:0;
}

.brand-name {
    display:block;
}

.brand small {
    display:block;
    color:var(--muted);
    font-weight:400;
    letter-spacing:normal;
}


/* =========================================================
   NAVIGATION
   ========================================================= */

nav {
    display:flex;
    flex:1 1 auto;
    min-width:0;
    justify-content:flex-end;
    gap:16px;
    flex-wrap:wrap;
    align-items:center;
}

nav a {
    font-size:.86rem;
    white-space:nowrap;
}


/* =========================================================
   MAIN
   ========================================================= */

.wrap {
    max-width:1280px;
    width:100%;
    min-width:0;
    margin:0 auto;
    padding:26px;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
    display:grid;
    grid-template-columns:1fr auto;
    gap:20px;
    align-items:end;
    margin-bottom:24px;
}

.hero h1 {
    margin:0 0 6px;
    font-size:1.8rem;
}

.muted {
    color:var(--muted);
}


/* =========================================================
   CARDS / FILTERS
   ========================================================= */

.filters,
.card,
.adminbox {
    background:var(--panel);
    border:1px solid var(--border);
    padding:16px;
    border-radius:4px;
}

.filters {
    margin-bottom:18px;
}

.row {
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
}


/* =========================================================
   FORMS
   ========================================================= */

input,
select,
button,
textarea {
    background:#070d10;
    color:var(--fg);
    border:1px solid #345044;
    padding:10px;
    border-radius:3px;
    font:inherit;
}

input[type=text],
input[type=url],
input[type=password],
input[type=number],
select {
    min-width:180px;
}

button,
.btn {
    display:inline-block;
    background:#102519;
    color:var(--green);
    border:1px solid #315a3a;
    padding:9px 12px;
    border-radius:3px;
    cursor:pointer;
}

.danger {
    color:#ff9a9a;
    border-color:#6d3434;
    background:#261313;
}

.warn {
    color:var(--amber);
}


/* =========================================================
   ARTICLES
   ========================================================= */

.articles {
    display:grid;
    gap:10px;
}

.article {
    display:grid;
    grid-template-columns:105px minmax(0,1fr) auto;
    gap:16px;
    padding:15px 16px;
    background:
        linear-gradient(
            90deg,
            var(--panel),
            #0b1114
        );
    border:1px solid var(--border);
    border-left:3px solid #2f5640;
}

.article.high {
    border-left-color:var(--red);
}

.stamp {
    font-size:.78rem;
    color:var(--muted);
}

.article h2 {
    font-size:1.05rem;
    margin:0 0 6px;
    overflow-wrap:anywhere;
}

.meta {
    font-size:.78rem;
    color:var(--muted);
    overflow-wrap:anywhere;
}

.summary {
    margin:8px 0 0;
    color:#afc1b8;
    overflow-wrap:anywhere;
}

.badge {
    display:inline-block;
    padding:2px 6px;
    border:1px solid #315143;
    margin:3px 4px 0 0;
    font-size:.7rem;
    color:#a8c6b6;
}

.score {
    min-width:55px;
    text-align:center;
    font-weight:700;
    color:var(--green);
}

.score.hot {
    color:var(--red);
}


/* =========================================================
   TABLES
   ========================================================= */

table {
    width:100%;
    border-collapse:collapse;
    background:var(--panel);
}

th,
td {
    text-align:left;
    padding:10px;
    border-bottom:1px solid var(--border);
    vertical-align:top;
}

th {
    color:var(--green);
}

.status-ok {
    color:var(--green);
}

.status-bad {
    color:var(--red);
}

.status-warn {
    color:var(--amber);
}


/* =========================================================
   PAGER / LOGIN / FLASH
   ========================================================= */

.pager {
    display:flex;
    gap:8px;
    margin:20px 0;
}

.login {
    max-width:460px;
    margin:8vh auto;
}

.flash {
    padding:12px;
    border:1px solid #315a3a;
    background:#0f2117;
    margin-bottom:15px;
}

.error {
    border-color:#6d3434;
    background:#251313;
    color:#ffb0b0;
}


/* =========================================================
   KPI
   ========================================================= */

.kpis {
    display:grid;
    grid-template-columns:
        repeat(auto-fit,minmax(180px,1fr));
    gap:12px;
    margin-bottom:18px;
}

.kpi {
    background:var(--panel);
    border:1px solid var(--border);
    padding:15px;
}

.kpi b {
    display:block;
    font-size:1.6rem;
    color:var(--green);
}


/* =========================================================
   SOURCE FORM
   ========================================================= */

.source-form {
    display:grid;
    grid-template-columns:
        repeat(auto-fit,minmax(210px,1fr));
    gap:10px;
}

.source-form .wide {
    grid-column:span 2;
}

.small {
    font-size:.76rem;
}

.nowrap {
    white-space:nowrap;
}

.break {
    overflow-wrap:anywhere;
}

code {
    color:#b9e9c1;
}

.poll-stats {
    font-size:.76rem;
    line-height:1.65;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    max-width:1280px;
    margin:30px auto 0;
    padding:20px 26px;
    border-top:1px solid var(--border);
    color:var(--muted);
    display:flex;
    justify-content:space-between;
    gap:20px;
    flex-wrap:wrap;
    font-size:.78rem;
}


/* =========================================================
   TABLET / MOBILE HEADER
   ========================================================= */

@media(max-width:1000px) {

    .topbar {
        position:-webkit-sticky;
        position:sticky;
        top:0;
        z-index:1000;
        flex-direction:column;
        align-items:flex-start;
        gap:8px;
        padding:8px 14px;
        background:#05090b;
    }

    .brand {
        width:100%;
    }

    .brand-link {
        gap:9px;
        width:100%;
    }

    .brand-icon {
        width:44px;
        max-width:44px;
    }

    .brand-name {
        font-size:.82rem;
        line-height:1.2;
        white-space:normal;
    }

    .brand small {
        font-size:.68rem;
    }

    nav {
        width:100%;
        justify-content:flex-start;
        gap:7px 12px;
    }

    nav a {
        font-size:.72rem;
    }
}


/* =========================================================
   MOBILE CONTENT
   ========================================================= */

@media(max-width:800px) {

    .article {
        grid-template-columns:1fr;
    }

    .score {
        text-align:left;
    }

    .hero {
        grid-template-columns:1fr;
    }

    .wrap {
        padding:16px;
    }

    .source-form .wide {
        grid-column:span 1;
    }

    table {
        display:block;
        overflow-x:auto;
    }
}
