/* MANSCOM Design System · components. Every value comes from tokens.css. */

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--label); font: var(--t-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, picture, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tint-label); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--tint) 70%, transparent); outline-offset: 2px; border-radius: var(--r-xs); }
.wrap { max-width: var(--content); margin-inline: auto; padding-inline: var(--gutter); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.locked { overflow: hidden; }
svg.i { width: 1em; height: 1em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Type ─────────────────────────────────────────────────────────────── */
.t-display { font: var(--t-display); letter-spacing: -.01em; margin: 0; }
.t-large-title { font: var(--t-large-title); letter-spacing: -.01em; margin: 0; }
.t-title-1 { font: var(--t-title-1); margin: 0; }
.t-title-2 { font: var(--t-title-2); margin: 0; }
.t-title-3 { font: var(--t-title-3); margin: 0; }
.t-headline { font: var(--t-headline); }
.t-callout { font: var(--t-callout); }
.t-subhead { font: var(--t-subhead); color: var(--label-2); }
.t-footnote { font: var(--t-footnote); color: var(--label-2); }
.t-caption { font: var(--t-caption); color: var(--label-2); }
.t-eyebrow { font: var(--t-headline); color: var(--tint-label); margin-bottom: var(--s-2); }
.t-secondary { color: var(--label-2); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 50px; padding: 0 var(--s-6); border: 0; border-radius: var(--r-md);
  font: var(--t-headline); cursor: pointer; user-select: none; text-decoration: none;
  transition: transform var(--dur-2) var(--ease-out), opacity var(--dur-1), background-color var(--dur-2);
}
.btn:active { transform: scale(.97); opacity: .86; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn--filled { background: var(--tint); color: var(--on-tint); }
.btn--tinted { background: color-mix(in srgb, var(--tint) 18%, transparent); color: var(--tint-label); }
.btn--gray { background: var(--fill); color: var(--label); }
.btn--plain { background: none; color: var(--tint-label); padding-inline: var(--s-1); min-height: var(--tap); }
.btn--small { min-height: 34px; padding: 0 var(--s-4); font: var(--t-subhead); font-weight: 600; border-radius: var(--r-pill); }
.btn--block { width: 100%; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--label);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 17px; flex: none;
  transition: transform var(--dur-2) var(--ease-out);
}
.icon-btn:active { transform: scale(.9); }

/* ── Navigation bar (regular material) ────────────────────────────────── */
.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-nav); padding-top: env(safe-area-inset-top);
  background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--separator);
  transition: background-color var(--dur-3), border-color var(--dur-3);
}
.navbar.is-clear { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.navbar__inner { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.navbar__links { display: flex; gap: var(--s-6); font: var(--t-subhead); }
.navbar__links a { color: var(--label-2); transition: color var(--dur-2); }
.navbar__links a:hover { color: var(--label); }
.navbar__end { display: flex; align-items: center; gap: var(--s-2); }
@media (max-width: 820px) { .navbar__links { display: none; } }
.wordmark { display: flex; align-items: center; gap: var(--s-2); color: var(--label); direction: ltr; font: 800 15px/1 var(--font-brand); letter-spacing: .14em; }
.wordmark__mark { width: 26px; height: 26px; border-radius: var(--r-xs); background: var(--charcoal); display: grid; place-items: center; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14); }
.wordmark__mark svg { width: 13px; height: 13px; fill: #fff; }

/* ── Segmented control ────────────────────────────────────────────────── */
.segmented { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 2px; border-radius: 9px; background: var(--fill); }
.segmented button { position: relative; z-index: 1; border: 0; background: none; padding: 7px 6px; border-radius: var(--r-xs); font: var(--t-subhead); font-weight: 500; color: var(--label); white-space: nowrap; cursor: pointer; }
.segmented button[aria-checked="true"] { font-weight: 600; }
.segmented__thumb { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: var(--r-xs); background: var(--thumb); box-shadow: var(--shadow-thumb); transition: transform var(--dur-3) var(--ease-spring), width var(--dur-3) var(--ease-spring); }

/* ── Switch ───────────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch__track { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--fill-2); transition: background-color var(--dur-2); }
.switch__track::after { content: ""; position: absolute; top: 2px; right: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform var(--dur-3) var(--ease-spring); }
.switch input:checked + .switch__track { background: var(--green); }
.switch--tint input:checked + .switch__track { background: var(--tint); }
.switch input:checked + .switch__track::after { transform: translateX(-20px); }
.switch input:focus-visible + .switch__track { outline: 3px solid color-mix(in srgb, var(--tint) 70%, transparent); outline-offset: 2px; }

/* ── Stepper ──────────────────────────────────────────────────────────── */
.stepper { display: inline-flex; border-radius: 9px; background: var(--fill); flex: none; }
.stepper button { width: 46px; height: 32px; border: 0; background: none; display: grid; place-items: center; font-size: 18px; cursor: pointer; color: var(--label); }
.stepper button + button { border-inline-start: .5px solid var(--separator); }
.stepper button:active { background: var(--fill); }

/* ── Slider ───────────────────────────────────────────────────────────── */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to left, var(--tint) var(--fill-pct, 30%), var(--fill-2) var(--fill-pct, 30%)); }
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill-2); }
.slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--tint); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #fff; box-shadow: 0 .5px 4px rgba(0, 0, 0, .12), 0 6px 13px rgba(0, 0, 0, .12); }
.slider::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 .5px 4px rgba(0, 0, 0, .12), 0 6px 13px rgba(0, 0, 0, .12); }

