/* FlowFund — components.css
   Reusable component styles. */

/* Card */
.ff-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.ff-card--interactive { cursor: pointer; }
@media (hover: hover) {
  .ff-card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}
.ff-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.ff-card__title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--heading);
  margin: 0;
}
.ff-card__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Button */
.ff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  border: 1px solid transparent;
}
/* Quick taps count as taps, never as a double-tap zoom (iPhone/iPad) */
.ff-btn, .ff-icon-btn, .ff-option-pill, .ff-option-card { touch-action: manipulation; }
.ff-btn:hover { filter: brightness(0.97); }
.ff-btn:active { transform: scale(0.99); }
.ff-btn--primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600; }
.ff-btn--primary:hover { background: var(--btn-primary-hover); filter: none; }
.ff-btn--secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); }
.ff-btn--secondary:hover { background: var(--btn-secondary-hover); filter: none; }
.ff-btn--ghost { background: transparent; color: var(--btn-ghost-text); border-color: var(--btn-ghost-border); }
.ff-btn--ghost:hover { background: var(--surface-alt); filter: none; }
.ff-btn--block { width: 100%; }
.ff-btn--sm { min-height: 36px; padding: 6px 14px; font-size: 0.8125rem; }
.ff-btn--lg { min-height: 52px; padding: 14px 28px; font-size: 1rem; }
/* Disabled: outline + muted text, never a faded fill with faded text */
.ff-btn:disabled { background: transparent; color: var(--text-muted); border-color: var(--btn-ghost-border); cursor: not-allowed; filter: none; transform: none; }

/* Input */
.ff-input, .ff-select, .ff-textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.ff-input--mono { font-family: var(--font-mono); }
.ff-input:focus, .ff-select:focus, .ff-textarea:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px var(--surface-alt);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 20%, transparent);
  outline: none;
}
.ff-input::placeholder { color: var(--color-text-secondary); opacity: 0.7; }
.ff-textarea { min-height: 80px; resize: vertical; }
.ff-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}
.ff-helper {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 6px;
}
.ff-field { margin-bottom: var(--space-4); }

/* Progress Bar */
.ff-progress {
  width: 100%;
  height: 8px;
  background: var(--progress-track);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.ff-progress__fill {
  height: 100%;
  background: var(--progress-fill);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chart-edge) 35%, transparent);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  width: 0%;
}
.ff-progress__fill--success { background: var(--fill-success); }
.ff-progress__fill--warning { background: var(--fill-warning); }
.ff-progress__fill--danger { background: var(--fill-danger); }

/* Toggle Switch */
.ff-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.ff-toggle input { opacity: 0; width: 0; height: 0; }
.ff-toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--btn-ghost-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.ff-toggle__slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.ff-toggle input:checked + .ff-toggle__slider {
  background: var(--accent-2-deep);
}
.ff-toggle input:checked + .ff-toggle__slider::before {
  transform: translateX(18px);
}

/* Toast */
.ff-toast {
  position: fixed;
  bottom: calc(var(--nav-mobile-height) + 24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 200;
  border: 1px solid var(--color-border);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  max-width: calc(100% - 32px);
}
.ff-toast--show { transform: translateX(-50%) translateY(0); opacity: 1; }
.ff-toast--success { background: var(--success-bg); color: var(--success-text); }
.ff-toast--danger { background: var(--danger-bg); color: var(--danger-text); }
.ff-toast__action {
  margin-left: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Modal */
.ff-modal {
  position: fixed;
  inset: 0;
  background: rgba(28,26,25,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 150;
  padding: 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.ff-modal--show { opacity: 1; }
.ff-modal__panel {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-6);
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
}
.ff-modal--show .ff-modal__panel { transform: translateY(0); }
@media (min-width: 768px) {
  .ff-modal { align-items: center; padding: 24px; }
  .ff-modal__panel { border-radius: var(--radius-xl); transform: scale(0.96); }
  .ff-modal--show .ff-modal__panel { transform: scale(1); }
}
.ff-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.ff-modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--heading);
  margin: 0;
}
.ff-modal__close {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
}
.ff-modal__close:hover { background: var(--color-surface-alt); }

/* Badge */
.ff-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--chip-3-bg);
  color: var(--chip-3-text);
}
.ff-badge--success { background: var(--success-bg); color: var(--success-text); }
.ff-badge--danger { background: var(--danger-bg); color: var(--danger-text); }
.ff-badge--auto {
  background: var(--chip-2-bg);
  color: var(--chip-2-text);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}

