/* ==========================================================================
   SAMAY — PREMIUM DESIGN SYSTEM (APPLE AESTHETICS)
   ========================================================================== */

/* Core Variables & Tokens
   Resolved theme is applied via html[data-theme="dark"|"light"].
   Preference (system|light|dark) is stored in localStorage; JS resolves it. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #000000;          /* True Black */
  --bg-secondary: #0a0a0c;        /* Space Black */
  --card-glass: rgba(14, 14, 17, 0.65); /* Translucent Well */
  --border-glass: rgba(255, 255, 255, 0.08); /* Razor edge glass highlight */
  --text-primary: #f5f5f7;        /* Crisp Apple White */
  --text-secondary: #86868b;      /* Matte Slate Gray */
  --text-tertiary: #48484a;       /* Deep Slate */
  
  /* Brand Accent Colors */
  --color-accent: #0071e3;        /* Apple Royal Blue */
  --color-primary: #0071e3;       /* Alias used by form controls */
  --color-emerald: #10b981;       /* Active Running */
  --color-amber: #f59e0b;         /* Active Paused */
  --color-rose: #ef4444;          /* Stop Actions */
  --color-gray: #3a3a3c;          /* Disabled */
  --color-text-muted: #86868b;    /* Muted label/helper text */
  
  /* Radii */
  --radius-interactive: 12px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  /* Fonts */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro", sans-serif;
  
  /* Timing Curves */
  --easing-apple: cubic-bezier(0.16, 1, 0.3, 1); /* Elegant decelerating curve */

  /* Surface Subtles & Scrollbars */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-subtle-light: rgba(255, 255, 255, 0.02);
  --surface-subtle: rgba(255, 255, 255, 0.02);
  --surface-subtle-hover: rgba(255, 255, 255, 0.05);
  --header-bg: rgba(0, 0, 0, 0.7);
  --tab-bar-bg: rgba(10, 10, 12, 0.8);
  --input-bg: rgba(255, 255, 255, 0.02);
  --input-bg-focus: rgba(255, 255, 255, 0.04);
  --btn-secondary-bg: rgba(255, 255, 255, 0.12);
  --btn-secondary-bg-hover: rgba(255, 255, 255, 0.18);
  --scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
  --surface-card: rgba(255, 255, 255, 0.015);
  --title-gradient: linear-gradient(180deg, #ffffff 0%, #a1a1a6 100%);
  --panel-title-gradient: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.7) 100%);
  --glow-opacity: 0.06;
  --glow-bg: #000000;
  --ring-track: rgba(255, 255, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.04);
  --chip-border: rgba(255, 255, 255, 0.08);
  --chip-delete: rgba(255, 255, 255, 0.35);
  /* Theme rim for category color dots / bars / pie / chips */
  --project-color-outline: rgba(255, 255, 255, 0.32);
  
  /* Premium Stripe Box */
  --premium-card-bg: rgba(15, 12, 30, 0.65);
  --premium-card-border: rgba(168, 85, 247, 0.2);
  --premium-card-shadow: rgba(168, 85, 247, 0.15);
}

/* Explicit light theme (also applied when preference is System + OS is light) */
html[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f5f5f7;          /* Crisp Apple Light Gray */
  --bg-secondary: #ffffff;        /* Pure White */
  --card-glass: rgba(255, 255, 255, 0.72); /* Translucent White Well */
  --border-glass: rgba(0, 0, 0, 0.08); /* Dark Razor edge highlight */
  --text-primary: #1d1d1f;        /* Deep Charcoal */
  --text-secondary: #6e6e73;      /* Muted Slate Gray */
  --text-tertiary: #86868b;       /* Soft Gray */
  --color-text-muted: #6e6e73;    /* Muted label/helper text */
  
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-subtle-light: rgba(0, 0, 0, 0.03);
  --surface-subtle: rgba(0, 0, 0, 0.03);
  --surface-subtle-hover: rgba(0, 0, 0, 0.06);
  --header-bg: rgba(245, 245, 247, 0.78);
  --tab-bar-bg: rgba(255, 255, 255, 0.86);
  --input-bg: rgba(0, 0, 0, 0.03);
  --input-bg-focus: rgba(0, 0, 0, 0.05);
  --btn-secondary-bg: rgba(0, 0, 0, 0.08);
  --btn-secondary-bg-hover: rgba(0, 0, 0, 0.12);
  --scrollbar-thumb: rgba(0, 0, 0, 0.14);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.28);
  --surface-card: rgba(0, 0, 0, 0.03);
  --title-gradient: linear-gradient(180deg, #1d1d1f 0%, #6e6e73 100%);
  --panel-title-gradient: linear-gradient(135deg, #1d1d1f 0%, #6e6e73 100%);
  --glow-opacity: 0.04;
  --glow-bg: #ffffff;
  --ring-track: rgba(0, 0, 0, 0.08);
  --chip-bg: rgba(0, 0, 0, 0.04);
  --chip-border: rgba(0, 0, 0, 0.1);
  --chip-delete: rgba(0, 0, 0, 0.35);
  /* Theme rim for category color dots / bars / pie / chips */
  --project-color-outline: rgba(0, 0, 0, 0.22);
  
  --premium-card-bg: rgba(243, 235, 255, 0.75);
  --premium-card-border: rgba(168, 85, 247, 0.3);
  --premium-card-shadow: rgba(168, 85, 247, 0.1);
}

/* Base Document Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  /* 100% of the browser text size, so rem follows Chrome and Safari text settings. */
  font-size: 100%;
  /* Prevent left/right jump when scrollbars appear/disappear */
  scrollbar-gutter: stable;
  width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 50px;
  width: 100%;
  margin: 0 auto;
}

/* Custom Scrollbar for a sleek browser experience */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Selection Highlight */
::selection {
  background: rgba(0, 113, 227, 0.25);
  color: var(--text-primary);
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  container-type: inline-size;
  container-name: app-header;
}

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* Let clicks pass through if needed */
}

.active-tab-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  text-transform: uppercase;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  z-index: 2;
  flex-shrink: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s var(--easing-apple);
}

.brand:hover .brand-logo {
  transform: rotate(180deg);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.3px;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
  z-index: 2;
}

.header-settings-btn {
  display: none; /* shown on mobile */
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s var(--easing-apple);
}

.header-settings-btn:hover,
.header-settings-btn:active {
  background: var(--surface-subtle-hover);
  color: var(--color-accent);
}

.header-settings-btn svg,
.header-settings-btn i {
  width: 18px;
  height: 18px;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Connection Status Badge */
.connection-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--easing-apple);
}

.connection-badge:hover {
  background: var(--surface-subtle-hover);
  color: var(--text-primary);
  border-color: var(--border-glass);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  display: inline-block;
}

/* Connection badge states */
.connection-badge.local .badge-dot {
  background: var(--text-secondary);
}
.connection-badge.online {
  border-color: rgba(16, 185, 129, 0.15);
  background: rgba(16, 185, 129, 0.03);
  color: #10b981;
}
.connection-badge.online .badge-dot {
  background: var(--color-emerald);
  box-shadow: 0 0 8px var(--color-emerald);
}
.connection-badge.syncing {
  border-color: rgba(0, 113, 227, 0.15);
  background: rgba(0, 113, 227, 0.03);
  color: var(--color-accent);
}
.connection-badge.syncing .badge-dot {
  background: var(--color-accent);
  animation: pulse-sync 1.5s infinite ease-in-out;
}

@keyframes pulse-sync {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ==========================================================================
   GLASSMORPHIC CARDS / COMMON
   ========================================================================== */
.glass {
  background: var(--card-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
}

/* ==========================================================================
   MAIN CONTAINERS
   ========================================================================== */
.main-container {
  max-width: 1040px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-top: calc(88px + env(safe-area-inset-top));
  margin-bottom: 0;
  /* Clear fixed tab bar + raised Track FAB so content never sits under it */
  padding: 0 24px calc(120px + env(safe-area-inset-bottom, 0px)) 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  box-sizing: border-box;
}

/* ==========================================================================
   HERO TIMER COMPONENT (APPLE CENTERPIECE)
   ========================================================================== */
.hero-timer-section {
  display: flex;
  justify-content: center;
}

.timer-wrapper {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
  gap: 0;
  z-index: 5;
  box-sizing: border-box;
}

/* Ring + play */
.timer-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0;
  min-height: 0;
}

/* Secondary stack under the hero — spacing stays fixed Focus ↔ Timer */
.timer-addons {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
  margin-top: 16px;
  gap: 10px;
  padding-top: 14px;
  /* Always reserve divider thickness so card height doesn’t jump */
  border-top: 1px solid transparent;
  position: relative;
  z-index: 6;
  flex-shrink: 0;
}

.timer-wrapper.is-pomodoro .timer-addons {
  border-top-color: var(--border-subtle);
}

/* Focus ↔ Timer — quiet segmented control */
.track-mode-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 3px;
  border-radius: 100px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  margin-bottom: 28px;
  position: relative;
}

.track-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s var(--easing-apple), background 0.25s var(--easing-apple), box-shadow 0.25s var(--easing-apple);
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.track-mode-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.track-mode-btn:hover {
  color: var(--text-primary);
}

.track-mode-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border-subtle);
}

.track-mode-btn.active .track-mode-icon {
  opacity: 1;
  color: var(--color-accent);
}

/* Start → green + thump; Pause → amber; Stop → back to usual accent */
.track-mode-btn.active.is-running {
  color: var(--color-emerald);
}
.track-mode-btn.active.is-running .track-mode-icon {
  color: var(--color-emerald);
  opacity: 1;
  animation: mode-icon-thump 1.4s ease-in-out infinite;
}

.track-mode-btn.active.is-paused {
  color: var(--color-amber);
}
.track-mode-btn.active.is-paused .track-mode-icon {
  color: var(--color-amber);
  opacity: 1;
  animation: none;
}

@keyframes mode-icon-thump {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 transparent);
  }
  50% {
    transform: scale(1.22);
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.55));
  }
}

html[data-theme="light"] .track-mode-btn.active {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Timer length strip — presets only (dial cue lives on the ring, not as text) */
.pomodoro-meta {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  order: -1; /* presets sit above task line when Timer is on */
  /* Single presets row — stable Focus ↔ Timer card height */
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  box-sizing: border-box;
  overflow: hidden;
  transition: opacity 0.2s var(--easing-apple);
  flex-shrink: 0;
}

/* Keep layout space when “hidden” — never collapse the card */
.pomodoro-meta.hidden {
  display: flex !important;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  /* still occupy height */
}

/* Pomodoro idle: type dropdown + rounds share the preset-strip slot */
.pomo-cycle-panel {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
}

.pomo-cycle-panel.hidden {
  display: none !important;
}

.pomo-type {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
}

.pomo-type select {
  width: 100%;
  height: 40px;
  margin: 0;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 28px 0 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
}

.pomo-type select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 55%, transparent);
  outline-offset: -2px;
}

.pomo-type select:disabled {
  cursor: default;
  opacity: 0.4;
}

.pomo-type-chevron {
  position: absolute;
  right: 10px;
  pointer-events: none;
  color: var(--text-secondary);
}

.pomo-rounds {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 40px;
  gap: 0;
  padding-right: 2px;
}

.pomo-rounds button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pomo-rounds button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.pomo-rounds button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pomo-rounds-value {
  min-width: 1.1em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

/* Custom length picker — stepper-first, phone-friendly sheet */
.timer-duration-picker {
  position: relative;
  z-index: 30;
  display: flex;
  justify-content: center;
  width: 100%;
}

.timer-duration-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  min-width: 88px;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.2s var(--easing-apple), border-color 0.2s var(--easing-apple), color 0.2s var(--easing-apple), box-shadow 0.2s var(--easing-apple);
  -webkit-tap-highlight-color: transparent;
}

.timer-duration-trigger:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-subtle-hover);
}

.timer-duration-trigger.is-custom,
.timer-duration-picker.open .timer-duration-trigger {
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 35%, var(--border-glass));
  background: color-mix(in srgb, var(--color-accent) 8%, var(--surface-subtle));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 10%, transparent);
}

.timer-duration-trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.timer-duration-chevron {
  opacity: 0.65;
  transition: transform 0.2s var(--easing-apple);
  flex-shrink: 0;
}

