/* ==========================================================================
   Components. Every pressable thing answers the finger within 140 ms.
   Only transform and opacity move; colours fade.
   ========================================================================== */

/* ---- Buttons ----------------------------------------------------------------- */

.btn {
  --btn-bg: var(--fill-strong);
  --btn-fg: var(--text);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 var(--fs-callout)/1.1 var(--font);
  letter-spacing: -0.012em;
  white-space: nowrap;
  touch-action: manipulation;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    opacity var(--dur-fast) ease;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); }
.btn-primary:active { --btn-bg: var(--accent-press); }
.btn-tinted { --btn-bg: var(--accent-tint); --btn-fg: var(--accent-text); }
.btn-plain { --btn-bg: transparent; --btn-fg: var(--accent-text); padding: 0 10px; }
.btn-plain:active { opacity: 0.5; transform: none; }
.btn-danger { --btn-bg: var(--danger-tint); --btn-fg: var(--danger); }
.btn-quiet { --btn-bg: var(--fill); --btn-fg: var(--text); }

.btn-lg {
  min-height: 54px;
  border-radius: var(--r-lg);
  font-size: var(--fs-headline);
}

.btn-sm {
  min-height: 34px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  font-size: var(--fs-subhead);
}

.btn-sm svg {
  width: 17px;
  height: 17px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.38;
  pointer-events: none;
}

/* Icon-only button: always a 44 px target. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  color: var(--accent-text);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.icon-btn:active {
  transform: scale(0.9);
  background: var(--fill);
}

.icon-btn.filled {
  width: 36px;
  height: 36px;
  background: var(--accent-tint);
}

.icon-btn.filled svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

/* ---- Chips --------------------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips.scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--text);
  font: 500 var(--fs-subhead)/1 var(--font);
  letter-spacing: -0.006em;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.chip:active {
  transform: scale(0.96);
}

.chip[aria-pressed="true"],
.chip[aria-checked="true"] {
  background: var(--text);
  color: var(--bg);
}

.chip.accent[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.chip .count {
  color: inherit;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.chip.suggested:not([aria-pressed="true"]) {
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent-text);
}

/* A chip with a second line (date chips show the day and its load). */
.chip.two-line {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: var(--r-md);
}

.chip.two-line small {
  font: 500 var(--fs-caption)/1 var(--font);
  opacity: 0.62;
  font-variant-numeric: tabular-nums;
}

.chip.two-line.full small {
  color: var(--caution);
  opacity: 1;
}

.chip.two-line[aria-pressed="true"].full small {
  color: inherit;
}

/* ---- Segmented control (sliding thumb) ---------------------------------------- */

.seg {
  --n: 2;
  --i: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  padding: 2px;
  border-radius: 11px;
  background: var(--fill-strong);
}

.seg-thumb {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc((100% - 4px) / var(--n));
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: 0 0 0 0.5px var(--hairline), 0 1px 2px rgba(0, 0, 0, 0.06);
  transform: translate3d(calc(var(--i) * 100%), 0, 0);
  transition: transform var(--dur-base) var(--ease-out);
}

.seg button {
  position: relative;
  z-index: 1;
  min-height: 34px;
  padding: 0 6px;
  border-radius: 9px;
  font: 500 var(--fs-subhead)/1 var(--font);
  color: var(--text-2);
  transition: color var(--dur-fast) ease;
}

.seg button[aria-checked="true"] {
  color: var(--text);
  font-weight: 600;
}

/* ---- Inputs ------------------------------------------------------------------- */

.field {
  display: grid;
  gap: 6px;
}

.field + .field {
  margin-top: var(--s-4);
}

.label {
  font: 600 var(--fs-footnote)/var(--lh-footnote) var(--font);
  color: var(--text-2);
  padding-left: 2px;
}

.hint {
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font);
  color: var(--text-3);
  padding-left: 2px;
}

.hint.caution {
  color: var(--caution);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--fill);
  color: var(--text);
  font: 400 var(--fs-body)/var(--lh-body) var(--font); /* 17px: iOS never zooms */
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-4);
}

