/* =====================================================================
   Grimy Grills — Field App
   Linear-inspired dark theme. Mobile-first, large tap targets (>=44px).
   ===================================================================== */

:root {
  /* Surfaces */
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;

  /* Hairlines */
  --hairline: #23252a;
  --hairline-strong: #34343a;

  /* Ink */
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;

  /* Accent (lavender) */
  --accent: #5e6ad2;
  --accent-hover: #828fff;
  --accent-focus: #5e69d1;

  /* Semantic */
  --success: #27a644;
  --danger: #e5484d;

  /* Radii */
  --r-chip: 4px;
  --r-input: 8px;
  --r-card: 12px;
  --r-pill: 9999px;

  /* Spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --font: -apple-system, "SF Pro Display", "SF Pro Text", system-ui, "Segoe UI", Roboto, Inter, sans-serif;

  --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  /* Subtle depth: a faint lavender glow at the top, never a flat fill */
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(94, 106, 210, 0.10), transparent 60%),
    var(--canvas);
}

.hidden { display: none !important; }

/* iOS Safari can leave composited video layers visible when a view is hidden. */
.hidden video,
details:not([open]) video {
  display: none !important;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.4px;
  margin: 0;
}

button { font-family: inherit; }

/* ---------------------------------------------------------------- Layout */
.app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--s4) calc(var(--s7) + env(safe-area-inset-bottom));
}

.view { animation: viewIn 0.28s ease both; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: max(var(--s4), env(safe-area-inset-top)) 0 var(--s4);
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(var(--canvas) 75%, transparent);
}

.topbar__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.topbar__spacer { flex: 1; }

.topbar__back {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: var(--tap);
  padding: var(--s2) var(--s3) var(--s2) var(--s2);
  background: var(--surface-1);
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.topbar__back svg { width: 18px; height: 18px; }
.topbar__back:hover { border-color: var(--hairline-strong); color: var(--ink); }
.topbar__back:active { transform: scale(0.98); }

/* ------------------------------------------------------------ Chooser */
.chooser {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s7);
  padding: var(--s7) 0;
}

.chooser__brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}

.chooser__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(94, 106, 210, 0.25));
}

.chooser__title {
  font-size: 32px;
  letter-spacing: -1px;
  margin-top: var(--s2);
}

.chooser__subtitle {
  margin: 0;
  color: var(--ink-subtle);
  font-size: 14px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 500;
}