.timer-duration-picker.open .timer-duration-chevron {
  transform: rotate(180deg);
}

.timer-duration-backdrop {
  display: none;
}

.timer-duration-menu {
  --wheel-item-h: 44px;
  --wheel-visible: 5;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, 88vw);
  padding: 12px 14px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 50;
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

html[data-theme="light"] .timer-duration-menu {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.timer-duration-menu.hidden,
.timer-duration-menu[hidden],
.timer-duration-backdrop.hidden,
.timer-duration-backdrop[hidden] {
  display: none !important;
}

.timer-duration-sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 100px;
  background: var(--border-glass);
  margin: 0 auto 2px;
}

/* Big − / value / + — easiest on a phone */
.timer-stepper {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.timer-step-btn {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.timer-step-btn:hover {
  background: var(--surface-subtle-hover);
  border-color: var(--text-tertiary);
}

.timer-step-btn:active {
  transform: scale(0.96);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--surface-subtle));
}

.timer-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.timer-step-value {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}

.timer-wheel {
  position: relative;
  height: calc(var(--wheel-item-h) * var(--wheel-visible));
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-subtle);
}

.timer-wheel-highlight {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  height: var(--wheel-item-h);
  transform: translateY(-50%);
  border-radius: 12px;
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 22%, transparent);
  pointer-events: none;
  z-index: 1;
}

.timer-wheel-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 40%;
  pointer-events: none;
  z-index: 2;
}

.timer-wheel-fade-top {
  top: 0;
  background: linear-gradient(to bottom, var(--bg-secondary) 0%, transparent 100%);
}

html[data-theme="light"] .timer-wheel-fade-top {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.timer-wheel-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--bg-secondary) 0%, transparent 100%);
}

html[data-theme="light"] .timer-wheel-fade-bottom {
  background: linear-gradient(to top, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.timer-wheel .timer-wheel-fade-top {
  background: linear-gradient(to bottom, var(--surface-subtle) 10%, transparent 100%);
}
.timer-wheel .timer-wheel-fade-bottom {
  background: linear-gradient(to top, var(--surface-subtle) 10%, transparent 100%);
}

.timer-wheel-scroller {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: calc(var(--wheel-item-h) * 2) 0;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
  touch-action: pan-y;
}

.timer-wheel-scroller::-webkit-scrollbar {
  display: none;
}

.timer-duration-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--wheel-item-h);
  min-height: var(--wheel-item-h);
  padding: 0 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  opacity: 0.35;
  transform: scale(0.92);
  transition: opacity 0.12s ease, transform 0.12s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.timer-duration-option.active {
  opacity: 1;
  transform: scale(1.1);
  color: var(--color-accent);
  font-weight: 700;
  font-size: 24px;
}

.timer-wheel-done {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  color: #fff;
  background: var(--color-accent);
  transition: filter 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.timer-wheel-done:hover {
  filter: brightness(1.06);
}

.timer-wheel-done:active {
  transform: scale(0.98);
}

/* Phones: bottom sheet — easier thumbs, bigger targets */
@media (max-width: 640px) {
  .timer-duration-backdrop:not(.hidden):not([hidden]) {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 120;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  html[data-theme="light"] .timer-duration-backdrop:not(.hidden):not([hidden]) {
    background: rgba(0, 0, 0, 0.28);
  }

  .timer-duration-menu:not(.hidden):not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 20px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    z-index: 121;
    gap: 14px;
    --wheel-item-h: 48px;
    --wheel-visible: 5;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
  }

  .timer-duration-sheet-handle {
    display: block;
  }

  .timer-step-btn {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 32px;
  }

  .timer-stepper {
    grid-template-columns: 64px 1fr 64px;
    gap: 12px;
  }

  .timer-step-value {
    min-height: 64px;
    font-size: 48px;
    border-radius: 18px;
  }

  .timer-wheel-done {
    min-height: 52px;
    font-size: 16px;
    border-radius: 16px;
  }
}

.pomo-preset-seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  padding: 3px;
  gap: 2px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
}

.pomo-preset-scroll {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 3px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.pomo-preset-scroll::-webkit-scrollbar {
  display: none;
}

.pomo-preset-scroll .pomo-seg-btn {
  flex: 0 0 auto;
  min-width: 52px;
  padding-left: 12px;
  padding-right: 12px;
}

.timer-duration-wheels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(220px, 72vw);
  margin: 0 auto;
}

.timer-duration-wheels.hidden {
  display: none;
}

.timer-duration-wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.timer-duration-wheel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.timer-duration-wheel-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
}

.timer-counter.hidden {
  display: none;
}

.week-stack-wrap {
  width: 100%;
  margin-bottom: 12px;
}

.week-stack-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.week-stack-caption-spaced {
  margin-top: 14px;
}

.week-stack-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  min-height: 160px;
}

.week-stack-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.week-stack-track {
  width: 100%;
  max-width: 56px;
  height: 140px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.week-stack-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.week-stack-seg {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 1px solid color-mix(in srgb, var(--bg-primary) 35%, transparent);
  display: block;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: opacity 0.15s ease;
}
.week-stack-seg.is-dimmed {
  opacity: 0.22;
}
.week-stack-seg.is-highlight {
  opacity: 1;
}

.week-stack-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.week-stack-meta {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-align: center;
}

.add-session-hero {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
}

.add-session-title-meta {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pomo-custom-field-solo {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

.pomo-seg-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 40px;
  padding: 8px 6px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: color 0.2s var(--easing-apple), background 0.22s var(--easing-apple), box-shadow 0.22s var(--easing-apple);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.pomo-seg-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: inherit;
  line-height: 1;
}

.pomo-seg-time {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-tertiary);
  line-height: 1;
}

.pomo-seg-btn:hover:not(:disabled) {
  color: var(--text-primary);
}

.pomo-seg-btn:hover:not(:disabled) .pomo-seg-time {
  color: var(--text-secondary);
}

.pomo-seg-btn.active,
.pomodoro-preset.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border-subtle);
}

.pomo-seg-btn.active .pomo-seg-name {
  color: var(--color-accent);
}

.pomo-seg-btn.active .pomo-seg-time {
  color: color-mix(in srgb, var(--color-accent) 70%, var(--text-secondary));
}

html[data-theme="light"] .pomo-seg-btn.active {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.pomo-seg-btn:disabled,
.pomodoro-preset:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Custom is a quiet opt-in under the segment */
.pomo-custom-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: -0.01em;
  padding: 6px 10px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  /* Keep fully in layout — never fade into the card edge */
  flex-shrink: 0;
  opacity: 1;
  line-height: 1.2;
}

.pomo-custom-toggle:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

.pomo-custom-toggle[aria-expanded="true"],
.pomo-custom-toggle.is-active {
  color: var(--color-accent);
}

.pomo-custom-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pomo-custom-editor {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.pomo-custom-editor.hidden,
.pomo-custom-editor[hidden] {
  display: none !important;
}

.pomo-custom-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pomo-custom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pomo-custom-field-name {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.pomo-optional-hint {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-tertiary);
  opacity: 0.85;
}

.pomo-custom-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
}

.pomo-custom-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--color-accent) 45%, var(--border-glass));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 12%, transparent);
}

.pomo-custom-input-wrap input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.pomo-custom-input-wrap input:disabled {
  opacity: 0.5;
}

.pomo-custom-input-wrap input::-webkit-outer-spin-button,
.pomo-custom-input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pomo-custom-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Timer status polish when in countdown mode */
.timer-wrapper.is-pomodoro .timer-counter {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

/* Status copy stays secondary; live color is on mode switch + tab only */

/* SVG Progress Ring Positioning
   Geometry stays in viewBox 0 0 340 340 (cx/cy 170, r 160).
   Only the container size changes on mobile — never rewrite cx/cy/r in CSS
   (that used to shift the ring off-center on phones). */
.progress-ring-container {
  position: relative;
  container-type: inline-size;
  width: 340px;
  height: 340px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
}

.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: visible;
  display: block;
  /* Keep SVG box square so the ring stays centered while scaling */
  aspect-ratio: 1 / 1;
}

.progress-ring-fill {
  stroke-dasharray: 1005.31; /* 2 * PI * r (160) — user units, independent of display size */
  stroke-dashoffset: 1005.31;
  transition: stroke-dashoffset 0.1s linear, stroke 0.6s var(--easing-apple);
}

/* Smooth organic light element behind clock */
.breathing-glow {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.04) 0%, rgba(0,0,0,0) 70%);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s var(--easing-apple), background 1s var(--easing-apple);
}

.breathing-glow.running {
  background: radial-gradient(circle, rgba(16,185,129,0.06) 0%, rgba(0,0,0,0) 70%);
  opacity: 1;
  animation: breathing-glow-pulse 4s ease-in-out infinite alternate;
}

.breathing-glow.paused {
  background: radial-gradient(circle, rgba(245,158,11,0.05) 0%, rgba(0,0,0,0) 70%);
  opacity: 1;
  animation: breathing-glow-pulse 6s ease-in-out infinite alternate;
}

@keyframes breathing-glow-pulse {
  0% { transform: scale(0.9); opacity: 0.4; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* Inner Digital Readout */
.clock-display {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timer-counter {
  font-family: var(--font-heading);
  font-size: clamp(28px, 16cqi, 52px);
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: color 0.3s var(--easing-apple), -webkit-text-fill-color 0.3s var(--easing-apple), font-size 0.25s var(--easing-apple);
}

/* Focus idle — phrase instead of 00:00:00 (must stay smaller than digits) */
.timer-counter.is-ready-phrase {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.2px;
  font-variant-numeric: normal;
  line-height: 1.25;
  max-width: 10em;
  text-align: center;
  padding: 0 1.25em;
}

/* Digits stay monochrome — live color is on tab + mode switch only */
.timer-counter.is-running,
.timer-counter.is-paused {
  /* keep title gradient / primary text */
}

.timer-status {
  position: absolute;
  left: 16%;
  right: 16%;
  top: calc(50% + 2.15rem);
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-secondary);
  letter-spacing: -0.1px;
  transition: color 0.3s var(--easing-apple);
}

.timer-status.running,
.timer-status.paused {
  color: var(--text-secondary);
}

.timer-wrapper.is-pomodoro .timer-status.running,
.timer-wrapper.is-pomodoro .timer-status.paused {
  color: var(--text-secondary);
}

/* Celebration Micro-Interactions */
.clock-display.celebrating {
  animation: celebrate-bounce 0.8s cubic-bezier(0.25, 1, 0.5, 1) both;
}

.clock-display.celebrating .timer-counter {
  color: var(--color-accent) !important;
  text-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
  scale: 1.05;
  transition: all 0.4s ease;
}

@keyframes celebrate-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.08); filter: brightness(1.2); }
  60% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

/* Floating sparkles inside the circle container */
.sparkle-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.2rem;
  z-index: 10;
  animation: float-sparkle 1.5s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes float-sparkle {
  0% {
    transform: translate(-50%, -50%) scale(0.5) translateY(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3) translateY(-60px) rotate(20deg);
    opacity: 0;
  }
}

body.project-picker-open .timer-wrapper {
  z-index: 40;
}

/* Task + project — quiet footer of the track card */
.task-input-container {
  width: 100%;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

.task-desc-input {
  width: 100%;
  max-width: 280px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border-glass);
  padding: 10px 4px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  text-align: center;
  transition: all 0.4s var(--easing-apple);
}

.task-desc-input:focus {
  outline: none;
  border-bottom-color: var(--text-secondary);
}

.task-desc-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
  transition: opacity 0.3s var(--easing-apple);
}

.task-desc-input:focus::placeholder {
  opacity: 0.25;
}

.task-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
}

/* Project picker — one polished control (replaces chip wall + native select) */
.project-picker {
  --project-color: var(--color-accent);
  --project-color-soft: rgba(0, 113, 227, 0.12);
  --project-color-border: rgba(0, 113, 227, 0.28);
  position: relative;
  z-index: 30;
  max-width: min(280px, 78vw);
}

.project-picker.open {
  z-index: 100;
}

.project-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px 8px 12px;
  border-radius: 100px;
  border: 1px solid var(--project-color-border);
  background: var(--project-color-soft);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.2s var(--easing-apple), border-color 0.2s var(--easing-apple), box-shadow 0.2s var(--easing-apple);
  -webkit-tap-highlight-color: transparent;
}