/* ── Inset grouped list ───────────────────────────────────────────────── */
.list { background: var(--bg-elevated); border-radius: var(--r-md); overflow: hidden; }
.list__header { font: var(--t-footnote); color: var(--label-2); padding: 0 var(--s-4) 6px; }
.list__footer { font: var(--t-footnote); color: var(--label-2); padding: 6px var(--s-4) 0; }
* + .list__header { margin-top: var(--s-6); }
.row { position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: var(--s-2) var(--s-4); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 0; right: var(--s-4); border-top: .5px solid var(--separator); }
.row__label { flex: none; min-width: 84px; }
.row__value { margin-inline-start: auto; color: var(--label-2); text-align: end; }
.row__end { margin-inline-start: auto; }
.row input, .row textarea { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: 6px 0; color: var(--label); }
.row textarea { resize: none; min-height: 64px; }
.row input::placeholder, .row textarea::placeholder { color: var(--label-3); }
.row--stack { display: block; padding-block: var(--s-3) var(--s-4); }
.row--stack .row__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }

/* ── Disclosure (FAQ) ─────────────────────────────────────────────────── */
.disclosure + .disclosure { border-top: .5px solid var(--separator); }
.disclosure summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: var(--s-3) var(--s-4); font: var(--t-headline); }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .i { margin-inline-start: auto; color: var(--label-3); transition: transform var(--dur-3) var(--ease-out); }
.disclosure[open] summary .i { transform: rotate(-90deg); }
.disclosure p { margin: 0; padding: 0 var(--s-4) var(--s-4); color: var(--label-2); }

/* ── Chip · Badge ─────────────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: var(--s-2); padding: var(--s-2) 14px; border-radius: var(--r-pill); background: var(--bg-elevated); font: var(--t-subhead); color: var(--label); box-shadow: var(--shadow-1); }
.chip .i { color: var(--tint-label); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--r-pill); font: var(--t-caption); color: #fff; background: rgba(30, 30, 30, .5); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card { background: var(--bg-elevated); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-1); }

/* ── Selectable tile ──────────────────────────────────────────────────── */
.tile { display: grid; gap: var(--s-2); padding: var(--s-4); border: 0; border-radius: var(--r-md); background: var(--bg-elevated); text-align: start; cursor: pointer; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow var(--dur-2), transform var(--dur-2) var(--ease-out); }
.tile:active { transform: scale(.97); }
.tile .i { font-size: 26px; color: var(--tint-label); }
.tile[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--tint); }

/* ── Day picker ───────────────────────────────────────────────────────── */
.days { display: flex; gap: var(--s-2); overflow-x: auto; padding: 2px 2px var(--s-3); scroll-snap-type: x proximity; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 64px; scroll-snap-align: start; display: grid; gap: 2px; padding: 10px 0; border: 0; border-radius: var(--r-md); background: var(--bg-elevated); text-align: center; cursor: pointer; transition: background-color var(--dur-2), color var(--dur-2); }
.day small { font: var(--t-caption); color: var(--label-2); }
.day b { font: 600 22px/1.2 var(--font); }
.day[aria-checked="true"] { background: var(--tint); color: var(--on-tint); }
.day[aria-checked="true"] small { color: inherit; opacity: .75; }

/* ── Sheet ────────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity var(--dur-4) var(--ease-sheet); }
.scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: var(--z-sheet); inset: auto 0 0 0; height: calc(100dvh - 44px - env(safe-area-inset-top));
  display: flex; flex-direction: column; background: var(--bg-sheet); border-radius: 12px 12px 0 0; box-shadow: var(--shadow-2);
  transform: translateY(105%); visibility: hidden; transition: transform var(--dur-4) var(--ease-sheet), visibility 0s var(--dur-4);
  --bg-elevated: var(--bg-sheet-elevated);
}
.sheet.is-open { transform: none; visibility: visible; transition: transform var(--dur-4) var(--ease-sheet); }
.sheet:focus { outline: none; }
@media (min-width: 761px) {
  .sheet { inset: 50% auto auto 50%; width: 560px; height: min(720px, calc(100dvh - 60px)); border-radius: var(--r-md); opacity: 0; transform: translate(-50%, -46%) scale(.96); transition: transform var(--dur-4) var(--ease-sheet), opacity var(--dur-3), visibility 0s var(--dur-4); }
  .sheet.is-open { opacity: 1; transform: translate(-50%, -50%); transition: transform var(--dur-4) var(--ease-sheet), opacity var(--dur-3); }
  .sheet__grabber { display: none; }
}
.sheet__grabber { width: 36px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: var(--fill-2); flex: none; touch-action: none; }
.sheet__bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 52px; padding: 0 var(--s-3); flex: none; touch-action: none; }
.sheet__title { font: var(--t-headline); text-align: center; }
.sheet__bar .btn--plain:first-child { justify-self: start; }
.sheet__bar .btn--plain:last-child { justify-self: end; }
.sheet__progress { height: 3px; margin: 0 var(--s-4); border-radius: 2px; background: var(--fill); overflow: hidden; flex: none; }
.sheet__progress i { display: block; height: 100%; width: 20%; background: var(--tint); transition: width var(--dur-4) var(--ease-sheet); }
.sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px var(--s-4) var(--s-2); }
.sheet__foot { flex: none; padding: 10px var(--s-4) calc(14px + env(safe-area-inset-bottom)); }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: var(--z-overlay); display: grid; place-items: center; padding: var(--s-5); background: rgba(0, 0, 0, .92); }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 86vh; border-radius: var(--r-md); }
.lightbox .icon-btn { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; background: rgba(120, 120, 128, .4); color: #fff; }