.chooser__cards {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.role-card {
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  text-align: left;
  padding: var(--s5) var(--s4);
  background: var(--surface-1);
  /* lighter top edge = subtle lift */
  border: 1px solid var(--hairline);
  border-top-color: var(--hairline-strong);
  border-radius: var(--r-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.role-card:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.role-card:active { transform: scale(0.99); }

.role-card__icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  color: var(--accent-hover);
}
.role-card__icon svg { width: 24px; height: 24px; }

.role-card__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.role-card__label { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.role-card__desc { font-size: 13px; color: var(--ink-subtle); }

.role-card__chev { flex: none; color: var(--ink-tertiary); }
.role-card__chev svg { width: 20px; height: 20px; display: block; }

/* ------------------------------------------------------- Employee hub */
.hub-intro { margin-top: var(--s5); }
.hub-intro__title { font-size: 24px; letter-spacing: -0.6px; }
.hub-intro__text { margin: var(--s2) 0 0; color: var(--ink-subtle); font-size: 15px; }

.hub-tiles {
  margin-top: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.hub-tile {
  display: flex;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  text-align: left;
  padding: var(--s5) var(--s4);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-top-color: var(--hairline-strong);
  border-radius: var(--r-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}
.hub-tile:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.hub-tile:active { transform: scale(0.99); }
.hub-tile--primary {
  border-color: rgba(94, 106, 210, 0.45);
  background: rgba(94, 106, 210, 0.08);
}
.hub-tile--primary:hover { border-color: var(--accent); background: rgba(94, 106, 210, 0.12); }

.hub-tile__icon {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  color: var(--accent-hover);
}
.hub-tile__icon svg { width: 24px; height: 24px; }

.hub-tile__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hub-tile__label { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.hub-tile__desc { font-size: 13px; color: var(--ink-subtle); }

.hub-tile__chev { flex: none; color: var(--ink-tertiary); }
.hub-tile__chev svg { width: 20px; height: 20px; display: block; }

/* -------------------------------------------------------- Payment links */
.paylink-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-top: var(--s5);
}

.paylink {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
}

.paylink__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.paylink__label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.paylink__price {
  font-size: 14px;
  color: var(--accent-hover);
  font-weight: 600;
}

.paylink__url {
  font-size: 12px;
  color: var(--ink-subtle);
  word-break: break-all;
  line-height: 1.4;
  margin-top: var(--s1);
}

.paylink__copy {
  flex-shrink: 0;
  width: auto;
  min-height: 40px;
  padding: 0 16px;
}

/* --------------------------------------------------------------- SOP */
.sop__lead { margin-top: var(--s5); }
.sop__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-hover);
}
.sop__title { font-size: 24px; letter-spacing: -0.6px; margin-top: var(--s1); }
.sop__text { margin: var(--s2) 0 0; color: var(--ink-subtle); font-size: 14px; }

.acc {
  margin-top: var(--s3);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  overflow: hidden;
}
.acc--accent { border-color: rgba(94, 106, 210, 0.45); }

.acc__summary {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--tap);
  padding: var(--s4);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.acc__summary::-webkit-details-marker { display: none; }
.acc__summary:hover { background: var(--surface-2); }

.acc__heading {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.acc__tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent-hover);
  background: rgba(94, 106, 210, 0.15);
  border: 1px solid rgba(94, 106, 210, 0.4);
  border-radius: var(--r-chip);
  padding: 2px 6px;
}

.acc__chev { flex: none; color: var(--ink-subtle); transition: transform 0.2s ease; }
.acc__chev svg { width: 18px; height: 18px; display: block; }
.acc[open] > .acc__summary .acc__chev { transform: rotate(180deg); }

.acc__body {
  padding: 0 var(--s4) var(--s4);
  border-top: 1px solid var(--hairline);
}
.acc[open] > .acc__body { animation: viewIn 0.22s ease both; }

.sop__para { margin: var(--s3) 0 0; color: var(--ink-muted); font-size: 14px; }
.sop__list {
  margin: var(--s3) 0 0;
  padding-left: var(--s4);
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.sop__list--defs { gap: var(--s3); }
.sop__list strong { color: var(--ink); font-weight: 600; }
.sop__link { color: var(--accent-hover); font-weight: 600; text-decoration: none; }
.sop__link:hover { text-decoration: underline; }

/* ----------------------------------------------------------- Checkbox */
.checkbox {
  margin-top: var(--s4);
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  min-height: var(--tap);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  cursor: pointer;
}
.checkbox__input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox__box {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-input);
  border: 2px solid var(--accent);
  background: transparent;
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.checkbox__box svg { width: 14px; height: 14px; }
.checkbox__input:checked + .checkbox__box {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.checkbox__input:focus-visible + .checkbox__box {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}
.checkbox__label { font-size: 14px; color: var(--ink-muted); line-height: 1.45; }

/* ----------------------------------------------------- Employee intro */
.intro-card {
  margin-top: var(--s5);
  padding: var(--s5);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-top-color: var(--hairline-strong);
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.intro-card__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent-hover);
}
.intro-card__title { font-size: 24px; letter-spacing: -0.6px; }
.intro-card__text { margin: 0 0 var(--s2); color: var(--ink-muted); font-size: 15px; }

/* ------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s4);
  border-radius: var(--r-input);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.985); }
.btn--block { width: 100%; }

.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:disabled {
  background: var(--surface-3);
  border-color: var(--hairline);
  color: var(--ink-tertiary);
  cursor: not-allowed;
  transform: none;
}

.btn--secondary {
  background: var(--surface-1);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn--secondary:hover { background: var(--surface-2); border-color: var(--hairline-strong); }
.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
  font-size: 12px;
}
.btn--ghost:hover { background: var(--surface-1); color: var(--ink); }

/* Focus rings — accent, 2px */
.btn:focus-visible,
.topbar__back:focus-visible,
.role-card:focus-visible,
.segmented__option:focus-visible,
.input:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- Fields */
.field { margin-top: var(--s5); display: flex; flex-direction: column; gap: var(--s2); }

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 11px var(--s3);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  color: var(--ink);
  font-size: 16px; /* >=16px avoids iOS zoom-on-focus */
  font-family: inherit;
}
.input::placeholder { color: var(--ink-tertiary); }
.input:focus { border-color: var(--accent-focus); outline: 2px solid var(--accent-focus); outline-offset: 0; }
/* Make the native date picker icon visible on dark */
.input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.divider { border: none; border-top: 1px solid var(--hairline); margin: var(--s5) 0 0; }

/* --------------------------------------------------------- Segmented */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1);
  padding: var(--s1);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
}

