/* Takker components. State classes (.is-hover, .is-pressed, .is-focus) mirror real
   pseudo-classes so the reference page can show them statically. */

/* ---------- Button ---------- */
.btn {
  --h: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); min-width: 44px; padding: 0 var(--s5);
  border-radius: 12px; border: 2px solid transparent;
  font: 700 16px/1 var(--font-sans); letter-spacing: -.01em; white-space: nowrap;
  transition: transform .06s ease, box-shadow .06s ease, background-color .12s ease;
  user-select: none; position: relative; text-decoration: none;
}
.btn-block { width: 100%; }
.btn-lg { --h: var(--tap-lg); font-size: 19px; font-weight: 900; border-radius: 12px; }

.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--line); box-shadow: 0 4px 0 var(--shadow); margin-bottom: 4px; }
.btn-primary:hover, .btn-primary.is-hover { background: var(--accent-hover); }
.btn-primary:active, .btn-primary.is-pressed { background: var(--accent-press); transform: translateY(4px); box-shadow: 0 0 0 var(--shadow); }

.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); border-width: 1.5px; }
.btn-secondary:hover, .btn-secondary.is-hover { background: var(--surface-2); }
.btn-secondary:active, .btn-secondary.is-pressed { transform: translateY(2px); }

.btn-ghost { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; padding: 0 var(--s3); }
.btn-ghost:hover, .btn-ghost.is-hover { background: var(--surface-2); }

.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); border-width: 1.5px; }
.btn-danger:hover, .btn-danger.is-hover { background: var(--danger-soft); }

.btn:focus-visible, .btn.is-focus { outline: 2.5px solid var(--focus); outline-offset: 3px; }

.btn:disabled, .btn.is-disabled {
  background: var(--surface-2); color: var(--muted); border-color: var(--line-soft);
  box-shadow: none; transform: none; cursor: not-allowed;
}
.btn.is-loading { cursor: progress; pointer-events: none; }
.btn-primary.is-loading { background: var(--accent-soft); color: var(--ink); border-color: var(--line); box-shadow: 0 4px 0 var(--shadow); }
.btn.is-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); box-shadow: none; transform: none; }
.btn.is-error.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Reason shown under a disabled primary button */
.btn-reason { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink-2); margin-top: var(--s2); }
.btn-reason svg { flex: none; margin-top: 2px; }

/* ---------- Spinner (never alone — always next to a label saying what loads) ---------- */
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
.spin-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-line { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); padding: var(--s3) 0; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line-soft) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Field / Input ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field-label .req { color: var(--danger); margin-left: 3px; font-weight: 700; }
.input {
  height: 54px; width: 100%; padding: 0 var(--s4);
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-soft); border-radius: 12px;
  font: 500 17px/1 var(--font-sans);  /* ≥16px avoids iOS zoom */
  transition: border-color .12s, box-shadow .12s; outline: none;
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover { border-color: var(--muted); }
.input:focus, .input.is-focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.field-hint { font-size: 13px; color: var(--muted); }
.field-error { display: none; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--danger); }
.field.has-error .input { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.field.has-error .field-error { display: flex; }
.field.has-error .field-hint { display: none; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 76px; }
.input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 44px; padding: 0 12px; font: 700 13px/1 var(--font-mono); color: var(--ink-2); border-radius: 8px; }
.input-action:hover { background: var(--surface-2); }

.input-code { font: 700 28px/1 var(--font-mono); letter-spacing: .5em; text-align: center; padding-left: calc(var(--s4) + .25em); height: 64px; }

/* ---------- Card ---------- */
.card { background: var(--surface); border: 1.5px solid var(--line-soft); border-radius: var(--r-lg); padding: var(--s4); }
.card-strong { border: 2px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s3); }
.card-inset { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s3); }
.divider { border: 0; border-top: 1.5px solid var(--line-soft); }
.divider-dashed { border-top-style: dashed; }

