/* ==========================================================================
   Journey Tracker Style Guide — Components
   Buttons, pills, inputs, cards, avatars, progress, toggles, etc.
   ========================================================================== */

/* ---------------------------------------------------------------
   BUTTONS
   --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--fg-on-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
  line-height: 1;
}
.btn [data-lucide] { width: 15px; height: 15px; stroke-width: 2.2; }
.btn:hover { background: var(--accent-hover); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring-focus); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled] {
  background: var(--bg-offset);
  color: var(--fg-3);
  cursor: not-allowed;
  box-shadow: none;
}

.btn--secondary {
  background: var(--bg-surface);
  color: var(--fg-1);
  border-color: var(--border-2);
}
.btn--secondary:hover { background: var(--bg-subtle); border-color: var(--border-3); }
.btn--secondary[disabled] { background: var(--bg-offset); color: var(--fg-3); border-color: var(--border-1); }

.btn--ghost {
  background: transparent;
  color: var(--fg-2);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--bg-subtle); color: var(--fg-1); }

.btn--danger {
  background: var(--st-overdue);
  color: #fff;
}
.btn--danger:hover { filter: brightness(0.94); }

.btn--sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn--lg { height: 44px; padding: 0 22px; font-size: 14px; }

/* Round icon button */
.btn-round {
  width: 36px; height: 36px;
  border-radius: 9999px;
  border: 0;
  background: var(--accent);
  color: var(--fg-on-accent);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-round:hover { background: var(--accent-hover); }
.btn-round:active { transform: scale(0.96); }
.btn-round [data-lucide] { width: 16px; height: 16px; stroke-width: 2.4; }
.btn-round--success { background: var(--st-success); }
.btn-round--success:hover { filter: brightness(0.95); }
.btn-round--danger { background: var(--st-overdue); }
.btn-round--danger:hover { filter: brightness(0.95); }
.btn-round--ghost {
  background: var(--bg-offset); color: var(--fg-2); box-shadow: none;
}
.btn-round--ghost:hover { background: var(--accent-soft); color: var(--accent); }

/* Square icon (compact, table-row size) */
.btn-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-1);
  background: var(--bg-surface);
  color: var(--fg-2);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
}
.btn-icon:hover { background: var(--bg-subtle); color: var(--fg-1); border-color: var(--border-2); }
.btn-icon [data-lucide] { width: 14px; height: 14px; }

/* ---------------------------------------------------------------
   PILLS / BADGES
   --------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1;
  white-space: nowrap;
}
.pill [data-lucide] { width: 12px; height: 12px; stroke-width: 2.4; }
.pill--lg { height: 28px; padding: 0 12px; font-size: 13px; }

/* Soft (default) — subtle tint with ring */
.pill--info    { background: var(--st-info-soft);    color: var(--st-info);    box-shadow: inset 0 0 0 1px var(--st-info-ring); }
.pill--success { background: var(--st-success-soft); color: var(--st-success); box-shadow: inset 0 0 0 1px var(--st-success-ring); }
.pill--review  { background: var(--st-review-soft);  color: var(--st-review);  box-shadow: inset 0 0 0 1px var(--st-review-ring); }
.pill--late    { background: var(--st-late-soft);    color: var(--st-late);    box-shadow: inset 0 0 0 1px var(--st-late-ring); }
.pill--overdue { background: var(--st-overdue-soft); color: var(--st-overdue); box-shadow: inset 0 0 0 1px var(--st-overdue-ring); }
.pill--draft   { background: var(--st-draft-soft);   color: var(--st-draft);   box-shadow: inset 0 0 0 1px var(--st-draft-ring); }
.pill--archive { background: var(--st-archive-soft); color: var(--st-archive); box-shadow: inset 0 0 0 1px var(--st-archive-ring); }
.pill--neutral { background: var(--bg-offset);       color: var(--fg-2);       box-shadow: inset 0 0 0 1px var(--border-1); }