.project-picker-trigger:hover {
  filter: brightness(1.04);
}

.project-picker.open .project-picker-trigger {
  box-shadow: 0 0 0 3px var(--project-color-soft);
}

.project-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--project-color);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--project-color-soft);
}

.project-picker-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: transform 0.2s var(--easing-apple);
}

.project-picker.open .project-picker-chevron {
  transform: rotate(180deg);
}

.project-selector-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Default: absolute under trigger. When open, JS portals to body + position:fixed. */
.project-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, 88vw);
  max-height: min(220px, 50vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.14);
  z-index: 110;
}

/* Portaled open state (on <body>) — above glass card / tab bar */
body > .project-picker-menu,
.project-picker-menu.is-floating {
  position: fixed !important;
  z-index: 9999 !important;
  transform: none !important;
  margin: 0;
}

html.hide-category-icons .project-chip-icon,
html.hide-category-icons .header-profile-chip-icon,
html.hide-category-icons .track-category-chip-icon,
html.hide-category-icons .project-badge .project-chip-icon,
html.hide-category-icons .option-icon,
html.hide-category-icons .project-pill-icon {
  display: none !important;
}
html.hide-category-icons .project-pill-dot,
html.hide-category-icons .option-dot {
  display: inline-block !important;
}
html.hide-category-icons .project-edit-live-icon,
html.hide-category-icons .icon-preview-chip .project-chip-icon {
  display: inline-flex !important;
}

.appearance-icons-title {
  margin-top: 18px;
}

.icon-preview-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.icon-preview-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: inherit;
  cursor: pointer;
}
.icon-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--project-color-outline);
  background: rgba(52, 211, 153, 0.22);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

html[data-theme="light"] .icon-preview-chip {
  background: rgba(52, 211, 153, 0.14);
}


html[data-theme="light"] .project-picker-menu {
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.06);
}

.project-picker-menu.hidden,
.project-picker-menu[hidden] {
  display: none !important;
}

.sub-actions-menu {
  width: min(260px, 88vw);
}

.project-picker-option.is-destructive {
  color: #ff453a;
}

.project-picker-section {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.project-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.project-picker-option:hover,
.project-picker-option:focus-visible {
  background: var(--surface-subtle-hover);
  outline: none;
}

.project-picker-option.active {
  background: var(--project-color-soft, var(--surface-subtle));
  font-weight: 600;
}

.project-picker-option .option-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline);
}

.project-picker-option .option-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-picker-option .option-check {
  color: var(--color-accent);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
}

.project-picker-option.active .option-check {
  opacity: 1;
}

.project-picker-option .option-edit {
  flex-shrink: 0;
  font-size: 13px;
  opacity: 0.45;
  padding: 2px 4px;
  border-radius: 6px;
  line-height: 1;
}

.project-picker-option .option-edit:hover,
.project-picker-option:hover .option-edit {
  opacity: 0.9;
  background: var(--surface-subtle, rgba(127, 127, 127, 0.12));
}

.project-picker-option.is-add {
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
  border-radius: 0 0 12px 12px;
  font-weight: 600;
}

.project-picker-hint {
  padding: 8px 14px 10px;
  font-size: 12px;
  color: var(--text-tertiary, var(--text-secondary));
}

.project-picker-hint {
  padding: 8px 14px 10px;
  font-size: 12px;
  color: var(--text-tertiary, var(--text-secondary));
}

.project-picker-option.is-upgrade-for-more {
  margin: 8px 12px 10px;
  width: calc(100% - 24px);
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  justify-content: center;
}

.project-picker-option.is-upgrade-for-more .option-label {
  flex: 0 1 auto;
  text-align: center;
}

.project-picker-option.is-upgrade-for-more:hover,
.project-picker-option.is-upgrade-for-more:focus-visible {
  background: rgba(168, 85, 247, 0.18);
  color: #a855f7;
}

.project-picker-option.is-add:hover {
  color: var(--text-primary);
}

/* History / analytics badges */
.project-badge-focus {
  text-transform: none !important;
  letter-spacing: 0.01em !important;
  font-weight: 600 !important;
}

/* Pulse animation for running/paused indicators */
.manual-shortcut {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pulse-amber {
  background-color: var(--color-amber);
  box-shadow: 0 0 6px var(--color-amber);
  animation: pulse-light 1.5s infinite;
}

@keyframes pulse-light {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* Play controls — clean under the ring */
.timer-hero .controls-capsule,
.controls-capsule {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
  margin-bottom: 14px; /* room for labels under the buttons */
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  z-index: 2;
  pointer-events: auto;
}

/* Multi-button row: no heavy pill — Garmin-style open controls */
.controls-capsule.is-multi {
  padding: 0;
  background: transparent;
  border: none;
}

.control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s var(--easing-apple), opacity 0.2s var(--easing-apple);
  box-shadow: none; /* heavy shadows look like hex blobs on some GPUs */
  position: relative;
  flex-shrink: 0;
}

/* Labels — monochrome, same as icons */
.control-btn-label {
  display: block;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
}

.control-btn:active {
  transform: scale(0.94);
}

/*
 * Controls stay calm glass — no blue / green / amber / rose fills.
 * Live color lives on the Track tab + Focus/Timer switch only.
 */
.control-btn.play,
.control-btn.pause,
.control-btn.stop,
.control-btn.play.is-resume,
.control-btn.stop.is-reset {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  box-shadow: none;
}

.control-btn.play:hover,
.control-btn.pause:hover,
.control-btn.stop:hover,
.control-btn.play.is-resume:hover,
.control-btn.stop.is-reset:hover {
  background: var(--btn-secondary-bg-hover);
  border-color: var(--border-glass);
  color: var(--text-primary);
  box-shadow: none;
}

/* Primary action slightly denser fill */
.control-btn.play,
.control-btn.pause,
.control-btn.play.is-resume {
  background: color-mix(in srgb, var(--text-primary) 8%, var(--btn-secondary-bg));
}

.control-btn.stop.is-reset .btn-icon {
  fill: none !important;
  stroke: currentColor;
  stroke-width: 2.2;
}

.control-btn.pause .btn-icon.fill {
  fill: currentColor;
}

.btn-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon.fill {
  fill: currentColor;
}

.control-btn.pause .btn-icon:not(.fill) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Hidden Utility class with transition fades */
.hidden {
  display: none !important;
}

.fade-in {
  animation: simple-fade 0.4s var(--easing-apple) forwards;
}

@keyframes simple-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   DASHBOARD SPLIT GRID
   ========================================================================== */
.dashboard-stat-row {
  display: flex;
  gap: 12px;
  width: 100%;
  margin: 0 0 6px;
}
.dashboard-stat-card {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
}
.dashboard-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary, var(--text-secondary));
  margin-bottom: 6px;
}
.dashboard-stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.dashboard-range-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 14px 0 16px;
}
.dashboard-browse-anchor {
  position: absolute;
  width: 0;
  height: 0;
  overflow: visible;
}
.dashboard-browse-anchor > .history-filter-pill {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.dashboard-chart-caption,
.dashboard-empty-caption {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-tertiary, var(--text-secondary));
}
.dashboard-history-empty {
  padding: 22px 16px;
  gap: 8px;
}
.dashboard-empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.dashboard-history-empty p {
  margin: 0;
  max-width: 260px;
  line-height: 1.45;
}
.dashboard-range-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 0;
  min-height: 36px;
  padding: 0 4px;
  width: 100%;
  max-width: none;
  flex: none;
}
.dashboard-range-switcher[hidden] {
  display: none !important;
}
.dashboard-range-arrow {
  width: 40px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}
.dashboard-range-arrow:disabled {
  opacity: 0.28;
  cursor: default;
}
.dashboard-range-arrow:hover:not(:disabled) {
  background: var(--surface-subtle);
}
.dashboard-range-switcher-label {
  flex: 0 1 auto;
  min-width: 5.5em;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.dashboard-range-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 16px;
  margin: 0;
  width: 100%;
}
.dashboard-browse .history-filter-pill {
  max-width: 220px;
  padding: 8px 12px;
  font-size: 13px;
}
.day-hour-chart {
  --day-plot-h: 96px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
  width: 100%;
}
.day-hour-empty {
  position: static;
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary, var(--text-secondary));
  pointer-events: none;
  margin: 0;
}
.day-hour-body {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}
.day-hour-main {
  flex: 1 1 auto;
  min-width: 0;
}
.day-hour-plot {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: var(--day-plot-h);
  width: 100%;
}
.day-hour-axis {
  position: relative;
  height: 16px;
  margin-top: 4px;
}
.day-hour-axis-label {
  position: absolute;
  top: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 16px;
  white-space: nowrap;
  color: var(--text-secondary);
}
.day-hour-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 100%;
}
.day-hour-track {
  flex: 0 1 10px;
  width: 10px;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  border-radius: 3px 3px 2px 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
}
html[data-theme="dark"] .day-hour-track {
  background: rgba(255, 255, 255, 0.06);
}
.day-hour-track.is-tick {
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.10);
}
html[data-theme="dark"] .day-hour-track.is-tick {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.12);
}
.day-hour-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.day-hour-seg {
  width: 100%;
  box-sizing: border-box;
  border-top: 0.5px solid transparent;
}
.day-hour-baseline {
  height: 1px;
  width: 100%;
  margin-top: 2px;
  background: rgba(0, 0, 0, 0.14);
}
html[data-theme="dark"] .day-hour-baseline {
  background: rgba(255, 255, 255, 0.18);
}
.day-hour-yaxis {
  width: 34px;
  height: var(--day-plot-h);
  flex: 0 0 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding-left: 4px;
  box-sizing: border-box;
}
.day-hour-ylabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.day-hour-ylabel-zero {
  color: var(--text-tertiary);
}
.prefs-row-title {
  margin-top: 18px;
}
.prefs-hour-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.prefs-hour-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prefs-hour-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.prefs-hour-cell select {
  width: 100%;
  appearance: none;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 12px;
}
.dashboard-range-toggle {
  display: flex;
  width: 100%;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  gap: 2px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.dashboard-range-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 8px;
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  flex: 1;
}
.dashboard-range-btn:hover:not(.active) { color: var(--text-primary); }
.dashboard-range-btn.active {
  background: var(--color-accent, #0071e3);
  color: #fff;
  box-shadow: none;
}
html[data-theme="light"] .dashboard-range-btn.active {
  background: var(--color-accent, #0071e3);
  color: #fff;
  box-shadow: none;
}

@media (max-width: 580px) {
  .dashboard-stat-row {
    gap: 8px;
  }
  .dashboard-stat-card {
    padding: 12px 12px;
  }
  .dashboard-range-switcher {
    width: 100%;
    max-width: none;
    margin-left: 0;
    flex: none;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
}

.dashboard-col-left {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.dashboard-panel {
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Session history sits under breakdown + categories; list scrolls inside */
.history-panel {
  min-height: 0;
  max-height: none;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.history-panel.is-collapsed {
  max-height: none;
}

.history-panel.is-collapsed .history-container {
  min-height: 0;
  max-height: 0;
}

.history-panel.is-collapsed .panel-body {
  display: none;
}

.history-panel-toggle {
  cursor: pointer;
  user-select: none;
}

.history-collapse-btn {
  flex-shrink: 0;
}

.history-panel.is-collapsed #history-collapse-icon {
  transform: rotate(0deg);
}

.history-panel:not(.is-collapsed) #history-collapse-icon {
  transform: rotate(180deg);
}

.history-panel .panel-header {
  flex-shrink: 0;
}

.history-panel .panel-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scrollable-panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flex-header {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text-primary);
}

.panel-title.gradient {
  background: var(--panel-title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-subtitle {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ==========================================================================
   DASHBOARD PROJECTS (theme-aware chips & form)
   ========================================================================== */
.projects-panel-header {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
}

.projects-panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  -webkit-text-fill-color: var(--text-primary);
  background: none !important;
  margin: 0;
}

.projects-panel-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  flex: 1;
  min-width: 0;
}

.projects-panel-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dashboard-add-project-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease, width 0.15s ease, padding 0.15s ease;
}

.dashboard-add-project-btn:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

.dashboard-add-project-btn:active {
  transform: scale(0.94);
}

/* Free-tier limit — same purple soft pill as native Upgrade for more */
.dashboard-add-project-btn.is-upgrade {
  width: auto;
  max-width: 58%;
  min-height: 28px;
  height: auto;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dashboard-add-project-btn.is-upgrade:hover {
  background: rgba(168, 85, 247, 0.18);
  color: #a855f7;
}

.dashboard-add-project-btn.is-upgrade .dashboard-add-project-icon {
  display: none;
}

.dashboard-add-project-btn.is-upgrade .dashboard-add-project-label {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard-projects-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.dashboard-projects-list:empty {
  display: none;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 20px;
  background: var(--chip-bg);
  border: 1px solid var(--project-color-outline);
  font-size: 0.82rem;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  font-weight: 550;
  position: relative;
  transition: filter 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
}

.project-chip:hover {
  filter: brightness(0.96);
}

.project-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline);
}

.project-chip-icon,
.project-edit-live-icon,
.project-pill-icon,
.option-icon {
  font-size: 16px;
  line-height: 1.35;
  width: 1.55em;
  height: 1.55em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .project-chip-icon,
html[data-theme="dark"] .project-edit-live-icon,
html[data-theme="dark"] .project-pill-icon,
html[data-theme="dark"] .option-icon {
  background: #2a2a32;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.project-chip-folder {
  display: inline-flex;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.project-chip-label {
  color: inherit;
  -webkit-text-fill-color: currentColor;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.project-edit-btn,
.project-delete-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 2px;
  color: var(--chip-delete);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

.project-edit-btn:hover {
  color: var(--color-accent, #10b981);
  background: rgba(16, 185, 129, 0.12);
}

.project-chip.is-clickable {
  cursor: pointer;
}

.project-chip.is-clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.project-chip.is-clickable:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.project-chip.is-locked {
  cursor: default;
}

.project-chip.is-locked:hover {
  transform: none;
  box-shadow: none;
}

.project-chip-lock {
  display: inline-flex;
  color: inherit;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Dashboard project edit popup */
.project-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: project-edit-fade-in 0.2s var(--easing-apple);
}

.project-edit-overlay.hidden,
.project-edit-overlay[hidden] {
  display: none !important;
  animation: none;
}

@keyframes project-edit-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes project-edit-card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.project-edit-card {
  position: relative;
  width: min(100%, 320px);
  padding: 0;
  border-radius: 18px;
  border: 1px solid var(--border-glass);
  background: var(--card-glass);
  color: var(--text-primary);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: project-edit-card-in 0.28s var(--easing-apple);
}

.project-edit-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(128, 128, 128, 0.14);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.project-edit-close:hover {
  color: var(--text-primary);
  background: rgba(128, 128, 128, 0.22);
  transform: scale(1.04);
}

.project-edit-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 10px;
  text-align: center;
}

.project-edit-live-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

.project-edit-live-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--project-color-outline);
  background: var(--surface-subtle);
  color: inherit;
}

.project-edit-live-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--project-color-outline);
}

.project-edit-live-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: inherit;
  -webkit-text-fill-color: currentColor;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.profile-edit-live-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.profile-edit-icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-edit-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-edit-emoji-custom {
  margin-top: 8px;
}

.profile-edit-icon-btn.is-selected {
  background: var(--surface-subtle);
  border-color: var(--color-accent, #0071e3);
}

.header-profile-chip-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.profile-picker-option-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.project-chip-folder {
  font-size: 14px;
  line-height: 1;
}

.project-edit-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 16px 16px;
}

.project-edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-edit-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.project-edit-name-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.project-edit-name-input:focus {
  border-color: var(--project-edit-accent, var(--color-accent));
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--project-edit-accent, var(--color-accent)) 22%, transparent);
}