.input:focus,
.textarea:focus,
.select:focus {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.textarea {
  min-height: 112px;
  resize: none;
  field-sizing: content;
}

.textarea.short {
  min-height: 48px;
}

.input[type="date"],
.input[type="time"] {
  min-height: 48px;
}

.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 19px;
  height: 19px;
  margin-top: -9.5px;
  color: var(--text-3);
  pointer-events: none;
}

.search .input {
  min-height: 40px;
  padding: 8px 36px 8px 38px;
  border-radius: 12px;
  background: var(--fill-strong);
}

.search .clear {
  position: absolute;
  right: 4px;
  top: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  display: grid;
  place-items: center;
  color: var(--text-3);
}

.search .clear svg {
  position: static;
  margin: 0;
  width: 18px;
  height: 18px;
}

/* ---- Grouped lists (inset, iOS Settings style) ------------------------------- */

.group {
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.group + .group {
  margin-top: var(--s-4);
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 16px;
  width: 100%;
  text-align: left;
  color: var(--text);
  transition: background-color 120ms ease;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: var(--inset, 16px);
  height: 0.5px;
  background: var(--separator);
}

button.row:active,
a.row:active,
.row.tappable:active {
  background: var(--fill-press);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.row-title {
  font: 500 var(--fs-body)/var(--lh-headline) var(--font);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title small {
  font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}

.row-sub {
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-trail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex: none;
  color: var(--text-3);
  font: 400 var(--fs-subhead)/1 var(--font);
  font-variant-numeric: tabular-nums;
}

.row-trail.inline {
  flex-direction: row;
  align-items: center;
}

.row-trail .late {
  color: var(--hot);
  font-weight: 600;
}

.row-trail .today {
  color: var(--accent-text);
  font-weight: 600;
}

.row .chev {
  width: 18px;
  height: 18px;
  color: var(--text-4);
  stroke-width: 2.2;
  flex: none;
}

.row-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-tint);
  color: var(--accent-text);
  flex: none;
}

.row-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* ---- Cards -------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-4);
}

.card + .card {
  margin-top: var(--s-3);
}

.card.pressable {
  display: block;
  width: 100%;
  text-align: left;
  transition: transform var(--dur-press) var(--ease-out);
}

.card.pressable:active {
  transform: scale(0.985);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font);
  letter-spacing: -0.01em;
}

.card-sub {
  margin-top: 2px;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
  color: var(--text-2);
}

.card.tint-accent { background: var(--accent-tint); }
.card.tint-caution { background: var(--caution-tint); }
.card.tint-hot { background: var(--hot-tint); }

/* ---- Level pill ---------------------------------------------------------------- */

.pill {
  --pill-tint: var(--lead-tint);
  --pill-fg: var(--lead);
  --pill-dot: var(--lead-dot);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 8px;
  border-radius: var(--r-pill);
  background: var(--pill-tint);
  color: var(--pill-fg);
  font: 600 13px/1 var(--font);
  letter-spacing: -0.004em;
  white-space: nowrap;
  flex: none;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pill-dot);
}

.pill.lg {
  height: 30px;
  padding: 0 12px 0 10px;
  font-size: 15px;
}

.pill.lg::before {
  width: 8px;
  height: 8px;
}

.pill.pop {
  animation: pill-pop 420ms var(--ease-out);
}

