/* Albion SC 2026/27 — Deep Navy #0B1D2D, Albion Blue #0080CF, Charcoal #323232, Gray #A8A8A8, White */
:root {
  --navy: #0B1D2D;
  --navy2: #12283B;
  --blue: #0080CF;
  --blue-l: #3aa6ea;
  --blue-dk: #006ba8;
  --char: #323232;
  --gray: #A8A8A8;
  --muted: #595959;
  --white: #fff;
  --card: #F4F5F7;
  --line: #d5d8dd;
  --danger: #CE2127;
  --ok: #1b7a4a;
  --f: "Roboto Condensed", "Barlow Condensed", "Archivo Narrow", "Arial Narrow", sans-serif;
  --pad: env(safe-area-inset-top);
  --pad-b: env(safe-area-inset-bottom);
  --pad-l: env(safe-area-inset-left);
  --pad-r: env(safe-area-inset-right);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--navy);
  color: var(--white);
  font: 400 16px/1.45 var(--f);
  color-scheme: dark;
}
body.sheet-mode { background: var(--white); color: var(--char); color-scheme: light; }
img { max-width: 100%; height: auto; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.skip {
  position: absolute; left: -999px; top: 0;
  background: #fff; color: #000; padding: 10px 14px; z-index: 20;
}
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ===== Chrome (header / footer) ===== */
.top {
  background: var(--navy);
  color: #fff;
  padding: calc(12px + var(--pad)) 18px 14px;
  padding-left: calc(18px + var(--pad-l));
  padding-right: calc(18px + var(--pad-r));
}
.top-inner { max-width: 1100px; margin: 0 auto; }
.lockup {
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
}
.lockup img { height: 28px; width: auto; flex: none; }
.lockup .rule { flex: 1; height: 1.5px; background: #fff; opacity: .9; }
.brand-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.chapter {
  display: inline-block; margin: 0 0 8px;
  color: var(--blue); font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
  position: relative; padding-bottom: 8px;
}
.chapter::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 93px; height: 1.5px; background: var(--blue);
}
.top h1 {
  margin: 0; font-size: clamp(1.55rem, 5.5vw, 2.4rem);
  font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.05;
}
.top .sub {
  margin: 6px 0 0; color: var(--gray); font-size: .95rem;
}
.crest-head { width: 64px; height: auto; flex: none; }
.actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.btn {
  appearance: none; border: 0; background: var(--blue); color: #fff;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  font-size: .85rem; padding: 12px 18px; min-height: 44px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: background .15s;
}
.btn:hover { background: var(--blue-l); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost {
  background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px #fff;
  clip-path: none; border-radius: 0;
}
body.sheet-mode .btn.ghost { color: #fff; }
.btn.ghost.dark { color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.btn.warn { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px var(--gray); clip-path: none; }
.btn.linkish { background: transparent; color: var(--blue); clip-path: none; padding: 8px 4px; letter-spacing: .08em; }

.foot {
  background: var(--navy);
  color: var(--gray);
  padding: 18px 18px calc(22px + var(--pad-b));
  padding-left: calc(18px + var(--pad-l));
  padding-right: calc(18px + var(--pad-r));
  text-align: center;
}
body.sheet-mode .foot { background: var(--white); color: var(--gray); border-top: 0; }
.foot .micro {
  margin: 0 0 8px; font-size: .62rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--gray);
}
.foot-rule {
  height: 1.5px; background: #fff; opacity: .85;
  max-width: 1100px; margin: 0 auto 12px;
}
body.sheet-mode .foot-rule { background: var(--char); opacity: 1; }
.tagline {
  margin: 0; font-weight: 700; text-transform: uppercase;
  letter-spacing: .38em; font-size: clamp(.7rem, 2.6vw, .92rem);
  color: #fff;
}
body.sheet-mode .tagline { color: var(--char); }
.tagline i { color: var(--blue); font-style: normal; }

/* ===== Wizard ===== */
.wizard-wrap {
  max-width: 560px; margin: 0 auto;
  padding: 22px 16px 48px;
  padding-left: calc(16px + var(--pad-l));
  padding-right: calc(16px + var(--pad-r));
}
.progress { margin: 0 0 18px; }
.progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; color: var(--gray);
  text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 600;
}
.bar { height: 4px; background: var(--navy2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.dots {
  display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; justify-content: center;
}
.dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1c3348; display: block;
}
.dots i.on { background: var(--blue); }
.dots i.done { background: #4a6a82; }

.card {
  background: #fff; color: var(--char);
  padding: 22px 20px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.card .group {
  margin: 0 0 6px; color: var(--blue); font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em; font-size: .75rem;
}
.card h2 {
  margin: 0 0 14px; font-size: 1.55rem; line-height: 1.1;
  text-transform: uppercase; font-weight: 700; letter-spacing: .02em;
}
.help { margin: 0 0 16px; color: var(--muted); font-size: .98rem; }
.help strong { color: var(--char); font-weight: 600; }
.field { margin: 0 0 14px; }
.field label {
  display: block; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .1em;
  font-size: .72rem; font-weight: 600; color: var(--blue);
}
.field input[type="text"],
.field input[type="number"],
.field input[type="tel"] {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--line); background: #fff; color: var(--char);
  font-size: 16px; /* iOS: prevent zoom */
}
.field input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(0,128,207,.2); }
.req { color: var(--danger); }
.err { color: var(--danger); font-size: .9rem; margin: 6px 0 0; min-height: 1.2em; }
.prefix {
  display: flex; align-items: center; border: 1.5px solid var(--line); background: #fff;
}
.prefix span {
  padding: 0 10px; color: var(--muted); font-weight: 700;
  border-right: 1.5px solid var(--line); min-height: 48px; display: flex; align-items: center;
}
.prefix input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; }
.prefix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,128,207,.2); }