/* Empty state */
.ff-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  gap: var(--space-3);
}
.ff-empty__icon {
  width: 80px; height: 80px;
  display: grid;
  place-items: center;
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}
.ff-empty__title { font-family: var(--font-display); font-size: 1.25rem; margin: 0; }
.ff-empty__body { color: var(--color-text-secondary); margin: 0; max-width: 320px; }

/* Loading skeleton */
.ff-skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 0%, var(--color-border) 50%, var(--color-surface-alt) 100%);
  background-size: 200% 100%;
  animation: ff-shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* Number display */
.ff-number-big {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  line-height: 1.1;
}
.ff-number-md {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

/* Header */
.ff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  padding-top: calc(var(--space-4) + env(safe-area-inset-top));
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.ff-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--heading);
  margin: 0;
  line-height: 1.2;
}
.ff-header__sub {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin: 2px 0 0;
}
.ff-header__actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.ff-icon-btn {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  background: transparent;
  transition: background var(--transition-fast);
}
.ff-icon-btn:hover { background: var(--color-surface-alt); }

/* Nav — Mobile */
.ff-nav-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-mobile-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  z-index: 60;
}
.ff-nav-mobile__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.6875rem;
  color: var(--nav-text);
  background: transparent;
  padding: 4px 2px;
  position: relative;
}
.ff-nav-mobile__item svg { color: var(--nav-icon); }
/* Active tab: a soft pill behind the icon AND its label, so it always lines up
   (a separate circle at a fixed spot sat off-centre from the icon). */
.ff-nav-mobile__item--active {
  color: var(--nav-active-text); font-weight: 600;
  background: var(--nav-active-bg);
  border-radius: 14px;
  margin: 6px 3px;
  box-shadow: inset 0 -3px 0 var(--accent-1-deep);
}
.ff-nav-mobile__item--active svg { color: var(--accent-1-deep); }

/* Nav — Desktop sidebar */
.ff-sidebar {
  display: none;
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
  flex-direction: column;
}
@media (min-width: 1024px) {
  .ff-sidebar { display: flex; }
}
.ff-sidebar__brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  padding: var(--space-2) var(--space-3) var(--space-5);
  color: var(--nav-text);
}
.ff-sidebar__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ff-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--nav-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  background: transparent;
  transition: all var(--transition-fast);
}
.ff-sidebar__item svg { color: var(--nav-icon); }
.ff-sidebar__item:hover { background: var(--nav-hover-bg); color: var(--nav-text); }
.ff-sidebar__item--active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent-1-deep);
}
.ff-sidebar__item--active svg { color: var(--accent-1-deep); }
.ff-sidebar__group {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nav-text);
  opacity: 0.85;
  padding: var(--space-3) 12px 4px;
  font-weight: 500;
}
.ff-sidebar__footer {
  padding: var(--space-3) 12px;
  font-size: 0.75rem;
  color: var(--nav-text);
  border-top: 1px solid var(--nav-hover-bg);
  margin-top: var(--space-4);
}

/* FAB */
.ff-fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-mobile-height) + 20px + env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  transition: transform var(--transition-normal);
}
@media (min-width: 1024px) {
  .ff-fab { bottom: 24px; right: 24px; }
}
.ff-fab:hover { transform: scale(1.05); }
.ff-fab--open { transform: rotate(45deg); }

.ff-fab-speed {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-mobile-height) + 90px + env(safe-area-inset-bottom));
  display: none;
  flex-direction: column-reverse;
  gap: var(--space-3);
  z-index: 69;
  align-items: flex-end;
}
@media (min-width: 1024px) {
  .ff-fab-speed { bottom: 94px; right: 24px; }
}
.ff-fab-speed--open { display: flex; }
.ff-fab-speed__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface);
  padding: 8px 16px 8px 8px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
  font-weight: 500;
  font-size: 0.875rem;
  animation: ff-fab-in 250ms ease-out backwards;
}
.ff-fab-speed__item:nth-child(1) { animation-delay: 0ms; }
.ff-fab-speed__item:nth-child(2) { animation-delay: 50ms; }
.ff-fab-speed__item:nth-child(3) { animation-delay: 100ms; }
.ff-fab-speed__item:nth-child(4) { animation-delay: 150ms; }
.ff-fab-speed__icon {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  background: var(--color-surface-alt);
  border-radius: var(--radius-full);
  color: var(--accent-1-deep);
}

