:root {
    color-scheme: dark;
    --bg: #090d13;
    --panel: #111823;
    --panel-2: #172231;
    --line: #263548;
    --text: #e8eef6;
    --muted: #8ea0b6;
    --accent: #29b6f6;
    --accent-2: #0085c7;
    --green: #42d392;
    --red: #ff6b72;
    --amber: #f4c95d;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 20% 0, #132337 0, var(--bg) 35%); color: var(--text); }
body { min-width: 320px; }
a { color: var(--accent); text-decoration: none; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.5rem); margin-bottom: .55rem; }
h2 { font-size: 1.1rem; margin-bottom: 1rem; }
small { color: var(--muted); }
label { display: block; margin: 0 0 .4rem; color: #c8d5e4; font-size: .88rem; }
button, input, select { font: inherit; }

.topbar { position: sticky; top: 0; z-index: 20; min-height: 68px; padding: 0 clamp(1rem, 4vw, 3.5rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: rgba(9,13,19,.92); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--text); }
.brand span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand small { margin-top: .25rem; letter-spacing: .08em; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(145deg, #32c5ff, #006fa9); color: white; font-size: 1.65rem; font-weight: 900; box-shadow: 0 12px 32px rgba(0,149,220,.3); }
.brand-mark.small { width: 40px; height: 40px; border-radius: 11px; font-size: 1.25rem; }
nav { display: flex; align-items: center; gap: .3rem; }
nav a, .nav-button { padding: .6rem .8rem; color: var(--muted); border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
nav a.active, nav a:hover, .nav-button:hover { color: white; background: var(--panel-2); }
nav form { margin: 0; }

.page-shell { width: min(1500px, calc(100% - 2rem)); margin: 0 auto; padding: 2.25rem 0 4rem; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { margin-bottom: .45rem; color: var(--accent); font-weight: 800; font-size: .72rem; letter-spacing: .18em; }
.muted { color: var(--muted); }
.card, .table-card { background: linear-gradient(150deg, rgba(23,34,49,.98), rgba(14,21,31,.98)); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 16px 50px rgba(0,0,0,.2); }
.card { padding: 1.25rem; }
.section-gap { margin-top: 1.25rem; }
.status-pill { display: inline-flex; align-items: center; white-space: nowrap; padding: .35rem .65rem; border: 1px solid; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.status-pill.ok { color: var(--green); border-color: rgba(66,211,146,.35); background: rgba(66,211,146,.09); }
.status-pill.bad { color: var(--red); border-color: rgba(255,107,114,.35); background: rgba(255,107,114,.09); }

.controls-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.file-box { position: relative; min-height: 115px; padding: 1rem; border: 1px dashed #36516f; border-radius: 11px; background: rgba(5,12,20,.45); display: flex; flex-direction: column; justify-content: center; gap: .6rem; overflow: hidden; }
.file-box input[type=file] { color: var(--muted); width: 100%; }
.file-label { color: var(--accent); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.compare-action { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
.form-control { width: 100%; min-height: 43px; padding: .65rem .75rem; color: var(--text); background: #0b121c; border: 1px solid #314157; border-radius: 8px; outline: none; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(41,182,246,.12); }
.btn-primary, .btn-secondary { border: 0; border-radius: 8px; padding: .68rem 1rem; cursor: pointer; font-weight: 700; }
.btn-primary { color: white; background: linear-gradient(135deg, #11aeea, #0075ad); box-shadow: 0 9px 22px rgba(0,133,199,.24); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-secondary { color: #c9d7e6; background: #202e40; border: 1px solid #314157; padding: .45rem .65rem; }
.btn-secondary:hover { color: white; border-color: #4d6684; }
.full-width { width: 100%; display: block; text-align: center; }
.link-button { margin-top: 1rem; }

.alert { margin: 1rem 0; padding: .85rem 1rem; border-radius: 9px; border: 1px solid; }
.alert.success { color: #baf4d7; background: rgba(66,211,146,.09); border-color: rgba(66,211,146,.3); }
.alert.error { color: #ffc3c6; background: rgba(255,107,114,.09); border-color: rgba(255,107,114,.3); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
.metric { padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; display: flex; justify-content: space-between; align-items: center; }
.metric span { color: var(--muted); }
.metric strong { font-size: 1.4rem; }
.metric.changed strong { color: var(--amber); }
.filters { display: grid; grid-template-columns: 2fr 1fr auto; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.check-row { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; }
.table-card, .table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { position: sticky; top: 0; z-index: 2; padding: .8rem; color: var(--muted); background: #121b27; border-bottom: 1px solid var(--line); text-align: left; font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
td { padding: .75rem .8rem; border-bottom: 1px solid rgba(38,53,72,.68); font-size: .88rem; vertical-align: top; }
td small { display: block; margin-top: .25rem; }
tbody tr:hover { background: rgba(41,182,246,.04); }
.row-changed { background: rgba(244,201,93,.07); }
.row-changed td:last-child { color: var(--amber); }
.row-only { background: rgba(255,107,114,.07); }
.row-only td:last-child { color: var(--red); }
.text-success { color: var(--green); }
.text-error { color: var(--red); }

.admin-form .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: end; }
.form-action { display: flex; align-items: flex-end; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 340px; }
.inline-form { display: flex; gap: .75rem; }
.inline-form .form-control { max-width: 360px; }
.validation-message { color: var(--red); font-size: .85rem; }

.login-shell { min-height: calc(100vh - 5rem); display: grid; place-items: center; padding: 2rem 1rem; }
.login-card { width: min(440px, 100%); padding: 2rem; border: 1px solid var(--line); border-radius: 18px; background: rgba(17,24,35,.96); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card .brand-mark { margin-bottom: 1.25rem; }
.login-card label:not(.check-row) { margin-top: 1rem; }
.login-note { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }

.valid.modified:not([type=checkbox]) { border-color: var(--green); }
.invalid { border-color: var(--red); }
h1:focus { outline: none; }

@media (max-width: 850px) {
    .topbar { align-items: flex-start; padding: .75rem 1rem; }
    nav { flex-wrap: wrap; justify-content: flex-end; }
    .brand small { display: none; }
    .controls-grid, .admin-form .form-grid { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: 1fr; }
    .inline-form { flex-direction: column; }
}

@media (max-width: 560px) {
    .topbar { position: static; flex-direction: column; }
    nav { width: 100%; justify-content: flex-start; }
    nav a, .nav-button { padding: .45rem .55rem; font-size: .85rem; }
    .page-shell { width: min(100% - 1rem, 1500px); padding-top: 1rem; }
    .hero { flex-direction: column; }
    .compare-action { flex-direction: column; align-items: stretch; }
}
