/* The sold-customer dashboard (/ops). OYO's colours and fonts. Type: 16 / 14 / 12px, weights 400 / 500 / 600.
   Spacing on a 4/8px grid. Touch targets 44px. Narrow below 768px; main content capped at 1280px. */
:root {
  --bg: #FBFAF6; --bg-alt: #F3F1EA; --panel: #FFFFFF;
  --navy: #16294B; --navy-dk: #0F1D36; --text: #17233B; --muted: #5C6B84;
  --border: #E3E1D9; --border-strong: #CFCCC2;
  --purple: #8A45D6; --teal: #0E7A73; --red: #C22F26; --danger: #DC2626; --green-bg: #E6F4F2; --amber-bg: #FFF4D6; --amber-ink: #6E4A00; --red-bg: #FBE9E7;
  --grad: linear-gradient(92deg, #FFCB3D, #F0498E 40%, #8A45D6 72%, #13B6AC);
  --vp-wide: 1280px; --tap: 44px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.5 Manrope, system-ui, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: Urbanist, Manrope, sans-serif; color: var(--navy); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
strong, b, th, .step-name { font-weight: 600; }
p { margin: 0; }
a { color: var(--navy); }
.muted { color: var(--muted); } .num { font-variant-numeric: tabular-nums; }
.meta { font-size: 0.75rem; line-height: 1.4; color: var(--muted); }
.note, .lede { font-size: 0.875rem; color: var(--muted); max-width: 75ch; }
.wrap-any { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Chrome: full width, no cap */
.bar { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--border); }
.bar::before { content: ""; display: block; height: 4px; background: var(--grad); }
.bar-in { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; min-height: var(--tap); }
.brand img { height: 28px; width: auto; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; border-radius: 8px; text-decoration: none; font-weight: 500; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--bg-alt); color: var(--navy); font-weight: 600; }
.who { font-size: 0.875rem; color: var(--muted); margin-left: auto; }

/* Page content: capped and centred */
.main { max-width: var(--vp-wide); margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); display: grid; gap: 16px; }
.page-head { display: grid; gap: 8px; }
.crumbs { font-size: 0.875rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); }
.frame { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.cols { display: grid; gap: 24px; grid-template-columns: 1fr; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

/* Controls */
button, .btn { font: 600 0.875rem Manrope, sans-serif; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--navy);
  padding: 0 16px; min-height: var(--tap); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button.primary, .btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0 4px; min-height: var(--tap); color: var(--navy); text-decoration: underline; font-weight: 500; }
.link.danger { color: var(--red); }
.link.on-dark { color: #fff; }
:focus-visible, .upload:focus-within { outline: 3px solid var(--purple); outline-offset: 2px; }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; min-height: var(--tap); max-width: 100%; }
input[aria-invalid] { border-color: var(--red); }
.field { display: grid; gap: 4px; font-weight: 500; font-size: 0.875rem; }
.field-err { color: var(--red); font-size: 0.875rem; font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 0.875rem; font-weight: 500; }
.check input { min-height: 0; width: 20px; height: 20px; }
.num-in { width: 6rem; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; padding-top: 16px; border-top: 1px solid var(--border); }
.form-row .full { flex-basis: 100%; }
.scope-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; display: grid; gap: 0; }
.scope-box legend { font-size: 0.875rem; font-weight: 600; padding: 0 4px; }
/* Grid and flex children may shrink below their content (a long dropdown option must not widen the page). */
.main, .frame, .stack, .cols { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.form-row > *, .toolbar > * { min-width: 0; max-width: 100%; }
.field select, .field input:not([type=checkbox]) { width: 100%; }

/* List pages */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.toolbar .search { flex: 1 1 260px; }
.filters-panel { position: relative; }
.filters-panel summary { list-style: none; }
.filters-panel summary::-webkit-details-marker { display: none; }
.filters-panel .panel { position: absolute; z-index: 5; top: calc(100% + 8px); right: 0; min-width: 240px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 4px 24px rgba(15, 29, 54, 0.06); padding: 16px; display: grid; gap: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chips:empty { display: none; }
.chip { min-height: var(--tap); padding: 0 12px; border-radius: 999px; background: var(--bg-alt); border-color: var(--border); font-weight: 500; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.875rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.r, th.r { text-align: right; }
.row-link { font-weight: 600; color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
tbody tr[data-go] { cursor: pointer; }
@media (hover: hover) { tbody tr[data-go]:hover { background: var(--bg-alt); } }
.table-scroll { overflow-x: auto; }
.empty { display: grid; gap: 8px; justify-items: start; padding: 24px 0; }
@media (max-width: 767.98px) {
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  table.cards td { border: 0; padding: 0; }
  table.cards td[data-k]::before { content: attr(data-k) ": "; color: var(--muted); font-size: 0.75rem; }
  table.cards td.r { text-align: left; }
  /* Filters wraps to the left of its row on phones, so its panel spans the toolbar instead of hanging off the button. */
  .toolbar { position: relative; } .filters-panel { position: static; } .filters-panel .panel { left: 0; right: 0; }
}

/* Badges: status only */
.badge { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.75rem; line-height: 1.6; font-weight: 600; background: var(--bg-alt); color: var(--navy); white-space: nowrap; vertical-align: middle; }
.badge.on_hold, .badge.pending { background: var(--amber-bg); color: var(--amber-ink); }
.badge.cancelled, .badge.declined { background: var(--red-bg); color: var(--red); }
.badge.done, .badge.approved { background: var(--green-bg); color: var(--teal); }

/* Detail: tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 500; font-size: 1rem; white-space: nowrap; scroll-snap-align: start; padding: 0 12px; }
.tabs [role=tab][aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }

.steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 4px 0 8px; position: relative; }
.steps li::before { content: ""; width: 16px; height: 16px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--border-strong); background: #fff; box-sizing: border-box; }
.steps li.done::before { background: var(--teal); border-color: var(--teal); }
.steps li.now::before { background: #FFCB3D; border-color: var(--navy); }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 24px; bottom: -4px; width: 2px; background: var(--border); }
.steps li.done:not(:last-child)::after { background: var(--teal); }
.history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; font-size: 0.875rem; }
.history li { border-left: 4px solid var(--border); padding-left: 12px; }

dl.kv { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr; gap: 8px 16px; margin: 16px 0; font-size: 0.875rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; font-size: 1rem; }
.section-all { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.money-big { font: 600 2rem/1.2 Urbanist, sans-serif; color: var(--navy); margin-top: 8px; }

.files { display: grid; }
.section { display: grid; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.section:first-child { padding-top: 0; } .section:last-child { border-bottom: 0; padding-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head h2 { font-size: 1rem; }
.group-head { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
.thumb { display: grid; gap: 4px; align-content: start; }
.thumb a { display: grid; gap: 4px; text-decoration: none; color: var(--text); }
.thumb img, .thumb .doc { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-alt); }
.thumb .doc { display: grid; place-items: center; font-weight: 600; color: var(--muted); }
.file-name { font-size: 0.875rem; overflow-wrap: anywhere; }
.upload { position: relative; }
.upload input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.warn { background: var(--amber-bg); color: var(--amber-ink); border-radius: 8px; padding: 12px 16px; font-size: 0.875rem; max-width: none; }
.err { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 12px 16px; display: grid; gap: 8px; justify-items: start; }
.toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px;
  max-width: calc(100vw - 32px); z-index: 20; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
dialog { border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: min(480px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(15, 29, 54, 0.4); }
.skel { height: 48px; border-radius: 8px; background: var(--bg-alt); }
.skel-title { height: 32px; width: 240px; }

/* Training */
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.subnav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 12px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.bar-track { display: inline-block; width: 120px; height: 8px; border-radius: 999px; background: var(--bg-alt); overflow: hidden; vertical-align: middle; }
.bar-track span { display: block; height: 100%; background: var(--teal); }
.next-step { border-color: var(--navy); }
.module { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.module.locked h3 { color: var(--muted); }
.module h3 { font-size: 1rem; }
.section-list { margin: 0; padding-left: 24px; display: grid; gap: 4px; }
.section-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: var(--tap); }
.stack-sm { display: grid; gap: 8px; }
.row.tight { gap: 4px; }
.row.space { justify-content: space-between; }
.section-page { gap: 24px; }
.block + .block { padding-top: 24px; border-top: 1px solid var(--border); }
.video-wrap { position: relative; background: #000; border-radius: 8px; overflow: hidden; }
.video-wrap video { display: block; width: 100%; max-height: 70vh; }
.cooldown { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; text-align: center; background: rgba(15, 29, 54, 0.92); color: #fff; padding: 16px; }
.cooldown .step-name { color: #fff; font-size: 1.25rem; }
.cooldown .num { font: 600 2rem Urbanist, sans-serif; }
.reading { max-width: 75ch; }
.reading h2 { font-size: 1.25rem; margin: 16px 0 8px; } .reading h3 { font-size: 1.1rem; margin: 16px 0 8px; } .reading h4 { font-size: 1rem; margin: 12px 0 4px; }
.reading p { margin: 0 0 12px; } .reading ul, .reading ol { margin: 0 0 12px; padding-left: 24px; }
.pdf-block { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pdf-block .note { flex-basis: 100%; }
.question { border: 0; border-top: 1px solid var(--border); padding: 16px 0 0; margin: 0; display: grid; gap: 4px; }
.question legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.block-edit { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; display: grid; gap: 12px; }
.md-tools button { padding: 0 12px; }
textarea { font: inherit; width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; }
.q-list { display: grid; gap: 12px; padding-left: 24px; margin: 0; }
.q-list ul { margin: 4px 0; padding-left: 20px; }
.choice .grow { flex: 1 1 200px; }
.choice input[type=radio], .choice input[type=checkbox] { width: 20px; height: 20px; min-height: 0; }
.inline-form { align-items: end; }