.segmented__option {
  min-height: var(--tap);
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented__option[aria-checked="true"] {
  background: var(--accent);
  color: #fff;
}
.segmented__option:not([aria-checked="true"]):hover { color: var(--ink); }

/* -------------------------------------------------------- Media items */
.media-item {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
}

.media-item__head { display: flex; align-items: flex-start; gap: var(--s3); }

.media-item__meta { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.media-item__label { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.media-item__hint { font-size: 13px; color: var(--ink-subtle); }

.media-item__body { margin-top: var(--s3); }
.media-item__action, .slot__action { width: 100%; }

/* Check indicator — lavender ring → green when done */
.check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  border: 2px solid var(--accent);
  position: relative;
  margin-top: 1px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.media-item.is-done .check,
.media-item--group.is-done .check {
  background: var(--success);
  border-color: var(--success);
}
.media-item.is-done .check::after,
.media-item--group.is-done .check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ------------------------------------------------------------- Slots */
.slots {
  margin-top: var(--s3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}

.slot {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s3);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
}
.slot__name { font-size: 13px; font-weight: 500; color: var(--ink-muted); }

/* ----------------------------------------------------------- Preview */
.media-preview {
  margin-top: var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.media-preview__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-input);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface-3);
  cursor: pointer;
}
.media-preview__frame img,
.media-preview__frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-preview__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  pointer-events: none;
}
.media-preview__play svg { width: 20px; height: 20px; }

.media-preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.media-preview__status {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
}
.media-preview__replace {
  background: none;
  border: none;
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: var(--s2);
  min-height: var(--tap);
}

/* Uploading state */
.media-preview__uploading {
  font-size: 13px;
  color: var(--ink-subtle);
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- Progress */
.checklist__progress {
  position: sticky;
  top: 64px;
  z-index: 4;
  padding: var(--s3) 0;
  background: linear-gradient(var(--canvas) 80%, transparent);
}
.progress { display: flex; align-items: center; gap: var(--s3); }
.progress__track {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.3s ease, background 0.3s ease;
}
.progress__fill.is-complete { background: var(--success); }
.progress__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.checklist__footer { margin-top: var(--s6); }

/* ----------------------------------------------------------- Success */
.success {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s7) var(--s4);
  margin-top: var(--s7);
}
.success__icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(39, 166, 68, 0.12);
  border: 1px solid rgba(39, 166, 68, 0.4);
  color: var(--success);
}
.success__icon svg { width: 30px; height: 30px; }
.success__title { font-size: 22px; letter-spacing: -0.4px; }
.success__text { margin: 0 0 var(--s4); color: var(--ink-muted); font-size: 15px; max-width: 320px; }
.success .btn { max-width: 320px; }

/* ------------------------------------------------------------- Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: calc(100% - 32px);
  padding: var(--s3) var(--s4);
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(229, 72, 77, 0.6); }
.toast.is-error::before { content: ""; }
.toast.is-success { border-color: rgba(39, 166, 68, 0.6); }

/* ----------------------------------------------------------- Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  padding: var(--s5);
  animation: fade 0.18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox__stage {
  max-width: 100%;
  max-height: 90dvh;
  display: grid;
  place-items: center;
}
.lightbox__stage img,
.lightbox__stage video {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline-strong);
}

.lightbox__close {
  position: absolute;
  top: max(var(--s4), env(safe-area-inset-top));
  right: var(--s4);
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  cursor: pointer;
}
.lightbox.hidden {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

/* -------------------------------------------------------- Config error */
.config-error {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--s5);
  background: var(--canvas);
  z-index: 100;
}
.config-error__card {
  max-width: 360px;
  text-align: center;
  padding: var(--s5);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
}
.config-error__card h1 { font-size: 20px; margin-bottom: var(--s3); }
.config-error__card p { margin: 0; color: var(--ink-muted); font-size: 14px; }

