:root {
  color-scheme: light;
  --ink: #152942;
  --muted: #475b72;
  --accent: #115f50;
  --accent-dark: #0a453a;
  --line: #d5dee7;
  --paper: #fff;
  --quiet: #edf2f7;
  --bad: #962d30;
  --good-bg: #e2f3eb;
  font: 16px/1.55 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f3f6fa; }
.wrap { width: min(1120px, calc(100% - 2.5rem)); margin-inline: auto; }
.masthead { background: #153249; color: #fff; padding: 2rem 0; border-bottom: 4px solid #38a88c; }
.header-content, .section-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.header-content p, .section-heading p { margin-bottom: 0; }
h1, h2, h3 { line-height: 1.2; margin-block: 0 .5rem; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.045em; }
h2 { font-size: 1.4rem; }
h3 { margin-top: 1.25rem; font-size: 1rem; }
.eyebrow { color: #a7eadb; font-size: .75rem; font-weight: 720; letter-spacing: .14em; margin: 0 0 .4rem; }
.subtitle { color: #d9e6f1; margin-top: .3rem; }
nav { display: flex; flex-wrap: wrap; gap: .9rem; }
nav a { color: #f1f8ff; text-underline-offset: .22em; font-size: .9rem; }
main { padding: 1.25rem 0 3rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; padding: 1.35rem; margin-bottom: 1rem; }
.panel p { color: var(--muted); margin-top: .25rem; }
.work-grid, .status-grid, .field-grid { display: grid; gap: .9rem; }
.work-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; }
.status-grid > div { padding: .8rem; background: #f5f8fb; border-radius: .6rem; min-width: 0; overflow-wrap: anywhere; }
.status-grid span { display: block; color: var(--muted); font-size: .83rem; margin-bottom: .3rem; }
.status-grid strong { display: inline-block; font-size: .9rem; border-radius: .45rem; padding: .15rem .5rem; background: var(--quiet); }
.status-grid strong[data-tone="good"] { background: var(--good-bg); color: var(--accent-dark); }
.status-grid strong[data-tone="bad"] { background: #fcebec; color: var(--bad); }
.field-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.credentials, .advanced { margin-top: 1rem; }
.credentials p { grid-column: 1 / -1; }
.stream-info { display: flex; justify-content: space-between; align-items: start; gap: .8rem; flex-wrap: wrap; padding-top: .9rem; margin-top: .9rem; border-top: 1px solid var(--line); }
.stream-info > div { min-width: 0; flex: 1 1 14rem; }
.stream-info h3 { margin-top: 0; }
.stream-info p { margin-bottom: .35rem; overflow-wrap: anywhere; }
.stream-info code { color: var(--ink); }
.stream-info strong[data-tone="good"] { color: var(--accent-dark); }
.stream-info strong[data-tone="bad"] { color: var(--bad); }
.stream-input { display: flex; align-items: end; gap: .5rem; }
.stream-input input { min-width: 0; }
.stream-input button { flex-shrink: 0; }
#stream-format { overflow-wrap: anywhere; }
label { font-weight: 650; font-size: .89rem; display: block; }
input:not([type="checkbox"]), select, textarea { display: block; width: 100%; margin-top: .35rem; padding: .53rem .6rem; color: var(--ink); background: var(--paper); border: 1px solid #8fa1b5; border-radius: .4rem; font: inherit; }
textarea { resize: vertical; }
input[readonly] { background: var(--quiet); }
button, .button-link { border: 1px solid var(--accent); border-radius: .45rem; padding: .57rem .9rem; font: 650 .9rem/1.4 system-ui, sans-serif; background: var(--accent); color: #fff; cursor: pointer; }
button:not(:disabled):hover, .button-link:hover { background: var(--accent-dark); color: #fff; }
.button-link { display: inline-block; text-decoration: none; }
button:disabled { opacity: .65; cursor: default; }
.secondary { background: var(--paper); color: var(--accent-dark); }
:focus-visible { outline: 3px solid #2479bd; outline-offset: 3px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { font-size: 1rem; font-weight: 700; margin: .45rem 0 .7rem; }
#upload-form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .9rem; }
#upload-form button { margin-top: .6rem; }
#upload-limit { font-weight: 400; color: var(--muted); }
.panel .message { margin: .8rem 0 0; }
.message.error { color: var(--bad); }
.check { display: flex; align-items: flex-start; gap: .5rem; margin-top: 1rem; }
.check input { margin-top: .32rem; accent-color: var(--accent); }
.hint { font-size: .86rem; }
details { margin-top: .8rem; }
summary { cursor: pointer; font-weight: 650; }
pre { max-height: 24rem; overflow: auto; background: #f3f6fa; padding: .75rem; border-radius: .45rem; font-size: .81rem; }
.reads, .event-list ol { list-style: none; padding: 0; }
.reads li { border-left: 3px solid var(--accent); padding: .5rem .7rem; margin: .35rem 0; background: #f4f9f7; }
.event-list { max-height: 23rem; overflow: auto; }
.event-list ol { margin: 0; }
.event-list li { padding: .6rem 0; border-top: 1px solid var(--line); }
.event-list time { font-size: .83rem; color: var(--muted); margin-right: .5rem; }
.event-list small { display: block; overflow-wrap: anywhere; color: var(--muted); }
.session-table { overflow-x: auto; }
.session-table table { width: 100%; border-collapse: collapse; text-align: left; }
.session-table td, .session-table th { padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
.session-table th { font-size: .85rem; white-space: nowrap; }
.session-table td { font-size: .9rem; }
.session-table img { display: block; width: 7rem; height: 2.7rem; object-fit: contain; background: #f3f6fa; }
.page-controls { display: flex; gap: .5rem; margin-top: .7rem; }
.report-ranges { margin-top: .9rem; }
.camera-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); margin-top: .9rem; }
.camera-list a { display: grid; gap: .2rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .45rem;
  color: var(--ink); background: var(--paper); text-decoration: none; overflow-wrap: anywhere; }
.camera-list a[aria-current="page"] { border-color: var(--accent); background: var(--good-bg); }
.camera-list a:hover { border-color: var(--accent); text-decoration: underline; }
.camera-list small { color: var(--muted); }
.report-table td:first-child { min-width: 9rem; overflow-wrap: anywhere; }
.report-table td:nth-child(n+3) { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stream-test-dialog { width: min(960px, calc(100% - 1.5rem)); max-height: 90dvh; overflow: auto;
  padding: 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--paper); color: var(--ink); }
.stream-test-dialog::backdrop { background: rgb(15 31 48 / .7); }
.stream-test-dialog figure { margin: .8rem 0 0; }
.stream-test-dialog img { display: block; width: 100%; max-height: 68dvh; object-fit: contain;
  background: #152942; border-radius: .45rem; }
.stream-test-dialog figcaption { margin-top: .45rem; color: var(--muted); font-size: .9rem; }
.auth-shell { max-width: 35rem; }
.auth-shell form label { margin-bottom: .8rem; }
.auth-guide { background: #f5f8fb; padding: .7rem; margin: .8rem 0; border-radius: .45rem; }
.auth-guide img { width: min(100%, 13rem); height: auto; background: var(--paper); }
.auth-guide code { overflow-wrap: anywhere; }
#account-link-label { margin-top: .8rem; }
.account-actions { min-width: 14rem; }
.account-actions button { margin: .15rem .3rem .15rem 0; }
.smtp-settings { margin-top: 1.5rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.smtp-settings form { margin-top: .8rem; }

@media (max-width: 680px) {
  .work-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .status-grid { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .status-grid span { display: inline-block; margin: 0 .5rem 0 0; }
  .wrap { width: calc(100% - 1.25rem); }
}