.choice {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.choice button {
  min-height: 56px; border: 1.5px solid var(--line); background: #fff; color: var(--char);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
}
.choice button[aria-pressed="true"] {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.choice.stacked { grid-template-columns: 1fr; }

.note {
  background: var(--card); padding: 14px 16px; border-left: 3px solid var(--blue);
  color: var(--char); margin: 0 0 8px;
}
.alert {
  background: #fdecec; color: #6d1215; border-left: 3px solid var(--danger);
  padding: 12px 14px; margin: 10px 0; font-weight: 600;
}
.alert .mark { margin-right: 6px; }

.gender-list { display: grid; gap: 10px; margin-top: 8px; }
.gender-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.gender-row span { font-weight: 600; }
.seg { display: inline-flex; border: 1.5px solid var(--line); }
.seg button {
  min-width: 52px; min-height: 40px; border: 0; background: #fff; color: var(--char);
  font-weight: 700; letter-spacing: .06em;
}
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }

.people-list { display: grid; gap: 8px; margin-top: 12px; }
.person {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.person label.chk {
  display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted);
  text-transform: none; letter-spacing: 0; font-weight: 400;
}
.person input[type="text"] {
  min-height: 40px; width: 100%; border: 1.5px solid var(--line);
  padding: 6px 8px; font-size: 16px;
}
.role-head {
  margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .1em;
  font-size: .72rem; font-weight: 600; color: var(--blue);
}

.fuel-grid, .rooms-grid {
  display: grid; gap: 12px;
}
.computed {
  background: var(--card); padding: 12px 14px; margin-top: 6px;
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
}
.computed .lbl { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); font-weight: 600; }
.computed .val { font-weight: 700; font-size: 1.2rem; }

.nav-row {
  display: flex; gap: 10px; margin-top: 18px;
}
.nav-row .btn { flex: 1; }
.nav-row .btn.back {
  background: transparent; color: var(--char);
  box-shadow: inset 0 0 0 1.5px var(--line); clip-path: none; flex: 0 0 38%;
}