/* Mood & Money — 7-day strip */
.ff-mood-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-1);
  width: 100%;
}
.ff-mood-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  min-width: 0;
  transition: background var(--transition-fast);
}
.ff-mood-cell:hover { background: var(--color-surface-alt); }
.ff-mood-cell--today {
  background: var(--chip-1-bg);
  color: var(--chip-1-text);
}
.ff-mood-cell__day {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.ff-mood-cell__emoji {
  font-size: 1.25rem;
  line-height: 1.2;
}

/* Status pill (used in safe-to-spend) */
.ff-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
}
.ff-status--good { background: var(--success-bg); color: var(--success-text); }
.ff-status--ok { background: var(--warning-bg); color: var(--warning-text); }
.ff-status--tight { background: var(--danger-bg); color: var(--danger-text); }

/* List items */
.ff-list { display: flex; flex-direction: column; gap: var(--space-2); }
.ff-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  transition: background var(--transition-fast);
}
.ff-list__item--urgent {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger-text);
}
.ff-list__icon {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.ff-list__body { flex: 1; min-width: 0; }
.ff-list__name { font-weight: 500; font-size: 0.9375rem; }
.ff-list__meta { font-size: 0.8125rem; color: var(--color-text-secondary); }
.ff-list__right { text-align: right; flex-shrink: 0; }

/* Quick-add row — amount + merchant + button on one row, wrap gracefully */
.ff-quick-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.ff-quick-row > * { min-width: 0; }

/* Quick-add categories — wrap to multiple rows, max two by default */
.ff-quick-cats {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-content: flex-start;
}

/* Horizontal scroll row */
.ff-hscroll {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
}
.ff-hscroll > * { scroll-snap-align: start; flex-shrink: 0; }
.ff-hscroll::-webkit-scrollbar { height: 6px; }
.ff-hscroll::-webkit-scrollbar-track { background: transparent; }
.ff-hscroll::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 9999px;
}
.ff-hscroll::-webkit-scrollbar-thumb:hover { background: var(--color-text-secondary); }

/* Action pill card */
.ff-action-card {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-alt);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.ff-action-card:hover { background: var(--chip-1-bg); border-color: var(--border-accent); }

/* Vertical action stack on the Action Needed dashboard card.
   Each row is full-width so long labels wrap instead of stretching the card. */
.ff-action-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
}
.ff-action-card--block {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  white-space: normal;       /* allow wrapping */
  word-break: break-word;
  text-align: left;
  justify-content: flex-start;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  line-height: 1.35;
}

/* Progress ring */
/* No CSS transform here: the 12 o'clock start is drawn inside the SVG
   (progress-ring.js) so the ring stays a crisp vector, not a blurry bitmap. */
.ff-ring {
  display: block;
}
.ff-ring__track { stroke: var(--chart-track); }
.ff-ring__fill { stroke: var(--chart-2); transition: stroke-dashoffset 800ms ease-out; }

/* Onboarding */
.ff-onboard {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-bg) 60%);
}
.ff-onboard__progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 24px 16px;
}
.ff-onboard__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition-fast), width var(--transition-fast);
}
.ff-onboard__dot--active { background: var(--accent-1-deep); width: 24px; border-radius: 4px; }
.ff-onboard__dot--done { background: var(--accent-1-deep); }
.ff-onboard__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  justify-content: center;
  gap: var(--space-4);
}
.ff-onboard__headline { font-family: var(--font-display); font-size: 2rem; line-height: 1.2; margin: 0; }
.ff-onboard__sub { color: var(--color-text-secondary); margin: 0; font-size: 1rem; }
.ff-onboard__body-text { color: var(--color-text-secondary); line-height: 1.6; }
.ff-onboard__footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