@keyframes pill-pop {
  from { transform: scale(0.92); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

[data-level="hot"] { --pill-tint: var(--hot-tint); --pill-fg: var(--hot); --pill-dot: var(--hot-dot); --lvl-tint: var(--hot-tint); --lvl-fg: var(--hot); }
[data-level="warm"] { --pill-tint: var(--warm-tint); --pill-fg: var(--warm); --pill-dot: var(--warm-dot); --lvl-tint: var(--warm-tint); --lvl-fg: var(--warm); }
[data-level="new"] { --pill-tint: var(--new-tint); --pill-fg: var(--new); --pill-dot: var(--new-dot); --lvl-tint: var(--new-tint); --lvl-fg: var(--new); }
[data-level="cold"] { --pill-tint: var(--cold-tint); --pill-fg: var(--cold); --pill-dot: var(--cold-dot); --lvl-tint: var(--cold-tint); --lvl-fg: var(--cold); }
[data-level="lead"] { --pill-tint: var(--lead-tint); --pill-fg: var(--lead); --pill-dot: var(--lead-dot); --lvl-tint: var(--lead-tint); --lvl-fg: var(--lead); }
[data-level="closed"] { --pill-tint: var(--closed-tint); --pill-fg: var(--closed); --pill-dot: var(--closed-dot); --lvl-tint: var(--closed-tint); --lvl-fg: var(--closed); }

/* ---- Avatar (initials, tinted by level) --------------------------------------- */

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--lvl-tint, var(--lead-tint));
  color: var(--lvl-fg, var(--lead));
  font: 600 15px/1 var(--font);
  letter-spacing: 0.01em;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 23px;
}

/* ---- Tick (the five proofs) ---------------------------------------------------- */

.tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1.7px var(--separator-strong);
  background: transparent;
  transition:
    background-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    transform var(--dur-press) var(--ease-out);
}

.tick svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 260ms var(--ease-out) 40ms;
}

.tick[aria-checked="true"] {
  background: var(--accent);
  box-shadow: inset 0 0 0 1.7px var(--accent);
}

.tick[aria-checked="true"] svg {
  stroke-dashoffset: 0;
}

.tick:active {
  transform: scale(0.9);
}

/* Read-only tick used in summaries. */
.tick.sm {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.tick.sm svg {
  width: 14px;
  height: 14px;
}

/* ---- Switch -------------------------------------------------------------------- */

.switch {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  border-radius: var(--r-pill);
  background: var(--fill-strong);
  transition: background-color var(--dur-base) ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 5px rgba(0, 0, 0, 0.14);
  transition: transform var(--dur-base) var(--ease-out);
}

.switch[aria-checked="true"] {
  background: var(--accent);
}

.switch[aria-checked="true"]::after {
  transform: translate3d(20px, 0, 0);
}

/* ---- Stepper ------------------------------------------------------------------- */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-sm);
  background: var(--fill-strong);
  flex: none;
}

.stepper button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 32px;
  border-radius: 8px;
  color: var(--text);
  transition: background-color 120ms ease, transform var(--dur-press) var(--ease-out);
}

.stepper button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.stepper button:active {
  background: var(--surface-raised);
  transform: scale(0.94);
}

.stepper output {
  min-width: 40px;
  text-align: center;
  font: 600 var(--fs-callout)/1 var(--font);
  font-variant-numeric: tabular-nums;
}

/* ---- Choice tiles (What happened?) ------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 84px;
  padding: 13px 14px 12px;
  border-radius: var(--r-lg);
  background: var(--fill);
  color: var(--text);
  text-align: left;
  font: 600 var(--fs-subhead)/1.25 var(--font);
  letter-spacing: -0.008em;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

.tile svg {
  width: 23px;
  height: 23px;
  color: var(--text-2);
  transition: color var(--dur-fast) ease;
}

.tile:active {
  transform: scale(0.97);
}

.tile[aria-checked="true"] {
  background: var(--accent-tint);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1.7px var(--accent);
}

.tile[aria-checked="true"] svg {
  color: var(--accent-text);
}

.tile.danger[aria-checked="true"] {
  background: var(--danger-tint);
  color: var(--danger);
  box-shadow: inset 0 0 0 1.7px var(--danger);
}

.tile.danger[aria-checked="true"] svg {
  color: var(--danger);
}

/* ---- Reveal (smooth height for show/hide without measuring) ------------------ */

.reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--dur-base) var(--ease-out), opacity var(--dur-fast) ease;
}

.reveal > * {
  overflow: hidden;
  min-height: 0;
}