/* Solid variant */
.pill--solid.pill--info    { background: var(--st-info);    color: #fff; box-shadow: none; }
.pill--solid.pill--success { background: var(--st-success); color: #fff; box-shadow: none; }
.pill--solid.pill--review  { background: var(--st-review);  color: #fff; box-shadow: none; }
.pill--solid.pill--late    { background: var(--st-late);    color: #fff; box-shadow: none; }
.pill--solid.pill--overdue { background: var(--st-overdue); color: #fff; box-shadow: none; }
.pill--solid.pill--draft   { background: var(--st-draft);   color: #fff; box-shadow: none; }

/* Pip — colored leading dot inside neutral pill */
.pill .pip {
  width: 7px; height: 7px;
  border-radius: 9999px;
  background: currentColor;
  flex-shrink: 0;
}

/* Count badge (small numeric chip) */
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: var(--bg-offset);
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.badge-count--accent { background: var(--accent-soft); color: var(--accent); }
.badge-count--alert  { background: var(--st-overdue);  color: #fff; }

/* ---------------------------------------------------------------
   INPUTS
   --------------------------------------------------------------- */
.input,
.select,
.textarea,
input.input,
select.select,
textarea.textarea {
  width: 100%;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg-1);
  background: var(--bg-surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  height: auto;
  min-height: 38px;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.input:hover, .select:hover, .textarea:hover,
input.input:hover, select.select:hover, textarea.textarea:hover { border-color: var(--border-3); }
.input:focus, .select:focus, .textarea:focus,
input.input:focus, select.select:focus, textarea.textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.input[disabled], .textarea[disabled],
input.input[disabled], textarea.textarea[disabled] {
  background: var(--bg-offset);
  color: var(--fg-3);
  cursor: not-allowed;
}
.textarea, textarea.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.select,
select.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Field — label + input + helper text */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--fg-2);
  letter-spacing: 0.1px;
}
.field .helper { font-size: 12px; color: var(--fg-3); }
.field .helper.error { color: var(--st-overdue); }
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
  border-color: var(--st-overdue);
}
.field.has-error .input:focus,
.field.has-error .textarea:focus {
  box-shadow: 0 0 0 3px var(--st-overdue-ring);
}

/* Search — pill input with leading icon */
.search-input {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  min-width: 280px;
  color: var(--fg-3);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input:focus-within { border-color: var(--accent); box-shadow: var(--ring-focus); }
.search-input [data-lucide] { width: 15px; height: 15px; flex-shrink: 0; }
.search-input input {
  border: 0; outline: 0; background: transparent;
  font: inherit; flex: 1;
  color: var(--fg-1);
}
.search-input input::placeholder { color: var(--fg-3); }
.search-input .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-offset);
  color: var(--fg-3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-1);
}

/* Checkbox & radio.
   Selector is `input.check` / `input.radio` (not bare `.check` /
   `.radio`) so the rules tie on specificity with classic Rails
   `form input` selectors that ship via `app/assets/stylesheets/forms.scss`.
   With equal specificity, source order wins — and the design-system
   bundle loads after the classic stylesheet, so these styles win. */
input.check, input.radio {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-2);
  padding: 0;
  margin: 0;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.12s ease;
  flex-shrink: 0;
}
input.check { border-radius: 4px; }
input.radio { border-radius: 9999px; }
input.check:hover, input.radio:hover { border-color: var(--border-3); }
input.check:focus-visible, input.radio:focus-visible { outline: 0; box-shadow: var(--ring-focus); }
input.check:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px;
}
input.radio:checked {
  border: 5px solid var(--accent);
  background: var(--bg-surface);
}

/* Toggle switch.
   Selector uses `input[type="checkbox"].switch` (specificity 0,2,1) so it
   reliably beats the classic `form input { ... }` styling in
   `app/assets/stylesheets/forms.scss` (specificity 0,1,1). Same approach
   should be applied to `input.check` / `input.radio` if/when they regress. */
input[type="checkbox"].switch {
  appearance: none;
  -webkit-appearance: none;
  width: 36px; height: 20px;
  background: var(--border-2);
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
  margin: 0;
  border: 0;
  padding: 0;
  box-shadow: none;
}
input[type="checkbox"].switch::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 9999px;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform 0.15s ease;
  box-shadow: var(--shadow-xs);
}
input[type="checkbox"].switch:checked { background: var(--accent); }
input[type="checkbox"].switch:checked::before { transform: translateX(16px); }
input[type="checkbox"].switch:focus-visible { outline: 0; box-shadow: var(--ring-focus); }
input[type="checkbox"].switch[disabled] { cursor: not-allowed; opacity: 0.6; }

/* Inline check/radio label rows */
.opt-row { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg-1); cursor: pointer; }