.project-edit-colors {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 26px;
  margin-top: 2px;
}

.project-edit-swatch {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 28px;
  aspect-ratio: 1;
  height: auto;
  min-height: 22px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.project-edit-swatch:hover:not(:disabled):not(.is-taken) {
  transform: scale(1.2);
}

.project-edit-swatch.is-taken,
.project-edit-swatch:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  transform: none;
}

.project-edit-swatch.is-selected {
  box-shadow:
    0 0 0 1.5px var(--card-glass),
    0 0 0 3px var(--text-primary);
  transform: scale(1.2);
}

.project-edit-custom-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  margin-top: 6px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-glass, rgba(128, 128, 128, 0.28));
  background: var(--surface-subtle, rgba(128, 128, 128, 0.08));
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.project-edit-custom-toggle-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--border-glass, rgba(128, 128, 128, 0.28));
  background: var(--project-edit-accent, #3b82f6);
  flex-shrink: 0;
}

.project-edit-custom-chevron {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-secondary);
}

.project-edit-custom-toggle[aria-expanded="true"] .project-edit-custom-chevron {
  transform: rotate(180deg);
}

.project-edit-spectrum {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.project-edit-spectrum.hidden {
  display: none;
}

.project-edit-sv {
  position: relative;
  height: 132px;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

.project-edit-sv-hue,
.project-edit-sv-white,
.project-edit-sv-black {
  position: absolute;
  inset: 0;
}

.project-edit-sv-white {
  background: linear-gradient(to right, #fff, transparent);
}

.project-edit-sv-black {
  background: linear-gradient(to top, #000, transparent);
}

.project-edit-sv-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.project-edit-hue {
  position: relative;
  height: 18px;
  border-radius: 9px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(
    to right,
    #f00,
    #ff0,
    #0f0,
    #0ff,
    #00f,
    #f0f,
    #f00
  );
}

.project-edit-hue-thumb {
  position: absolute;
  top: 1px;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.project-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.project-edit-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 40px;
  margin-top: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: transparent;
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.project-edit-delete-btn:hover {
  background: rgba(239, 68, 68, 0.08);
}

.project-edit-delete-btn.hidden,
.project-edit-delete-btn[hidden] {
  display: none !important;
}

.project-edit-btn-secondary,
.project-edit-btn-primary {
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

.project-edit-btn-secondary {
  border: 1px solid var(--chip-border);
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
}

.project-edit-btn-secondary:hover {
  background: var(--btn-secondary-bg-hover);
  color: var(--text-primary);
}

.project-edit-btn-primary {
  /* Always brand accent — project color (e.g. white) can be unreadable on dark */
  background: var(--color-accent, #0071e3);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--color-accent, #0071e3) 35%, transparent);
}

.project-edit-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.project-edit-btn-primary:active,
.project-edit-btn-secondary:active {
  transform: scale(0.98);
}

@media (max-width: 420px) {
  .project-edit-card {
    width: 100%;
    border-radius: 16px;
  }

  .project-edit-colors {
    gap: 4px;
  }
}

.project-delete-btn:hover {
  color: var(--color-rose);
  background: rgba(239, 68, 68, 0.12);
}

/* Theme toggle controls */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s var(--easing-apple);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--surface-subtle-hover);
  border-color: var(--border-glass);
}

.theme-toggle-btn svg,
.theme-toggle-btn i {
  width: 16px;
  height: 16px;
}

.theme-toggle-btn .theme-icon-sun,
.theme-toggle-btn .theme-icon-moon,
.theme-toggle-btn .theme-icon-system {
  display: none;
}

html[data-theme="light"] .theme-toggle-btn .theme-icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle-btn .theme-icon-moon {
  display: block;
}

html[data-theme-pref="system"] .theme-toggle-btn .theme-icon-sun,
html[data-theme-pref="system"] .theme-toggle-btn .theme-icon-moon {
  display: none;
}

html[data-theme-pref="system"] .theme-toggle-btn .theme-icon-system {
  display: block;
}

.appearance-card {
  margin-top: 0;
}

.theme-segmented {
  display: flex;
  width: 100%;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  box-sizing: border-box;
}

.theme-segment {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.1px;
  padding: 10px 6px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transition: background 0.2s var(--easing-apple), color 0.2s var(--easing-apple);
}

.theme-segment svg,
.theme-segment i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.theme-segment:hover {
  color: var(--text-primary);
}

.theme-segment.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.theme-segment.active svg,
.theme-segment.active i {
  color: var(--color-accent);
  stroke: var(--color-accent);
}

html[data-theme="light"] .theme-segment.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

/* ==========================================================================
   ANALYTICS & ALLOCATION DESIGN
   ========================================================================== */
.analytics-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
}

/* Empty State aesthetics */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 10px;
}

.empty-icon {
  width: 32px;
  height: 32px;
  stroke-width: 1.25;
  opacity: 0.35;
}

.empty-state p {
  font-size: 13px;
  font-weight: 400;
  opacity: 0.85;
  max-width: 240px;
  line-height: 1.5;
}

.empty-start-tracking-btn {
  margin-top: 4px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-interactive);
  font-size: 14px;
  font-weight: 600;
}

/* Allocation Bars */
.allocation-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

button.project-bar-item {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  margin: 0 -8px;
  padding: 8px 8px;
  border-radius: 12px;
  text-align: inherit;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button.project-bar-item:hover {
  background: var(--surface-subtle);
}

button.project-bar-item.is-selected {
  background: var(--surface-subtle);
  box-shadow: inset 0 0 0 1px var(--border-glass);
}

button.project-bar-item.is-dimmed {
  opacity: 0.4;
}

button.project-bar-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent, #10b981) 45%, transparent);
  outline-offset: 2px;
}

.project-bar-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
}

.project-bar-name {
  color: var(--text-primary);
}

.project-bar-percentage {
  color: var(--text-secondary);
}

.project-bar-track {
  width: 100%;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 100px;
  overflow: hidden;
}

.project-bar-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 100px;
  box-sizing: border-box;
  border: 1px solid var(--project-color-outline);
  transition: width 0.8s var(--easing-apple);
}

/* This week total (no goal bar for now) */
.weekly-summary-box {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  padding: 14px 18px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.weekly-summary-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.weekly-summary-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   WORK LOG HISTORY TIMELINE
   ========================================================================== */
.history-container {
  width: 100%;
  flex: 1 1 auto;
  min-height: 180px;
  max-height: min(60vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.history-container:has(#history-empty-state:not(.hidden)) {
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 8px;
}

.day-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 0 6px;
  position: sticky;
  top: 0;
  background: var(--bg-secondary, var(--card-glass));
  z-index: 2;
}

html[data-theme="dark"] .day-header {
  background: #141418;
}

html[data-theme="light"] .day-header {
  background: #ffffff;
}

.sessions-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle-light);
  border-radius: 10px;
  transition: all 0.3s var(--easing-apple);
}

.session-item:hover {
  background: var(--surface-subtle-hover);
  border-color: var(--border-glass);
}

.session-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}

.session-title-row {
  display: flex;
  align-items: baseline;
  min-width: 0;
}

.session-desc {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  padding-right: 6px;
}

.session-no-desc {
  color: var(--text-secondary);
  font-style: italic;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mini project badges (session history labels) */
.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--surface-subtle);
  border: 1px solid var(--project-color-outline);
  color: inherit;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
.project-badge .project-chip-icon {
  font-size: 14px;
  width: 1.55em;
  height: 1.55em;
}
.project-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline);
}