/* Multi-select pill option */
.ff-option-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ff-option-pill--selected {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-bg);
  font-weight: 600;
}

/* Card option (single select) */
.ff-option-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ff-option-card--selected { border-color: var(--accent-1-deep); background: var(--surface-alt); }
.ff-option-card__icon { font-size: 1.5rem; flex-shrink: 0; }
.ff-option-card__body { flex: 1; }
.ff-option-card__title { font-weight: 500; margin: 0 0 2px; }
.ff-option-card__desc { font-size: 0.8125rem; color: var(--color-text-secondary); margin: 0; }

/* Slider */
.ff-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--progress-track);
  outline: none;
}
.ff-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-1-deep);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.ff-slider::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-1-deep);
  cursor: pointer;
  border: none;
}

/* Category color swatches */
.ff-cat { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-full); font-size: 1rem; }
.ff-cat--1 { background: var(--cat-1); }
.ff-cat--2 { background: var(--cat-2); }
.ff-cat--3 { background: var(--cat-3); }
.ff-cat--4 { background: var(--cat-4); }
.ff-cat--5 { background: var(--cat-5); }
.ff-cat--6 { background: var(--cat-6); }
.ff-cat--7 { background: var(--cat-7); }

/* Theme signatures --------------------------------------------------------
   A 6px stripe across the top of the menu (Rainbow Pastel only; the token
   is `none` elsewhere), and on Rainbow Pastel the menu icons cycle through
   the six hues. */
.ff-sidebar::before, .ff-nav-mobile::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 6px;
  background: var(--brand-stripe);
  pointer-events: none;
}
.ff-nav-mobile::before { height: 4px; }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n+1) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n+1) svg { color: var(--chip-1-text); }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n+2) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n+2) svg { color: var(--chip-2-text); }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n+3) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n+3) svg { color: var(--chip-3-text); }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n+4) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n+4) svg { color: var(--chip-4-text); }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n+5) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n+5) svg { color: var(--chip-5-text); }
[data-theme="rainbow-pastel"] .ff-sidebar__item:nth-of-type(6n) svg,
[data-theme="rainbow-pastel"] .ff-nav-mobile__item:nth-of-type(6n) svg { color: var(--chip-6-text); }

/* Chips cycle through the theme's chip colours */
.ff-chip-1 { background: var(--chip-1-bg); color: var(--chip-1-text); }
.ff-chip-2 { background: var(--chip-2-bg); color: var(--chip-2-text); }
.ff-chip-3 { background: var(--chip-3-bg); color: var(--chip-3-text); }
.ff-chip-4 { background: var(--chip-4-bg); color: var(--chip-4-text); }

/* Tinted cards and rows: captions and outline buttons inside take the tint's
   own deep shade, so nothing mid-tone sits on a pastel fill. */
.ff-tint--danger { background: var(--danger-bg); }
.ff-tint--warning { background: var(--warning-bg); }
.ff-tint--danger .ff-caption, .ff-tint--danger .ff-list__meta, .ff-tint--danger .ff-btn--ghost,
.ff-list__item--urgent .ff-list__meta, .ff-list__item--urgent .ff-caption, .ff-list__item--urgent .ff-btn--ghost { color: var(--danger-text); }
.ff-tint--warning .ff-caption, .ff-tint--warning .ff-list__meta, .ff-tint--warning .ff-btn--ghost { color: var(--warning-text); }
.ff-tint--danger .ff-btn--ghost, .ff-list__item--urgent .ff-btn--ghost { border-color: var(--danger-text); }
.ff-tint--warning .ff-btn--ghost { border-color: var(--warning-text); }

/* Free demo (tools/make-demo.py) — inert in the paid app */
html.is-demo .demo-hide { display: none !important; }
.demo-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px 12px; padding: 8px 16px;
  background: var(--callout-bg); color: var(--text);
  border-bottom: 1px solid var(--callout-border);
  font-size: 0.875rem; text-align: center;
}
.demo-bar .ff-btn { min-height: 32px; padding: 4px 14px; text-decoration: none; }
.demo-card { background: var(--callout-bg); border-color: var(--callout-border); }
.demo-card .ff-btn { text-decoration: none; }
@media print { .demo-bar { display: none !important; } }

