:root {
    --bg: #0f1419;
    --bg-elev: #1a222c;
    --bg-soft: #243040;
    --line: #334155;
    --text: #e8eef5;
    --muted: #94a3b8;
    --accent: #3d9a78;
    --accent-2: #e8a54b;
    --danger: #e35d6a;
    --warn: #d4a017;
    --ok: #3d9a78;
    --font: "Source Sans 3", "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 600px at 10% -10%, #1c3a32 0%, transparent 55%),
        radial-gradient(900px 500px at 100% 0%, #2a2418 0%, transparent 50%),
        var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: rgba(15, 20, 25, 0.92);
    border-right: 1px solid var(--line);
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; gap: .75rem; align-items: center; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 8px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #3d9a78, #1f5c48);
    font-family: var(--mono); font-weight: 500; font-size: .85rem;
}
.brand strong { display: block; font-size: 1rem; }
.brand small { color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar nav a {
    color: var(--muted);
    padding: .55rem .75rem;
    border-radius: 6px;
    text-decoration: none;
}
.sidebar nav a:hover, .sidebar nav a.active {
    background: var(--bg-soft);
    color: var(--text);
}
.logout-form { border-top: 1px solid var(--line); padding-top: 1rem; }
.logout-form button {
    background: transparent; border: 1px solid var(--line); color: var(--text);
    padding: .4rem .7rem; border-radius: 6px; cursor: pointer; width: 100%;
}
.logout-form small { display: block; margin-top: .5rem; color: var(--muted); }

.main { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1400px; }
.guest-main { max-width: 480px; margin: 0 auto; padding-top: 8vh; }

h1 { margin: 0 0 .25rem; font-size: 1.75rem; font-weight: 700; }
h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.subtitle { color: var(--muted); margin: 0 0 1.5rem; }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; font-family: var(--mono); margin-top: .25rem; }

.panel {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
}
.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 960px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .panel-grid { grid-template-columns: 1fr; }
    .main { padding: 1rem; }
}

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: rgba(255,255,255,.02); }

.badge {
    display: inline-block;
    padding: .15rem .45rem;
    border-radius: 4px;
    font-size: .75rem;
    font-family: var(--mono);
    font-weight: 500;
}
.badge-Fatal, .badge-Parse { background: rgba(227,93,106,.2); color: #ffb4bb; }
.badge-Warning { background: rgba(212,160,23,.2); color: #f0d078; }
.badge-Notice, .badge-Deprecated, .badge-Strict { background: rgba(61,154,120,.15); color: #9fd9c2; }
.badge-Unknown { background: var(--bg-soft); color: var(--muted); }

.filters {
    display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; align-items: end;
}
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
.filters input, .filters select, .form-row input, .form-row select, .form-row textarea {
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 6px;
    padding: .45rem .6rem;
    font: inherit;
    min-width: 140px;
}
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    background: var(--accent); color: #062218; border: none;
    border-radius: 6px; padding: .5rem .9rem; font-weight: 600; cursor: pointer;
    font: inherit; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .3rem .55rem; font-size: .85rem; }

.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: rgba(61,154,120,.15); border: 1px solid rgba(61,154,120,.35); }
.flash.err { background: rgba(227,93,106,.12); border: 1px solid rgba(227,93,106,.35); }
.flash ul { margin: 0; padding-left: 1.1rem; }

.mono { font-family: var(--mono); font-size: .85rem; }
.muted { color: var(--muted); }
.truncate { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log-view {
    background: #0a0e12;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
    overflow: auto;
    max-height: 70vh;
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.45;
}
.log-line { display: grid; grid-template-columns: 4rem 1fr; gap: .75rem; }
.log-line .n { color: #64748b; text-align: right; user-select: none; }
.log-line .t { white-space: pre-wrap; word-break: break-word; }

.login-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2rem;
}
.login-card h1 { margin-bottom: .25rem; }
.form-row { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.form-row label { color: var(--muted); font-size: .9rem; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; color: var(--muted); margin-bottom: 1rem; }
.pager { display: flex; gap: .75rem; align-items: center; margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.delta-up { color: #ffb4bb; }
.delta-down { color: #9fd9c2; }
.delta-new { color: var(--accent-2); }
.delta-gone { color: var(--muted); }

pre.tail {
    background: #0a0e12;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem;
    overflow: auto;
    max-height: 280px;
    font-family: var(--mono);
    font-size: .75rem;
    color: #cbd5e1;
}