/* Color codes for project badges based on text */
.project-badge[data-project="Engineering"] {
  background: rgba(0, 113, 227, 0.06);
  border-color: rgba(0, 113, 227, 0.15);
  color: #2997ff;
}
.project-badge[data-project="Product Design"] {
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}
.project-badge[data-project="Business Development"] {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.project-badge[data-project="Client Services"] {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.session-time {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.session-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-duration {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
  padding-left: 6px;
  text-align: right;
}

/* Delete Log Button */
.btn-delete-log {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s var(--easing-apple);
}

.session-project-popover {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  min-width: 200px;
  max-height: 48vh;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary, #16161a);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.session-project-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.session-project-option:hover,
.session-project-option.is-selected {
  background: var(--surface-subtle);
}

.session-item:hover .btn-delete-log {
  color: var(--text-secondary);
}

.btn-delete-log:hover {
  color: var(--color-rose) !important;
  background: rgba(239, 68, 68, 0.08);
}

.btn-delete-log svg {
  width: 14px;
  height: 14px;
}

/* Export Button */
.btn-icon-only {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--easing-apple);
}

.btn-icon-only:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

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

/* ==========================================================================
   TAB VIEWS & CONTENT STATES
   ========================================================================== */
/* Simple show/hide only — no opacity animations (they freeze blank on iOS) */
.tab-content {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.tab-content.hidden {
  display: none !important;
}

/* ==========================================================================
   UNIFIED IOS-STYLE BOTTOM TAB BAR NAVIGATION
   ========================================================================== */
.tab-navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  /* Content row sits above the home indicator — all tabs share one baseline */
  min-height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: var(--tab-bar-bg);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-top: 0.5px solid var(--border-glass);
  display: flex;
  justify-content: space-between;
  align-items: center; /* side icons level with Track */
  z-index: 1000;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.tab-nav-item {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  max-width: none;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* center icon + label as a unit */
  gap: 4px;
  padding: 4px 2px;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s var(--easing-apple);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab-nav-label {
  display: block;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dashboard / Settings icons — same visual band as Track */
.tab-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transition: transform 0.3s var(--easing-apple), color 0.3s var(--easing-apple);
}

.tab-nav-item:not([data-tab="tracking"]) > svg,
.tab-nav-item:not([data-tab="tracking"]) > i {
  /* Match the visual center of the larger Track ring */
  width: 24px;
  height: 24px;
  margin-bottom: 1px;
}

.tab-nav-item:hover,
.tab-nav-item.active {
  color: var(--text-primary);
}

.tab-nav-item.active:not([data-tab="tracking"]) svg {
  color: var(--color-accent);
  transform: scale(1.04);
}

/* Settings tab — keep clearly tappable on phones */
.tab-nav-item[data-tab="settings"] {
  flex: 1 1 0;
  z-index: 2;
}

/* Center Track — slightly larger, same baseline as side tabs */
.tab-nav-item[data-tab="tracking"] {
  flex: 1 1 0;
  gap: 3px;
}

.tracking-btn-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-subtle-hover) 0%, var(--surface-subtle) 100%);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0; /* no upward float — aligns with Dashboard / Settings */
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.3s var(--easing-apple);
  flex-shrink: 0;
}

.tracking-btn-ring svg,
.tracking-btn-ring i {
  width: 22px;
  height: 22px;
}

/* Track tab: blue idle · green glowing when running · amber static when paused */
.tab-nav-item[data-tab="tracking"]:hover .tracking-btn-ring {
  transform: scale(1.06);
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--border-glass));
}

/* Selected, idle — accent blue (static, same energy as other selected tabs) */
.tab-nav-item[data-tab="tracking"].active:not(.running):not(.paused) .tracking-btn-ring {
  background: linear-gradient(135deg, var(--color-accent) 0%, #2997ff 100%);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35);
  animation: none;
}

.tab-nav-item[data-tab="tracking"].active:not(.running):not(.paused) .tracking-btn-ring svg,
.tab-nav-item[data-tab="tracking"].active:not(.running):not(.paused) .tracking-btn-ring i {
  color: #ffffff;
}

.tab-nav-item[data-tab="tracking"].active:not(.running):not(.paused) .tab-nav-label {
  color: var(--color-accent);
}

/* Running — emerald + glowing pulse */
.tab-nav-item[data-tab="tracking"].running .tracking-btn-ring {
  background: linear-gradient(135deg, var(--color-emerald) 0%, #059669 100%);
  border-color: transparent;
  animation: track-glow-pulse 1.6s ease-in-out infinite;
}

.tab-nav-item[data-tab="tracking"].running .tracking-btn-ring svg,
.tab-nav-item[data-tab="tracking"].running .tracking-btn-ring i {
  color: #ffffff;
}

.tab-nav-item[data-tab="tracking"].running .tab-nav-label,
.tab-nav-item[data-tab="tracking"].running {
  color: var(--color-emerald);
}

/* Paused — amber, static (no pulse) */
.tab-nav-item[data-tab="tracking"].paused .tracking-btn-ring {
  animation: none;
  background: linear-gradient(135deg, var(--color-amber) 0%, #d97706 100%);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.32);
  transform: none;
}

.tab-nav-item[data-tab="tracking"].paused .tracking-btn-ring svg,
.tab-nav-item[data-tab="tracking"].paused .tracking-btn-ring i {
  color: #ffffff;
}

.tab-nav-item[data-tab="tracking"].paused .tab-nav-label,
.tab-nav-item[data-tab="tracking"].paused {
  color: var(--color-amber);
}

@keyframes track-glow-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(16, 185, 129, 0.35),
      0 4px 14px rgba(16, 185, 129, 0.45);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(16, 185, 129, 0),
      0 6px 28px rgba(16, 185, 129, 0.7);
    transform: scale(1.05);
  }
}

/* ==========================================================================
   SETTINGS VIEW STYLING
   ========================================================================== */
.settings-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 36px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-sizing: border-box;
}

.settings-header {
  padding-bottom: 0;
}

.settings-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin: 0;
}

.settings-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: none;
}

/* Same stack as the phone: User, Preferences, Appearance, Account.
   Capped so a wide window stays one column instead of stretching into a form. */
.settings-body-split {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  align-items: stretch;
}

.settings-account-stack {
  display: contents;
}

.settings-account-panel { order: 1; }
.settings-col-appearance { order: 2; }
.settings-account-actions-wrap { order: 3; }

.settings-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

.settings-col .form-section-title {
  margin: 4px 0 0;
  border-bottom: none;
  padding-bottom: 0;
}

.settings-col .account-card,
.settings-col .appearance-card {
  width: 100%;
  margin: 0;
  flex: 1;
}

.appearance-card-header {
  margin-bottom: 4px;
}

.profile-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.developer-info-card {
  display: flex;
  gap: 12px;
  background: rgba(16, 185, 129, 0.02);
  border: 1px solid rgba(16, 185, 129, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.developer-info-card svg {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.developer-info-card span {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Form styles */
.form-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle-light);
  padding-bottom: 4px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.input-group label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-group input {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  transition: all 0.3s var(--easing-apple);
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--input-bg-focus);
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Button UI kit */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--easing-apple);
}

.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.08);
  background: var(--color-accent);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--btn-secondary-bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-rose);
}

.btn-danger:hover {
  background: var(--color-rose);
  color: var(--bg-primary);
}

.settings-actions, .auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.firebase-guide-box {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.firebase-guide-box h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.firebase-guide-box ol {
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 14px;
}

.firebase-guide-box a {
  color: var(--color-accent);
  text-decoration: none;
}

.firebase-guide-box a:hover {
  text-decoration: underline;
}

/* Authentication overlay styling */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: auth-enter 0.5s var(--easing-apple);
}

@keyframes auth-enter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.auth-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
}

.auth-header p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* "or" divider removed from ChatGPT-style login */
.auth-social-divider {
  display: none;
}

.auth-social-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-continue-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  width: 100%;
  min-height: 50px;
  padding: 0 16px !important;
  border-radius: var(--radius-interactive);
}

/* Apple always black / white (brand) — not theme-inverted */
.btn-apple.auth-continue-btn {
  background: #000000 !important;
  color: #ffffff !important;
  border: 1px solid #000000 !important;
}
.btn-apple.auth-continue-btn:hover {
  filter: brightness(1.12);
}

/* Google + phone share secondary stack chrome */
.auth-continue-btn.btn-google {
  min-height: 52px;
  font-size: 15px;
  border-width: 1px;
}

/* Theme-safe auth fields (no hardcoded white) */
.auth-field-shell {
  display: flex;
  gap: 0;
  border-radius: var(--radius-interactive);
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  overflow: hidden;
  height: 52px;
}
.auth-field-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: var(--btn-secondary-bg);
  border-right: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  min-width: 80px;
  user-select: none;
}
.auth-phone-row .auth-country-select {
  flex: 0 0 auto;
  width: auto;
  min-width: 108px;
  max-width: 148px;
  height: 100%;
  border: none;
  border-right: 1px solid var(--border-glass);
  border-radius: 0;
  background: var(--btn-secondary-bg);
  padding: 0 8px;
}
.auth-field-input {
  flex: 1;
  height: 100%;
  padding: 0 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}
.auth-otp-input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border-radius: var(--radius-interactive);
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-family: inherit;
  letter-spacing: 0.4em;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  outline: none;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-interactive);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s var(--easing-apple);
  cursor: pointer;
}

.btn-social-icon {
  width: 18px;
  height: 18px;
}

.btn-google {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

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

.btn-apple {
  background: #ffffff;
  border: none;
  color: #000000;
}

.btn-apple:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

/* Passwordless Auth Screen styling */
.btn-premium {
  background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
  cursor: pointer;
  transition: all 0.25s var(--easing-apple);
}

.btn-premium:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
  filter: brightness(1.1);
}

.scanner-laser {
  position: absolute;
  width: 100%;
  height: 2px;
  background: #a855f7;
  top: 50%;
  left: 0;
  box-shadow: 0 0 12px #a855f7;
  animation: scan-line 2s infinite ease-in-out;
}

@keyframes scan-line {
  0% { top: 10%; }
  50% { top: 90%; }
  100% { top: 10%; }
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE FLOATING BOTTOM DOCK
   ========================================================================== */
@media (max-width: 900px) {
  .history-panel {
    order: 99; /* keep history at the very bottom in the single-column stack */
  }

  .history-panel:not(.is-collapsed) .history-container {
    max-height: min(56vh, 420px);
  }

  .history-panel.is-collapsed .history-container {
    min-height: 0;
    max-height: 0;
  }
  
  .profile-fields-row {
    grid-template-columns: 1fr;
  }

  .settings-container {
    padding: 28px 20px 32px;
  }
}

@media (max-width: 580px) {
  .main-container {
    margin-top: calc(72px + env(safe-area-inset-top));
    /* Tab bar + raised Track control — keep timer ring clear of the dock */
    padding: 0 16px calc(132px + env(safe-area-inset-bottom, 0px)) 16px;
    gap: 20px;
  }
  
  .hidden-mobile {
    display: none !important;
  }

  .header-container {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-title {
    display: none; /* free header space on phones */
  }

  .header-center {
    display: none; /* title is obvious from the active tab */
  }

  .header-right {
    gap: 6px;
    margin-left: auto;
  }

  .header-settings-btn {
    display: inline-flex;
  }

  .connection-badge {
    padding: 6px 8px;
    gap: 5px;
    max-width: 42vw;
  }

  .connection-status-label {
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 72px;
  }

  .theme-toggle-btn {
    width: 36px;
    height: 36px;
  }

  .premium-header-badge {
    display: none !important; /* avoid crowding; plan shows in Settings */
  }
  
  .timer-wrapper {
    padding: 24px 16px 22px;
    margin-bottom: 4px;
  }
  
  /* Scale the ring box only — geometry stays in the 340 viewBox (centered) */
  .progress-ring-container {
    width: 260px;
    height: 260px;
  }
  
  .breathing-glow {
    width: 170px;
    height: 170px;
  }
  
  .timer-counter {
    font-size: clamp(32px, 10vw, 40px);
  }

  .timer-counter.is-ready-phrase {
    font-size: 14px;
    font-weight: 500;
  }
  
  .dashboard-panel {
    padding: 24px 16px;
  }
  
  .controls-capsule {
    margin-top: 10px;
  }

  .timer-addons {
    margin-top: 14px;
    gap: 10px;
  }

  .task-input-container {
    margin-top: 0;
    gap: 10px;
  }

  .track-mode-switch {
    margin-bottom: 18px;
  }
  
  .settings-container {
    padding: 18px 14px 28px;
    gap: 18px;
  }

  .settings-title {
    font-size: 28px;
  }

  .settings-body-split {
    gap: 18px;
  }

  .settings-account-panel,
  .settings-col {
    gap: 12px;
  }

  .profile-fields-row {
    grid-template-columns: 1fr;
  }

  .appearance-card {
    margin-top: 0;
  }

  .theme-segment {
    padding: 10px 4px;
    font-size: 12px;
  }

  .tab-navbar {
    padding-left: 4px;
    padding-right: 4px;
    padding-top: 10px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    min-height: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .tab-nav-item {
    min-height: 54px;
    font-size: 11px;
    gap: 5px;
  }

  .tab-nav-item:not([data-tab="tracking"]) > svg,
  .tab-nav-item:not([data-tab="tracking"]) > i {
    width: 24px;
    height: 24px;
  }

  .tab-nav-item[data-tab="settings"] .tab-nav-label {
    color: inherit;
    font-weight: 600;
  }

  .tracking-btn-ring {
    width: 50px;
    height: 50px;
    margin-top: 0;
  }

  .tracking-btn-ring svg,
  .tracking-btn-ring i {
    width: 23px;
    height: 23px;
  }

  #tab-settings,
  #tab-dashboard {
    overflow: visible;
    max-height: none;
  }
}

/* Very short viewports (landscape phones / small screens) */
@media (max-height: 720px) and (max-width: 900px) {
  .progress-ring-container {
    width: 240px;
    height: 240px;
  }

  .timer-wrapper {
    padding: 16px 16px 18px;
  }

  .controls-capsule {
    margin-top: 8px;
  }

  .timer-addons {
    margin-top: 12px;
  }

  .main-container {
    padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px));
  }
}