/* Home top half (v2.0.19): banner, chart cards, rings — theme tokens only */
.ff-home-banner {
  display: flex; align-items: stretch; justify-content: space-between; gap: var(--space-4);
  background: var(--callout-bg); border: 1px solid var(--callout-border);
  border-radius: var(--radius-lg); padding: var(--space-5);
  margin-top: calc(4px + env(safe-area-inset-top));   /* Home has no header, so clear the notch here */
  overflow: hidden;
}
.ff-home-banner__text { min-width: 0; align-self: center; }
.ff-home-banner__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 4px; flex-shrink: 0; margin: -8px -8px 0 0; }
.ff-home-banner__title { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.15; margin: 0; color: var(--heading); }
.ff-home-banner__sub { margin: 4px 0 0; font-size: 0.875rem; color: var(--text-muted); }
.ff-home-banner__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.ff-home-banner__art { width: 240px; height: auto; margin-right: 8px; }
@media (max-width: 520px) {
  .ff-home-banner { padding: var(--space-4); }
  .ff-home-banner__art { width: 110px; margin: 0 -8px -10px 0; }
  .ff-home-banner__title { font-size: 1.4rem; }
}

.ff-home-charts {
  display: grid; gap: var(--space-4); margin-top: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.ff-home-rings {
  display: grid; gap: var(--space-3); margin-top: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.ff-home-charts > *, .ff-home-rings > * { min-width: 0; }
.ff-viz-card { cursor: pointer; padding: var(--space-4); }
@media (hover: hover) { .ff-viz-card:hover { border-color: var(--border-accent); } }
.ff-viz-card__label { font-size: 0.8125rem; font-weight: 500; color: var(--text-muted); margin-bottom: 8px; }
.ff-viz-donut { display: flex; align-items: center; gap: var(--space-4); }
.ff-viz-donut__svg { width: 112px; height: 112px; flex-shrink: 0; }
.ff-viz-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.8125rem; }
.ff-viz-legend__row { display: flex; align-items: center; }
.ff-viz-legend__val { margin-left: auto; padding-left: 8px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ff-viz-bars { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.ff-viz-bar { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 0.8125rem; }
.ff-viz-bar__name { overflow-wrap: anywhere; }
.ff-viz-bar__track { height: 10px; border-radius: var(--radius-full); background: var(--chart-track); overflow: hidden; }
.ff-viz-bar__fill { display: block; height: 100%; border-radius: var(--radius-full); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chart-edge) 35%, transparent); }
.ff-viz-bar__val { color: var(--text-muted); }
.ff-viz-line { display: block; width: 100%; height: 96px; }
.ff-viz-axis { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.ff-viz-card--ring { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.ff-viz-ring { width: 52px; height: 52px; flex-shrink: 0; }
.ff-viz-ring__title { font-weight: 500; font-size: 0.875rem; overflow-wrap: anywhere; }
@media print { .ff-home-banner__art { display: none; } }

/* Settings theme picker: a row per theme with real colour chips (v2.0.21) */
.ff-theme-picker { display: flex; flex-direction: column; gap: 8px; }
.ff-theme-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  width: 100%; min-height: 56px; text-align: left;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface); color: var(--heading);
  cursor: pointer; font: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
@media (hover: hover) { .ff-theme-option:hover { border-color: var(--border-accent); } }
.ff-theme-option--active {
  border-color: var(--accent-1-deep);
  box-shadow: inset 3px 0 0 var(--accent-1-deep), 0 0 0 2px color-mix(in srgb, var(--accent-1-deep) 18%, transparent);
}
.ff-theme-option__name { font-size: 0.9375rem; font-weight: 600; }
.ff-theme-option--active .ff-theme-option__name::after { content: " ✓"; }
.ff-theme-option__hint { font-size: 0.8125rem; color: var(--text-muted); }
/* the strip's own background is the theme's page colour, so Dark's chips sit on charcoal */
.ff-theme-option__chips {
  display: flex; gap: 6px; flex-shrink: 0; padding: 6px 8px;
  border-radius: var(--radius-full); background: var(--bg); border: 1px solid var(--border);
}
.ff-theme-option__swatch { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--heading) 16%, transparent); }
@media (max-width: 360px) { .ff-theme-option__swatch { width: 16px; height: 16px; } }
