/* BeFast Data Onboarding — built for non-technical users: large type, one task per screen. */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f1f4f7;
  --border: #e3e8ee;
  --fg: #16202b;
  --muted: #5b6876;
  --brand: #25aae1;            /* BeFast blue — decorative only, too light for text */
  --accent: #0b74a6;           /* BeFast blue darkened to pass WCAG AA on white */
  --accent-hover: #09648f;
  --accent-fg: #ffffff;
  --accent-soft: #e8f5fc;
  --success: #15803d;
  --success-soft: #e9f7ee;
  --success-fg: #ffffff;
  --warn: #9a5b00;
  --warn-soft: #fdf3e1;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #25aae1;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171e26;
    --surface-2: #1f2832;
    --border: #2b3640;
    --fg: #e8edf2;
    --muted: #9aa7b4;
    --accent: #3cb8ec;
    --accent-hover: #5cc6f0;
    --accent-fg: #06202e;
    --accent-soft: #10303f;
    --success: #4ade80;
    --success-soft: #12301f;
    --success-fg: #06230f;
    --warn: #f2b65a;
    --warn-soft: #382a12;
    --danger: #f58b80;
    --danger-soft: #3d1c19;
    --shadow: none;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: clamp(26px, 3vw, 32px); }
h2 { font-size: clamp(22px, 2.4vw, 26px); }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
.center { text-align: center; }
.stack { display: grid; gap: 20px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.eyebrow a { color: inherit; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.points { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--border);
}
.logo-wrap { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.logo { display: block; height: 30px; width: auto; }
.logo-wrap .product { font-weight: 600; font-size: 15px; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--border); }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.who { font-size: 14px; color: var(--muted); }
@media (max-width: 640px) { .logo-wrap .product, .who { display: none; } }

/* ---------- Page ---------- */
.page { flex: 1; width: 100%; padding: 32px var(--gutter) 120px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { margin-top: 6px; font-size: 17px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font: 600 15px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.big { min-height: 52px; padding: 14px 28px; font-size: 16px; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); }
.btn.quiet:hover { color: var(--fg); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: 600 14px var(--font); cursor: pointer; border-radius: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------- Forms ---------- */
label { display: grid; gap: 6px; font-size: 15px; font-weight: 600; }
.hint { font-size: 14px; font-weight: 400; color: var(--muted); }
input, select, textarea {
  font: 400 16px var(--font); color: var(--fg); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; min-height: 46px; width: 100%; min-width: 0;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; margin: 0; }
.check { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; cursor: pointer; }
.check-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.field-error { color: var(--danger); font-size: 14px; font-weight: 500; }
.field-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.input-pair { display: flex; gap: 8px; }
.input-pair select { width: 82px; flex: none; }

/* ---------- Cards, pills, callouts ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 24px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px;
  font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill.done, .pill.verified, .pill.granted, .pill.paid { background: var(--success-soft); color: var(--success); }
.pill.yours { background: var(--success-soft); color: var(--success); }
.pill.pending, .pill.sent { background: var(--warn-soft); color: var(--warn); }
.pill.befast, .pill.in_progress { background: var(--accent-soft); color: var(--accent); }
.pill.revoked, .pill.void { background: var(--danger-soft); color: var(--danger); }
.callout { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 15px; }
.callout.info { background: var(--accent-soft); }
.callout.ok { background: var(--success-soft); color: var(--success); font-weight: 500; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.banner { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---------- Wizard layout ---------- */
/* Brands: steps across the top, step content full width. Admin: plus a right column. */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.wizard.with-admin { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1200px) { .wizard.with-admin { grid-template-columns: minmax(0, 1fr); } }
.main-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; container-type: inline-size; }
.panel, .steps-nav, .panel > * { min-width: 0; }

.steps-nav { padding: 20px 24px; display: grid; gap: 18px; }
.steps-progress { display: flex; align-items: center; gap: 16px; }
.steps-progress .bar { flex: 1; }
.bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width 0.4s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
@container (max-width: 760px) { .steps { grid-auto-columns: minmax(140px, 1fr); overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; } .steps li { scroll-snap-align: start; } }
.step-link {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 12px; align-items: center; width: 100%; height: 100%;
  padding: 12px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.step-link:hover { background: var(--surface-2); }
.step-link:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.step-link.current { background: var(--accent-soft); border-color: var(--accent-soft); }
.step-link .num {
  grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 99px;
  border: 2px solid var(--border); font-weight: 700; font-size: 15px; color: var(--muted); background: var(--surface);
}
.step-link.done .num { background: var(--success); border-color: var(--success); color: #fff; }
.step-link.yours .num { border-color: var(--success); color: var(--success); }
.step-link.befast .num, .step-link.current .num { border-color: var(--accent); color: var(--accent); }
.step-link .title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-link .state { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-link.yours .state { color: var(--success); font-weight: 600; }

/* Step panel */
.panel { padding: clamp(20px, 3vw, 40px); display: grid; gap: 28px; align-content: start; min-height: 420px; }
.panel:focus { outline: none; }
.panel-head { display: grid; gap: 8px; }
.panel-head .lead { font-size: 17px; color: var(--muted); max-width: 70ch; }
.panel-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 24px; }
.waiting { display: flex; align-items: center; gap: 16px; padding: 24px; border-radius: var(--radius); background: var(--surface-2); font-size: 16px; }
.waiting img { width: 56px; flex: none; }

/* Sources — one editable row per source; extras behind "More". Stacks into a card on small screens. */
.sources { display: grid; gap: 10px; }
.sources-head, .source-row {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: 32px minmax(150px, 1.3fr) minmax(120px, 1.5fr) 150px 108px 150px 92px 124px 84px;
}
.sources-head { padding: 0 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.source { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.source.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.source-row { padding: 12px 14px 4px; }
/* Desktop table: tighter controls so all nine columns fit beside the admin column without overlap. */
@container (min-width: 1200px) {
  .source-row :is(input:not([type="checkbox"]), select) { min-height: 40px; padding: 8px 10px; font-size: 15px; }
  .source-row select { padding-right: 30px; background-position: right 8px center; }
  .source-row .input-pair { gap: 6px; }
  .source-row .input-pair select { flex: 0 0 64px; padding-right: 24px; background-position: right 6px center; }
  .source-row .icon-btn { width: 36px; height: 36px; }
  .source-row .help-check { font-size: 13px; gap: 6px; }
  .row-foot { padding-left: 56px; }
}
.source-row .idx { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 99px; background: var(--surface-2); font-weight: 700; font-size: 14px; color: var(--muted); }
.source-row .cell { min-width: 0; }
.source-row .cell-label { display: none; }
.help-check { align-items: center; gap: 8px; font-size: 14px; }
.row-tools { display: flex; gap: 4px; justify-content: flex-end; }
.row-foot { display: flex; gap: 12px; padding: 0 16px 10px 64px; min-height: 22px; }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.error { color: var(--danger); }
.icon { display: inline-flex; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-soft); }
.icon-btn.has { color: var(--accent); border-color: var(--accent); }
.icon-btn .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.source-more { padding: 20px 24px 24px 64px; border-top: 1px solid var(--border); display: grid; gap: 20px; }
@container (max-width: 1199px) {
  .sources-head { display: none; }
  .source-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding: 16px; }
  .source-row .idx { grid-column: 1 / -1; }
  .source-row .cell { display: grid; gap: 6px; }
  .source-row .cell-label { display: block; font-size: 14px; font-weight: 600; }
  .row-tools { grid-column: 1 / -1; justify-content: flex-start; }
  .row-foot { padding: 0 16px 12px; }
  .source-more { padding: 20px 16px; }
}
@container (max-width: 600px) { .source-row { grid-template-columns: 1fr; } }
.add-source {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; justify-self: start;
  border: 0; border-radius: var(--radius-sm); background: var(--success); color: var(--success-fg);
  min-height: 52px; padding: 14px 28px; font: 600 16px var(--font); cursor: pointer;
  box-shadow: 0 2px 6px rgb(21 128 61 / 0.25); transition: filter 0.15s;
}
.add-source:hover { filter: brightness(1.1); }
.add-source:active { transform: translateY(1px); }
.add-source:disabled { opacity: 0.6; cursor: not-allowed; }
.add-source:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.guide { border-radius: var(--radius-sm); background: var(--accent-soft); padding: 16px 18px; }
.guide summary { cursor: pointer; font-weight: 600; }
.guide ol, .guide-card ol { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; }
.thumb { margin: 0; width: 140px; display: grid; gap: 6px; font-size: 13px; }
.thumb img { width: 140px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.thumb figcaption { overflow-wrap: anywhere; color: var(--muted); }

/* Questions thread */
.thread { display: grid; gap: 12px; }
.comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.comment { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 6px; }
.comment.mine { background: var(--accent-soft); }
.comment.open { box-shadow: inset 3px 0 0 var(--warn); }
.comment-meta { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.comment-meta strong { color: var(--fg); }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.questions { border-top: 1px solid var(--border); padding-top: 24px; }
.questions summary { cursor: pointer; font-weight: 600; font-size: 16px; display: flex; gap: 10px; align-items: center; }

/* Quote */
.quote, .estimate { display: grid; gap: 16px; padding: 28px; border-radius: var(--radius); background: var(--surface-2); }
.estimate { grid-template-columns: auto 1fr; align-items: center; gap: 12px 32px; padding: 20px 24px; }
@media (max-width: 640px) { .estimate { grid-template-columns: 1fr; } }
.estimate .amount { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quote .amount { font-size: clamp(32px, 4vw, 44px); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quote-scope { white-space: pre-wrap; font-size: 16px; }

/* Plain tables (manifest, access, delivery, admin board) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * + * { margin-left: 8px; }
tbody tr.link-row { cursor: pointer; }
tbody tr.link-row:hover td { background: var(--surface-2); }

/* Admin column */
.admin-col { display: grid; gap: 16px; align-content: start; }
.admin-col .card { padding: 20px; display: grid; gap: 12px; }
.admin-tag { display: inline-flex; align-self: start; justify-self: start; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-box { border: 2px dashed var(--accent-soft); border-radius: var(--radius); padding: 20px; display: grid; gap: 16px; }
.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 14px; }
.activity time { display: block; color: var(--muted); font-size: 13px; }

/* Admin board */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-tile { padding: 20px 24px; display: grid; gap: 4px; }
.kpi { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.brand-cards { display: none; }
@media (max-width: 900px) {
  .board-table { display: none; }
  .brand-cards { display: grid; gap: 12px; }
  .brand-card { padding: 20px; display: grid; gap: 10px; text-decoration: none; color: inherit; }
}
.dialog { border: 0; border-radius: 18px; padding: 32px; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); box-shadow: 0 24px 64px rgb(0 0 0 / 0.25); }
.dialog::backdrop { background: rgb(15 20 25 / 0.5); }

/* States */
.skeleton { height: 72px; border-radius: var(--radius); background: var(--surface-2); animation: pulse 1.2s ease-in-out infinite; }
.skeleton + .skeleton { margin-top: 12px; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ---------- Library ---------- */
.library { max-width: 960px; margin: 0 auto; }
.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tip { padding: 20px; display: grid; gap: 6px; }
.section-title { font-size: 20px; margin: 40px 0 16px; }
.filter { margin-bottom: 16px; }
.guide-card { padding: 18px 22px; }
.guide-card summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; }

/* ---------- Documents (manifest, invoice, terms) ---------- */
.doc { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 40px var(--gutter) 80px; display: grid; gap: 28px; align-content: start; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 6px 20px; margin: 0; font-size: 15px; }
.doc-meta dt { color: var(--muted); }
.doc-meta dd { margin: 0; font-weight: 500; }
.doc-table tfoot td { background: var(--surface-2); font-weight: 600; }
.doc-notes ul { margin: 8px 0; padding-left: 22px; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .parties { grid-template-columns: 1fr; } }
.prose { max-width: 780px; line-height: 1.75; font-size: 16px; }
.prose h1 { font-size: 30px; margin-bottom: 8px; }
.prose h2 { font-size: 20px; margin: 28px 0 8px; }
.prose p, .prose ul { margin: 0 0 10px; }

/* ---------- Mascot ---------- */
.site-foot { width: 100%; padding: 16px var(--gutter) 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 14px; }
.helpbot { position: fixed; right: 20px; bottom: 16px; z-index: 30; display: flex; align-items: flex-end; gap: 10px; border: 0; background: none; padding: 0; cursor: pointer; }
.helpbot img { width: 64px; height: auto; transform-origin: 50% 100%; animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.18)); }
.helpbot:hover img, .helpbot:focus-visible img { animation: wave 0.9s ease-in-out 2; }
.helpbot:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 14px; }
.helpbot-hint { background: var(--accent); color: var(--accent-fg); font: 600 15px var(--font); padding: 10px 16px; border-radius: 16px 16px 4px 16px; margin-bottom: 44px; box-shadow: 0 6px 16px rgb(0 0 0 / 0.15); }
.helpbot[aria-expanded="true"] .helpbot-hint { visibility: hidden; }
.helpbot-panel { position: fixed; right: 20px; bottom: 118px; z-index: 30; width: min(380px, calc(100vw - 40px)); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: 0 16px 40px rgb(0 0 0 / 0.18); display: grid; gap: 14px; }
@media (max-width: 640px) { .helpbot-hint { display: none; } .helpbot img { width: 54px; } .helpbot-panel { bottom: 96px; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
@media (prefers-reduced-motion: reduce) {
  .helpbot img, .helpbot:hover img, .skeleton { animation: none; }
  .bar > i, .source-row .chev { transition: none; }
}

@media print {
  .topbar, .helpbot, .helpbot-panel, .site-foot, .no-print { display: none !important; }
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --fg: #000; --muted: #555; --border: #ccc; --shadow: none; }
  body { background: #fff; font-size: 12px; }
  .doc { padding: 0; max-width: none; }
  .table-wrap { border: 0; overflow: visible; }
  tr { break-inside: avoid; }
}

/* Collapsible cards in the admin column */
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; color: var(--muted); }
details.card[open] > summary::after { content: "▴"; }
details.card[open] > summary { margin-bottom: 4px; }

.step-link.no-state { grid-template-rows: auto; }
.step-link.no-state .num { grid-row: auto; }
.subsection { display: grid; gap: 16px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); }
.subsection.active { border-color: var(--success); }
.subsection h3 { font-size: 20px; }

/* ---------- Sign-in ---------- */
.login-page { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), var(--bg) 70%); }
.login-wrap { flex: 1; display: grid; place-items: center; align-content: center; gap: 24px; padding: 48px 16px; }
.login-card { width: min(440px, 100%); padding: clamp(28px, 5vw, 44px); display: grid; gap: 28px; }
.login-logo { height: 44px; width: auto; display: block; }
.login-card h1 { font-size: 26px; }
.code-input { font-size: 28px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; min-height: 60px; }

/* Custom select: one clean chevron, consistent across browsers. */
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6876' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  text-overflow: ellipsis;
}
select.placeholder { color: var(--muted); }
select option, select optgroup { color: var(--fg); }
.input-pair select { padding-right: 32px; background-position: right 8px center; }
.source-row .help-check { white-space: nowrap; }
.source-row .row-tools { gap: 6px; }
.icon-btn { width: 38px; height: 38px; }

.step-link.locked { opacity: 0.45; cursor: not-allowed; }
.step-link.locked:hover { background: none; }
.share-box { margin-top: 4px; }
.share-box textarea { min-height: 72px; }

.invoice-row { padding: 12px 0; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.invoice-row:last-child { border-bottom: 0; }
.invoice-row select { width: auto; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.guide-btn { border-color: var(--accent); color: var(--accent); }
.guide-btn:hover { background: var(--accent-soft); }
.admin-box > .btn { justify-self: start; }

/* ---------- Invoice ---------- */
.inv { background: #fff; color: #16202b; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 56px); display: grid; gap: 36px; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap;
  padding-bottom: 28px; border-bottom: 3px solid #25aae1; }
.inv-logo { height: 46px; width: auto; display: block; margin-bottom: 14px; }
.inv-from { font-size: 14px; line-height: 1.6; color: #5b6876; margin: 0; }
.inv-from strong { color: #16202b; }
.inv-title { text-align: right; display: grid; gap: 4px; justify-items: end; }
.inv-word { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: #0b74a6; }
.inv-number { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.inv-status { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #fdf3e1; color: #9a5b00; }
.inv-status.paid { background: #e9f7ee; color: #15803d; }
.inv-status.void { background: #fdecea; color: #b42318; }
.inv-status.draft { background: #f1f4f7; color: #5b6876; }
.inv-meta { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: start; }
@media (max-width: 640px) { .inv-meta { grid-template-columns: 1fr; } .inv-title { text-align: left; justify-items: start; } }
.inv-label, .inv-dates dt { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #5b6876; }
.inv-billto { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.5; }
.inv-dates { margin: 0; display: grid; grid-template-columns: repeat(2, auto); gap: 16px 40px; }
.inv-dates dd { margin: 0; font-size: 15px; font-weight: 600; }
.inv-amount-due { grid-column: 1 / -1; background: #e8f5fc; border-radius: 10px; padding: 12px 16px; }
.inv-amount-due dd { font-size: 26px; font-weight: 700; color: #0b74a6; font-variant-numeric: tabular-nums; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.inv-table th { background: none; position: static; text-align: left; font-size: 12px; letter-spacing: 0.08em; color: #5b6876; border-bottom: 2px solid #16202b; padding: 10px 0; }
.inv-table td { padding: 16px 0; border-bottom: 1px solid #e3e8ee; }
.inv-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-table tfoot td { border-bottom: 0; padding: 8px 0; color: #5b6876; }
.inv-table tfoot .inv-total td { border-top: 2px solid #16202b; padding-top: 14px; font-size: 18px; font-weight: 700; color: #16202b; }
.inv-foot { display: grid; gap: 8px; font-size: 14px; line-height: 1.6; border-top: 1px solid #e3e8ee; padding-top: 20px; }
.inv-foot p { margin: 0; }
@media print {
  @page { size: letter; margin: 0; }   /* margin 0 also drops the browser's date/URL header */
  .doc { padding: 0.6in !important; }
  .inv { border: 0; box-shadow: none; border-radius: 0; padding: 0; }
  .inv, .inv * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Data size guides (docs-style: list left, guide right) ---------- */
.guides-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .guides-layout { grid-template-columns: 1fr; } }
.guides-nav { padding: 16px; display: grid; gap: 14px; position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; }
@media (max-width: 900px) { .guides-nav { position: static; max-height: 320px; } }
.sys-group { display: grid; gap: 4px; }
.sys-group + .sys-group { margin-top: 10px; }
.sys-group-title { margin: 0 0 2px; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sys-link {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg); font: 500 15px var(--font); text-align: left; cursor: pointer;
}
.sys-link .icon { opacity: 0; color: var(--accent); transition: opacity 0.15s; }
.sys-link:hover { background: var(--surface-2); }
.sys-link:hover .icon, .sys-link.active .icon { opacity: 1; }
.sys-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sys-link:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.guide-view { padding: clamp(24px, 3.5vw, 44px); display: grid; gap: 28px; min-height: 420px; align-content: start; }
.guide-head h2 { font-size: clamp(26px, 3vw, 32px); margin-top: 4px; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.guide-steps li {
  counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 4px 16px; align-items: start;
  padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 16px; line-height: 1.6;
}
.guide-steps li::before {
  content: counter(step); grid-row: span 3; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 99px;
  background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 15px;
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumb { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.crumb-sep { color: var(--muted); font-weight: 700; }
.step-rest { display: block; margin-top: 8px; color: var(--muted); }
.step-lead { display: block; margin-bottom: 8px; }
.guide-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.guide-media { margin: 0; display: grid; gap: 8px; }
.guide-media img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.guide-media.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-sm); }
.guide-media figcaption { font-size: 14px; color: var(--muted); }
.guide-docs { display: grid; gap: 8px; }
.guide-docs .sys-group-title { padding: 0; }
.guide-docs ul { display: grid; gap: 6px; }
.guide-docs a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.guide-docs a:hover { text-decoration: underline; }
.guide-docs a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.guide-help { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius); background: var(--accent-soft); }
.guide-help > .stack-sm { flex: 1; min-width: 220px; }
.guide-help img { width: 44px; height: auto; }

.tips-strip { margin-top: 40px; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; counter-reset: tip; }
.tips .tip { counter-increment: tip; padding: 20px; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tips .tip strong::before { content: counter(tip) ". "; color: var(--accent); }
.tips .tip p { margin: 0; font-size: 15px; }

/* Mascot tooltip (guides page): shows on hover/focus instead of a permanent bubble. */
.helpbot { text-decoration: none; }
.bot-tip {
  position: absolute; right: 74px; bottom: 30px; width: 260px; padding: 12px 14px; border-radius: 14px 14px 4px 14px;
  background: var(--fg); color: var(--bg); font: 500 14px/1.45 var(--font); box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.helpbot:hover .bot-tip, .helpbot:focus-visible .bot-tip { opacity: 1; transform: none; }
@media (hover: none) { .bot-tip { display: none; } }
.contact-list li { align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.contact-list li:last-child { border-bottom: 0; }
.contact strong { font-size: 15px; }
.danger-zone { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.danger-zone .btn { justify-self: start; }

.agreement-dialog { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; display: flex; flex-direction: column; }
.agreement-dialog[open] { display: flex; }
.agreement-bar { position: sticky; top: 0; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.agreement-body { overflow: auto; padding: 24px 32px 40px; max-width: none; }
.link-btn.big-link { font-size: 16px; }

/* Signed agreement record */
.stamp { display: flex; gap: 24px; align-items: flex-start; padding: 24px; border: 3px double #0b74a6; border-radius: 12px; background: #f4fafd; color: #16202b; }
.stamp-logo { height: 40px; width: auto; flex: none; }
.stamp-title { margin: 0 0 10px; font-weight: 700; letter-spacing: 0.16em; color: #0b74a6; }
.stamp-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.stamp-grid dt { color: #5b6876; } .stamp-grid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.stamp-hash { font-family: ui-monospace, monospace; font-size: 12px; font-weight: 400 !important; }
.stamp-note { margin: 12px 0 0; font-size: 13px; color: #5b6876; }
.signed-doc { margin-top: 24px; }
.signed-list { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
@media print { .stamp, .stamp * { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Phones (desktop unchanged) ---------- */
/* Steps bar: numbered circles in one row, only the current step is named — no sideways scroll. */
@container (max-width: 600px) {
  .steps-nav { padding: 16px; gap: 14px; }
  .steps { grid-auto-flow: column; grid-auto-columns: auto; justify-content: space-between; overflow: visible; padding: 0; gap: 6px; }
  .step-link { grid-template-columns: 34px; padding: 6px; gap: 0; }
  .step-link .title, .step-link .state { display: none; }
  .step-link.current { grid-template-columns: 34px auto; gap: 0 10px; padding: 6px 12px 6px 6px; }
  .step-link.current .title { display: block; font-size: 15px; white-space: nowrap; overflow: visible; text-overflow: clip; }
  .step-link .num { grid-row: auto; }

  /* Source rows: compact two-column card. Children: idx, source, description, size, need help, since, screenshot, status, tools. */
  .source-row { grid-template-columns: 1fr 1fr; gap: 12px 12px; padding: 14px; }
  .source-row > * { grid-column: 1 / -1; }
  .source-row > :nth-child(1) { order: 0; }
  .source-row > :nth-child(2) { order: 1; }
  .source-row > :nth-child(3) { order: 2; }
  .source-row > :nth-child(4) { order: 3; }
  .source-row > :nth-child(6) { order: 4; }
  .source-row > :nth-child(5) { order: 5; }
  .source-row > :nth-child(8) { order: 6; }
  .source-row > :nth-child(7) { order: 7; grid-column: span 1; align-self: end; }
  .source-row > :nth-child(9) { order: 8; grid-column: span 1; justify-content: flex-end; align-self: end; }
  .source-row > :nth-child(7) .cell-label { display: none; }
  .source-row > :nth-child(5) .cell-label { display: none; }
  .source-row .cell { gap: 4px; }
  .source-row .cell-label { font-size: 13px; }
  .source-row .idx { width: 28px; height: 28px; }
  .source-row input[type="month"] { min-width: 0; }
  .input-pair select { width: 70px; padding-right: 26px; background-position: right 6px center; }
  .row-foot { padding: 0 14px 10px; }
  .panel { padding: 18px; gap: 20px; }
}
@media (max-width: 640px) {
  .page { padding: 20px 14px 110px; }
  .helpbot img { width: 46px; }
  .helpbot { right: 10px; bottom: 10px; }
}
td .num-input { width: 120px; margin-left: auto; display: block; }

/* Spreadsheet-style table (manifest) */
.sheet { font-size: 14px; }
.sheet th { padding: 8px 12px; font-size: 12px; }
.sheet td { padding: 7px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); line-height: 1.35; }
.sheet td:last-child, .sheet th:last-child { border-right: 0; }
.sheet th { border-right: 1px solid var(--border); }
.sheet tbody tr:nth-child(even) td { background: var(--surface-2); }
.sheet tbody tr.filler td { height: 34px; }
.sheet td:first-child, .sheet th:first-child { width: 44px; text-align: center; }
.sheet .pill { padding: 2px 10px; font-size: 12px; }
.sheet tfoot td { background: var(--surface); border-top: 2px solid var(--border); }
.msg-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; }
.brand-cell { gap: 8px; flex-wrap: nowrap; }