/* ==========================================================================
   PREMIUM GUIDED INSTALL PROMPT (theme-aware light / dark)
   ========================================================================== */
.install-prompt {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom)); /* Clear the tab bar, including its top padding */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  width: calc(100% - 32px);
  max-width: 420px;
  padding: 14px 44px 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 999;
  /* Follow active theme tokens */
  background: var(--card-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  box-shadow:
    0 12px 40px color-mix(in srgb, var(--bg-primary) 55%, transparent),
    0 2px 12px color-mix(in srgb, var(--text-primary) 8%, transparent);
  opacity: 0;
  transition:
    transform 0.5s var(--easing-apple),
    opacity 0.5s var(--easing-apple),
    background 0.25s var(--easing-apple),
    border-color 0.25s var(--easing-apple),
    color 0.25s var(--easing-apple),
    box-shadow 0.25s var(--easing-apple);
}

/* Stronger solid fallback where color-mix is unavailable */
html[data-theme="dark"] .install-prompt {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

html[data-theme="light"] .install-prompt {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.install-prompt.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* The card is fixed above the tab bar. Dashboard and Settings must scroll clear of it. */
html.is-dashboard-view #ext-prompt,
html.is-dashboard-view #install-prompt {
  display: none !important;
}
html:not(.is-track-view):has(#ext-prompt.visible) .main-container,
html:not(.is-track-view):has(#install-prompt.visible) .main-container {
  padding-bottom: calc(220px + env(safe-area-inset-bottom, 0px));
}

.install-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s var(--easing-apple);
}

.install-close:hover,
.install-close:active {
  background: var(--surface-subtle-hover);
  color: var(--text-primary);
}

.install-close svg {
  width: 14px;
  height: 14px;
}

.install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.install-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.install-app-icon {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: cover;
  border-radius: 10px;
}

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

.install-title {
  font-family: var(--font-heading);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.install-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.install-desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

.ios-share-inline-icon {
  display: inline-block;
  vertical-align: middle;
  width: 13px;
  height: 13px;
  margin: 0 2px;
  color: var(--color-accent);
}

.install-action-btn {
  padding: 6px 14px !important;
  border-radius: 100px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  flex-shrink: 0;
  margin-top: 0 !important;
  background: var(--color-accent) !important;
  color: #ffffff !important;
  border: none !important;
}

.install-action-btn:hover {
  filter: brightness(1.08);
}

html[data-theme="light"] .install-action-btn {
  background: var(--color-accent) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   MONETIZATION, PAYWALL & PREMIUM SYSTEMS
   ========================================================================== */
.paywall-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 12, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  animation: fade-in 0.3s ease-out forwards;
}

.paywall-overlay.hidden {
  display: none !important;
}

.paywall-content {
  text-align: center;
  padding: 32px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.paywall-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c084fc;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
  margin-bottom: 8px;
}

.paywall-icon {
  width: 24px;
  height: 24px;
}

.paywall-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #f3e8ff, #fbcfe8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.paywall-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Premium Button Styling */
.btn-premium {
  background: linear-gradient(135deg, #a855f7, #db2777);
  color: #ffffff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
  transition: all 0.3s var(--easing-apple);
}

.btn-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6), 0 0 12px rgba(236, 72, 153, 0.4);
}

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

/* Upgrade Card Container (inside bottom sheet) */
.premium-upgrade-card-wrapper {
  margin: 0;
  width: 100%;
}

.premium-upgrade-card-wrapper.hidden {
  display: none !important;
}

/* Premium bottom sheet — only when requested */
.premium-sheet {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.premium-sheet:not(.hidden) {
  pointer-events: auto;
}

.premium-sheet.hidden {
  display: none !important;
}

.premium-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s var(--easing-apple);
}

.premium-sheet.visible .premium-sheet-backdrop {
  opacity: 1;
}

.premium-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: min(88vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.28);
  transform: translateY(110%);
  transition: transform 0.35s var(--easing-apple);
  z-index: 1;
}

.premium-sheet.visible .premium-sheet-panel {
  transform: translateY(0);
}

.premium-sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 100px;
  background: var(--border-glass);
  margin: 4px auto 16px;
  touch-action: none;
}

.premium-sheet-reason {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.premium-sheet-reason.hidden {
  display: none !important;
}

html[data-theme="light"] .premium-sheet-panel {
  background: #ffffff;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .premium-sheet-backdrop {
  background: rgba(0, 0, 0, 0.28);
}

.glass-premium {
  background: var(--premium-card-bg);
  border: 1px solid var(--premium-card-border);
  box-shadow: 0 8px 32px 0 var(--premium-card-shadow);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.premium-sheet-pricing {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.premium-sheet-pricing-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin-bottom: 4px;
}

.premium-sheet-pricing-intro .premium-card-title {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.premium-sheet-pricing-intro .premium-card-desc {
  margin-bottom: 0;
}

/* Monthly / Yearly plan picker (replaces embedded pricing table) */
.premium-plan-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}
.premium-plan-card {
  appearance: none;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-radius: 14px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  position: relative;
  min-height: 108px;
}
.premium-plan-card:hover {
  border-color: rgba(168, 85, 247, 0.55);
  background: rgba(168, 85, 247, 0.08);
  transform: translateY(-1px);
}
.premium-plan-card.is-featured {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
}
.premium-plan-card.is-featured:hover {
  border-color: rgba(16, 185, 129, 0.7);
  background: rgba(16, 185, 129, 0.12);
}
.premium-plan-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 6px;
  border-radius: 999px;
}
.premium-plan-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.premium-plan-price {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-primary);
}
.premium-plan-period {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 1px;
}
.premium-plan-note {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}
.premium-plan-cta {
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #c4b5fd;
}
.premium-plan-card.is-featured .premium-plan-cta {
  color: #6ee7b7;
}
.premium-plan-features {
  margin-top: 4px;
}
@media (max-width: 380px) {
  .premium-plan-options {
    grid-template-columns: 1fr;
  }
}

.glass-premium::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.premium-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.premium-badge-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #e9d5ff;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 4px 10px;
  border-radius: 100px;
}

.premium-price {
  font-size: 13px;
  font-weight: 700;
  color: #fbcfe8;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.premium-card-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.premium-card-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.premium-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.premium-features-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.feature-icon {
  color: #c084fc;
  flex-shrink: 0;
}

/* Premium Header Badge */
.premium-header-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(236, 72, 153, 0.2));
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #e9d5ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 100px;
  margin-left: 12px;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
  animation: glow-pulse 3s infinite alternate;
}

.premium-header-badge.hidden {
  display: none !important;
}

@keyframes glow-pulse {
  0% {
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
  }
  100% {
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.35), 0 0 6px rgba(236, 72, 153, 0.2);
  }
}

/* ==========================================================================
   SETTINGS USER ACCOUNT PANEL
   ========================================================================== */
.settings-account-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.account-card {
  background: var(--surface-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: background 0.3s var(--easing-apple), border-color 0.3s var(--easing-apple);
}

.account-card:hover {
  background: var(--surface-subtle-hover);
  border-color: var(--border-glass);
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.account-icon-wrapper-offline {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  font-size: 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  font-family: inherit;
  padding: 0;
  box-shadow: none;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.account-header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.account-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
  overflow: visible;
  white-space: normal;
}

.account-sync-status {
  color: var(--color-emerald) !important;
  font-size: 11px !important;
  font-weight: 500;
}

.account-contact-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.account-contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
}

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

.account-contact-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.account-contact-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-contact-add {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--color-accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.account-contact-add.is-open {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.account-contact-add[hidden] {
  display: none !important;
}

.account-phone-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.account-phone-panel[hidden],
.account-phone-otp[hidden],
#settings-phone-entry[hidden] {
  display: none !important;
}

.account-phone-otp {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-phone-panel .phone-inline-btn {
  width: 100%;
}

.account-phone-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.account-legacy-fields,
.account-legacy-fields[hidden] {
  display: none !important;
}

.account-actions-card .account-actions {
  margin-top: 0;
}

.account-pitch {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Plan row — label and badge on the card, same as the phone. */
.account-details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 14px 0 0;
  background: transparent;
  border: none;
  border-top: 1px solid var(--border-glass);
  border-radius: 0;
}

.account-details-row-btn {
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s var(--easing-apple), border-color 0.2s var(--easing-apple);
}

.account-details-row-btn:hover {
  background: var(--surface-subtle-hover);
  border-color: var(--border-glass);
}

.account-details-row-btn:active {
  transform: scale(0.995);
}

.plan-badge-cluster {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.plan-row-chevron {
  font-size: 18px;
  line-height: 1;
  color: var(--text-tertiary);
  font-weight: 400;
  transform: translateY(-1px);
}

.details-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  text-align: left;
  padding-left: 0;
}

.plan-status-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 100px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  margin-left: 0;
  text-align: center;
  white-space: nowrap;
}

.plan-status-badge.free {
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
}

/* Same CTA as dashboard / picker / native Settings */
.plan-status-badge.upgrade-for-more {
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  letter-spacing: -0.01em;
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
}

.settings-plan-upgrade {
  display: flex;
  width: 100%;
  margin-top: 10px;
  justify-content: center;
  cursor: pointer;
}

.settings-plan-upgrade.hidden {
  display: none !important;
}

.account-actions {
  margin-top: 16px;
  width: 100%;
}

.account-actions-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.account-actions-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-actions-toggle-text strong {
  font-size: 15px;
  font-weight: 600;
}

.account-actions-chevron {
  font-size: 14px;
  opacity: 0.7;
  transition: transform 0.2s var(--easing-apple);
}

.account-actions-toggle.open .account-actions-chevron {
  transform: rotate(180deg);
}

.account-actions-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.account-actions-body.hidden,
.account-actions-body[hidden] {
  display: none !important;
}

.history-show-more-btn {
  display: flex;
  width: 100%;
  margin-top: 12px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--color-accent, #0071e3);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.history-show-more-btn:hover {
  filter: brightness(1.04);
}

.profile-edit-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.profile-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 4px 0 2px;
}

.tracking-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.tracking-profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tracking-profile-mark {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(127, 127, 127, 0.12);
  font-size: 13px;
}

.tracking-profile-row.is-active .tracking-profile-mark {
  background: rgba(0, 113, 227, 0.15);
}

.tracking-profile-mark-add {
  background: rgba(0, 113, 227, 0.12);
  color: var(--color-accent, #0071e3);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
}

.tracking-profile-row:hover {
  background: var(--surface-subtle-hover, var(--btn-secondary-bg));
}

.tracking-profile-row.is-active {
  border-color: var(--color-accent, #0071e3);
  background: rgba(0, 113, 227, 0.08);
}

.tracking-profile-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.tracking-profile-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent, #0071e3);
  flex-shrink: 0;
}

.track-context-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  margin: 14px auto 0;
}

html.is-track-view #header-profile-chip {
  display: none !important;
}

.track-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.track-category-chip .project-picker-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.track-category-chip.open {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.track-category-chip .project-pill-icon {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.track-project-slot {
  flex: 1 1 0;
  max-width: none;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.track-project-slot .project-picker {
  width: 100%;
  max-width: 100%;
}

.identity-color-section {
  margin-top: 0;
}

.identity-color-section[hidden] {
  display: none !important;
}

.identity-color-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.identity-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
}

.identity-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline, rgba(255, 255, 255, 0.32));
}

.identity-color-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-color-edit {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: 100px;
}

.identity-color-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.identity-color-custom input {
  width: 44px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.identity-color-error {
  margin: 0;
  font-size: 13px;
  color: #e11d48;
}

.identity-color-error[hidden] {
  display: none !important;
}

/* Manual add session modal */
.add-session-sub {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-secondary);
  font-weight: 500;
}

