:root {
    color-scheme: light;
    font: 16px/1.5 system-ui, sans-serif;
    color: #172534;
    background: #f3f6f8;
    --ink: #172534;
    --muted: #506478;
    --line: #d7e1e9;
    --navy: #10263a;
    --accent: #006557;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid #228a78;
    outline-offset: 3px;
}
.top { background: var(--navy); color: white; }
.top-inner, main { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }
.top-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 70px; }
.top a { color: #e6eff6; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; white-space: nowrap; }
.brand span { background: #a4e7d6; color: var(--navy); border-radius: 6px; padding: 3px 8px; letter-spacing: .06em; }
.top nav { display: flex; gap: 8px; flex-wrap: wrap; }
.top nav a { padding: 8px 12px; border-radius: 6px; }
.top nav a:hover, .top nav a[aria-current] { background: #24445a; color: white; }
main { flex: 1; padding-block: 36px 64px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.15rem); letter-spacing: -.045em; line-height: 1.1; overflow-wrap: anywhere; }
h2 { font-size: 1.35rem; margin-block: 28px 14px; }
h3 { font-size: 1.2rem; }
.hero { background: linear-gradient(115deg, #10263a, #174f5c); border-radius: 16px; padding: clamp(28px, 6vw, 64px); color: white; }
.areas { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 350px)); gap: 16px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 12px; }
.area { display: grid; gap: 8px; color: var(--ink); text-decoration: none; padding: 22px; }
.area:hover { border-color: var(--accent); box-shadow: 0 4px 16px #10263a12; }
.area-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.area-icon { font-size: 1.35rem; border-radius: 8px; padding: 4px 10px; background: #e2f5ef; color: var(--accent); }
.arrow, .area-count { color: var(--accent); font-weight: 700; }
.area p, .muted, small { color: var(--muted); }
.area-count { font-size: .85rem; margin-top: 8px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.heading p { margin-top: 6px; }
.button, button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 42px;
    background: var(--accent); border: 1px solid var(--accent); border-radius: 7px;
    color: white; text-decoration: none; padding: 8px 14px; font: inherit; font-weight: 650; cursor: pointer;
}
.button:hover, button:hover { filter: brightness(.9); }
.secondary { background: #e8f4f1; color: #005649; border-color: #b7d8ce; }
label { display: grid; gap: 5px; font-weight: 650; }
input, textarea, select {
    width: 100%; padding: 8px 10px; min-height: 42px; border: 1px solid #aebdca;
    border-radius: 7px; color: var(--ink); background: white; font: inherit; font-weight: 400;
}
input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--accent); }
.search, .bulk { padding: 16px; margin-bottom: 14px; }
.input-row, .bulk { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.input-row { margin-top: 5px; }
.input-row input, .bulk label { flex: 1 1 260px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 12px 14px; vertical-align: top; }
th { background: #eaf0f5; color: #374e60; font-size: .86rem; white-space: nowrap; }
td { border-top: 1px solid #e1e8ed; overflow-wrap: anywhere; }
tbody tr:hover { background: #f8fafb; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.item-link { color: var(--ink); font-weight: 700; text-decoration-color: #a5b4be; text-underline-offset: .17em; }
.item-link:hover { color: var(--accent); }
small { display: block; }
small:empty { display: none; }
.back { display: inline-block; margin-bottom: 12px; text-underline-offset: .16em; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { display: grid; gap: 8px; padding: 12px; justify-items: start; font-size: .9rem; }
.stat strong { font-size: 1.45rem; line-height: 1; }
.badge { display: inline-block; border-radius: 20px; padding: 3px 8px; font-weight: 650; font-size: .81rem; white-space: nowrap; }
.unknown { background: #ebeff3; color: #3e5264; }
.ok { background: #ddf3e7; color: #085537; }
.defective { background: #f9e3e1; color: #882e26; }
.repair { background: #fff0cf; color: #724a08; }
.box { padding: 14px 18px; margin-bottom: 10px; }
summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.wide { grid-column: 1 / -1; }
.edit-form { display: grid; gap: 8px; margin-top: 8px; min-width: 190px; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.flash { padding: 12px; background: #ddf3e7; color: #085537; border-radius: 8px; margin-bottom: 14px; }
.flash.error { background: #f9e3e1; color: #882e26; }
@media (max-width: 600px) {
    .top-inner, main { width: calc(100% - 28px); }
    .top-inner { align-items: flex-start; flex-direction: column; gap: 6px; padding-block: 10px; }
    main { padding-top: 22px; }
    .form-grid { grid-template-columns: 1fr; }
    th, td { padding: 9px; }
}
.auth-main { display: grid; align-content: start; justify-items: center; padding-top: clamp(26px, 8vh, 85px); }
.auth-panel { width: min(100%, 440px); padding: clamp(20px, 5vw, 36px); }
.auth-panel h1 { font-size: clamp(1.85rem, 5vw, 2.45rem); margin-bottom: 12px; }
.auth-form { display: grid; gap: 14px; margin-top: 20px; }
.auth-form button { margin-top: 4px; }
.auth-panel .flash { margin-block: 16px 0; }
.sign-out { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding-block: 6px; }
.sign-out button { background: #24445a; border-color: #567084; min-height: 36px; padding-block: 4px; }
@media (max-width: 760px) {
    .top-inner { flex-wrap: wrap; }
}
