/* =============================================================================
   Components — Songon Manage
   Finance-conservative: precise borders, restrained shadows, tabular numerics,
   tight type. Every legacy class name is preserved.
   ============================================================================= */

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
  --btn-bg: var(--surface-raised);
  --btn-fg: var(--text-primary);
  --btn-border: var(--border-default);
  --btn-bg-hover: var(--gray-100);
  --btn-border-hover: var(--border-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  min-height: 38px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition:
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  --btn-bg: var(--brand-700);
  --btn-fg: #ffffff;
  --btn-border: var(--brand-700);
  --btn-bg-hover: var(--brand-600);
  --btn-border-hover: var(--brand-600);
  box-shadow: var(--elev-1);
}

.btn-danger {
  --btn-bg: var(--danger-default);
  --btn-fg: #ffffff;
  --btn-border: var(--danger-default);
  --btn-bg-hover: var(--red-700);
  --btn-border-hover: var(--red-700);
}

.btn-success {
  --btn-bg: var(--green-600);
  --btn-fg: #ffffff;
  --btn-border: var(--green-600);
  --btn-bg-hover: var(--green-700);
  --btn-border-hover: var(--green-700);
}

.btn-outline {
  --btn-bg: transparent;
  --btn-fg: var(--text-brand);
  --btn-border: var(--border-default);
  --btn-bg-hover: var(--brand-50);
  --btn-border-hover: var(--brand-500);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-secondary);
  --btn-border: transparent;
  --btn-bg-hover: var(--surface-sunken);
  --btn-border-hover: transparent;
}

.btn-sm { min-height: 32px; padding: 0 var(--space-4); font-size: var(--text-xs); }
.btn-xs { min-height: 26px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-block { width: 100%; }

/* Solid buttons lift their shadow on hover for a tactile, modern feel. */
.btn-primary:hover,
.btn-danger:hover,
.btn-success:hover { box-shadow: var(--elev-2); }
.btn-primary:active,
.btn-danger:active,
.btn-success:active { box-shadow: var(--elev-1); }

/* =============================================================================
   Cards & sections
   ============================================================================= */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  padding: var(--space-6);
  contain: layout paint;
  transition:
    box-shadow var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard);
}

/* Cards quietly gain depth on hover — alive without implying clickability. */
.card:hover { box-shadow: var(--elev-2); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-header h3 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-brand);
  letter-spacing: var(--tracking-tight);
}

/* =============================================================================
   Stat cards — ledger-style, top accent bar, large tabular value
   ============================================================================= */
.stat-card {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  padding: var(--space-5) var(--space-6);
  overflow: hidden;
  contain: layout paint;
  transition:
    box-shadow var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-decel);
}

.stat-card:hover {
  box-shadow: var(--elev-2);
  transform: translateY(-2px);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--brand-500);
}

.stat-card.blue::before  { background: var(--brand-500); }
.stat-card.dark::before  { background: var(--brand-700); }
.stat-card.green::before { background: var(--green-600); }
.stat-card.red::before   { background: var(--danger-default); }

.stat-card .stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--text-brand);
  line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: var(--tracking-tight);
}

.stat-card .stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* =============================================================================
   Forms
   ============================================================================= */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    box-shadow   var(--duration-fast) var(--ease-standard),
    background   var(--duration-fast) var(--ease-standard);
}

.form-control::placeholder { color: var(--text-subtle); }

.form-control:hover:not(:focus) {
  border-color: var(--border-strong);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px oklch(from var(--brand-500) l c h / 0.16);
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--surface-sunken);
  color: var(--text-muted);
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

textarea.form-control {
  resize: vertical;
  min-height: 96px;
  line-height: var(--leading-snug);
}

/* Form rows use subgrid where supported so labels and fields align across
   adjacent .form-group children. Falls back to a regular grid otherwise. */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--space-4);
}

@supports (grid-template-rows: subgrid) {
  .form-row {
    grid-template-rows: auto;
  }
  .form-row > .form-group {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 2;
  }
}

/* Validation */
.form-control.invalid,
.form-group.has-error .form-control {
  border-color: var(--danger-default);
  box-shadow: 0 0 0 3px oklch(from var(--danger-default) l c h / 0.16);
}

.form-control.valid {
  border-color: var(--green-600);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger-fg);
  margin-top: var(--space-1);
  display: none;
}
.form-group.has-error .form-error { display: block; }

/* Native HTML validation styling — bonus for any required field. */
.form-control:user-invalid {
  border-color: var(--danger-default);
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  border: 1px solid transparent;
  line-height: 1.6;
  /* Status pills aren't interactive, but easing color/border keeps live status
     changes from snapping. No hover/transform, so no false affordance. */
  transition:
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.badge-blue   { background: var(--info-bg);    color: var(--info-fg);    border-color: oklch(from var(--brand-500) l c h / 0.18); }
.badge-dark   { background: var(--info-bg);    color: var(--brand-700);  border-color: oklch(from var(--brand-700) l c h / 0.18); }
.badge-green  { background: var(--success-bg); color: var(--success-fg); border-color: oklch(from var(--green-600) l c h / 0.18); }
.badge-yellow { background: var(--warning-bg); color: var(--warning-fg); border-color: oklch(from var(--amber-500) l c h / 0.20); }
.badge-red    { background: var(--danger-bg);  color: var(--danger-fg);  border-color: oklch(from var(--danger-default) l c h / 0.20); }

/* =============================================================================
   Tables — ledger feel, sticky head support, tabular numerics
   ============================================================================= */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

table {
  width: 100%;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
}

table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.7rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border-default);
}