/* ------------------------------------------------------- Wider screens */
@media (min-width: 600px) {
  .chooser__title { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =====================================================================
   Admin finance — spending dashboard
   ===================================================================== */
.fin { padding: var(--s4) var(--s4) var(--s7); max-width: 860px; margin: 0 auto; }

.fin-tabs { display: flex; gap: var(--s2); margin-bottom: var(--s5); }
.fin-tab {
  appearance: none; border: 1px solid var(--hairline); background: var(--surface-1);
  color: var(--ink-subtle); border-radius: var(--r-pill); padding: 8px 18px;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; min-height: var(--tap);
  transition: color .15s, border-color .15s, background .15s;
}
.fin-tab:hover { color: var(--ink); }
.fin-tab.is-active { color: var(--ink); border-color: var(--accent); background: rgba(94,106,210,.12); }

.fin-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.fin-actions .btn { width: auto; min-height: 40px; padding: 0 16px; }
.fin-btn-danger { color: var(--danger) !important; }
.fin-note { margin: var(--s3) 0 0; color: var(--success); font-size: 13px; font-weight: 500; }
.fin-hint { margin: var(--s3) 0 0; color: var(--ink-subtle); font-size: 13px; line-height: 1.45; }
.fin-empty { color: var(--ink-subtle); font-size: 14px; margin: var(--s2) 0; }
.fin-h {
  font-size: 10px; font-weight: 700; color: var(--ink-tertiary); letter-spacing: 1.2px;
  text-transform: uppercase; margin: 28px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.fin-h::after { content: ''; flex: 1; height: 1px; background: var(--hairline); }
.fin-divider { height: 1px; background: var(--hairline); margin: var(--s6) 0; }

/* container used by renderSpending for hero + chart */
.fin-cards { display: block; margin-top: var(--s4); }

/* ---- Hero metric ---- */
.fin-hero {
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 18px;
}
.fin-hero__eyebrow {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--ink-tertiary); margin-bottom: 8px;
}
.fin-hero__amount {
  font-size: 46px; font-weight: 700; letter-spacing: -2.5px; color: var(--ink);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.fin-hero__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.fin-hero__chip {
  font-size: 11px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-pill); padding: 3px 10px; color: var(--ink-subtle); white-space: nowrap;
}
.fin-hero__chip--accent {
  border-color: rgba(94,106,210,0.4); color: var(--accent-hover);
  background: rgba(94,106,210,0.1);
}

/* ---- Monthly bar chart ---- */
.fin-month-chart {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-card); padding: 14px 14px 0; overflow: hidden; margin-bottom: 24px;
}
.fin-month-chart__label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ink-tertiary); margin-bottom: 10px;
}
.fin-month-chart__bars { display: flex; gap: 8px; align-items: flex-end; }
.fin-month-bar { flex: 1; display: flex; flex-direction: column; }
.fin-month-bar__fill {
  flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(94,106,210,0.9) 0%, var(--accent) 100%);
  opacity: 0.65; transition: opacity 0.2s;
}
.fin-month-bar__fill.is-current {
  opacity: 1;
  background: linear-gradient(180deg, #828fff 0%, var(--accent) 100%);
}
.fin-month-bar:hover .fin-month-bar__fill { opacity: 1; }

.fin-month-chart__meta {
  display: flex; gap: 8px; padding: 10px 0; border-top: 1px solid var(--hairline);
}
.fin-month-meta { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fin-month-meta__label {
  font-size: 10px; color: var(--ink-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fin-month-meta__value {
  font-size: 12px; font-weight: 700; color: var(--ink-muted); letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.fin-month-meta.is-current .fin-month-meta__value { color: var(--ink); }
.fin-month-meta__count { font-size: 10px; color: var(--ink-tertiary); }

/* ---- Category bars ---- */
/* ---- Month sections ---- */
.fin-month { margin-bottom: 20px; }
.fin-month__head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}
.fin-month__label {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-subtle);
}
.fin-month__meta { display: flex; align-items: baseline; gap: 6px; }
.fin-month__total {
  font-size: 15px; font-weight: 700; letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.fin-month__count { font-size: 11px; color: var(--ink-tertiary); }
.fin-month__cats { display: flex; flex-direction: column; gap: 5px; }

.fin-cats { display: flex; flex-direction: column; }
.fin-cat {
  background: var(--surface-1); border: 1px solid var(--hairline);
  border-radius: var(--r-input); padding: 10px 12px 10px 18px;
  position: relative; overflow: hidden; transition: border-color 0.15s;
  cursor: pointer; user-select: none;
}
.fin-cat:hover { border-color: var(--hairline-strong); }
.fin-cat__strip {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent);
}
.fin-cat__top {
  display: flex; align-items: baseline; gap: 6px;
}
.fin-cat__name { font-size: 13px; font-weight: 500; color: var(--ink); flex: 1; }
.fin-cat__chev {
  font-size: 12px; color: var(--ink-tertiary); transition: transform 0.18s ease;
  flex-shrink: 0; line-height: 1;
}
.fin-cat.is-expanded .fin-cat__chev { transform: rotate(90deg); }
.fin-cat__amount {
  font-size: 14px; font-weight: 700; letter-spacing: -0.5px; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.fin-bar { height: 4px; background: var(--surface-3); border-radius: 3px; margin: 6px 0 4px; overflow: hidden; }
.fin-bar__fill { height: 100%; background: var(--accent); border-radius: 3px; }
.fin-cat__foot { font-size: 10px; color: var(--ink-tertiary); }

/* Merchant breakdown (revealed on expand) */
.fin-cat__merchants {
  max-height: 0; overflow: hidden;
  transition: max-height 0.22s ease;
}
.fin-cat.is-expanded .fin-cat__merchants {
  max-height: 400px;
}
.fin-cat__merchants-inner {
  padding-top: 8px; margin-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.fin-merchant {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; gap: 8px;
}
.fin-merchant__name {
  font-size: 12px; color: var(--ink-muted); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.fin-merchant__amt {
  font-size: 12px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.fin-cat__misc-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--danger); background: rgba(229,72,77,0.12);
  border: 1px solid rgba(229,72,77,0.3); border-radius: var(--r-chip);
  padding: 1px 5px; vertical-align: middle; margin-left: 5px;
}

/* Category color tokens */
.fin-cat--supplies .fin-cat__strip,
.fin-cat--supplies .fin-bar__fill { background: #4ade80; }
.fin-cat--payroll .fin-cat__strip,
.fin-cat--payroll .fin-bar__fill { background: #facc15; }
.fin-cat--marketing .fin-cat__strip,
.fin-cat--marketing .fin-bar__fill { background: #60a5fa; }
.fin-cat--fuel .fin-cat__strip,
.fin-cat--fuel .fin-bar__fill { background: #fb923c; }
.fin-cat--insurance .fin-cat__strip,
.fin-cat--insurance .fin-bar__fill { background: #c084fc; }
.fin-cat--tech .fin-cat__strip,
.fin-cat--tech .fin-bar__fill { background: #22d3ee; }
.fin-cat--meals .fin-cat__strip,
.fin-cat--meals .fin-bar__fill { background: #fb7185; }
.fin-cat--labor .fin-cat__strip,
.fin-cat--labor .fin-bar__fill { background: #94a3b8; }
.fin-cat--misc { border-color: rgba(229,72,77,0.2); }
.fin-cat--misc .fin-cat__strip,
.fin-cat--misc .fin-bar__fill { background: var(--danger); opacity: 0.7; }

/* ---- Transaction rows ---- */
.fin-txns, .fin-emps { display: flex; flex-direction: column; }
.fin-txn, .fin-emp {
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s3); border-radius: var(--r-input);
  border: 1px solid transparent; transition: background 0.1s, border-color 0.1s;
}
.fin-txn:hover, .fin-emp:hover { background: var(--surface-1); border-color: var(--hairline); }
.fin-txn__main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.fin-txn__name, .fin-emp__name {
  font-size: 13px; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: color 0.1s;
}
.fin-txn__name:hover { color: var(--ink-muted); }
.fin-txn__name.is-expanded { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
.fin-txn__date { font-size: 11px; color: var(--ink-tertiary); }
.fin-txn__amt, .fin-emp__amt {
  font-size: 14px; font-weight: 600; color: var(--ink);
  min-width: 80px; text-align: right; font-variant-numeric: tabular-nums;
}
.fin-emp__name { flex: 1; }
.fin-emp__flag { font-size: 10px; color: var(--accent-hover); font-weight: 600; }

.fin-txn__cat, .fin-emp__role {
  appearance: none; background: var(--surface-2); color: var(--ink-muted);
  border: 1px solid var(--hairline); border-radius: var(--r-chip);
  padding: 5px 8px; font: inherit; font-size: 12px; cursor: pointer;
  max-width: 130px; transition: border-color 0.15s, color 0.15s;
}
.fin-txn__cat:hover, .fin-emp__role:hover { border-color: var(--hairline-strong); color: var(--ink); }
.fin-txn__cat:focus-visible, .fin-emp__role:focus-visible { outline: 2px solid var(--accent-focus); }

@media (max-width: 560px) {
  .fin-txn__cat, .fin-emp__role { max-width: 100px; }
}

/* ---- Import progress ----------------------------------------------- */
.imp-progress {
  margin-top: var(--s4);
  padding: var(--s5);
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: var(--r-card);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.imp-body {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.imp-steps {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

.imp-sep {
  color: var(--ink-tertiary);
  font-size: 12px;
  flex-shrink: 0;
}

.imp-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-tertiary);
  transition: color 0.2s ease;
}

.imp-step.is-active { color: var(--ink); }
.imp-step.is-done { color: var(--success); }
.imp-step.is-error { color: var(--danger); }

.imp-step__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  position: relative;
}

.imp-step__icon::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hairline-strong);
  transition: background 0.2s ease;
}

.imp-step.is-active .imp-step__icon::before { display: none; }
.imp-step.is-active .imp-step__icon::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  position: absolute;
}

.imp-step.is-done .imp-step__icon::before {
  width: 14px; height: 14px; background: var(--success); border-radius: 50%;
}
.imp-step.is-done .imp-step__icon::after {
  content: '';
  position: absolute;
  left: 5px; top: 2px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.imp-step.is-error .imp-step__icon::before { background: var(--danger); width: 14px; height: 14px; }
.imp-step.is-error .imp-step__icon::after {
  content: '×';
  position: absolute;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.imp-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.imp-status__msg {
  font-size: 12px;
  color: var(--ink-secondary);
}

.imp-timer {
  font-size: 12px;
  color: var(--ink-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Needs Review queue -------------------------------------------- */
.fin-review {
  margin: 20px 0 24px;
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: var(--r-card);
  background: rgba(251,146,60,0.04);
  overflow: hidden;
}
.fin-review__head {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s4);
  border-bottom: 1px solid rgba(251,146,60,0.15);
}
.fin-review__title { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; }
.fin-review__count {
  font-size: 11px; font-weight: 700;
  color: #fb923c; background: rgba(251,146,60,0.15);
  border: 1px solid rgba(251,146,60,0.3);
  border-radius: var(--r-pill); padding: 2px 8px;
}
.fin-review__hint {
  font-size: 12px; color: var(--ink-subtle); margin: 0;
  padding: var(--s2) var(--s4);
  border-bottom: 1px solid rgba(251,146,60,0.12);
  line-height: 1.4;
}
.fin-review .fin-txns { padding: var(--s2); max-height: 360px; overflow-y: auto; }
.fin-review .fin-txn { border-radius: var(--r-input); }
.fin-review .fin-txn:hover {
  background: rgba(251,146,60,0.06);
  border-color: rgba(251,146,60,0.2);
}
.fin-txn__cat--unset {
  border-color: rgba(251,146,60,0.5) !important;
  color: #fb923c !important;
}

/* ---- Admin checklists ---------------------------------------------- */
.chk-list { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }

.chk-item {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  overflow: hidden;
}
.chk-item[open] { border-color: var(--hairline-strong); }

.chk-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  cursor: pointer;
  list-style: none;
  min-height: var(--tap);
}
.chk-item__head::-webkit-details-marker { display: none; }
.chk-item__head::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid var(--ink-tertiary);
  border-bottom: 2px solid var(--ink-tertiary);
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-right: 4px;
  transition: transform .15s;
}
.chk-item[open] .chk-item__head::after { transform: rotate(-135deg); margin-top: 4px; }

.chk-item__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chk-item__name { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.chk-item__meta { font-size: 12px; color: var(--ink-tertiary); margin-top: 2px; }
.chk-item__when { font-size: 11px; color: var(--ink-subtle); white-space: nowrap; flex-shrink: 0; }

.chk-item__body { padding: 0 var(--s4) var(--s4); border-top: 1px solid var(--hairline); }
.chk-item__signoff { margin: var(--s3) 0 var(--s4); font-size: 13px; color: var(--ink-muted); }

.chk-media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s3);
}
@media (min-width: 480px) {
  .chk-media-grid { grid-template-columns: repeat(3, 1fr); }
}

.chk-media {
  appearance: none;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  border-radius: var(--r-input);
  padding: var(--s2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  text-align: left;
  color: inherit;
  font: inherit;
  transition: border-color .15s, background .15s;
}
.chk-media:hover { border-color: var(--accent); background: var(--surface-3); }
.chk-media:focus-visible { outline: 2px solid var(--accent-focus); outline-offset: 2px; }

.chk-media__thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-chip);
  overflow: hidden;
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chk-media__thumb img,
.chk-media__thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chk-media__video-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--ink-muted);
}
.chk-media__video-thumb svg {
  width: 32px;
  height: 32px;
  opacity: 0.85;
}
.chk-media__label { font-size: 11px; font-weight: 500; color: var(--ink-subtle); line-height: 1.3; }

/* =====================================================================
   EMPLOYEE PORTAL — login, signup, onboarding, training, hub extras
   ===================================================================== */

/* ---------------------------------------------------------- Tech login */
.login {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s6);
  padding: var(--s6) 0;
}

.login__brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}

.login__logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(94, 106, 210, 0.25));
}

.login__title {
  font-size: 28px;
  letter-spacing: -0.8px;
  margin-top: var(--s2);
}

.login__subtitle {
  margin: 0;
  color: var(--ink-subtle);
  font-size: 15px;
}

.login__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
}

.login__hint {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: 13px;
  text-align: center;
}

/* Floating back-to-chooser button on the login / admin gate screens */
.login__back {
  position: absolute;
  top: calc(var(--s4) + env(safe-area-inset-top, 0px));
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  color: var(--ink-subtle);
  font-size: 14px;
  font-weight: 500;
  padding: var(--s2) var(--s4) var(--s2) var(--s3);
  cursor: pointer;
  min-height: var(--tap);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.login__back svg { width: 18px; height: 18px; }
.login__back:hover { border-color: var(--hairline-strong); color: var(--ink); }

/* Icon badge used where there's no logo (admin gate) */
.login__badge {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  color: var(--accent-hover);
}
.login__badge svg { width: 28px; height: 28px; }

/* ------------------------------------------------------------ PIN pad */
.pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
}

.pin__dots {
  display: flex;
  gap: var(--s4);
  padding: var(--s2) 0;
}

.pin__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--hairline-strong);
  background: transparent;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.pin__dot.is-filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.pin__error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  max-width: 320px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  width: min(300px, 84vw);
}

.keypad__btn {
  height: 64px;
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  color: var(--ink);
  font-size: 24px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.06s ease;
  -webkit-tap-highlight-color: transparent;
}

.keypad__btn:active {
  background: var(--surface-3);
  transform: scale(0.96);
}

.keypad__btn--del { color: var(--ink-subtle); }
.keypad__btn--del svg { width: 26px; height: 26px; }

.keypad__gap { pointer-events: none; }

@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.is-shake { animation: pinShake 0.4s ease; }

/* ------------------------------------------------------------- Signup */
.signup {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s6) 0;
}