/* ---------------------------------------------------------------
   CARDS & SURFACES
   --------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-xs);
}
.card--hero {
  border-radius: var(--radius-2xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.card--flat { box-shadow: none; }
.card--ghost {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-2);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 15px; }

/* Stat card */
.stat {
  display: flex; flex-direction: column; gap: 6px;
}
.stat .eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--fg-3);
  text-transform: uppercase;
}
.stat .number {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--fg-1);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .number--success { color: var(--st-success); }
.stat .number--danger  { color: var(--st-overdue); }
.stat .delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--fg-3);
}
.stat .delta [data-lucide] { width: 12px; height: 12px; }

/* List item / row */
.list-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  transition: background 0.12s ease;
}
.list-row + .list-row { border-top: 1px solid var(--border-1); }
.list-row:hover { background: var(--bg-subtle); }
.list-row .title { font-size: 14px; font-weight: 500; color: var(--fg-1); }
.list-row .sub   { font-size: 12px; color: var(--fg-3); margin-top: 2px; }

/* ---------------------------------------------------------------
   AVATARS
   --------------------------------------------------------------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 9999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.avatar--xs { width: 22px; height: 22px; font-size: 10px; }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatar--xl { width: 80px; height: 80px; font-size: 24px; }

.avatar--moss     { background: rgba(79,122,79,0.18);  color: #3e6240; }
.avatar--terra    { background: rgba(180,106,61,0.18); color: #94522d; }
.avatar--ocean    { background: rgba(58,122,156,0.18); color: #2c6184; }
.avatar--violet   { background: rgba(140,100,180,0.18); color: #6e4ea0; }
.avatar--amber    { background: rgba(213,147,17,0.18); color: #8c6111; }

.avatar-stack {
  display: inline-flex;
}
.avatar-stack .avatar {
  border: 2px solid var(--bg-surface);
  margin-left: -8px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Avatar with status dot */
.avatar-wrap { position: relative; display: inline-block; }
.avatar-wrap .status-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 9999px;
  background: var(--st-success);
  border: 2px solid var(--bg-surface);
}

/* ---------------------------------------------------------------
   PROGRESS
   --------------------------------------------------------------- */
.progress {
  height: 6px;
  width: 100%;
  background: var(--bg-offset);
  border-radius: 9999px;
  overflow: hidden;
}
.progress > .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress--success > .fill { background: var(--st-success); }
.progress--late > .fill    { background: var(--st-late); }
.progress--lg { height: 8px; }

/* Steps progress (badge plan) */
.steps {
  display: flex; gap: 4px;
}
.steps .step {
  flex: 1; height: 6px;
  background: var(--bg-offset);
  border-radius: 9999px;
}
.steps .step.done { background: var(--accent); }
.steps .step.now  { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* Meter (numeric value bar) */
.meter {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--fg-3);
}
.meter .lbl { color: var(--fg-2); font-weight: 500; }
.meter .val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--fg-1); }

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border-radius: 9999px;
  border: 2.5px solid var(--bg-offset);
  border-top-color: var(--accent);
  animation: sg-spin 0.8s linear infinite;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--bg-offset) 0%, var(--bg-subtle) 50%, var(--bg-offset) 100%);
  background-size: 200% 100%;
  animation: sg-skel 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes sg-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skel--text { height: 12px; }
.skel--block { height: 60px; border-radius: var(--radius-md); }

/* ---------------------------------------------------------------
   TABS / SEGMENTED
   --------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-1);
}
.tabs button {
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 13px; font-weight: 500;
  color: var(--fg-3);
  padding: 10px 14px;
  position: relative;
  cursor: pointer;
  transition: color 0.15s ease;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.tabs button:hover { color: var(--fg-1); background: var(--bg-subtle); }
.tabs button.active { color: var(--fg-1); font-weight: 600; }
.tabs button.active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.segmented {
  display: inline-flex;
  background: var(--bg-offset);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.segmented button,
.segmented .segmented-link {
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 12px; font-weight: 600;
  color: var(--fg-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.segmented button:hover,
.segmented .segmented-link:hover { color: var(--fg-1); }
.segmented button.active,
.segmented .segmented-link.active {
  background: var(--bg-surface);
  color: var(--fg-1);
  box-shadow: var(--shadow-xs);
}

/* ---------------------------------------------------------------
   TOOLTIP & POPOVER
   --------------------------------------------------------------- */
