/* BloomBooks — 21Studio brand: black, white and coral; BloomBooks tint Ledger Moss. Sora for headings, DM Sans for the work. */
@font-face{font-family:"Sora";font-weight:600;font-display:swap;src:url("/fonts/sora-600.woff2") format("woff2")}
@font-face{font-family:"Sora";font-weight:700;font-display:swap;src:url("/fonts/sora-700.woff2") format("woff2")}
@font-face{font-family:"DM Sans";font-weight:400;font-display:swap;src:url("/fonts/dmsans-400.woff2") format("woff2")}
@font-face{font-family:"DM Sans";font-weight:500;font-display:swap;src:url("/fonts/dmsans-500.woff2") format("woff2")}
:root {
  --paper: #ffffff;
  --ink: #161B1F;
  --moss: #3F5520;
  --moss-wash: #EEF2E3;
  --ink-2: #4a4f59;
  --ink-3: #868b95;
  --mist: #F4F4F2;
  --line: #e3e5e9;
  --coral: #EE7B5C;
  --coral-ink: #B84A2B;   /* Deep Coral: coral for text on white */
  --coral-wash: #fdf0ec;
  --green: #2f7d5b;
  --green-wash: #eaf5ef;
  --amber-wash: #fff6e0;
  --radius: 10px;
  --side: 232px;
  font-family: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); line-height: 1.45; }
.hidden { display: none !important; }
a { color: var(--coral-ink); text-underline-offset: 2px; }
h1 { font: 600 26px/1.2 'Sora', 'Helvetica Neue', Arial, sans-serif; letter-spacing: -0.02em; margin: 0; }
h2 { font: 600 18px/1.3 'Sora', 'Helvetica Neue', Arial, sans-serif; letter-spacing: -0.01em; margin: 0 0 10px; }
.strip .v { font-family: 'Sora', 'Helvetica Neue', Arial, sans-serif; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; max-width: 72ch; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* Wordmark: the two o's of Bloom are linked rings, as in the 21Studio brand */
.wm { display: block; height: 20px; width: auto; }
.side > a:first-child { padding: 4px 8px; }
.gate .wm { height: 26px; }
.mark { display: inline-flex; align-items: center; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: inherit; text-decoration: none; }
.mark .rings { display: inline-block; width: 25px; height: 15px; margin: 0 2px 0 4px; position: relative; top: 1px; }
.mark .rings::before, .mark .rings::after { content: ''; position: absolute; top: 0; width: 15px; height: 15px; border: 2.6px solid currentColor; border-radius: 50%; box-sizing: border-box; }
.mark .rings::before { left: 0; }
.mark .rings::after { left: 10px; border-color: var(--coral); }
.mark .b { color: var(--coral); margin-left: 3px; font-weight: 600; }

/* Controls */
button, .btn {
  font: inherit; font-weight: 550; font-size: 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--ink-3); }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
button.primary:hover { background: #000; }
button.coral { background: var(--coral); border-color: var(--coral); color: #1b0a06; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.danger { color: var(--coral-ink); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--coral-wash); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
label.check input { width: auto; }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.form .wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.bottom { align-items: flex-end; }
.spacer { flex: 1; }
.error { color: var(--coral-ink); font-size: 14px; min-height: 1em; }

/* Sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--mist); }
.gate form { width: min(380px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.gate form.wide { width: min(560px, 100%); }
.gate .qr svg { width: 180px; height: 180px; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #e9eaee; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.side .mark { color: #fff; padding: 0 8px; }
.side nav { display: grid; gap: 2px; }
.side nav a { color: #c5c8cf; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: #23262d; color: #fff; }
.side nav a.on { background: #fff; color: var(--ink); box-shadow: inset 3px 0 0 var(--moss); }
.side nav .group { color: #7d828d; font-size: 12px; padding: 12px 10px 4px; }
.side .pill { background: var(--coral); color: #1b0a06; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.side .who { margin-top: auto; font-size: 13px; color: #9aa0ab; padding: 0 8px; }
.side .who button { color: #c5c8cf; padding: 4px 0; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); z-index: 5; flex-wrap: wrap; }
.menu-btn { display: none; }
.content { padding: 22px 28px 60px; display: grid; gap: 22px; }
.banner { padding: 10px 28px; background: var(--amber-wash); font-size: 14px; }

/* Panels & tables */
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.panel.flat { border: 0; padding: 0; }
.grid2 { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 550; color: var(--ink-3); font-size: 13px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--mist); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #fafafb; }
tfoot td { font-weight: 650; background: var(--mist); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }

/* Status chips */
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--mist); color: var(--ink-2); white-space: nowrap; }
.chip.good { background: var(--green-wash); color: var(--green); }
.chip.bad { background: var(--coral-wash); color: var(--coral-ink); }
.chip.wait { background: var(--amber-wash); color: #8a5a00; }

/* Today: the signature view — a ledger strip of the numbers that need attention */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.strip a { display: block; padding: 16px 18px; background: var(--paper); text-decoration: none; color: inherit; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.strip a:hover { background: var(--mist); }
.strip .v { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.strip .k { color: var(--ink-2); font-size: 13px; }
.strip a.alert .v { color: var(--coral-ink); }

/* Statements */
.statement td { border-bottom: 1px dotted var(--line); }
.statement tr.total td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 650; }
.statement tr.head td { color: var(--ink-3); font-size: 13px; padding-top: 18px; border-bottom: 0; }

/* Dialog */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; box-shadow: 0 24px 60px rgba(22, 24, 29, .25); }
dialog::backdrop { background: rgba(22, 24, 29, .45); }
dialog .dlg { padding: 22px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
#dlg-extra { overflow-x: auto; min-width: 0; }
dialog .dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--coral-ink); }