.reveal.open {
  grid-template-rows: 1fr;
  opacity: 1;
}

/* ---- Bottom sheet ---------------------------------------------------------- */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100% - var(--safe-t) - 10px);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--surface-sheet);
  transform: translate3d(0, 105%, 0);
  will-change: transform;
  overflow: hidden;
}

.sheet.tall {
  height: calc(100% - var(--safe-t) - 10px);
}

.sheet-grab {
  flex: none;
  display: grid;
  place-items: center;
  height: 20px;
  touch-action: none;
}

.sheet-grab::before {
  content: "";
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--fill-strong);
}

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px 8px 20px;
  touch-action: none;
}

.sheet-title {
  flex: 1;
  min-width: 0;
}

.sheet-title h2 {
  font: 700 var(--fs-title3)/var(--lh-title3) var(--font-display);
  letter-spacing: var(--tracking-snug);
}

.sheet-title p {
  margin-top: 1px;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--fill-strong);
  color: var(--text-2);
  transition: transform var(--dur-press) var(--ease-out);
}

.sheet-close svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

.sheet-close:active {
  transform: scale(0.9);
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 20px 24px;
}

.sheet-foot {
  flex: none;
  display: grid;
  gap: 8px;
  padding: 12px 20px calc(12px + var(--safe-b));
  border-top: 0.5px solid var(--hairline);
  background: var(--surface-sheet);
}

.sheet-layer.kb-open .sheet-foot {
  padding-bottom: 12px;
}

.sheet-section + .sheet-section {
  margin-top: var(--s-6);
}

.sheet-section > .label,
.sheet-section > .t-eyebrow {
  display: block;
  margin-bottom: 10px;
}

/* Action sheet (a short menu of choices) */
.menu {
  display: grid;
  gap: 2px;
}

.menu .row {
  border-radius: var(--r-md);
  min-height: 56px;
}

.menu .row + .row::before {
  display: none;
}

@media (min-width: 760px) {
  .sheet {
    left: 50%;
    right: auto;
    width: 600px;
    margin-left: -300px;
    bottom: 16px;
    border-radius: var(--r-xl);
    max-height: calc(100% - 48px);
  }
  .sheet.tall {
    height: calc(100% - 48px);
  }
  .sheet-foot {
    padding-bottom: 14px;
  }
}

/* ---- Toast ------------------------------------------------------------------- */

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  min-height: 48px;
  padding: 11px 10px 11px 16px;
  border-radius: var(--r-lg);
  background: var(--toast-bg);
  color: var(--toast-fg);
  font: 500 var(--fs-subhead)/var(--lh-subhead) var(--font);
  transform: translate3d(0, 18px, 0) scale(0.98);
  opacity: 0;
  transition: transform 320ms var(--ease-out), opacity 220ms ease;
}

.toast.show {
  transform: none;
  opacity: 1;
}

.toast.hide {
  transform: translate3d(0, 10px, 0);
  opacity: 0;
  transition-duration: 200ms;
}

.toast button {
  flex: none;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font: 600 var(--fs-subhead)/1 var(--font);
  color: inherit;
  opacity: 0.85;
}

.toast .msg {
  padding-right: 6px;
}

/* ---- Empty state --------------------------------------------------------------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 36px 24px;
  text-align: center;
}

.empty svg {
  width: 34px;
  height: 34px;
  color: var(--text-4);
  stroke-width: 1.5;
  margin-bottom: 4px;
}

.empty h3 {
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font);
}

.empty p {
  max-width: 300px;
  color: var(--text-2);
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.empty .btn {
  margin-top: 10px;
}

/* ---- Progress ring (new calls today) ----------------------------------------- */

.ring {
  position: relative;
  width: 64px;
  height: 64px;
  flex: none;
}

.ring svg {
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 6;
}

.ring .track {
  stroke: var(--fill-strong);
}

.ring .bar {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 700ms var(--ease-out);
}