.tooltip-wrap { position: relative; display: inline-block; }
.tooltip-wrap .tip {
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: var(--bg-inverse);
  color: var(--bg-app);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  box-shadow: var(--shadow-md);
}
.tooltip-wrap:hover .tip,
.tooltip-wrap:focus-within .tip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------
   ALERTS / TOASTS
   --------------------------------------------------------------- */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  font-size: 13px;
  color: var(--fg-1);
}
.alert [data-lucide] { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.alert .body strong { display: block; margin-bottom: 2px; font-weight: 600; font-size: 13px; }
.alert .body p { font-size: 13px; color: var(--fg-2); }

.alert--success { background: var(--st-success-soft); border-color: var(--st-success-ring); }
.alert--success [data-lucide] { color: var(--st-success); }
.alert--late    { background: var(--st-late-soft); border-color: var(--st-late-ring); }
.alert--late [data-lucide] { color: var(--st-late); }
.alert--overdue { background: var(--st-overdue-soft); border-color: var(--st-overdue-ring); }
.alert--overdue [data-lucide] { color: var(--st-overdue); }

.toast {
  display: flex; gap: 12px; align-items: center;
  background: var(--bg-inverse);
  color: var(--bg-app);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  min-width: 320px;
}
.toast [data-lucide] { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.toast .grow { flex: 1; }
.toast .dismiss {
  background: transparent; border: 0; color: inherit;
  opacity: 0.6; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center;
}
.toast .dismiss:hover { opacity: 1; }

/* ==========================================================================
   PLAYGROUND-PROMOTED PRIMITIVES (Promises redesign, May 2026)
   These were promoted from the playground build. Each has a JSX demo in
   docs/style_guide/sg-components.jsx. Do not delete without updating the demo.
   ========================================================================== */

/* ---------------------------------------------------------------
   BANNER — page-level alert that sits above content. Persistent
   (no auto-dismiss) until the user explicitly closes it. Pair with
   `.banner--dismissible` to render a close button slot.
   --------------------------------------------------------------- */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--fg-1);
}
.banner [data-lucide] { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.banner .banner-body { flex: 1; min-width: 0; }
.banner .banner-title { display: block; font-size: 14px; font-weight: 600; color: var(--fg-1); margin-bottom: 2px; }
.banner .banner-message { font-size: 13px; color: var(--fg-2); margin: 0; line-height: 1.5; }
.banner .banner-actions { display: inline-flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: 12px; }
.banner .banner-close {
  background: transparent; border: 0; cursor: pointer; color: var(--fg-3);
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: var(--transition-fast);
}
.banner .banner-close:hover { background: rgba(15,23,42,0.05); color: var(--fg-1); }

.banner--late    { background: var(--st-late-soft);    border-color: var(--st-late-ring);    }
.banner--late [data-lucide] { color: var(--st-late); }
.banner--overdue { background: var(--st-overdue-soft); border-color: var(--st-overdue-ring); }
.banner--overdue [data-lucide] { color: var(--st-overdue); }
.banner--success { background: var(--st-success-soft); border-color: var(--st-success-ring); }
.banner--success [data-lucide] { color: var(--st-success); }
.banner--info    { background: var(--st-info-soft);    border-color: var(--st-info-ring);    }
.banner--info [data-lucide] { color: var(--st-info); }

/* Persistent variant (cannot be dismissed in the live app — used for the
   frequency-window-passed warning that escalates after the modal window
   closes; stays until the admin schedules a survey). */
.banner--persistent .banner-close { display: none; }

/* ---------------------------------------------------------------
   FILE UPLOAD — multi-file dropzone with progress + uploaded-list slot.
   Markup contract:
   <div class="file-upload">
     <label class="file-upload-dropzone"> ... <input type=file …> </label>
     <ul class="file-upload-list" data-target="…">
       <li class="file-upload-item">
         <i data-lucide=file/></i>
         <div class="grow"><span class="file-upload-name">…</span><div class="file-upload-bar"><span style="width:42%"></span></div></div>
         <button class="file-upload-remove">…</button>
       </li>
     </ul>
   </div>
   --------------------------------------------------------------- */
.file-upload {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%;
}
.file-upload-dropzone {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 16px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}
.file-upload-dropzone:hover,
.file-upload-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--fg-1);
}
.file-upload-dropzone [data-lucide] { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.file-upload-dropzone input[type="file"] { display: none; }
.file-upload-dropzone .meta { display: block; font-size: 11.5px; color: var(--fg-3); margin-top: 4px; }

.file-upload-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.file-upload-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 13px;
}
.file-upload-item [data-lucide]:first-child { color: var(--accent); flex-shrink: 0; width: 16px; height: 16px; }
.file-upload-item .grow { flex: 1; min-width: 0; }
.file-upload-item .file-upload-name { display: block; font-weight: 500; color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-upload-item .file-upload-meta { font-size: 11.5px; color: var(--fg-3); }
.file-upload-bar {
  position: relative;
  width: 100%; height: 4px;
  background: var(--bg-offset);
  border-radius: var(--radius-pill);
  margin-top: 4px;
  overflow: hidden;
}
.file-upload-bar > span {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.3s ease;
}
.file-upload-item--success .file-upload-bar > span { background: var(--st-success); }
.file-upload-item--error   .file-upload-bar > span { background: var(--st-overdue); }
.file-upload-remove {
  background: transparent; border: 0; cursor: pointer;
  color: var(--fg-3); padding: 4px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
}
.file-upload-remove:hover { color: var(--st-overdue); background: var(--st-overdue-soft); }

/* ---------------------------------------------------------------
   DATE PICKER — a styled input affixed with a calendar icon.
   Pair with a JS date picker library in production; the styling here
   covers both the bare input and a calendar-icon prefix.
   --------------------------------------------------------------- */
.date-picker {
  position: relative;
  display: inline-flex; align-items: stretch; width: 100%;
}
.date-picker > input {
  flex: 1; width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 14px;
  color: var(--fg-1);
  font-family: inherit;
  transition: var(--transition-fast);
}
.date-picker > input:hover { border-color: var(--border-3); }
.date-picker > input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.date-picker > input[disabled] {
  background: var(--bg-subtle);
  color: var(--fg-3);
  cursor: not-allowed;
}
.date-picker > [data-lucide] {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--fg-3);
  pointer-events: none;
  z-index: 1;
}
.date-picker--range { display: inline-flex; gap: 6px; align-items: center; }
.date-picker--range > .date-picker { width: auto; flex: 1; }
.date-picker--range .range-sep { color: var(--fg-3); font-size: 12px; }