table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition:
    background var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

table tbody tr:nth-child(even) td {
  background: oklch(from var(--gray-100) l c h / 0.5);
}

table tbody tr:hover td {
  background: var(--brand-50);
  color: var(--text-primary);
}

table tbody tr:last-child td { border-bottom: none; }

/* =============================================================================
   Progress
   ============================================================================= */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  background: var(--brand-500);
  border-radius: var(--radius-pill);
  transition: width var(--duration-slow) var(--ease-emphasized);
}

.progress-bar .progress-fill.green { background: var(--green-600); }
.progress-bar .progress-fill.red   { background: var(--danger-default); }

/* =============================================================================
   Difficulty dots
   ============================================================================= */
.difficulty {
  display: inline-flex;
  gap: 3px;
}

.difficulty .dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--gray-300);
}

.difficulty .dot.filled {
  background: var(--gold-500);
}

/* =============================================================================
   Filter bar
   ============================================================================= */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-1);
  transition:
    box-shadow var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard);
}

/* Lift the whole filter surface while the user is typing/selecting in it, so
   the active filtering context reads as one focused unit. Elevation only — no
   brand border — so it never competes with the focused input's own ring. */
.filter-bar:focus-within { box-shadow: var(--elev-2); }

.filter-bar .form-control {
  width: auto;
  min-width: 160px;
}

.filter-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

/* =============================================================================
   Pagination
   ============================================================================= */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition:
    background var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--brand-500);
  color: var(--brand-700);
  background: var(--brand-50);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0 var(--space-3);
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Alerts (inline)
   ============================================================================= */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  border-left-width: 3px;
}

/* Inline alerts are toggled via .hidden (display:none -> block). Fade+rise them
   in on the same guarded path as the modal, so form feedback doesn't pop. */
@supports (transition-behavior: allow-discrete) {
  .alert {
    transition:
      opacity var(--duration-base) var(--ease-decel),
      transform var(--duration-base) var(--ease-decel),
      display var(--duration-base) allow-discrete;
  }
  @starting-style {
    .alert { opacity: 0; transform: translateY(-4px); }
  }
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: oklch(from var(--danger-default) l c h / 0.25);
  border-left-color: var(--danger-default);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-fg);
  border-color: oklch(from var(--green-600) l c h / 0.25);
  border-left-color: var(--green-600);
}

/* =============================================================================
   Toast notifications — animated entry via @starting-style, no JS class needed
   when using `popover` or fresh DOM nodes.
   ============================================================================= */
.toast-container {
  position: fixed;
  bottom: max(var(--space-6), env(safe-area-inset-bottom, 0));
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  box-shadow: var(--elev-3);
  pointer-events: auto;
  max-width: 380px;
  border: 1px solid oklch(0 0 0 / 0.06);

  /* Entry: existing JS toggles `.toast-show`. Keep that path working. */
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--duration-base) var(--ease-decel),
    transform var(--duration-base) var(--ease-decel);
}

.toast.toast-show {
  opacity: 1;
  transform: translateY(0);
}

/* Bonus: when a toast is freshly inserted to DOM, it animates in even
   without the JS class, on browsers that support @starting-style. */
@starting-style {
  .toast {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast-success { background: var(--green-600);     color: #fff; }
.toast-error   { background: var(--danger-default);color: #fff; }
.toast-warning { background: var(--amber-700);     color: #fff; }
.toast-info    { background: var(--brand-700);     color: #fff; }

.toast-msg { flex: 1; }

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: var(--text-lg);
  cursor: pointer;
  opacity: 0.75;
  padding: 0;
  line-height: 1;
}

.toast-close:hover { opacity: 1; }

/* =============================================================================
   Confirm dialog — same animation pattern as toast
   ============================================================================= */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2001;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-standard);
}

.confirm-overlay.confirm-show { opacity: 1; }

.confirm-dialog {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  max-width: 420px;
  width: 90%;
  box-shadow: var(--elev-4);
  text-align: center;
  /* The backdrop fades via .confirm-show (toggled by app.js on the next frame);
     give the card its own matching rise so it doesn't snap in at full size. */
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition:
    opacity var(--duration-base) var(--ease-decel),
    transform var(--duration-base) var(--ease-decel);
}

.confirm-overlay.confirm-show .confirm-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.confirm-dialog p {
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  line-height: var(--leading-snug);
}

.confirm-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* =============================================================================
   Skeleton — subtle, on-brand
   ============================================================================= */
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200) 25%,
    var(--gray-100) 50%,
    var(--gray-200) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s var(--ease-standard) infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 1em; margin-bottom: 0.75em; border-radius: var(--radius-xs); }
.skeleton-text:last-child { width: 60%; }

.skeleton-card { height: 120px; border-radius: var(--radius-lg); }
.skeleton-stat { height: 92px; border-radius: var(--radius-lg); }
.skeleton-row  { height: 44px; margin-bottom: 4px; border-radius: var(--radius-sm); }

.skeleton-grid {
  display: grid;
  gap: var(--space-4);
}

.skeleton-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.skeleton-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.skeleton-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }

