:root {
    color-scheme: light;
    --ink: #17273a;
    --muted: #56677a;
    --surface: #fff;
    --canvas: #f2f6fa;
    --border: #d9e3ed;
    --nav: #152536;
    --teal: #07675c;
    --teal-light: #dbf3ee;
    --amber: #654707;
    --amber-light: #fff0c9;
    --red: #8e3033;
    --red-light: #fce8e9;
    font: 15px/1.55 "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: var(--teal); }
h1, h2, p, dl { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.045em; margin-bottom: 0; }
h2 { font-size: 1.12rem; letter-spacing: -.014em; margin-bottom: 1rem; }
small { font-size: .82rem; }
code { font-size: .88em; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid #0b9690; outline-offset: 3px; }

.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 2.5rem; padding: 2rem 1.35rem; color: #e9f4ff; background: var(--nav); }
.brand { display: flex; align-items: center; gap: .75rem; color: inherit; font-size: 1.14rem; font-weight: 720; white-space: nowrap; text-decoration: none; }
.brand b { font-weight: 500; }
.brand-mark { display: inline-block; width: 1.7rem; height: 1.7rem; border-radius: .45rem; border: solid 5px #55ccbd; border-bottom-color: #27877c; flex: none; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar nav a { padding: .68rem .8rem; color: #d9e6f4; text-decoration: none; border-radius: .55rem; }
.sidebar nav a:hover { background: #20384e; }
.sidebar nav a[aria-current] { background: #29465a; color: #fff; font-weight: 650; }
.sidebar-footer { margin-top: auto; display: grid; gap: .85rem; color: #b5c6d8; }
.sidebar-footer .quiet { border-color: #536e86; color: #edf6ff; background: transparent; }
.sidebar-footer .quiet:hover { background: #20384e; }
.workspace { width: 100%; max-width: 99rem; padding: clamp(1.1rem, 3vw, 3rem); }
.page-header, .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.page-header { margin-bottom: 1.3rem; }
.section-head h2 { margin-bottom: 0; }
.section-head { margin-bottom: 1rem; }
.panel { padding: 1.3rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--surface); margin-bottom: 1rem; }
.panel > :last-child { margin-bottom: 0; }
.metrics, .site-grid { display: grid; gap: 1rem; }
.metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); margin-bottom: 1rem; }
.site-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.metrics > .panel, .site-grid > .panel { margin: 0; }
.site-grid { margin-bottom: 1rem; }
.metric { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.metric strong { font-size: clamp(1.18rem, 1.9vw, 1.7rem); letter-spacing: -.025em; }
.metric strong small, .muted, dt { color: var(--muted); }
.metric .muted { font-size: .86rem; }
progress { width: 100%; height: .48rem; border: 0; accent-color: var(--teal); }
.badge { display: inline-block; margin: .12rem 0; padding: .16rem .5rem; border-radius: .32rem; font-weight: 650; font-size: .79rem; line-height: 1.5; }
.good { color: var(--teal); background: var(--teal-light); }
.neutral { color: #37516a; background: #e8eff6; }
.warn { color: var(--amber); background: var(--amber-light); }
.bad { color: var(--red); background: var(--red-light); }
.notice { padding: .65rem .85rem; border-radius: .55rem; }
.alerts { padding-left: 1.35rem; }
.alerts li + li { margin-top: .45rem; }
.facts { display: grid; gap: .65rem; margin-bottom: 1rem; }
.facts > div { display: grid; grid-template-columns: minmax(9rem, .65fr) 1fr; gap: .75rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
details { padding: .6rem 0; border-top: 1px solid var(--border); }
summary { cursor: pointer; color: var(--teal); }
details ul { padding-left: 1.25rem; margin-bottom: 0; }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .7rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-size: .82rem; color: var(--muted); }
tbody th { font-weight: 630; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
td small, th small, th .badge { display: block; margin-top: .2rem; width: fit-content; }
td small, th small { color: var(--muted); font-weight: 450; }
.filename { overflow-wrap: anywhere; }
.archive-actions { min-width: 14rem; }
.actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
button, input { font: inherit; }
.primary, .quiet {
    display: inline-flex; justify-content: center; align-items: center; padding: .34rem .65rem;
    min-height: 2.28rem; border-radius: .42rem; border: 1px solid var(--border); background: #fff;
    color: var(--ink); font-size: .86rem; text-decoration: none; cursor: pointer;
}
.quiet:hover { background: var(--canvas); }
.primary { background: var(--teal); color: #fff; font-weight: 650; border-color: var(--teal); }
.primary:hover { background: #055349; }
.login-wrap { min-height: 100vh; padding: 1rem; display: grid; place-items: center; }
.login { width: min(100%, 27rem); padding: clamp(1.25rem, 5vw, 2.2rem); }
.login .brand { margin-bottom: 1.4rem; }
.login h1 { font-size: 1.85rem; margin-bottom: 1rem; }
.login-form { display: grid; gap: .65rem; }
.login-form input { width: 100%; padding: .58rem; border: 1px solid var(--border); border-radius: .4rem; }
.setup-wrap { width: min(100%, 54rem); margin: 0 auto; padding: clamp(1rem, 4vw, 2.5rem); }
.setup-header { margin-bottom: 1.25rem; }
.setup-header h1 { margin-top: .5rem; }
.setup-checks { list-style: none; padding: 0; }
.setup-checks li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .3rem 0; }
.setup-wrap textarea { display: block; width: 100%; padding: .6rem; margin: 0 0 .65rem; resize: vertical; border: 1px solid var(--border); border-radius: .4rem; }
.setup-checkbox { display: flex; gap: .5rem; align-items: baseline; }
.setup-checkbox input { width: auto; }
.primary:disabled { opacity: .55; cursor: not-allowed; }

.settings-content { max-width: 62rem; }
.settings-card h2 { margin-bottom: .75rem; }
.settings-meta {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: .55rem 1.3rem; margin-bottom: .55rem;
}
.settings-meta dt { font-size: .84rem; }
.settings-meta dd { margin: .12rem 0 0; overflow-wrap: anywhere; }
.settings-meta small, .rotation-auto small { display: block; }
.settings-meta-wide { grid-column: 1 / -1; }
.settings-note { margin-bottom: .85rem; font-size: .86rem; }
.rotation-form { display: grid; gap: .75rem; }
.rotation-fields {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem .85rem;
}
.rotation-fields label { display: grid; grid-template-rows: 1fr auto; gap: .3rem; font-size: .88rem; font-weight: 630; min-width: 0; }
.rotation-fields input, .rotation-fields select {
    width: 100%; min-width: 0; height: 2.35rem; padding: .25rem .5rem; border: 1px solid var(--border);
    border-radius: .42rem; background: var(--surface); color: var(--ink); font: inherit; font-weight: 450;
}
.rotation-choice { display: flex; align-items: flex-start; gap: .6rem; padding: .3rem 0; cursor: pointer; }
.rotation-choice input[type="checkbox"] { flex: none; margin: .24rem 0 0; width: 1.05rem; height: 1.05rem; accent-color: var(--teal); }
.rotation-choice span { min-width: 0; overflow-wrap: anywhere; }
.rotation-auto { padding: .58rem .7rem; background: var(--canvas); border-radius: .5rem; }
.rotation-actions { margin-top: .75rem; }

@media (max-width: 730px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { gap: .8rem; padding: 1rem; }
    .sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sidebar nav a { padding: .45rem .2rem; text-align: center; }
    .sidebar-footer { display: flex; align-items: center; justify-content: space-between; }
    .sidebar-footer small br { display: none; }
    .facts > div { grid-template-columns: 1fr; gap: 0; }
    th, td { padding-inline: .52rem; }
}