/* ---------------------------------------------------------------
   FILTER CHIP — pill-shaped multi-select trigger + menu.
   Contract:
   <details class="filter-chip" open|closed>
     <summary class="filter-chip-trigger">Studios <span class="filter-chip-count">3</span></summary>
     <div class="filter-chip-menu">
       <input class="filter-chip-search" placeholder="Search…" />
       <ul class="filter-chip-options">
         <li><label class="opt-row"><input type="checkbox"/> Spark Studio</label></li> …
       </ul>
       <div class="filter-chip-footer"><button>Clear</button><button>Apply</button></div>
     </div>
   </details>
   --------------------------------------------------------------- */
.filter-chip { position: relative; display: inline-block; }
.filter-chip > summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-1);
  background: var(--bg-surface);
  color: var(--fg-1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}
.filter-chip > summary::-webkit-details-marker { display: none; }
.filter-chip > summary:hover { border-color: var(--border-3); }
.filter-chip[open] > summary {
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.filter-chip-trigger [data-lucide] { width: 14px; height: 14px; color: var(--fg-3); }
.filter-chip-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--fg-on-accent);
  font-size: 11px;
  font-weight: 600;
}
.filter-chip-menu {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  z-index: 30;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.filter-chip-search {
  width: 100%; height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 13px;
  color: var(--fg-1);
}
.filter-chip-search:focus { outline: none; border-color: var(--accent); background: var(--bg-surface); }
.filter-chip-options {
  list-style: none; padding: 0; margin: 0;
  max-height: 220px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.filter-chip-options li { display: flex; align-items: center; }
.filter-chip-options .opt-row {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.filter-chip-options .opt-row:hover { background: var(--bg-subtle); }
.filter-chip-footer {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border-1);
  padding-top: 6px; margin-top: 2px;
  gap: 6px;
}
.filter-chip-footer .btn { height: 28px; padding: 0 12px; font-size: 12px; }

/* ---------------------------------------------------------------
   PLAYGROUND-PROMOTED: ADMIN SECTION NAV
   Horizontal pill nav matching the live admin .box-nav surface.
   Sits inside .hdr-card right under the top bar.
   --------------------------------------------------------------- */
.playground-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-surface);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}
.playground-section-nav a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.playground-section-nav a:hover {
  background: var(--bg-subtle);
  color: var(--fg-1);
}
.playground-section-nav a.active {
  background: var(--accent);
  color: var(--fg-on-accent);
  font-weight: 600;
}