.ring output {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 17px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---- Week strip and time slots (booking) --------------------------------------- */

.week {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -20px;
  padding: 2px 20px 4px;
  scrollbar-width: none;
}

.week::-webkit-scrollbar {
  display: none;
}

.day {
  display: grid;
  justify-items: center;
  gap: 4px;
  flex: none;
  width: 54px;
  padding: 9px 0 8px;
  border-radius: var(--r-md);
  background: var(--fill);
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.day .dow {
  font: 500 var(--fs-caption)/1 var(--font);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day .dom {
  font: 600 19px/1 var(--font);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.day .load {
  display: flex;
  gap: 3px;
  height: 5px;
}

.day .load i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-4);
}

.day:active {
  transform: scale(0.95);
}

.day[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.day[aria-pressed="true"] .dow {
  color: inherit;
  opacity: 0.7;
}

.day[aria-pressed="true"] .load i {
  background: var(--bg);
}

.day.full:not([aria-pressed="true"]) {
  opacity: 0.4;
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.slot {
  min-height: 44px;
  border-radius: var(--r-sm);
  background: var(--fill);
  font: 600 var(--fs-subhead)/1 var(--font);
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.slot:active {
  transform: scale(0.95);
}

.slot[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---- Notices --------------------------------------------------------------------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--fill);
  color: var(--text-2);
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.notice svg {
  width: 19px;
  height: 19px;
  flex: none;
  margin-top: 0.5px;
}

.notice.caution {
  background: var(--caution-tint);
  color: var(--caution);
}

.notice.accent {
  background: var(--accent-tint);
  color: var(--accent-text);
}

.notice b {
  font-weight: 600;
}

.notice .btn {
  margin-top: 8px;
}

/* ---- Linear progress --------------------------------------------------------- */

.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--fill-strong);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform 500ms var(--ease-out);
}

/* ---- Action buttons row (Call, WhatsApp, Log, Book) -------------------------- */

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.action {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--accent-text);
  font: 500 var(--fs-caption)/1 var(--font);
  letter-spacing: 0.005em;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease;
}

.action svg {
  width: 23px;
  height: 23px;
  stroke-width: 1.9;
}

.action:active {
  transform: scale(0.95);
}

.action.primary {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---- History timeline ------------------------------------------------------- */

.timeline {
  display: grid;
}

.event {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  padding-bottom: 18px;
}

.event::before {
  content: "";
  position: absolute;
  left: 6.5px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: var(--separator);
}

.event:last-child::before {
  display: none;
}

.event-dot {
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--separator-strong);
}

.event-dot.ok {
  box-shadow: inset 0 0 0 4px var(--accent);
}

.event-dot.miss {
  box-shadow: inset 0 0 0 2px var(--text-4);
}

.event-dot.stop {
  box-shadow: inset 0 0 0 4px var(--danger);
}

.event-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font: 600 var(--fs-subhead)/var(--lh-subhead) var(--font);
}

.event-head span {
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.event-note {
  margin-top: 4px;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font);
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- Key–value rows (client info) -------------------------------------------- */

.kv {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.kv dt {
  color: var(--text-2);
}

.kv dd {
  margin: 0;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Small badges ------------------------------------------------------------ */

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--fill-strong);
  color: var(--text-2);
  font: 600 var(--fs-caption)/1 var(--font);
  font-variant-numeric: tabular-nums;
}

.badge.hot {
  background: var(--hot-dot);
  color: #fff;
}

.badge.accent {
  background: var(--accent);
  color: var(--on-accent);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--fill);
  color: var(--text-2);
  font: 500 var(--fs-footnote)/1 var(--font);
}

.tag svg {
  width: 14px;
  height: 14px;
}

.tag.caution {
  background: var(--caution-tint);
  color: var(--caution);
}

/* ---- Reduced motion ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .chip:active,
  .tile:active,
  .card.pressable:active,
  .action:active,
  .day:active,
  .slot:active {
    transform: none;
  }
  .seg-thumb,
  .switch::after,
  .toast {
    transition-duration: 1ms;
  }
  .pill.pop {
    animation: none;
  }
}