.signup__card {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.signup__card--center {
  align-items: center;
  text-align: center;
}

.signup__title {
  font-size: 26px;
  letter-spacing: -0.7px;
  line-height: 1.25;
}

.signup__text {
  margin: 0;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1.55;
}

.signup__label { font-size: 15px; }

.signup__card .pin { margin-top: var(--s2); }

.input--big {
  font-size: 18px;
  min-height: 56px;
}

.btn--big {
  min-height: 56px;
  font-size: 17px;
}

.success__icon--party {
  font-size: 52px;
  background: none;
  border: none;
}

/* --------------------------------------------------- Journey (steps) */
.journey {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding-bottom: var(--s6);
}

.journey__head { display: flex; flex-direction: column; gap: var(--s2); }

.journey__title {
  font-size: 24px;
  letter-spacing: -0.6px;
}

.journey__text {
  margin: 0;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Papers progress bar */
.docbar {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.docbar__track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}

.docbar__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.docbar__label {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-subtle);
  white-space: nowrap;
}

.journey__hint {
  margin: 0;
  color: var(--ink-tertiary);
  font-size: 13px;
  text-align: center;
}

/* ------------------------------------------- Doc / module list items */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.doc-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: var(--s4);
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.doc-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.doc-item.is-next {
  border-color: var(--accent);
  background: rgba(94, 106, 210, 0.08);
}

.doc-item.is-signed .doc-item__check {
  background: rgba(39, 166, 68, 0.15);
  border-color: transparent;
  color: var(--success);
}

.doc-item__check {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-item__check svg { width: 18px; height: 18px; }

.doc-item__idx {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-subtle);
}

.mod-item__icon {
  font-size: 18px;
  border: none;
  background: var(--surface-3);
}

.doc-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.doc-item__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.doc-item__sub {
  font-size: 13px;
  color: var(--ink-subtle);
  line-height: 1.4;
}

.doc-item.is-signed .doc-item__sub { color: var(--success); }

.doc-item__cta {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  white-space: nowrap;
}

/* --------------------------------------------------------- Doc reader
   Each paper renders as an actual light "sheet" inside the dark app, with
   a letterhead and a live signature line at the bottom. */
.doc-read {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s4) 0 var(--s7);
}