/* ---------------------------------------------------------------
   PLAYGROUND-SCOPED LIST RESET
   Tailwind preflight is off per DS rules, so the browser default
   (~40px padding-left + bullets) bleeds through on every <ul>/<ol>.
   Reset these only inside the playground content card so we don't
   touch other DS surfaces. Components that need indentation/markers
   can re-apply them inside their own scope.
   --------------------------------------------------------------- */
.hdr-card ul,
.hdr-card ol,
.playground-section-nav + div ul,
.playground-section-nav + div ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------
   PLAYGROUND-PROMOTED: SEGMENTED CONTROL — anchor support
   The base .segmented rule targets <button> only. Playground variant /
   active+archived / dashboard+graphs toggles use <a> for navigation, so
   apply the same chrome to anchors inside .segmented.
   --------------------------------------------------------------- */
.segmented a {
  display: inline-flex;
  align-items: center;
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.segmented a:hover { color: var(--fg-1); }
.segmented a.active {
  background: var(--bg-surface);
  color: var(--fg-1);
  box-shadow: var(--shadow-xs);
}
/* ---------------------------------------------------------------
   PLAYGROUND-PROMOTED: RATING SCALE
   1–10 rating row used by promise surveys / NPS-style questions.
   Default = subtle, hover = soft accent fill, selected = solid accent.
   The container fans out with even spacing; buttons are square / pill-ish
   and stay readable down to 7-button / 11-button scales.
   --------------------------------------------------------------- */
.rating-scale {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-wrap: wrap;
}
.rating-scale__btn {
  appearance: none;
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-1);
  background: var(--bg-surface);
  color: var(--fg-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.rating-scale__btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.rating-scale__btn:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--ring-focus);
}
.rating-scale__btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--fg-on-accent);
  box-shadow: var(--shadow-xs);
}
/* Larger / generous variant for hero respondent forms */
.rating-scale--lg .rating-scale__btn {
  min-width: 44px;
  height: 48px;
  font-size: 15px;
}
/* Stretch each button to fill row when caller provides container width */
.rating-scale--fill .rating-scale__btn { flex: 1 1 0; }

/* Endpoint-label row (anchors the scale: "Not at all likely" → "Extremely likely") */
.rating-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 8px;
}

/* ---------------------------------------------------------------
   PLAYGROUND-PROMOTED: ACTION MENU
   Lightweight dropdown for *action* items (e.g. Add → New | Search…).
   Distinct from .filter-chip (which is for multi-select filtering).
   Wrap in <details data-action-menu>; the playground--dropdown-close
   controller closes it on outside-click. <summary> can be styled as
   a regular .btn / .btn--secondary.
   --------------------------------------------------------------- */
.action-dropdown {
  position: relative;
  display: inline-block;
}
.action-dropdown > summary {
  list-style: none;
  cursor: pointer;
}
.action-dropdown > summary::-webkit-details-marker { display: none; }

.action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.action-menu--align-left { right: auto; left: 0; }

.action-menu__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--fg-1);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
}
.action-menu__item:hover,
.action-menu__item:focus-visible {
  outline: 0;
  background: var(--bg-subtle);
}
.action-menu__item [data-lucide] {
  width: 16px;
  height: 16px;
  color: var(--fg-3);
  flex-shrink: 0;
  margin-top: 2px;
  transition: color 0.12s ease;
}
.action-menu__item:hover [data-lucide],
.action-menu__item:focus-visible [data-lucide] { color: var(--accent); }

.action-menu__item-body { display: flex; flex-direction: column; min-width: 0; }
.action-menu__item-title {
  font-weight: 600;
  color: var(--fg-1);
  line-height: 1.3;
}
.action-menu__item-meta {
  font-size: 11.5px;
  color: var(--fg-3);
  margin-top: 1px;
  line-height: 1.4;
}

.action-menu__divider {
  height: 1px;
  background: var(--border-1);
  margin: 4px -2px;
}
