/* PixelOwl fonts (SIL Open Font License, see /brand/fonts/README.txt). */
@font-face { font-family: "Inter"; src: url("/brand/fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/brand/fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/brand/fonts/Inter-Bold.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/brand/fonts/SpaceGrotesk-Medium.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/brand/fonts/SpaceGrotesk-Bold.woff2") format("woff2"); font-weight: 600 900; font-display: swap; }

:root {
  --navy: #061B3A;
  --navy-deep: #03152F;
  --cyan: #08C9EE;
  --azure: #078BFA;
  --royal: #0758EF;
  --gold: #FFB020;
  --ink: #0E1B2E;
  --muted: #5B6B82;
  --line: #DCE3EE;
  --bg: #F4F7FC;
  --card: #FFFFFF;
  --good: #12A150;
  --bad: #D92D20;
  --radius: 10px;
  /* --brand-font is set from Settings → Branding. */
  font-family: var(--brand-font,) "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --heading-font: var(--brand-font,) "Space Grotesk", "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
h1, h2 { font-family: var(--heading-font); letter-spacing: -0.01em; }
h1 { font-size: 26px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 19px; margin: 0 0 12px; color: var(--navy); }
p.sub { margin: 0 0 20px; color: var(--muted); }
a { color: var(--royal); }

.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--navy); color: #fff; padding: 10px 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.topbar .brand img { height: 30px; display: block; }
.topbar .brand.custom img { height: 44px; max-width: 160px; object-fit: contain; }
.topbar .brand-name { font-size: 15px; line-height: 1.15; max-width: 200px; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #C9D6EA; text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.topbar .who { display: flex; gap: 12px; align-items: center; color: #C9D6EA; font-size: 14px; }
.topbar .link { color: var(--cyan); }

main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--royal); background: var(--royal); color: #fff;
  padding: 8px 14px; border-radius: 8px; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: color-mix(in srgb, var(--royal), #000 15%); }
button.secondary { background: #fff; color: var(--royal); }
button.secondary:hover { background: color-mix(in srgb, var(--royal) 8%, #fff); }
button.danger { background: #fff; color: var(--bad); border-color: #F2C4C0; }
button.danger:hover { background: #FEF1F0; }
button.link { background: none; border: none; padding: 0; color: var(--royal); }
button:disabled { opacity: .5; cursor: default; }

label { display: block; font-weight: 600; font-size: 13px; color: var(--navy); margin: 0 0 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--azure); outline-offset: -1px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pill.public { background: #E3F7FC; color: #05708A; }
.pill.internal { background: #EAE8FD; color: #3B2DB0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #B7C2D3; }
.dot.on { background: var(--good); }

.slide { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fff; }
.slide.off { opacity: .55; }
.slide .kind { width: 88px; font-size: 12px; font-weight: 600; color: var(--royal); text-transform: uppercase; }
.slide .order { display: flex; flex-direction: column; gap: 2px; }
.slide .order button { padding: 0 8px; font-size: 12px; line-height: 18px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item .thumb { height: 110px; background: var(--navy-deep); display: flex; align-items: center; justify-content: center; }
.media-item .thumb img, .media-item .thumb video { max-width: 100%; max-height: 100%; }
.media-item .meta { padding: 8px; font-size: 12px; word-break: break-word; }
.media-item.pick { cursor: pointer; }
.media-item.selected { outline: 3px solid var(--azure); }

.login { max-width: 380px; margin: 10vh auto; }
.login .logo { display: block; width: 300px; max-width: 100%; margin: 0 auto 8px; }
.login .tagline { text-align: center; color: var(--muted); margin: 0 0 24px; font-family: var(--heading-font); }

.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #EEF3FA; padding: 6px 8px; border-radius: 6px; word-break: break-all; }

dialog { border: none; border-radius: 12px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(3,21,47,.35); }
dialog::backdrop { background: rgba(3,21,47,.5); }
dialog form { padding: 22px; }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; margin: 6px 0; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.bad { background: var(--bad); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; justify-content: space-between; }
  .topbar .brand img { height: 32px; }
  .topbar nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .card { overflow-x: auto; }
  td[style*="nowrap"] { white-space: normal !important; }
  td button { margin: 2px 0; }
  main { padding: 20px 16px 60px; }
  .slide .kind { width: auto; }
  th.hide-sm, td.hide-sm { display: none; }
}

.layouts { display: flex; gap: 10px; flex-wrap: wrap; font-weight: 400; }
.layout-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; font-size: 13px; width: 140px; text-align: center; }
.layout-choice input { position: absolute; opacity: 0; pointer-events: none; }
.layout-choice:has(input:checked) { border-color: var(--royal); background: #EEF3FE; }
.layout-pic { width: 112px; height: 63px; display: block; }
.subcard { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; background: #FAFBFD; }
[hidden] { display: none !important; }
.field > .label { font-weight: 600; font-size: 13px; color: var(--navy); margin: 0 0 6px; }

.place-results { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.place-results button { font-size: 13px; padding: 5px 10px; }
.steps details { border-top: 1px solid var(--line); padding: 10px 0; }
.steps summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.steps ol { margin: 10px 0 6px; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
textarea[name=token] { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

dialog.preview { width: min(1400px, 96vw); }
.preview-body { padding: 18px; }
.preview-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; margin-top: 12px; align-items: start; }
.preview-screen { aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.preview-side { display: flex; flex-direction: column; min-height: 0; max-height: min(70vh, 640px); }
.preview-side h3 { margin: 0 0 2px; font-size: 15px; }
.preview-list { overflow-y: auto; min-height: 0; padding-right: 2px; }
.preview-zone + .preview-zone { margin-top: 12px; }
.preview-zone h3 { margin: 4px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.preview-zone ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.preview-pick { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; cursor: pointer; }
.preview-pick:hover:not(:disabled) { border-color: var(--azure); background: color-mix(in srgb, var(--azure) 6%, var(--card)); }
.preview-pick:disabled, .preview-pick:disabled:hover { opacity: .55; cursor: not-allowed; background: var(--card); }
.preview-pick.now { border-color: var(--royal); background: color-mix(in srgb, var(--royal) 10%, var(--card)); box-shadow: inset 3px 0 0 var(--royal); }
.preview-pick .num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--muted); }
.preview-pick.now { position: relative; overflow: hidden; }
.preview-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: color-mix(in srgb, var(--royal) 15%, transparent); }
.preview-progress i { display: block; height: 100%; background: var(--royal); transform-origin: left; animation: preview-progress linear both; }
@keyframes preview-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.preview-pick.now .num { background: var(--royal); color: #fff; }
.preview-pick .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.preview-pick .what strong, .preview-pick .what small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-pick .what strong { font-size: 14px; }
.preview-pick .what small { color: var(--muted); font-size: 12px; }
.preview-pick .live { flex: none; font-size: 11px; font-weight: 700; color: var(--royal); text-transform: uppercase; letter-spacing: .06em; }
.preview-hold { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--cyan) 14%, var(--card)); font-size: 13px; font-weight: 600; }
.preview-hold button { padding: 4px 10px; }
@media (max-width: 900px) {
  .preview-layout { grid-template-columns: 1fr; }
  .preview-side { max-height: 40vh; }
}
.preview-frame { width: 100%; height: 100%; border: 0; display: block; }

/* Police stats slide: pick categories and their labels */
.stat-picks { display: flex; flex-direction: column; gap: 8px; }
.stat-pick { align-items: center; flex-wrap: nowrap; }
.stat-pick input[type=text] { width: 100%; }
.stat-pick .muted { white-space: nowrap; }
.stat-picks { max-height: 320px; overflow-y: auto; }
.scroll-box { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.scroll-box table { margin: 0; }
.scroll-box input[type=text] { width: 100%; }
.rotation { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.rot-day { border-radius: 6px; padding: 6px 8px; font-size: 13px; font-weight: 700; background: #E6F0FF; color: var(--navy); }
.rot-day.t1 { background: #DDF7FD; } .rot-day.t2 { background: #EDE7FF; } .rot-day.t3 { background: #FFF2D9; }
.stat-pick select.note-pick { width: 210px; flex: none; }
@media (max-width: 640px) { .stat-pick { flex-wrap: wrap; } .stat-pick select.note-pick { width: 100%; } }
/* Schedule and transition */
details.options { padding: 10px 14px; }
details.options summary { cursor: pointer; font-weight: 600; color: var(--navy); }
details.options[open] summary { margin-bottom: 4px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days .day { display: flex; align-items: center; justify-content: center; min-width: 52px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; cursor: pointer; margin: 0; background: #fff; }
.days .day input { position: absolute; opacity: 0; pointer-events: none; }
.days .day:has(input:checked) { border-color: var(--royal); background: #EEF3FE; color: var(--royal); font-weight: 600; }
input[type=date], input[type=time] { font: inherit; width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input[type=color] { width: 64px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.sched { margin-top: 3px; color: var(--muted); }
.pill.active { background: #E3F7EA; color: #0B7A3B; }
.pill.waiting, .pill.upcoming { background: #FFF4DB; color: #8A5A00; }
.pill.expired { background: #EEF1F5; color: #5B6B82; }
.pill.bad { background: #FDECEC; color: #A61B1B; }
details.options > .hint { font-size: 12px; color: var(--muted); }
input[type=color] { display: block; }
.media-item .thumb { position: relative; }
.pick-num { position: absolute; top: 6px; left: 6px; background: var(--royal); color: #fff; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }

/* Feedback: red tab fixed to the right edge, and the triage page */
.feedback-fab {
  position: fixed; right: 0; top: 50%; z-index: 20;
  transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl;
  background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; letter-spacing: .04em;
  padding: 16px 9px; border-radius: 0 8px 8px 0; box-shadow: 0 4px 14px rgba(3,21,47,.25);
}
.feedback-fab:hover { background: #B42318; border-color: #B42318; }
.feedback-fab:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.nav-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }
.filters { margin-bottom: 16px; gap: 8px; }
.pill.kind-problem { background: #FDECEC; color: #A61B1B; }
.pill.kind-idea { background: #E3F7FC; color: #05708A; }
.feedback-item.closed { opacity: .7; }
.feedback-about { margin-top: 10px; font-size: 14px; }
.feedback-message { white-space: pre-wrap; margin: 12px 0; }
.feedback-notes textarea { font-size: 14px; }
select.status-pick { width: auto; }
@media (max-width: 640px) { .feedback-fab { padding: 12px 7px; font-size: 13px; } }

/* ---------- size guide ---------- */
.size-card summary { cursor: pointer; }
.size-card[open] summary { margin-bottom: 10px; }
.size-guide { width: 100%; font-size: 13px; }
.size-guide td, .size-guide th { padding: 6px 8px; }
.size-list { margin: 0 0 10px; padding-left: 20px; font-size: 14px; }
.warn-note { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: #FFF6E5; border: 1px solid #F2C46D; color: #6B4A00; font-size: 13px; }
.warn-note p { margin: 0; }
.warn-note p + p { margin-top: 4px; }
.ok-note { margin: 4px 0 0; color: #1B7A3E; }
.shot-zone { border: 2px dashed var(--line); border-radius: 8px; padding: 12px; background: #FAFBFD; }
.shot-zone.over { border-color: var(--azure); background: #EEF3FE; }
.shot-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.shot-list:empty { display: none; }
.shot { position: relative; display: block; width: 120px; height: 80px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--navy-deep); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-remove { position: absolute; top: 3px; right: 3px; padding: 0 7px; line-height: 20px; border-radius: 10px; background: rgba(3,21,47,.75); border: none; font-size: 15px; }
.feedback-item .shot-list { margin: 0 0 12px; }

/* ---------- branding settings ---------- */
.brand-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 18px; }
.brand-color .pair { display: flex; gap: 8px; align-items: center; }
.brand-color .pair input[type=text] { width: 110px; font-family: ui-monospace, Menlo, Consolas, monospace; text-transform: uppercase; }
.brand-color input.bad { border-color: var(--bad); }
.brand-preview { border-radius: 10px; padding: 18px 20px; color: #fff; display: grid; gap: 8px; margin: 6px 0 14px; position: relative; overflow: hidden; }
.brand-preview .bp-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.brand-preview .bp-title { font-size: 24px; font-weight: 700; line-height: 1.15; }
.brand-preview .bp-bars { display: flex; gap: 6px; align-items: flex-end; height: 40px; }
.brand-preview .bp-bars i { width: 22px; border-radius: 3px 3px 0 0; display: block; }
.brand-preview .bp-chip { justify-self: start; padding: 4px 10px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.brand-preview img { position: absolute; right: 16px; bottom: 14px; height: 54px; max-width: 120px; object-fit: contain; }
.contrast-list { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; font-size: 13px; }
.contrast-list .sw { display: inline-block; padding: 1px 8px; border-radius: 4px; font-weight: 700; margin-right: 6px; border: 1px solid var(--line); }
.brand-logo-pick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.brand-logo-pick .now { width: 96px; height: 64px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 6px; }
.brand-logo-pick .now img { max-width: 100%; max-height: 100%; object-fit: contain; }
.login .logo.custom { width: auto; max-width: 260px; height: 140px; object-fit: contain; }