.doc-read__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-read__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.doc-read__signedtag {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: rgba(39, 166, 68, 0.12);
  border-radius: var(--r-pill);
  padding: 4px 10px;
}

.paper {
  background: #faf8f2;
  color: #26262e;
  border-radius: var(--r-card);
  padding: var(--s5) var(--s5) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.5);
}

.paper__letterhead {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding-bottom: var(--s3);
  border-bottom: 1px solid #e5e1d3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #8b8a80;
}
.paper__letterhead img { display: block; }

.paper__title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.4px;
  color: #17171c;
  line-height: 1.3;
}

.paper__body { display: flex; flex-direction: column; gap: var(--s3); }
.paper__body p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #3c3c45;
}

.paper__sig { margin-top: var(--s2); }

.paper__sigline {
  min-height: 48px;
  display: flex;
  align-items: flex-end;
  padding: 0 var(--s2) 4px;
  border-bottom: 1.5px solid #26262e;
}

.paper__signame {
  font-family: "Snell Roundhand", "Segoe Script", "Bradley Hand", cursive;
  font-size: 28px;
  line-height: 1.1;
  color: #1c1c66;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper__sigmeta {
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #9a988c;
}

.doc-sign {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* ------------------------------------------------------------ Lessons */
.lesson {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding-bottom: var(--s6);
}

.lesson__meter {
  display: flex;
  gap: 4px;
}

.lesson__tick {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  transition: background 0.2s ease;
}

.lesson__tick.is-on { background: var(--accent); }

.lesson__card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-height: 300px;
  animation: viewIn 0.24s ease both;
}

