:root {
  color-scheme: light dark;
  --bg: #f4f5f3;
  --surface: #ffffff;
  --text: #1c1f1d;
  --muted: #646b66;
  --line: #dde0dc;
  --accent: #1f6f50;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --warn-bg: #fdf1d8;
  --warn-text: #7a5300;
  --ok-bg: #dff2e8;
  --ok-text: #17583f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816;
    --surface: #1f2320;
    --text: #e8ebe8;
    --muted: #a0a8a2;
    --line: #363c38;
    --accent: #58b78e;
    --accent-text: #0d1f17;
    --danger: #f2877f;
    --warn-bg: #3d3016;
    --warn-text: #f0cf8a;
    --ok-bg: #1b3a2c;
    --ok-text: #9fe0c1;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0; font-size: 19px; }
h3 { margin: 22px 0 4px; font-size: 16px; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.muted { color: var(--muted); margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button, .file-btn { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .6; cursor: progress; }
button:focus-visible, input:focus-visible, .file-btn:focus-within, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; min-height: 40px; width: 100%; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
#search { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.name { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; }
.badge.ok { background: var(--ok-bg); color: var(--ok-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.off { background: var(--line); color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 14px; }
label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; }
.error { color: var(--danger); margin: 0; font-weight: 400; min-height: 0; }
dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dialog-head button { min-width: 40px; padding: 6px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wide { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 14px 0; }
legend { padding: 0; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 10px 0; }
.file-btn { display: inline-flex; align-items: center; font-weight: 500; font-size: 15px; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.results { list-style: none; margin: 10px 0; padding: 0; font-size: 14px; }
.results .bad { color: var(--danger); }
.results .good { color: var(--ok-text); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 12px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 5px; right: 5px; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
main:has(#camera-view:not([hidden])) { max-width: 1500px; }
.camera-note { margin: 0 0 12px; }
.camera-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.camera { position: relative; display: block; width: 100%; min-height: 0; padding: 0; overflow: hidden; aspect-ratio: 16 / 9; background: #0c0e0d; border-radius: 8px; }
.camera img { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .label { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; color: #fff; font-size: 14px; font-weight: 600; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.camera .state { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: #c8ceca; font-size: 13px; text-align: center; }
.live-dialog { width: min(1800px, calc(100vw - 32px)); }
.live-dialog p { margin: 0 0 8px; }
.live-dialog p:empty { display: none; }
.live-dialog img:not([src]) { visibility: hidden; }
.live-dialog img { display: block; color: transparent; width: 100%; min-height: 200px; max-height: calc(100vh - 130px); object-fit: contain; background: #0c0e0d; border-radius: 8px; }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } dialog { padding: 16px; } .camera-grid { grid-template-columns: 1fr; } }