.add-session-duration-wheels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.add-session-wheel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.add-session-wheel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.add-session-wheel-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 12px 10px;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-ui);
  text-align: center;
  cursor: pointer;
}

.add-session-project-select {
  width: 100%;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  font-family: var(--font-ui);
}

.add-session-error {
  margin: 0;
  font-size: 13px;
  color: #e11d48;
}



.dashboard-identity-select {
  max-width: min(220px, 46vw);
}
.header-identity-select {
  margin-right: 8px;
  padding: 8px 10px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}
.header-profile-chip[hidden] {
  display: none !important;
}
.header-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  /* Hug label; only truncate very long names */
  width: fit-content;
  max-width: min(280px, 70vw);
  vertical-align: middle;
  flex-shrink: 0;
  min-width: 0;
}
.header-profile-chip #header-profile-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-profile-chip:hover {
  background: var(--btn-secondary-bg);
}

.header-profile-chip.is-disabled,
.header-profile-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
}

.header-profile-chip.is-disabled:hover,
.header-profile-chip:disabled:hover {
  background: var(--surface-subtle);
}

.tracking-profile-row.is-disabled,
.tracking-profile-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.tracking-profiles-lock-note {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-tertiary);
}

.header-profile-chip.open {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.header-profile-chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s var(--easing-apple);
}

.header-profile-chip.open .header-profile-chevron {
  transform: rotate(180deg);
  display: inline-block;
}

.profile-picker-hint {
  padding: 6px 12px 12px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-tertiary);
}

/* Profiles gate — same pill as Active Plan badge / project “Upgrade for more” */
.tracking-profiles-upgrade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  font: inherit;
}

.profile-input-group {
  margin: 0;
  width: 100%;
}

.profile-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.profile-field-input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-interactive);
  border: 1px solid var(--border-glass);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s var(--easing-apple), background 0.2s var(--easing-apple);
}

.profile-field-input:focus {
  border-color: var(--color-accent);
  background: var(--input-bg-focus);
}

.profile-save-btn {
  width: 100%;
  height: 40px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-interactive);
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  margin-top: 2px;
}

.profile-status-msg {
  color: var(--color-accent);
  font-size: 11px;
  text-align: center;
  margin-top: 4px;
  font-weight: 500;
}

.profile-logout-btn {
  width: 100%;
  margin-top: 2px;
}

.profile-delete-account-btn {
  width: 100%;
  margin-top: 10px;
  color: var(--color-rose, #ef4444) !important;
  border-color: color-mix(in srgb, var(--color-rose, #ef4444) 35%, transparent) !important;
  background: color-mix(in srgb, var(--color-rose, #ef4444) 8%, transparent) !important;
}

.plan-status-badge.premium {
  color: #c084fc;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: none;
  letter-spacing: 0.4px;
  font-size: 11px;
  font-weight: 700;
}

/* Accordion for Developers */
.developer-settings-accordion {
  margin-top: 16px;
  border-top: 1px solid var(--border-glass);
  padding-top: 16px;
}

.developer-summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
  list-style: none; /* Hide default arrow in some browsers */
  display: flex;
  align-items: center;
  gap: 6px;
}

.developer-summary::-webkit-details-marker {
  display: none; /* Hide default safari marker */
}

.developer-summary:hover {
  color: var(--text-primary);
}

/* Tracking view — match production proportions (wide comfortable card) */
#tab-tracking {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  align-self: center;
}

/* Track / Timer panel — visible rect; shadow reflects live state */
#tab-tracking .timer-wrapper {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  background: var(--card-glass);
  border: 1.5px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  transition:
    border-color 0.3s var(--easing-apple),
    box-shadow 0.3s var(--easing-apple);
}

html[data-theme="light"] #tab-tracking .timer-wrapper {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

#tab-tracking .timer-wrapper.is-running {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.18),
    0 12px 36px rgba(16, 185, 129, 0.28);
}

#tab-tracking .timer-wrapper.is-paused {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.16),
    0 12px 36px rgba(245, 158, 11, 0.24);
}

html[data-theme="light"] #tab-tracking .timer-wrapper.is-running {
  box-shadow:
    0 0 0 1px rgba(16, 185, 129, 0.14),
    0 12px 32px rgba(16, 185, 129, 0.2);
}

html[data-theme="light"] #tab-tracking .timer-wrapper.is-paused {
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.12),
    0 12px 32px rgba(245, 158, 11, 0.18);
}

#tab-dashboard,
#tab-settings {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

/* ==========================================================================
   TRACK: no page scroll + centered card (production-like proportions)
   ========================================================================== */
html.is-track-view,
html.is-track-view body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
  overscroll-behavior: none;
}

html.is-track-view body {
  padding-bottom: 0;
  touch-action: manipulation;
  width: 100%;
}

html.is-track-view,
html.is-track-view body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html.is-track-view::-webkit-scrollbar,
html.is-track-view body::-webkit-scrollbar {
  display: none !important;
}

/* Center the card in the viewport band */
html.is-track-view .main-container {
  max-width: 1040px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
  margin-bottom: 0;
  padding:
    calc(72px + env(safe-area-inset-top, 0px))
    24px
    calc(100px + env(safe-area-inset-bottom, 0px))
    24px;
  height: 100dvh;
  max-height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
  gap: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

html.is-track-view #tab-tracking {
  flex: 0 0 auto;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
}

/* Content-sized card — wide like production, not a skinny column */
html.is-track-view #tab-tracking .timer-wrapper {
  flex: 0 0 auto;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
  padding: 28px 40px 30px;
  box-sizing: border-box;
  overflow: visible;
}

html.is-track-view #tab-tracking .track-mode-switch {
  margin-bottom: 28px;
}

html.is-track-view #tab-tracking .timer-hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Full production-scale ring — same size for Focus and Timer (never grow in dial mode) */
html.is-track-view #tab-tracking .progress-ring-container,
html.is-track-view #tab-tracking .progress-ring-container.is-dialable {
  width: 320px;
  height: 320px;
  flex: 0 0 auto;
  overflow: visible;
  margin-left: auto;
  margin-right: auto;
  transform: none;
}

html.is-track-view #tab-tracking .progress-ring {
  width: 100%;
  height: 100%;
}

html.is-track-view #tab-tracking .controls-capsule {
  margin-top: 0;
}

html.is-track-view #tab-tracking .timer-addons {
  width: 100%;
  max-width: 360px;
  margin-top: 16px;
  padding-top: 14px;
  gap: 10px;
}

html.is-track-view #tab-tracking .timer-counter {
  font-size: clamp(28px, 16cqi, 52px);
  white-space: nowrap;
}

/* Ready phrase: track-view digit size was overriding the smaller phrase rule */
html.is-track-view #tab-tracking .timer-counter.is-ready-phrase {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.2px;
  line-height: 1.25;
  max-width: 10em;
  padding: 0 1.25em;
}

html.is-track-view #tab-tracking .control-btn {
  width: 56px;
  height: 56px;
}

html[data-theme="light"] .progress-ring-track {
  stroke: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .timer-wrapper.is-pomodoro .timer-addons {
  border-top-color: rgba(0, 0, 0, 0.06);
}

/*
 * Phones / short viewports: the card used to center + overflow-clip,
 * which hid the Focus/Timer switch at the top. Top-align and compress
 * so the switch is always visible without page scroll.
 */
@media (max-width: 580px) {
  html.is-track-view .main-container {
    padding-left: 14px;
    padding-right: 14px;
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    /* Prefer top of the card (mode switch) over vertical centering */
    justify-content: flex-start;
    align-items: center;
  }

  html.is-track-view #tab-tracking {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    justify-content: flex-start;
    overflow: hidden;
  }

  html.is-track-view #tab-tracking .timer-wrapper {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    gap: 0;
  }

  /* Keep the mode switch pinned in the visible top of the card */
  html.is-track-view #tab-tracking .track-mode-switch {
    margin-bottom: 10px;
    flex-shrink: 0;
    z-index: 6;
  }

  html.is-track-view #tab-tracking .track-mode-btn {
    padding: 7px 14px;
    font-size: 12px;
  }

  html.is-track-view #tab-tracking .timer-hero {
    gap: 10px;
    flex-shrink: 1;
    min-height: 0;
  }

  html.is-track-view #tab-tracking .progress-ring-container,
  html.is-track-view #tab-tracking .progress-ring-container.is-dialable {
    width: min(230px, 62vw);
    height: min(230px, 62vw);
    transform: none;
  }

  html.is-track-view #tab-tracking .control-btn {
    width: 50px;
    height: 50px;
  }

  html.is-track-view #tab-tracking .controls-capsule {
    margin-top: 0;
    margin-bottom: 10px;
    flex-shrink: 0;
  }

  html.is-track-view #tab-tracking .timer-addons {
    margin-top: 8px;
    padding-top: 8px;
    gap: 8px;
    flex-shrink: 0;
    width: 100%;
  }

  html.is-track-view #tab-tracking .timer-counter {
    font-size: clamp(28px, 16cqi, 42px);
    white-space: nowrap;
  }

  html.is-track-view #tab-tracking .timer-counter.is-ready-phrase {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.2px;
    line-height: 1.25;
    max-width: 10em;
  }

  /* Keep Focus/Timer card height identical — presets only (no text hint) */
  html.is-track-view #tab-tracking .pomodoro-meta,
  html.is-track-view #tab-tracking .pomodoro-meta.hidden,
  html.is-track-view #tab-tracking .pomodoro-meta:not(.hidden) {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
  }

  html.is-track-view #tab-tracking .pomodoro-meta.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* Short window: landscape phone, short side panel, short browser.
   The clock stays on screen. The rest of Track scrolls instead of clipping. */
@media (max-height: 700px) {
  html.is-track-view,
  html.is-track-view body {
    height: auto !important;
    max-height: none !important;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  html.is-track-view .main-container {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  html.is-track-view #tab-tracking,
  html.is-track-view #tab-tracking .timer-wrapper,
  html.is-extension.is-track-view #tab-tracking,
  html.is-extension.is-track-view #tab-tracking .timer-wrapper {
    overflow: visible;
    max-height: none;
  }

  html.is-track-view #tab-tracking .timer-wrapper {
    padding: 10px 12px 12px;
  }

  html.is-track-view #tab-tracking .progress-ring-container,
  html.is-track-view #tab-tracking .progress-ring-container.is-dialable,
  html.is-extension.is-track-view #tab-tracking .progress-ring-container,
  html.is-extension.is-track-view #tab-tracking .progress-ring-container.is-dialable {
    width: min(320px, 70vw, max(120px, calc(100dvh - 280px)));
    height: min(320px, 70vw, max(120px, calc(100dvh - 280px)));
    transform: none;
  }

  html.is-track-view #tab-tracking .track-mode-switch {
    margin-bottom: 8px;
  }

  html.is-track-view #tab-tracking .timer-addons {
    margin-top: 6px;
    padding-top: 6px;
  }

  html.is-track-view #tab-tracking .control-btn {
    width: 46px;
    height: 46px;
  }

  html.is-track-view #tab-tracking .controls-capsule {
    margin-bottom: 6px;
  }

  .control-btn-label {
    font-size: 9px;
    top: calc(100% + 4px);
  }
}

@media (max-height: 460px) {
  html.is-track-view .main-container {
    padding-top: calc(44px + env(safe-area-inset-top, 0px));
  }
}

html, body {
  overflow-x: hidden;
  min-height: 100%;
  min-height: 100dvh;
  position: relative;
  width: 100%;
}

/* ==========================================================================
   INTERACTIVE AVATAR HOVER & CROPPER CUSTOM STYLES
   ========================================================================== */
.user-avatar {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-avatar::after {
  content: "EDIT";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
}

.user-avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

.user-avatar:hover::after {
  opacity: 1;
}

/* Custom Zoom slider style */
#cropper-zoom-slider {
  background: rgba(255, 255, 255, 0.1);
  accent-color: var(--color-primary);
  cursor: pointer;
}

#cropper-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s;
}

#cropper-zoom-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

/* Passkey panel: only flex when visible (don't fight .hidden) */
#passkey-animation-container:not(.hidden) {
  display: flex;
}



/* ==========================================================================
   FEATURE BRANCH: product updates (recovered)
   Phone field · analytics Week/Month · history range · dial · cropper · ext
   ========================================================================== */