/* list rows inside cards (offers, settings) */
.list > * + * { border-top: 1.5px solid var(--line-soft); }
.list-row { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s3) 0; text-decoration: none; }
.list-row .chev { margin-left: auto; color: var(--muted); }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); font: 500 11.5px/1 var(--font-mono); white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.badge-accent { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.badge-ok { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.badge-warn { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.badge-danger { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.badge-outline { background: transparent; border: 1.5px solid var(--line-soft); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-pill { border-radius: var(--r-pill); height: 30px; padding: 0 12px; font-size: 12px; }

/* live dot with halo */
.live { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); flex: none; }
.live.is-off { background: var(--muted); box-shadow: 0 0 0 5px var(--surface-2); }
.live.is-warn { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.live.is-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px transparent; } }

/* ---------- Meter (trial clock, daily claims) ---------- */
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.meter.is-warn > i { background: var(--warn); }
.pips { display: flex; gap: 4px; }
.pips > i { flex: 1; height: 8px; border-radius: 2px; background: var(--surface-2); }
.pips > i.on { background: var(--ink); }

/* ---------- Toggle ---------- */
.toggle { position: relative; display: inline-flex; width: 56px; height: 34px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.toggle .track { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--surface-2); border: 1.5px solid var(--line-soft); transition: background .15s; }
.toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked + .track { background: var(--accent); border-color: var(--line); }
.toggle input:checked + .track::after { transform: translateX(22px); background: var(--on-accent); }
.toggle input:focus-visible + .track { outline: 2.5px solid var(--focus); outline-offset: 3px; }
.toggle input:disabled + .track { opacity: .5; }

/* ---------- Stepper (numbers: stops, pay) ---------- */
.stepper { display: flex; align-items: center; height: 54px; border: 1.5px solid var(--line-soft); border-radius: 12px; background: var(--surface); overflow: hidden; }
.stepper button { width: 54px; height: 100%; font: 700 22px/1 var(--font-mono); color: var(--ink); }
.stepper button:hover { background: var(--surface-2); }
.stepper button:active { background: var(--line-soft); }
.stepper button:disabled { color: var(--line-soft); cursor: not-allowed; background: none; }
.stepper output { flex: 1; text-align: center; font: 700 19px/1 var(--font-mono); border-left: 1.5px solid var(--line-soft); border-right: 1.5px solid var(--line-soft); height: 100%; display: grid; place-items: center; }

/* ---------- Segmented ---------- */
.segmented { display: flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 12px; }
.segmented button { flex: 1; height: 44px; border-radius: 9px; font-weight: 700; font-size: 15px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1.5px var(--line-soft); }

/* ---------- Choice chip (facility pick) ---------- */
.chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line-soft); background: var(--surface); font-weight: 700; font-size: 15px; }
.chip[aria-pressed="true"] { border: 2px solid var(--line); background: var(--accent-soft); }
.chip .tick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-soft); display: grid; place-items: center; }
.chip[aria-pressed="true"] .tick { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- Toast ---------- */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 var(--s4); z-index: 50; pointer-events: none; }
.toast {
  pointer-events: auto; width: 100%; max-width: calc(var(--screen-max) - 32px);
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: var(--toast-bg); color: var(--toast-ink); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: toast-in .2s ease-out;
}
.toast-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--accent); color: #16140F; }
.toast-ok .toast-icon { background: #5CC985; }
.toast-error .toast-icon { background: #FF7B6B; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 15px; }
.toast-msg { font-size: 13.5px; color: var(--toast-muted); }
.toast-action { height: 44px; padding: 0 12px; font: 700 13px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--toast-ink); border-radius: 8px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Sheet (errors, confirmations) ---------- */
.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  width: 100%; max-width: var(--screen-max); background: var(--bg); color: var(--ink);
  border-radius: 20px 20px 0 0; padding: 10px var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  animation: sheet-in .22s cubic-bezier(.2,.8,.2,1);
  max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line-soft); margin: 0 auto var(--s5); }
.sheet-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); margin-bottom: var(--s4); }
.sheet-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.sheet-icon.is-accent { background: var(--accent-soft); color: var(--accent-press); }
.sheet h2 { margin-bottom: var(--s2); }
.sheet p { color: var(--ink-2); margin-bottom: var(--s5); }
.sheet .btn + .btn { margin-top: var(--s2); }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- App chrome ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 900; font-size: 23px; letter-spacing: -.055em; text-decoration: none; color: var(--ink); }
/* wordmark "takker." — lowercase, k's locked together, orange dot */
.wm { line-height: 1; padding-bottom: 2px; }
.wm .kk { letter-spacing: -.09em; margin-right: .03em; }
.wm i { font-style: normal; color: var(--accent); }
/* logo: "T inside U" mark, Hi-Vis (orange + ink cut-outs + press shadow) */
.logo { width: 26px; height: 28px; flex: none; background: url(/assets/img/logo-light.svg) no-repeat center / contain; }
[data-theme="dark"] .logo { background-image: url(/assets/img/logo-dark.svg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { background-image: url(/assets/img/logo-dark.svg); } }

.tabbar { position: sticky; bottom: 0; display: flex; justify-content: space-around; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line-soft); background: var(--bg); margin: 0 calc(var(--s4) * -1); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 80px; height: 52px; font: 500 11px/1 var(--font-mono); color: var(--muted); text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }

.backbar { display: flex; align-items: center; gap: var(--s2); height: 56px; margin-left: -10px; }
.backbar a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ink); }
.backbar a:hover { background: var(--surface-2); }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Alert (inline message inside a screen) ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; font-size: 15px; background: var(--surface-2); color: var(--ink); }
.alert .icon { margin-top: 1px; }
.alert > div > b:first-child { display: block; }
.alert p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.alert-ok { background: var(--ok-soft); } .alert-ok .icon { color: var(--ok); }
.alert-warn { background: var(--warn-soft); } .alert-warn .icon { color: var(--warn); }
.alert-danger { background: var(--danger-soft); } .alert-danger .icon { color: var(--danger); }
.alert a { font-weight: 700; color: inherit; }

/* mock-mode marker (local dev only) */
.mock-tag { position: fixed; bottom: 6px; right: 6px; z-index: 99; font: 700 10px/1 var(--font-mono); letter-spacing: .1em; padding: 5px 8px; border-radius: 6px; background: var(--ink); color: var(--bg); opacity: .55; pointer-events: none; }

/* dark solid button (Stop bot) — still the one dominant action, but clearly "off" not "go" */
.btn-ink { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: 0 4px 0 var(--accent); margin-bottom: 4px; }
.btn-ink:hover { background: var(--ink-2); }
.btn-ink:active { transform: translateY(4px); box-shadow: 0 0 0 var(--accent); }
.btn-ink.is-loading { background: var(--ink-2); }

.sheet-list { display: flex; flex-direction: column; gap: 8px; margin: -8px 0 20px; }
.sheet-list li { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.sheet-list .icon { color: var(--ok); width: 18px; height: 18px; }
.sheet p b { color: var(--ink); }

/* signup: SMS consent checkbox (required) */
.consent { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line-soft); cursor: pointer; }
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.consent-box { width: 24px; height: 24px; flex: none; margin-top: 1px; display: grid; place-items: center; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--surface); color: transparent; }
.consent-box .icon { width: 15px; height: 15px; stroke-width: 3; }
.consent input:checked + .consent-box { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.consent input:focus-visible + .consent-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.consent-txt { font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.field.has-error .consent { border-color: var(--danger); }
