/* Beatbook. Quiet Carbon-style base, one bold element: the hi-vis tape band. */
:root {
  --ink: #161616;
  --ink-2: #474b52;
  --ink-3: #6f747c;
  --canvas: #ffffff;
  --surface: #f3f4f5;
  --surface-2: #e2e4e7;
  --line: #d9dce0;
  --accent: #0f62fe;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0ff;
  --hivis: #d4f20a;
  --tape: #c6c9cc;
  --ok: #1f8a3e;
  --danger: #c4161f;
  --warn-bg: #fff8db;
  --warn-line: #e3c43a;
  --r-ctl: 6px;
  --r-card: 12px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef0f2;
    --ink-2: #c3c7cc;
    --ink-3: #959aa1;
    --canvas: #141618;
    --surface: #1d2023;
    --surface-2: #2a2e32;
    --line: #34393e;
    --accent: #5b93ff;
    --accent-ink: #0b0d10;
    --accent-soft: #1b2a45;
    --tape: #8b9096;
    --ok: #4cc26b;
    --danger: #ff6b70;
    --warn-bg: #2b2611;
    --warn-line: #7d6a17;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 16px/1.55 var(--font);
}
h1, h2 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.125rem; }
p { margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--ink-3); }
.small { font-size: 0.875rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--canvas); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* header with hi-vis tape */
.top { background: var(--ink); color: #f4f4f4; position: relative; }
@media (prefers-color-scheme: dark) { .top { background: #0b0c0d; } }
.tape {
  height: 14px;
  background: linear-gradient(var(--hivis) 0 4px, var(--tape) 4px 10px, var(--hivis) 10px 14px);
}
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; max-width: 1240px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { font-size: 1.125rem; font-weight: 600; display: block; line-height: 1.2; }
.brand .tag { font-size: 0.8125rem; color: #b9bdc2; display: block; }
.mark { width: 28px; height: 28px; border-radius: 6px; flex: none; background: linear-gradient(#262626 0 10px, var(--hivis) 10px 18px, #262626 18px); box-shadow: inset 0 0 0 1px #3a3a3a; }
.top-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.trial-left { font-size: 0.8125rem; color: #c9cdd1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top .btn-ghost { color: #f4f4f4; border-color: #5a5f64; }
.top .btn-ghost:hover { background: #2b2e31; }

/* layout */
.shell { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding: 24px 20px 48px; }
main { min-width: 0; }
.tabs { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; align-self: start; }
.tab {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--r-ctl);
  background: none; color: var(--ink-2); font: inherit; font-size: 0.9375rem; text-align: left; cursor: pointer;
}
.tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tab:hover { background: var(--surface); color: var(--ink); }
.tab[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }

.local-note {
  font-size: 0.875rem; color: var(--ink-2); background: var(--surface); border-radius: var(--r-ctl);
  padding: 8px 12px; margin-bottom: 20px; border-left: 3px solid var(--hivis);
}
.lead { color: var(--ink-2); max-width: 62ch; }

.card { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.span2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem; font-weight: 500; color: var(--ink-2); min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--canvas);
  border: 1px solid var(--line); border-bottom-color: var(--ink-3); border-radius: var(--r-ctl);
  padding: 10px 12px; width: 100%; min-width: 0; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .tab:focus-visible, .chip input:focus-visible + span {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 0.875rem; font-weight: 500; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 12px; align-items: end; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-ctl); border: 1px solid transparent; font: inherit; font-size: 0.9375rem; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(0.92); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 36px; }
.btn-danger-ghost { background: none; color: var(--danger); border-color: transparent; padding: 0 8px; }
.btn.icon { width: 44px; padding: 0; }
.file-btn { position: relative; overflow: hidden; flex-direction: row; display: inline-flex; color: var(--ink); }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { flex-direction: row; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--canvas); color: var(--ink-2); cursor: pointer; font-weight: 500;
}
.chip input:checked + span { background: var(--ink); color: var(--canvas); border-color: var(--ink); }

/* shift */
.shift-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-left: 4px solid var(--hivis); }
.shift-site { font-size: 1.25rem; font-weight: 600; }
.entry-form textarea { margin-bottom: 12px; }
.entry-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.entry-row .btn { margin-left: auto; }
.time-pick { width: 140px; }
.grow { flex: 1; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 80px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.timeline time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.etype { font-size: 0.8125rem; color: var(--ink-3); }
.timeline .txt { overflow-wrap: anywhere; }
.timeline button { background: none; border: 0; color: var(--ink-3); cursor: pointer; font: inherit; font-size: 0.8125rem; min-height: 32px; }

/* people rows */
.person { display: grid; grid-template-columns: 1.2fr 0.9fr 1.6fr 44px; gap: 8px; margin-bottom: 8px; align-items: center; }
.person .btn { min-height: 44px; }

.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.photo-row figure { margin: 0; position: relative; }
.photo-row img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--r-ctl); border: 1px solid var(--line); display: block; }
.photo-row button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }

/* records */
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.list-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 8px; flex-wrap: wrap; }
.list-actions { display: flex; gap: 8px; }
.rec-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.rec {
  display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 4px 16px; padding: 14px 8px; border-bottom: 1px solid var(--line);
  cursor: pointer; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; font: inherit; color: inherit;
}
.rec:hover { background: var(--surface); }
.rec .no { font-family: var(--mono); font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rec .title { font-weight: 600; overflow-wrap: anywhere; }
.rec .sub { color: var(--ink-3); font-size: 0.875rem; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec .when { font-size: 0.875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin-right: 6px; vertical-align: 1px; }
.badge.inc { background: #fde8e9; color: #9f1219; }
@media (prefers-color-scheme: dark) { .badge.inc { background: #4a1d20; color: #ffb3b6; } }
.empty { padding: 32px 8px; color: var(--ink-3); }

/* backup */
.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.warn .muted { color: inherit; opacity: 1; }
.split { align-items: start; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split .card { margin-bottom: 16px; }

.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--ink-2); max-width: 72ch; }

/* dialog */
dialog {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-card); background: var(--canvas); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 12, 14, .55); }
dialog[open] { display: flex; flex-direction: column; }
.dlg-head, .dlg-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.dlg-head { border-bottom: 1px solid var(--line); justify-content: space-between; }
.dlg-head h2 { margin: 0; }
.dlg-foot { border-top: 1px solid var(--line); flex-wrap: wrap; }
.dlg-body { padding: 16px 20px; overflow: auto; }

/* record view (dialog + print) */
.rv dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 16px; margin: 0 0 16px; }
.rv dt { color: var(--ink-3); font-size: 0.875rem; }
.rv dd { margin: 0; overflow-wrap: anywhere; }
.rv h3 { font-size: 1rem; font-weight: 600; margin: 16px 0 6px; }
.rv .prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.rv table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.rv th, .rv td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.rv th { font-weight: 600; color: var(--ink-2); font-size: 0.8125rem; }
.rv td.k { white-space: nowrap; overflow-wrap: normal; }
.rv td.t { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv .pics { display: flex; gap: 8px; flex-wrap: wrap; }
.rv .pics img { max-width: 220px; max-height: 220px; border-radius: 4px; border: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--canvas);
  padding: 10px 16px; border-radius: var(--r-ctl); font-size: 0.9375rem; z-index: 40; max-width: calc(100vw - 32px);
}

.print-area { display: none; }

/* tablet */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 20px 16px 104px; gap: 0; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 30; flex-direction: row; gap: 0;
    background: var(--canvas); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  /* trial used up: the shared unlock bar owns the bottom edge, the menu sits just above it */
  .has-paybar .tabs { bottom: var(--paybar-h, 0px); padding-bottom: 4px; }
  .toast { bottom: calc(80px + var(--paybar-h, 0px)); }
  .has-paybar .shell { padding-bottom: calc(104px + var(--paybar-h, 0px)); }
  .tab { flex: 1; flex-direction: column; gap: 2px; font-size: 0.75rem; padding: 8px 2px; text-align: center; min-height: 56px; }
  .tab[aria-current="page"] { box-shadow: inset 0 3px 0 var(--accent); }
  .filters { grid-template-columns: 1fr 1fr; }
  /* the legal footer sits below the shell, so it carries the room for the fixed menu */
  .shell, .has-paybar .shell { padding-bottom: 8px; }
  footer.legal { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  html.has-paybar footer.legal { padding-bottom: calc(96px + var(--paybar-h, 0px)); }
}
/* phone */
@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .top-in { padding: 10px 16px; flex-wrap: wrap; row-gap: 8px; }
  .top-actions { flex: 1 1 100%; justify-content: space-between; gap: 8px; }
  .brand .tag { display: none; }
  .trial-left { font-size: 0.75rem; }
  .hide-sm { display: none; }
  .top .btn { min-height: 40px; padding: 0 12px; font-size: 0.875rem; }
  .card { padding: 16px; }
  .form-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .person { grid-template-columns: minmax(0, 1fr) 44px; }
  .person .pname { grid-column: 1; grid-row: 1; }
  .person .btn { grid-column: 2; grid-row: 1; }
  .person .prole, .person .pdetail { grid-column: 1 / -1; }
  .person { padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .timeline li { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .timeline .etype { grid-column: 2; grid-row: 1; }
  .timeline .txt { grid-column: 1 / -1; }
  .timeline li > button { grid-column: 3; grid-row: 1; }
  .rec { grid-template-columns: minmax(0, 1fr) auto; }
  .rec .no { grid-column: 1; }
  .rec .when { grid-column: 2; grid-row: 1; }
  .rec .body { grid-column: 1 / -1; }
  .list-actions { width: 100%; }
  .list-actions .btn { flex: 1; }
  .rv dl { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .rv dd { margin-bottom: 8px; }
  .shift-head { flex-direction: column; align-items: stretch; }
  .dlg-foot .btn { flex: 1; }
  .dlg-foot .grow { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* print: only the report pages */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  :root { --ink: #000; --ink-2: #222; --ink-3: #555; --line: #bbb; --canvas: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .pr-page { break-after: page; }
  .pr-page:last-child { break-after: auto; }
  .pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 12px; }
  .pr-head .co { font-size: 14pt; font-weight: 600; }
  .pr-head .no { font-family: var(--mono); font-size: 10pt; }
  .pr-title { font-size: 16pt; margin: 0 0 10px; }
  .pr-foot { margin-top: 18px; padding-top: 6px; border-top: 1px solid #999; font-size: 8.5pt; color: #444; }
  .pr-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; font-size: 10pt; }
  .pr-sign div { border-top: 1px solid #000; padding-top: 4px; }
  .rv tr, .rv dl, .rv .pics img { break-inside: avoid; }
}

/* ship: restore link, FAQ, legal footer */
.restore-link { background: none; border: 0; color: #e4e6e8; font: inherit; font-size: 0.8125rem; text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0 2px; white-space: nowrap; }
.faq { margin-top: 32px; max-width: 72ch; }
.faq h2 { font-size: 1.125rem; margin: 0 0 8px; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; min-height: 24px; }
.faq p { margin: 8px 0 0; color: var(--ink-2); }
footer.legal { font-size: 0.75rem; line-height: 1.5; color: var(--ink-2); text-align: center; padding: 16px 16px 24px; max-width: 900px; margin: 0 auto; }
footer.legal a { color: inherit; display: inline-block; min-height: 24px; line-height: 24px; }
html.has-paybar footer.legal { padding-bottom: calc(24px + var(--paybar-h, 0px)); }
