:root {
    --ink: #142033;
    --muted: #66758a;
    --line: #dbe3ec;
    --soft: #f3f6fa;
    --panel: #ffffff;
    --primary: #175cd3;
    --primary-dark: #1149a8;
    --success: #087443;
    --danger: #b42318;
    --warning: #8a5b00;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--soft);
    font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--soft); }
a { color: var(--primary); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 1000; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 850; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; font-size: .82rem; letter-spacing: .04em; }
.primary-nav { display: flex; align-items: center; gap: 4px; }
.primary-nav a { padding: 9px 11px; border-radius: 9px; color: #42526a; text-decoration: none; font-size: .92rem; font-weight: 700; }
.primary-nav a:hover, .primary-nav a.active { background: #e9f0fb; color: var(--primary-dark); }
.nav-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 11px; font-weight: 750; }
.page-main { padding: 28px 0 60px; min-height: calc(100vh - 126px); }
.auth-main { min-height: calc(100vh - 58px); display: grid; place-items: center; padding: 32px 16px; }
.auth-shell { width: min(460px, 100%); }
.site-footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .82rem; }
.footer-inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0 0 5px; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.08; }
.page-heading p { margin: 0; color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(20,32,51,.05); }
.card-body { padding: 22px; }
.card-header { padding: 17px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.card-header h2, .card-body h2 { margin: 0; font-size: 1.15rem; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 19px; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.stat-value { margin-top: 8px; font-weight: 850; font-size: 1.65rem; line-height: 1; }
.stat-sub { margin-top: 7px; color: var(--muted); font-size: .86rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; border-radius: 10px; padding: 9px 15px; border: 1px solid transparent; text-decoration: none; font-weight: 800; font-size: .92rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; color: #34445b; border-color: #cbd5e1; }
.btn-secondary:hover { background: #f7f9fc; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f2b8b5; }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: .82rem; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: block; margin-bottom: 7px; font-weight: 800; font-size: .88rem; }
.field-help { color: var(--muted); font-size: .8rem; margin-top: 6px; }
input, select, textarea {
    width: 100%;
    border: 1px solid #c8d2df;
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--ink);
    background: #fff;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,92,211,.13); }
textarea { min-height: 110px; resize: vertical; }
.form-row { margin-bottom: 16px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.required::after { content: " *"; color: var(--danger); }
.alert { border-radius: 11px; padding: 13px 15px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: #eaf8ef; color: #075f37; border-color: #b8e6c9; }
.alert-error { background: #fff0ee; color: #8e2319; border-color: #f2c0bb; }
.alert-warning { background: #fff8df; color: #6f4d05; border-color: #edd792; }
.alert-info { background: #eaf2fd; color: #194d91; border-color: #bdd3f2; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #526176; font-size: .78rem; text-transform: uppercase; letter-spacing: .045em; background: #f8fafc; }
tbody tr:hover { background: #fafcff; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: .74rem; font-weight: 850; background: #e9f0fb; color: #2255a0; }
.badge-gray { background: #edf1f5; color: #536174; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.thumb { width: 112px; max-height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #eef2f7; }
.detail-list { display: grid; grid-template-columns: minmax(130px, .35fr) 1fr; margin: 0; }
.detail-list dt, .detail-list dd { padding: 10px 0; margin: 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-weight: 750; }
.detail-list dd { font-weight: 650; }
.route-map { height: 420px; border-radius: 13px; overflow: hidden; background: #e9eef5; border: 1px solid var(--line); }
.route-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.route-metric { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.route-metric span { display: block; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.route-metric strong { display: block; margin-top: 6px; font-size: 1.15rem; }
.route-status { min-height: 22px; color: var(--muted); font-size: .88rem; margin-top: 10px; }
.route-status.error { color: var(--danger); }
.split-layout { display: grid; grid-template-columns: minmax(0,.8fr) minmax(420px,1.2fr); gap: 20px; align-items: start; }
.filter-bar { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; align-items: end; }
.login-card { padding: 28px; }
.login-card h1 { margin: 0 0 7px; }
.login-card .brand-mark { margin-bottom: 18px; }
.evidence-large { display: block; width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #edf1f5; }
.info-banner { background: #f0f6ff; border: 1px solid #cddff7; border-radius: 12px; padding: 13px 15px; color: #315782; font-size: .88rem; }
.danger-zone { border-color: #efc5c1; }
.danger-zone .card-header { background: #fff5f4; }
.nowrap { white-space: nowrap; }

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .split-layout { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .shell { width: min(100% - 22px, 1180px); }
    .nav-toggle { display: inline-flex; }
    .primary-nav { display: none; position: absolute; left: 11px; right: 11px; top: 62px; padding: 9px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 35px rgba(20,32,51,.16); flex-direction: column; align-items: stretch; }
    .primary-nav.open { display: flex; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .grid-2, .grid-3, .grid-4, .stats-grid, .route-summary, .filter-bar { grid-template-columns: 1fr; }
    .route-map { height: 340px; }
    .footer-inner { padding: 14px 0; flex-direction: column; align-items: flex-start; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list dt { border-bottom: 0; padding-bottom: 2px; }
    .detail-list dd { padding-top: 0; }
}