/* Duration dial: same ring size + stroke as Focus (no visual scale-up) */
.progress-ring-container.is-dialable {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.progress-ring-container.is-dialable:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.45);
  outline-offset: 4px;
  border-radius: 50%;
}
.progress-ring-container.is-dialable.is-dialing {
  cursor: grabbing;
}
.progress-ring-container.is-dialing .progress-ring-fill {
  transition: none;
}
/* Explicitly lock stroke to base Focus weights (2.5 track / 3 fill) */
.progress-ring-container.is-dialable .progress-ring-track {
  stroke-width: 2.5;
}
.progress-ring-container.is-dialable .progress-ring-fill {
  stroke-width: 3;
}
.progress-ring-container.is-dialable .clock-display {
  pointer-events: none;
}

/* Finger-on-ring dial hint removed (was confusing) */

/* Timer strip: presets only */
.pomodoro-meta {
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  gap: 0;
}

/* Track card: same height whether Focus or Timer */
html.is-track-view #tab-tracking .pomodoro-meta,
html.is-track-view #tab-tracking .pomodoro-meta.hidden {
  height: 52px;
  min-height: 52px;
  max-height: 52px;
}

/* History Week / All */
.history-heading {
  min-width: 0;
  flex: 1;
}

.history-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.history-title-row .panel-title {
  margin: 0;
}

.history-category-filter {
  position: relative;
  flex-shrink: 0;
}

.history-filter-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 160px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.history-filter-pill:hover {
  color: var(--text-primary);
}

.history-filter-pill.is-filtered {
  border-color: var(--accent, #0071e3);
}

.history-filter-pill:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent, #0071e3) 45%, transparent);
  outline-offset: 2px;
}

.history-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline, rgba(0, 0, 0, 0.2));
}

.history-filter-chevron {
  flex-shrink: 0;
  opacity: 0.7;
}

.history-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 200px;
  max-width: min(280px, 80vw);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: var(--bg-secondary, var(--surface-card));
  box-shadow: 0 10px 28px color-mix(in srgb, #000 18%, transparent);
}

.history-filter-option {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
}

.history-filter-option:hover,
.history-filter-option.is-selected {
  background: var(--surface-subtle);
  color: var(--text-primary);
}

.history-filter-option.is-selected {
  font-weight: 600;
}

.history-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.history-range-toggle {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  gap: 2px;
}
.history-range-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1.2;
}
.history-range-btn:hover { color: var(--text-primary); }
.history-range-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text-primary) 10%, transparent);
}
html[data-theme="light"] .history-range-btn.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Analytics Week / Month */
.analytics-panel-header {
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.analytics-period-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  gap: 2px;
  flex-shrink: 0;
}
.analytics-period-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.analytics-period-btn:hover { color: var(--text-primary); }
.analytics-period-btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text-primary) 10%, transparent);
}
html[data-theme="light"] .analytics-period-btn.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Chart frame: wraps bars + pie; icon switcher in its own toolbar row */
.analytics-chart-frame {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  box-sizing: border-box;
  min-height: 0;
}

/* Dedicated row so icons never sit on top of project names / empty copy */
.analytics-viz-toggle {
  position: static;
  align-self: flex-end;
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-glass);
  gap: 2px;
  flex-shrink: 0;
  margin: 0;
}

.analytics-viz-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  width: 34px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.analytics-viz-btn:hover {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--text-primary) 6%, transparent);
}

.analytics-viz-btn.active {
  background: var(--bg-secondary);
  color: var(--color-accent, #10b981);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text-primary) 10%, transparent);
}

html[data-theme="light"] .analytics-viz-btn.active {
  background: #fff;
  color: var(--color-accent, #10b981);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.analytics-viz-icon {
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.analytics-chart-frame .analytics-container {
  width: 100%;
  min-height: 0;
  height: auto;
  max-height: none;
  padding: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: visible;
}
.analytics-chart-frame .analytics-container:has(#analytics-empty-state:not(.hidden)) {
  align-items: center;
  justify-content: center;
}

.analytics-chart-frame .empty-state {
  width: 100%;
  min-height: 0;
  padding: 8px 0 4px;
  gap: 0;
  box-sizing: border-box;
}

.analytics-chart-frame .allocation-bars {
  gap: 14px;
  padding-top: 2px;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
}
.analytics-chart-frame .allocation-bars.is-expanded {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.analytics-chart-frame .project-bar-info {
  padding-right: 2px;
  gap: 12px;
}

.analytics-chart-frame .project-bar-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.analytics-chart-frame .project-bar-percentage {
  flex-shrink: 0;
}

/* Pie / donut — chart on top, scrollable project list underneath */
.project-pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 0;
  height: auto;
  max-height: none;
  padding: 4px 6px 2px;
  box-sizing: border-box;
  overflow: visible;
}
.project-pie-wrap.hidden { display: none !important; }
.project-pie-svg {
  flex: 0 0 auto;
  display: block;
  width: 148px;
  height: 148px;
  max-width: min(148px, 55vw);
  overflow: visible;
}
.project-pie-slice {
  transition: opacity 0.15s ease, filter 0.15s ease;
}
.project-pie-slice:hover {
  filter: brightness(1.08);
}
/* Theme rim — keeps white slices readable (matches --project-color-outline) */
.project-pie-rim {
  fill: none;
  stroke: var(--project-color-outline);
  stroke-width: 1.25px;
  pointer-events: none;
}
.project-pie-center-value {
  fill: var(--text-primary);
  font-family: var(--font-heading), system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.project-pie-center-label {
  fill: var(--text-secondary);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.project-pie-legend {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: hidden;
  overflow-x: hidden;
  padding-right: 2px;
}
.project-pie-legend.is-expanded {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.project-pie-legend-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
}
.project-pie-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.3;
  min-width: 0;
  padding: 7px 6px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.project-pie-legend-item:hover {
  background: var(--surface-subtle);
}
.project-pie-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--project-color-outline);
}
.project-pie-legend-name {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.project-pie-legend-meta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 12px;
  justify-self: end;
}
.project-pie-show-more {
  appearance: none;
  flex-shrink: 0;
  border: 1px solid var(--border-glass, rgba(128, 128, 128, 0.22));
  background: var(--surface-subtle, rgba(128, 128, 128, 0.08));
  color: var(--accent, #10b981);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  min-height: 36px;
  padding: 8px 12px;
  margin: 6px 0 0;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-interactive, 12px);
  width: 100%;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.project-pie-show-more:hover {
  opacity: 0.9;
}
.project-pie-show-more:focus-visible {
  outline: 2px solid rgba(16, 185, 129, 0.45);
  outline-offset: 2px;
}

@media (max-width: 520px) {
  .project-pie-svg {
    max-width: 180px;
  }
  .project-pie-legend {
    max-width: 100%;
  }
}
.analytics-panel-body { gap: 16px; }
.analytics-summary { width: 100%; }
.analytics-summary-hero {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.analytics-summary-hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.analytics-summary-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.analytics-summary-value,
.analytics-summary-hero .weekly-summary-value {
  font-family: var(--font-heading);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}
.analytics-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}
.analytics-daily-avg {
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
}
.analytics-daily-avg strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* Overlay bars: light = previous, dark = current */
.allocation-bars.is-overlay { gap: 16px; }
.project-bar-track-overlay {
  position: relative;
  height: 12px;
}
.project-bar-track-overlay .project-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  border-radius: 100px;
  min-width: 0;
}
.project-bar-track-overlay .project-bar-fill-previous {
  z-index: 1;
  box-shadow: none !important;
}
.project-bar-track-overlay .project-bar-fill-current {
  z-index: 2;
}

/* Compact phone field */
.account-phone-field { margin-bottom: 4px; }
.phone-inline-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.phone-country-select {
  flex: 0 0 auto;
  width: 108px;
  max-width: 140px;
  height: 42px;
  padding: 0 6px;
  border-radius: var(--radius-interactive, 12px);
  border: 1px solid var(--border-glass);
  background: var(--input-bg, var(--surface-subtle));
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.phone-inline-input { flex: 1 1 auto; min-width: 0; }
.phone-otp-input {
  flex: 1 1 auto;
  min-width: 0;
  letter-spacing: 0.2em;
  font-weight: 600;
  text-align: center;
}
.phone-inline-btn {
  flex: 0 0 auto;
  height: 42px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  white-space: nowrap;
}
.phone-otp-row.hidden,
.phone-otp-row[hidden] { display: none !important; }
.account-phone-status {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-emerald);
  line-height: 1.35;
}
.account-phone-status.is-error { color: var(--color-rose, #ef4444); }
.account-phone-status[hidden] { display: none !important; }

/* Cropper / auth safety */
.auth-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
#recaptcha-container {
  position: fixed !important;
  left: 0 !important;
  bottom: 0 !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
}
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.cropper-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cropper-modal.hidden {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
.cropper-modal-card {
  width: min(100%, 340px);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 14, 17, 0.9);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Extension promo (desktop) */
.ext-prompt .install-action-btn { display: inline-flex !important; }
.ext-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
}
.ext-guide-overlay.hidden,
.ext-guide-overlay[hidden] { display: none !important; }
.ext-guide-card {
  position: relative;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow: auto;
  padding: 22px 20px 18px;
  border-radius: 18px;
  border: 1px solid var(--border-glass);
  background: var(--card-glass);
  color: var(--text-primary);
}
.ext-guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-right: 28px;
}
.ext-guide-header h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}
.ext-guide-lead {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.ext-guide-steps {
  margin: 0 0 14px;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ext-guide-steps li {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.ext-guide-steps li strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.ext-guide-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.ext-guide-note {
  margin: 0 0 14px;
  font-size: 11.5px;
  color: var(--text-secondary);
}
@media (max-width: 700px), (pointer: coarse) and (max-width: 1024px) {
  #ext-prompt,
  #settings-ext-card {
    display: none !important;
  }
}

/* The header bar measures itself. A mid-width window and a widened side panel
   drop the wordmark and the centered title before they run into the chips. */
@container app-header (max-width: 1080px) {
  .brand-title,
  .header-center,
  .header-stat,
  .premium-header-badge {
    display: none !important;
  }

  .header-left,
  .header-right {
    flex-shrink: 1;
    min-width: 0;
  }

  .header-profile-chip {
    flex-shrink: 1;
    max-width: min(220px, 46cqw);
  }

  .connection-badge {
    min-width: 0;
    flex-shrink: 1;
  }

  .connection-status-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 9em;
  }
}

/* Chrome side panel: the shell already shows the name, and the iframe is a
   column beside another page even when the user drags it past 580px. */
html.is-extension .brand-title,
html.is-extension .header-center,
html.is-extension .header-stat,
html.is-extension .premium-header-badge,
html.is-extension #settings-ext-card,
html.is-extension #ext-prompt {
  display: none !important;
}

html.is-extension .header-left,
html.is-extension .header-right {
  flex-shrink: 1;
  min-width: 0;
}

html.is-extension .header-profile-chip {
  flex-shrink: 1;
  max-width: min(200px, 48vw);
}

html.is-extension.is-track-view .main-container {
  justify-content: flex-start;
  padding-top: calc(56px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  padding-left: 12px;
  padding-right: 12px;
}

html.is-extension.is-track-view #tab-tracking,
html.is-extension.is-track-view #tab-tracking .timer-wrapper {
  max-width: 100%;
}

html.is-extension.is-track-view #tab-tracking .timer-wrapper {
  padding: 12px 14px 14px;
}

html.is-extension.is-track-view #tab-tracking .track-mode-switch {
  margin-bottom: 10px;
}

html.is-extension.is-track-view #tab-tracking .progress-ring-container,
html.is-extension.is-track-view #tab-tracking .progress-ring-container.is-dialable {
  width: min(220px, 68vw, max(120px, calc(100dvh - 280px)));
  height: min(220px, 68vw, max(120px, calc(100dvh - 280px)));
}

html.is-extension.is-track-view #tab-tracking .timer-counter {
  font-size: clamp(28px, 16cqi, 52px);
  white-space: nowrap;
}

html.is-extension.is-track-view #tab-tracking .control-btn {
  width: 50px;
  height: 50px;
}

html.is-extension.is-track-view #tab-tracking .timer-addons {
  max-width: 100%;
}