/* =============================================================================
   Empty state
   ============================================================================= */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--text-muted);
}

@keyframes empty-rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 0.7; transform: none; }
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--gray-400);
  opacity: 0.7;
  /* One-shot warm entrance when an empty state mounts. `both` holds the final
     0.7 opacity (matching the resting value), so it never ends up brighter. */
  animation: empty-rise var(--duration-slow) var(--ease-decel) both;
}

.empty-state h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.empty-state .btn { margin-top: var(--space-2); }

/* =============================================================================
   Breadcrumb
   ============================================================================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

/* Animated underline that grows from the left on hover — a restrained, modern
   affordance (no color jump) drawn with a background gradient. */
.breadcrumb a {
  color: var(--text-link);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-size var(--duration-base) var(--ease-standard);
}
.breadcrumb a:hover { background-size: 100% 1px; }

.breadcrumb-sep { color: var(--gray-400); font-size: var(--text-xs); }
.breadcrumb-current {
  color: var(--text-secondary);
  font-weight: var(--weight-medium);
}

/* =============================================================================
   Modal — overlay + dialog + native popover/dialog support
   ============================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-4);
  padding: var(--space-7);
  width: min(600px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-6);
  color: var(--text-brand);
  letter-spacing: var(--tracking-tight);
}

/* Entrance for the custom (non-native) .modal-overlay/.modal, which pages show
   by removing the .hidden class (display:none -> flex). Guarded by @supports so
   browsers without discrete-display transitions simply show it instantly
   (never stuck invisible). Mirrors the native dialog entrance below. */
@supports (transition-behavior: allow-discrete) {
  .modal-overlay {
    transition:
      opacity var(--duration-base) var(--ease-standard),
      display var(--duration-base) allow-discrete;
  }
  @starting-style { .modal-overlay { opacity: 0; } }

  .modal {
    transition:
      opacity var(--duration-base) var(--ease-decel),
      transform var(--duration-base) var(--ease-decel);
  }
  @starting-style {
    .modal { opacity: 0; transform: translateY(8px) scale(0.98); }
  }
}

/* Native <dialog> + popover= styling for free, when used. */
dialog,
:popover-open {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text-primary);
  box-shadow: var(--elev-4);
  padding: var(--space-7);
}

dialog::backdrop,
:popover-open::backdrop {
  background: var(--surface-overlay);
  backdrop-filter: blur(3px);
}

/* Animate native popover/dialog entry (Chrome 117+/Safari 17.5+). */
@supports (transition-behavior: allow-discrete) {
  dialog, [popover] {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition:
      opacity var(--duration-base) var(--ease-decel),
      transform var(--duration-base) var(--ease-decel),
      overlay var(--duration-base) allow-discrete,
      display var(--duration-base) allow-discrete;
  }
  dialog[open], [popover]:popover-open {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  @starting-style {
    dialog[open], [popover]:popover-open {
      opacity: 0;
      transform: translateY(8px) scale(0.98);
    }
  }
}

/* =============================================================================
   Choice / radio cards — finance-style boxed selectors
   ============================================================================= */
.choice-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--space-3);
}

.choice-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}

.choice-item:hover {
  border-color: var(--brand-500);
  background: var(--brand-50);
  transform: translateY(-1px);
}

.choice-item:active { transform: translateY(0); }

.choice-item input[type="radio"] {
  accent-color: var(--brand-700);
}

/* Use :has() so a checked input drives the parent state without JS. */
.choice-item.selected,
.choice-item:has(input:checked) {
  border-color: var(--brand-700);
  background: var(--brand-50);
  box-shadow: inset 0 0 0 1px var(--brand-700);
}

/* =============================================================================
   Timer
   ============================================================================= */
.timer {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--text-brand);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.timer.warning {
  color: var(--danger-fg);
  background: var(--danger-bg);
  border-color: oklch(from var(--danger-default) l c h / 0.25);
}

/* =============================================================================
   Performance: long lists render only what's visible.
   ============================================================================= */
.virtual-list,
.long-list,
.table-wrapper tbody {
  /* content-visibility lets the browser skip painting offscreen rows.
     contain-intrinsic-size hints a placeholder height to avoid scrollbar jump. */
}

.virtual-list > *,
.long-list > * {
  content-visibility: auto;
  contain-intrinsic-size: auto 60px;
}