.lines td input { padding: 6px 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.scan { font-size: 20px; padding: 14px; }

/* Camera scanner */
dialog.scanner { width: min(520px, 100vw); max-height: 100dvh; background: #0f1215; color: #fff; padding: 0; }
.scanner .scan-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.scanner .scan-head button { color: #fff; font-size: 15px; }
.scanner .scan-view { position: relative; aspect-ratio: 3 / 4; max-height: 62dvh; background: #000; overflow: hidden; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .scan-frame { position: absolute; left: 10%; right: 10%; top: 34%; height: 32%; border: 3px solid rgba(255,255,255,.9); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.scanner .scan-msg { margin: 0; padding: 14px 16px 4px; min-height: 3em; font-size: 16px; max-width: none; }
.scanner .scan-msg.bad { color: #ffb4a0; }
.scanner .scan-type { padding: 8px 16px 18px; flex-wrap: nowrap; }
.scanner .scan-type input { background: #1d2227; color: #fff; border-color: #333a41; }
.scanner .scan-type button { color: #fff; }
.with-btn { display: flex; gap: 6px; align-items: center; min-width: 0; }
.with-btn input { flex: 1; }
.with-btn.search { width: min(420px, 100%); }
.scan-btn { padding: 8px 10px; border-color: var(--line); background: #fff; color: var(--ink); }
.cam-count { justify-self: start; font-size: 16px; padding: 14px 20px; }
.side-shade { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(280px, 82vw); z-index: 20; transform: translateX(-100%); transition: transform .2s; padding-top: max(18px, env(safe-area-inset-top)); }
  .side.open { transform: none; }
  .side.open + .main .side-shade, .side-shade.on { display: block; position: fixed; inset: 0; background: rgba(22,24,29,.4); z-index: 15; }
  .side nav a { padding: 11px 10px; }
  .menu-btn { display: inline-flex; font-size: 20px; padding: 6px 10px; }
  .topbar { padding: max(12px, env(safe-area-inset-top)) 16px 10px; gap: 8px; }
  .topbar h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .spacer { display: none; }
  #actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .content { padding: 16px 16px max(60px, env(safe-area-inset-bottom)); gap: 18px; }
  .banner { padding: 10px 16px; }
  input, select, textarea { font-size: 16px; }
  button, .btn { min-height: 42px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip a { padding: 12px 14px; }
  .strip .v { font-size: 22px; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  dialog .dlg { padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
  dialog .dlg-actions { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
  dialog .dlg-actions button { flex: 1; justify-content: center; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .scan { font-size: 18px; }
}
/* Phones: tables become cards, one row per card with the column names alongside */
@media (max-width: 640px) {
  .table-wrap { border: 0; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tfoot, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr, .table-wrap tfoot tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; background: #fff; }
  .table-wrap td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; white-space: normal; text-align: right; }
  .table-wrap td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex: none; max-width: 45%; }
  .table-wrap td:first-child { font-weight: 600; }
  .table-wrap td:empty, .table-wrap td.blank { display: none; }
  .table-wrap tfoot tr { background: var(--mist); }
  table.lines, table.lines tbody, table.lines tr, table.lines td { display: block; width: 100%; }
  table.lines thead { display: none; }
  table.lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; position: relative; }
  table.lines td { padding: 0; border: 0; white-space: normal; }
  table.lines td:first-child { grid-column: 1 / -1; padding-right: 40px; }
  table.lines td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
  table.lines td input { width: 100% !important; }
  table.lines td.rmcell { position: absolute; top: 6px; right: 6px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .topbar, .no-print { display: none !important; } .shell { display: block; } }