/* ===== Sheet ===== */
.sheet-wrap {
  background: var(--white); color: var(--char);
  padding: 20px 16px 48px;
  padding-left: calc(16px + var(--pad-l));
  padding-right: calc(16px + var(--pad-r));
}
.sheet-inner { max-width: 1100px; margin: 0 auto; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 0 0 22px;
}
.sum-card {
  background: var(--card); padding: 12px 14px 14px;
  border-top: 3px solid var(--blue);
}
.sum-card.grand { background: var(--navy); color: #fff; border-top-color: var(--blue); }
.sum-card .k {
  display: block; text-transform: uppercase; letter-spacing: .1em;
  font-size: .68rem; font-weight: 600; color: var(--blue); margin-bottom: 4px;
}
.sum-card.grand .k { color: var(--blue-l); }
.sum-card .v { font-size: 1.35rem; font-weight: 700; letter-spacing: .01em; }
.counts {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin: 0 0 22px; color: var(--muted); font-size: .95rem;
}
.counts b { color: var(--char); font-weight: 700; }

.panel {
  margin: 0 0 28px;
}
.panel h2 {
  margin: 0 0 12px; font-size: 1.15rem; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700;
  color: var(--navy);
  border-bottom: 1.5px solid var(--char); padding-bottom: 6px;
}
.assume {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 14px;
}
.assume .field { margin: 0; }
.assume .field input,
.assume .prefix input,
.sheet-wrap input[type="number"],
.sheet-wrap input[type="text"] { font-size: 16px; }
.span-2 { grid-column: span 2; }
@media (max-width: 520px) { .span-2 { grid-column: span 1; } }

.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 0 -4px; padding-bottom: 4px;
  border: 1px solid var(--line);
}
table.people {
  width: 100%; border-collapse: collapse; min-width: 720px;
  background: #fff;
}
table.people th, table.people td {
  padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line);
  vertical-align: middle; white-space: nowrap;
}
table.people th {
  background: var(--blue); color: #fff; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: .72rem;
  text-align: right; position: sticky; top: 0; z-index: 1;
}
table.people th:first-child, table.people td:first-child { text-align: left; }
table.people tbody tr:nth-child(even) { background: var(--card); }
table.people tfoot td {
  background: var(--navy); color: #fff; font-weight: 700;
  border-bottom: 0;
}
table.people .sticky {
  position: sticky; left: 0; background: inherit; z-index: 2;
  box-shadow: 4px 0 8px -6px rgba(0,0,0,.25);
}
table.people thead .sticky { background: var(--blue); z-index: 3; }
table.people tfoot .sticky { background: var(--navy); }
table.people input[type="text"],
table.people input[type="number"] {
  width: 100%; min-width: 110px; min-height: 38px;
  border: 1px solid var(--line); padding: 4px 8px; background: #fff; color: var(--char);
}
table.people input.name { min-width: 140px; text-align: left; }
table.people input.paid { width: 100px; text-align: right; }
table.people .owed { font-weight: 700; }
table.people .owed.due { color: var(--danger); }
table.people .owed.zero { color: var(--ok); }
table.people .owed.credit { color: var(--blue-dk); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: .88rem; }

.recon {
  margin: 10px 0 0; font-size: .88rem; color: var(--ok); font-weight: 600;
}
.recon.bad { color: var(--danger); }

/* print */
@media print {
  body, body.sheet-mode { background: #fff !important; color: #000; }
  .skip, .actions, .btn, .nav-row, .dots, .progress { display: none !important; }
  .top { padding: 8px 0 10px; background: #fff !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .top h1, .chapter { color: var(--navy) !important; }
  .lockup .rule { background: var(--char); }
  .crest-head { width: 48px; }
  .wizard-wrap { display: none !important; }
  .sheet-wrap { padding: 0; }
  .table-scroll { overflow: visible; border: 0; }
  table.people { min-width: 0; width: 100%; font-size: 11px; }
  table.people th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.people tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sum-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
  .foot { background: #fff !important; }
  a { text-decoration: none; color: inherit; }
  input { border: 0 !important; background: transparent !important; }
}
@page { margin: 0.5in; }

/* Undo + row add/remove */
.btn.undo[disabled],
.btn.undo:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.row-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px;
}
.icon-btn {
  appearance: none; border: 1.5px solid var(--line); background: #fff;
  color: var(--char); min-width: 36px; min-height: 36px;
  font-weight: 700; font-size: 1.1rem; line-height: 1;
}
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
table.people td.act { width: 44px; text-align: center; padding: 4px; }
table.people th.act { width: 44px; text-align: center; }
.toast {
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px;
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  font-size: .8rem; z-index: 30; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }
@media print {
  .row-actions, .icon-btn, th.act, td.act, .toast { display: none !important; }
}