.lesson__icon { font-size: 36px; line-height: 1; }

.lesson__title {
  font-size: 21px;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

.lesson__line {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.lesson__callout {
  border-radius: var(--r-input);
  border: 1px solid rgba(229, 72, 77, 0.35);
  background: rgba(229, 72, 77, 0.1);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  padding: var(--s3) var(--s4);
}

.lesson__nav {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--s3);
}

.lesson__nav .btn { min-height: 56px; font-size: 16px; }

.lesson__count {
  margin: 0;
  text-align: center;
  color: var(--ink-tertiary);
  font-size: 13px;
}

/* --------------------------------------------------------------- Quiz */
.quiz {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding-bottom: var(--s6);
}

.quiz__count {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.quiz__q {
  font-size: 21px;
  letter-spacing: -0.5px;
  line-height: 1.35;
}

.quiz__options {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.quiz__opt {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  padding: var(--s4);
  border-radius: var(--r-card);
  border: 1px solid var(--hairline);
  background: var(--surface-1);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.quiz__opt:not(:disabled):active { border-color: var(--accent); }

.quiz__letter {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-subtle);
}

.quiz__opt.is-correct {
  border-color: var(--success);
  background: rgba(39, 166, 68, 0.12);
}
.quiz__opt.is-correct .quiz__letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.quiz__opt.is-wrong {
  border-color: var(--danger);
  background: rgba(229, 72, 77, 0.1);
}
.quiz__opt.is-wrong .quiz__letter {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.quiz__opt.is-dim { opacity: 0.45; }

.quiz__feedback {
  border-radius: var(--r-input);
  padding: var(--s3) var(--s4);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.quiz__feedback.is-good {
  border: 1px solid rgba(39, 166, 68, 0.4);
  background: rgba(39, 166, 68, 0.1);
}

.quiz__feedback.is-bad {
  border: 1px solid rgba(229, 72, 77, 0.35);
  background: rgba(229, 72, 77, 0.08);
}

.quiz__bigscore {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--ink);
}

.quiz__bigscore--pass { color: var(--success); }

/* -------------------------------------------------------- Hub extras */
.topbar__logout {
  background: none;
  border: none;
  color: var(--ink-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: var(--tap);
  padding: var(--s2);
}
.topbar__logout:hover { color: var(--ink); text-decoration: underline; }

.hub-help {
  margin: var(--s6) 0 0;
  text-align: center;
  color: var(--ink-tertiary);
  font-size: 13px;
}

.hub-help__link {
  color: var(--ink-subtle);
  font-weight: 600;
}

.acc__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-subtle);
  margin-right: var(--s1);
}

.acc__emoji { font-size: 15px; }

.howto {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-bottom: var(--s4);
}

.howto__step {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: 14px;
  color: var(--ink-muted);
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  padding: var(--s3);
}

.howto__num {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.paylink--accent { border-color: rgba(94, 106, 210, 0.55); }

.paylink__note {
  font-size: 13px;
  color: var(--ink-subtle);
  line-height: 1.5;
}

.pay-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s5);
}

.pay-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  padding: var(--s4);
}

.pay-card__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.pay-card__icon { font-size: 22px; line-height: 1; }

.pay-card__title {
  font-size: 16px;
  letter-spacing: -0.3px;
}

.pay-card__lines {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pay-card__lines li {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* --------------------------------------------------------- Admin Team */
.team-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.team-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
  overflow: hidden;
}

.team-card.is-open { border-color: var(--hairline-strong); }

.team-card__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  padding: var(--s4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.team-card__avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: rgba(94, 106, 210, 0.18);
  color: var(--accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.team-card__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.team-card__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-card__meta {
  font-size: 13px;
  color: var(--ink-subtle);
}

.team-chip {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 4px 10px;
  white-space: nowrap;
}

.team-chip--active {
  color: var(--success);
  background: rgba(39, 166, 68, 0.12);
}

.team-chip--invited {
  color: var(--accent-hover);
  background: rgba(94, 106, 210, 0.14);
}

.team-chip--inactive {
  color: var(--ink-subtle);
  background: var(--surface-3);
}

.team-card__detail {
  border-top: 1px solid var(--hairline);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.team-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s2);
}

.team-stat {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.team-stat__num {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.team-stat__num--sm { font-size: 12px; font-weight: 600; }

.team-stat__label {
  font-size: 11px;
  color: var(--ink-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.team-inviterow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  padding: var(--s2) var(--s3);
  font-size: 14px;
  color: var(--ink-muted);
}

.team-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.team-danger { color: var(--danger); }

.team-activity {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.team-activity__title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-tertiary);
}

.team-event {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  font-size: 13px;
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--hairline);
}

.team-event:last-child { border-bottom: none; }

.team-event__type { color: var(--ink-muted); min-width: 0; }
.team-event__when { color: var(--ink-tertiary); flex: none; }

.team-invite,
.team-add {
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: var(--r-card);
  padding: var(--s4);
  margin-bottom: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.team-invite__title {
  font-size: 15px;
  font-weight: 600;
}

.team-invite__text {
  margin: 0;
  font-size: 13px;
  color: var(--ink-subtle);
  line-height: 1.5;
}

.team-invite__linkrow {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.team-invite__link {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-input);
  padding: var(--s3);
  word-break: break-all;
}
