@font-face { font-family: Inter; src: url(/static/fonts/inter.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Grotesk; src: url(/static/fonts/grotesk.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #F3F4F1; --card: #FFFFFF; --ink: #15191D; --muted: #5B636B; --line: #DADDD8; --ph: #CBD0C8;
  --accent: #C2410C; --accent-ink: #9A3412; --accent-soft: #FDEBDD; --accent-wash: #FFF7F1; --on-accent: #FFFFFF;
  --blue: #1D4ED8; --blue-soft: #E3EAFB; --ok: #15803D; --ok-soft: #DCF1E3; --danger: #B91C1C;
  --radius: 18px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1114; --card: #1A1F24; --ink: #F2F3F1; --muted: #A3ABB3; --line: #2E353C; --ph: #2A3036;
    --accent: #EA6A2A; --accent-ink: #FDBA74; --accent-soft: #3A2116; --accent-wash: #241610; --on-accent: #15191D;
    --blue: #8AB0FF; --blue-soft: #1C2740; --ok: #4ADE80; --ok-soft: #12301F; --danger: #F87171;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1114; --card: #1A1F24; --ink: #F2F3F1; --muted: #A3ABB3; --line: #2E353C; --ph: #2A3036;
  --accent: #EA6A2A; --accent-ink: #FDBA74; --accent-soft: #3A2116; --accent-wash: #241610; --on-accent: #15191D;
  --blue: #8AB0FF; --blue-soft: #1C2740; --ok: #4ADE80; --ok-soft: #12301F; --danger: #F87171;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, sans-serif; font-size: 16px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; }
.h1 { font-family: Grotesk, Inter, sans-serif; font-weight: 700; font-size: 28px; letter-spacing: -0.01em; }
.h2 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.screen { min-height: 100dvh; padding-bottom: calc(110px + var(--safe-b)); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(24px, env(safe-area-inset-top)) 0 14px; }
.top .date { font-size: 13px; font-weight: 500; color: var(--muted); }
.bar { display: flex; align-items: center; gap: 6px; padding: max(18px, env(safe-area-inset-top)) 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.bar .h1 { font-size: 24px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn svg { width: 22px; height: 22px; }

/* search */
.search { position: relative; margin: 4px 0 16px; }
.search input { width: 100%; height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); padding: 0 48px 0 46px; font-size: 17px; }
.search input::placeholder { color: var(--muted); }
.search > svg { position: absolute; left: 14px; top: 15px; width: 24px; height: 24px; color: var(--muted); pointer-events: none; }
.search .clear { position: absolute; right: 5px; top: 5px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.tile:active { transform: scale(.98); }
.tile .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .ic.b { background: var(--blue-soft); color: var(--blue); }
.tile .ic svg { width: 26px; height: 26px; }
.tile .t { font-weight: 700; font-size: 17px; display: block; }
.tile .s { font-size: 13px; color: var(--muted); display: block; margin-top: 3px; }

/* list */
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 10px; }
.section-h h2 { font-size: 15px; font-weight: 600; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.row .th { width: 52px; height: 52px; border-radius: 10px; background: var(--ph); flex: none; object-fit: cover; display: grid; place-items: center; color: var(--muted); }
.row .th svg { width: 22px; height: 22px; }
.row .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row .t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row mark { background: var(--accent-soft); color: var(--accent-ink); border-radius: 3px; padding: 0; font-weight: 700; }
.row .s.ids { color: var(--ink); font-weight: 500; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.more { margin: 14px auto 0; display: block; }

/* record form */
.nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.digits { height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-family: Grotesk, Inter, sans-serif; font-size: 26px; font-weight: 600; letter-spacing: 8px; text-align: center; padding-left: 8px; color: var(--ink); width: 100%; }
.digits::placeholder { color: var(--line); }
textarea.notes { border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 12px; font-size: 15px; resize: vertical; min-height: 84px; color: var(--ink); width: 100%; }
.psec { margin-top: 22px; }
.psec .hd { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.shot { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--ph); border: 0; padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .badge { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(21,25,29,.75); color: #fff; }
.add { aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--accent); background: var(--accent-wash); color: var(--accent-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 0; }
.add svg { width: 28px; height: 28px; }
.add.gal { border-style: dotted; border-color: var(--line); background: var(--card); color: var(--muted); }
.meta { margin-top: 18px; font-size: 13px; color: var(--muted); }
.link-danger { background: none; border: 0; color: var(--danger); font-weight: 600; padding: 12px 0; }

/* bottom action bar */
.actions { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 10; padding: 14px 0 calc(14px + var(--safe-b)); }
.actions .wrap { display: flex; gap: 10px; }
.btn { height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 16px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn svg { width: 20px; height: 20px; }
.btn.primary { border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.grow { flex: 1; }
.btn.grow2 { flex: 2; }
.btn:disabled { opacity: .5; }

/* auth & settings */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.auth { max-width: 420px; margin: 0 auto; padding: 12vh 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.auth .logo { width: 72px; height: 72px; border-radius: 18px; }
.input { height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; font-size: 16px; width: 100%; color: var(--ink); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--danger); font-size: 14px; font-weight: 500; min-height: 1em; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); }
.urow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.urow:last-child { border-bottom: 0; }

/* banners & toast */
.banner { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; margin-bottom: 12px; background: var(--accent-wash); color: var(--accent-ink); border: 1px solid var(--accent-soft); }
.banner svg { width: 18px; height: 18px; flex: none; }
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 40px); }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* viewer */
.viewer { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; }
.viewer .vt { display: flex; justify-content: space-between; align-items: center; padding: max(14px, env(safe-area-inset-top)) 12px 10px; color: #fff; gap: 8px; }
.viewer .vt .icon-btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.viewer .vimg { flex: 1; min-height: 0; display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .vb { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px calc(16px + var(--safe-b)); color: #ddd; font-size: 14px; gap: 8px; }
.viewer .vb .icon-btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.shot .spin { position: absolute; top: 6px; right: 6px; color: #fff; }

/* privacy hint, blur tool, admin lists */
.banner.hint { margin: 16px 0 0; align-items: flex-start; }
.banner.hint svg { margin-top: 2px; }
.small-btn { height: 34px; padding: 0 12px; font-size: 13px; flex: none; }
.viewer.blur .vimg { touch-action: none; padding: 0 8px; }
.blur-canvas { touch-action: none; cursor: crosshair; max-width: 100%; max-height: 100%; }
.viewer .btn { height: 46px; background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.viewer .btn.primary { background: var(--accent); color: var(--on-accent); }
.audit { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.arow { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.arow:last-child { border-bottom: 0; }
.urow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* ================================================================ styles (Settings → Style) */
@font-face { font-family: Archivo; src: url(/static/fonts/archivo.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
[data-act="preclimb"] { --act: #C2410C; }
[data-act="tetra"] { --act: #0F766E; }
[data-act="drill_house"] { --act: #1D4ED8; }
[data-act="drill_mdu"] { --act: #7E22CE; }

/* style picker */
.styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.style-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
.style-opt[aria-pressed="true"] { border-color: var(--accent); }
.style-opt .sw { display: flex; width: 100%; height: 28px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.style-opt .sw span { flex: 1; }
.style-opt .nm { font-weight: 700; font-size: 14px; }
.style-opt .sb { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.3; }
@media (max-width: 360px) { .styles { grid-template-columns: 1fr; } }

/* ---------------- Night Shift: always dark, safety yellow */
:root[data-style="night"] {
  --bg: #0B0D10; --card: #15181C; --ink: #F4F4F2; --muted: #A1A7AE; --line: #2A2F36; --ph: #2A2F36;
  --accent: #FACC15; --accent-ink: #FACC15; --accent-soft: #3A3108; --accent-wash: #1C1A0E; --on-accent: #0B0D10;
  --blue: #FACC15; --blue-soft: transparent; --ok: #4ADE80; --ok-soft: #0F2E1C; --danger: #F87171;
  color-scheme: dark;
}
[data-style="night"] .hl { color: #FACC15; }
[data-style="night"] .tile .ic { background: #FACC15; color: #0B0D10; }
[data-style="night"] .tile .ic.b { background: transparent; border: 2px solid #FACC15; color: #FACC15; }
[data-style="night"] .section-h h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
[data-style="night"] .add { background: #FACC15; color: #0B0D10; border: 0; font-weight: 700; }
[data-style="night"] .add.gal { background: transparent; color: var(--muted); border: 1px dashed #4A515A; }
[data-style="night"] .digits { color: #FACC15; }
[data-style="night"] .digits:focus { border: 2px solid #FACC15; outline: none; }
[data-style="night"] .field { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; }
[data-style="night"] .btn.primary { font-weight: 800; }
[data-style="night"] .row .s.ids { color: var(--ink); }

/* ---------------- Hi-Vis Blocks: always light, a solid colour per activity, chunky type */
:root[data-style="hivis"] {
  --bg: #FFFFFF; --card: #FFFFFF; --ink: #111418; --muted: #4A5158; --line: #111418; --ph: #CBD0C8;
  --accent: #111418; --accent-ink: #111418; --accent-soft: #EEEFEC; --accent-wash: #FFFFFF; --on-accent: #FFFFFF;
  --blue: #1D4ED8; --blue-soft: #E3EAFB; --ok: #15803D; --ok-soft: #DCF1E3; --danger: #B91C1C; --radius: 8px;
  color-scheme: light;
}
[data-style="hivis"] body, [data-style="hivis"] button, [data-style="hivis"] input, [data-style="hivis"] textarea { font-family: Archivo, Inter, sans-serif; }
[data-style="hivis"] .h1 { font-family: Archivo, Inter, sans-serif; font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em; }
[data-style="hivis"] .h2, [data-style="hivis"] .section-h h2 { font-weight: 900; text-transform: uppercase; color: var(--ink); }
[data-style="hivis"] .search input { border: 3px solid #111418; border-radius: 8px; font-weight: 600; }
[data-style="hivis"] .search > svg { color: #111418; }
[data-style="hivis"] .tile { background: var(--act); color: #FFFFFF; border: 0; border-radius: 8px; }
[data-style="hivis"] .tile .ic, [data-style="hivis"] .tile .ic.b { background: transparent; color: #FFFFFF; width: auto; height: auto; justify-content: flex-start; }
[data-style="hivis"] .tile .ic svg { width: 34px; height: 34px; stroke-width: 2.4; }
[data-style="hivis"] .tile .t { font-size: 20px; font-weight: 900; text-transform: uppercase; line-height: 1.05; }
[data-style="hivis"] .tile .s { color: #FFFFFF; opacity: .92; }
[data-style="hivis"] .list { gap: 0; }
[data-style="hivis"] .row { border: 0; border-top: 2px solid #111418; border-radius: 0; padding: 12px 0; background: transparent; }
[data-style="hivis"] .row:last-child { border-bottom: 2px solid #111418; }
[data-style="hivis"] .row::before { content: ''; width: 8px; align-self: stretch; border-radius: 2px; background: var(--act); flex: none; }
[data-style="hivis"] .row .t { font-weight: 800; }
[data-style="hivis"] .row .s.ids { color: var(--ink); font-weight: 700; }
[data-style="hivis"] .row mark { background: #FDE68A; color: #111418; }
[data-style="hivis"] .pill { background: transparent; color: #111418; border: 2px solid #111418; border-radius: 6px; font-weight: 800; }
[data-style="hivis"] .pill.ok { background: #15803D; color: #FFFFFF; border-color: #15803D; }
[data-style="hivis"] .btn { border: 3px solid #111418; border-radius: 8px; font-weight: 900; text-transform: uppercase; }
[data-style="hivis"] .btn.primary { border: 0; background: var(--act, #111418); color: #FFFFFF; }
[data-style="hivis"] .actions { border-top: 3px solid #111418; }
[data-style="hivis"] .card { border: 2px solid #111418; }
[data-style="hivis"] .input, [data-style="hivis"] textarea.notes { border: 2px solid #111418; border-radius: 8px; }
/* the record screen header becomes a full-width block in the activity's colour */
[data-style="hivis"] .rec-head { background: var(--act); color: #FFFFFF; box-shadow: 0 0 0 100vmax var(--act); clip-path: inset(0 -100vmax); padding-bottom: 20px; margin-bottom: 4px; }
[data-style="hivis"] .rec-head .bar { background: var(--act); }
[data-style="hivis"] .rec-head .icon-btn.ghost { color: #FFFFFF; }
[data-style="hivis"] .rec-head .field { color: #FFFFFF; text-transform: uppercase; font-weight: 800; }
[data-style="hivis"] .rec-head .digits { border: 0; background: #FFFFFF; color: #111418; font-family: Archivo, Inter, sans-serif; font-weight: 900; font-size: 28px; }
[data-style="hivis"] .rec-head .digits:focus { outline: 3px solid #111418; outline-offset: 2px; }
[data-style="hivis"] .psec .hd { border-bottom: 2px solid #111418; padding-bottom: 6px; }
[data-style="hivis"] .shot { border-radius: 6px; }
[data-style="hivis"] .add { border: 3px solid var(--act); background: #FFFFFF; color: var(--act); border-radius: 6px; font-weight: 900; text-transform: uppercase; }
[data-style="hivis"] .add.gal { border: 2px dashed #4A5158; color: #4A5158; }
[data-style="hivis"] .style-opt[aria-pressed="true"] { border-color: #111418; border-width: 3px; padding: 9px; }

/* uploads, 2FA */
button.banner { width: 100%; text-align: left; cursor: pointer; }
.shot .ok-tick { position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; background: #15803D; color: #fff; display: grid; place-items: center; }
.shot .ok-tick svg { width: 13px; height: 13px; stroke-width: 3; }
.row.busy { border-color: var(--accent); }
.row .spin { color: var(--accent); flex: none; }
.th.big { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.th.big.done { background: var(--ok-soft); color: var(--ok); }
.th.big.off { background: var(--line); color: var(--muted); }
.th.big svg { width: 24px; height: 24px; }
.warn { color: var(--accent-ink); font-weight: 600; }
.qr { width: 200px; height: 200px; align-self: center; background: #fff; border-radius: 12px; padding: 6px; }
.secret { font-size: 15px; letter-spacing: 1px; text-align: center; word-break: break-all; background: var(--accent-soft); padding: 8px; border-radius: 8px; color: var(--ink); }
.codes { margin: 0; padding: 12px; background: var(--accent-soft); color: var(--ink); border-radius: 10px; font-size: 17px; line-height: 1.7; text-align: center; letter-spacing: 1px; user-select: all; }
.auth .btn svg, .card .btn svg { width: 20px; height: 20px; }
