/* ==========================================================================
   Focus — Rosé Pine Theme Stylesheet
   ========================================================================== */

:root, [data-theme="dark"] {
  /* Dark (Rosé Pine Main) */
  --rp-base: #191724;
  --rp-surface: #1f1d2e;
  --rp-overlay: #26233a;
  --rp-muted: #6e6a86;
  --rp-subtle: #908caa;
  --rp-text: #e0def4;
  --rp-love: #eb6f92;
  --rp-gold: #f6c177;
  --rp-rose: #ebbcba;
  --rp-pine: #31748f;
  --rp-foam: #9ccfd8;
  --rp-iris: #c4a7e7;
  --rp-hl-low: #21202e;
  --rp-hl-med: #403d52;
  --rp-hl-high: #524f67;
  --rp-border: #302d41;

  --bg: var(--rp-base);
  --surface: var(--rp-surface);
  --surface-hover: var(--rp-overlay);
  --border: var(--rp-border);
  --text: var(--rp-text);
  --text-muted: var(--rp-subtle);
  --text-dim: var(--rp-muted);
  --accent: var(--rp-pine);
  --accent-love: var(--rp-love);
  --accent-gold: var(--rp-gold);
  --accent-foam: var(--rp-foam);
  --accent-iris: var(--rp-iris);

  --font-sans: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  /* Light (Rosé Pine Dawn) */
  --rp-base: #faf4ed;
  --rp-surface: #fffaf3;
  --rp-overlay: #f2e9de;
  --rp-muted: #9893a5;
  --rp-subtle: #797593;
  --rp-text: #575279;
  --rp-love: #b4637a;
  --rp-gold: #ea9d34;
  --rp-rose: #d7827e;
  --rp-pine: #286983;
  --rp-foam: #56949f;
  --rp-iris: #907aa9;
  --rp-hl-low: #f4ede8;
  --rp-hl-med: #dfdad9;
  --rp-hl-high: #cecacd;
  --rp-border: #dfdad9;

  --bg: var(--rp-base);
  --surface: var(--rp-surface);
  --surface-hover: var(--rp-overlay);
  --border: var(--rp-border);
  --text: var(--rp-text);
  --text-muted: var(--rp-subtle);
  --text-dim: var(--rp-muted);
  --accent: var(--rp-pine);
  --accent-love: var(--rp-love);
  --accent-gold: var(--rp-gold);
  --accent-foam: var(--rp-foam);
  --accent-iris: var(--rp-iris);

  --shadow-sm: 0 2px 8px rgba(87, 82, 121, 0.08);
  --shadow-md: 0 8px 24px rgba(87, 82, 121, 0.15);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    /* Light (Rosé Pine Dawn) when system prefers light and not explicitly locked to dark */
    --rp-base: #faf4ed;
    --rp-surface: #fffaf3;
    --rp-overlay: #f2e9de;
    --rp-muted: #9893a5;
    --rp-subtle: #797593;
    --rp-text: #575279;
    --rp-love: #b4637a;
    --rp-gold: #ea9d34;
    --rp-rose: #d7827e;
    --rp-pine: #286983;
    --rp-foam: #56949f;
    --rp-iris: #907aa9;
    --rp-hl-low: #f4ede8;
    --rp-hl-med: #dfdad9;
    --rp-hl-high: #cecacd;
    --rp-border: #dfdad9;

    --bg: var(--rp-base);
    --surface: var(--rp-surface);
    --surface-hover: var(--rp-overlay);
    --border: var(--rp-border);
    --text: var(--rp-text);
    --text-muted: var(--rp-subtle);
    --text-dim: var(--rp-muted);
    --accent: var(--rp-pine);
    --accent-love: var(--rp-love);
    --accent-gold: var(--rp-gold);
    --accent-foam: var(--rp-foam);
    --accent-iris: var(--rp-iris);

    --shadow-sm: 0 2px 8px rgba(87, 82, 121, 0.08);
    --shadow-md: 0 8px 24px rgba(87, 82, 121, 0.15);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom Global Rosé Pine Scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--rp-muted) var(--bg);
  overflow-x: hidden;
  max-width: 100vw;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--rp-muted);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--rp-subtle);
}

/* Remove ugly number input spin arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
}

/* ==================== HEADER ==================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

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

.brand-focus-icon {
  width: 22px;
  height: 22px;
  color: var(--rp-pine);
  flex-shrink: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.nav-tab.active {
  background: var(--surface);
  color: var(--rp-pine);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-icon {
  width: 16px;
  height: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  flex-shrink: 0;
}

.header-action-btn svg {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.header-action-btn:hover {
  color: var(--rp-pine);
  border-color: var(--rp-pine);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.header-action-btn:active {
  transform: scale(0.92);
}

.system-theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  user-select: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.system-theme-pill:hover {
  color: var(--text);
  border-color: var(--rp-pine);
  background: var(--surface-hover);
}

.system-theme-pill:active {
  transform: scale(0.95);
}

.theme-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--rp-pine);
}

/* ==================== COMMON CARDS & BUTTONS ==================== */
.main-content {
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--rp-pine);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(49, 116, 143, 0.35);
}

.btn-primary:hover {
  background: #3e8fb0;
  transform: translateY(-1px);
}

.btn-primary.running {
  background: var(--rp-love);
  box-shadow: 0 4px 12px rgba(235, 111, 146, 0.35);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--rp-hl-med);
  color: var(--text);
}

.btn-danger {
  background: rgba(235, 111, 146, 0.15);
  color: var(--rp-love);
  border: 1px solid var(--rp-love);
}

.btn-danger:hover {
  background: var(--rp-love);
  color: #fff;
}

.btn-danger-solid {
  background: var(--rp-love);
  color: #fff;
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger-solid:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background-color: var(--rp-love);
  flex-shrink: 0;
}

/* ==================== TAB 1 : TIMER PAGE ==================== */
.timer-page-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .timer-page-layout {
    grid-template-columns: 1fr;
  }
}

.timer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0 auto 12px auto;
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
}

.mode-btn {
  flex: 1;
  padding: 7px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.mode-btn:disabled,
.mode-btn.disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.8);
}

/* Project Selector Bar */
.project-selector-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 440px;
  margin: 0 auto 12px auto;
  box-sizing: border-box;
}

.project-input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 42px;
  padding: 0 8px 0 14px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-input-wrapper:focus-within {
  border-color: var(--rp-pine);
  box-shadow: 0 0 0 2px var(--rp-hl-low);
}

.project-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  min-width: 0;
}

.project-input-wrapper input::placeholder {
  color: var(--text-dim);
  opacity: 0.75;
}

.project-dropdown-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.project-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.project-dropdown-btn:hover {
  color: var(--text);
  border-color: var(--rp-hl-med);
  background: var(--rp-hl-low);
}

.dropdown-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}

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

/* Custom Rosé Pine Dropdown Menu (on PC Desktop) */
.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 100%;
  max-width: 320px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 100;
  padding: 6px;
  box-sizing: border-box;
}

.project-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.project-dropdown-item:hover {
  background: var(--rp-hl-med);
  color: var(--text);
}

.project-dropdown-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

/* Native select element: hidden on PC desktop, used as invisible touch target on mobile */
.month-projects-select {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .month-projects-select {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
  }
}

/* Durations Config (Pomodoro only: 60m / Custom, 10m / Custom) */
.durations-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 42px;
  padding: 0 12px;
  margin: 0 auto 24px auto;
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
  flex-wrap: nowrap;
}

.duration-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.duration-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.duration-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pill-presets {
  display: flex;
  gap: 3px;
}

.preset-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.preset-btn:hover {
  color: var(--text);
}

.preset-btn.active {
  background: var(--rp-pine);
  color: #fff;
  border-color: var(--rp-pine);
}

.custom-input-box {
  display: flex;
  align-items: center;
  gap: 3px;
}

.custom-input-box input {
  width: 38px;
  background: var(--surface);
  border: 1px solid var(--rp-pine);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  padding: 2px 3px;
  outline: none;
  box-sizing: border-box;
}

.custom-input-box .unit {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.duration-separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Disabled states when session is running or paused */
.project-input-wrapper input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  user-select: none;
}

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

.durations-config.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.durations-config.disabled .preset-btn,
.durations-config.disabled input {
  opacity: 0.55;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* Circular Progress Ring */
.timer-display-container {
  margin: 12px 0 28px 0;
  display: flex;
  justify-content: center;
}

.timer-circle-wrap {
  position: relative;
  width: 290px;
  height: 290px;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--rp-hl-med);
  stroke-width: 10;
}

.progress-ring-fg {
  fill: none;
  stroke: var(--rp-pine);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 879.6; /* 2 * PI * 140 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.timer-center-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.phase-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 58px;
  font-weight: 600;
  letter-spacing: -2px;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.timer-project-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-hover);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

/* Action Controls */
.timer-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Today Sessions Panel */
.today-sessions-card {
  display: flex;
  flex-direction: column;
}

.today-total-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--rp-foam);
  background: var(--surface-hover);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.session-item:hover {
  border-color: var(--rp-hl-med);
}

.session-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-proj-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
}

.session-time-range {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.session-dur {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 48px 16px;
  font-size: 13px;
}

/* ==================== TAB 2 : TIMEWARRIOR MONTH VIEW ==================== */
.month-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.month-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
}

.section-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.month-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Months Scroll Container with sleek Rosé Pine scrollbar */
.months-scroll-container {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--rp-muted) transparent;
}

.months-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.months-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.months-scroll-container::-webkit-scrollbar-thumb {
  background-color: var(--rp-muted);
  border-radius: var(--radius-full);
}

.months-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: var(--rp-subtle);
}

.months-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* History Stepper Buttons (Load earlier/later months in timeline) */
.history-nav-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
  width: 100%;
}

.history-nav-top {
  margin-bottom: 4px;
}

.history-nav-bottom {
  margin-top: 14px;
}

.btn-history-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
  user-select: none;
}

.btn-history-stepper:hover,
.btn-history-stepper:active {
  background-color: var(--overlay);
  color: var(--text);
  border-color: var(--rp-muted);
  transform: translateY(-1px);
}

.btn-history-stepper svg {
  width: 15px;
  height: 15px;
}

/* Single Month Block */
.month-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
}

.month-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface-hover);
  border-bottom: 1px solid var(--border);
}

.month-block-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.month-block-total {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--rp-foam);
  background: var(--bg);
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Month's Individual Project Legend */
.month-projects-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.month-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.month-legend-item:hover {
  color: var(--text);
}

.month-legend-empty {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* Timewarrior Matrix Table */
.timeline-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.timeline-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.timeline-header-row {
  background: var(--bg);
}

.th-date {
  width: 110px;
  max-width: 110px;
  padding: 6px 10px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.th-track-header {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.th-hours-container {
  display: flex;
  width: 100%;
  height: 24px;
  align-items: center;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-sizing: border-box;
}

.th-hour {
  flex: 1;
  text-align: center;
  color: var(--text-dim);
  font-size: 10px;
  border-left: 1px solid var(--border);
  box-sizing: border-box;
}

.th-hour:first-child {
  border-left: none;
}

.th-total {
  width: 65px;
  max-width: 65px;
  padding: 6px 10px;
  text-align: right;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.timeline-day-row {
  height: 24px;
  transition: background-color 0.1s ease;
}

.timeline-day-row:hover {
  background-color: var(--surface-hover);
}

.timeline-day-row.weekend {
  opacity: 0.85;
}

.td-date {
  width: 110px;
  max-width: 110px;
  padding: 3px 10px;
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-date .week-num {
  color: var(--text-dim);
  font-size: 10px;
  margin-right: 4px;
}

.date-mobile-short {
  display: none;
}

.date-full {
  display: inline;
}

.td-track {
  padding: 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.track-timeline {
  position: relative;
  height: 20px;
  width: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  overflow: hidden;
  box-sizing: border-box;
}

/* Grid hour lines */
.hour-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.5;
  pointer-events: none;
}

/* Tracked Session Block inside 24h timeline */
.session-block {
  position: absolute;
  top: 1px;
  bottom: 1px;
  height: 18px;
  border-radius: 3px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  z-index: 2;
  transition: filter 0.15s ease;
}

.session-block:hover {
  filter: brightness(1.2);
  z-index: 10;
}

.td-total {
  width: 65px;
  max-width: 65px;
  padding: 3px 10px;
  text-align: right;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.td-total.has-time {
  color: var(--rp-foam);
  font-weight: 600;
}

/* ==================== TAB 3 : STATS PAGE ==================== */
.stats-page-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stats-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pill-group {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.stats-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.stats-pill.active {
  background: var(--surface-hover);
  color: var(--text);
  font-weight: 600;
}

/* Unified Capsule Button (as shown in user mockup) */
.unified-capsule-btn {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 36px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.unified-capsule-btn:hover {
  border-color: var(--rp-hl-med);
}

.capsule-arrow {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 32px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.capsule-arrow svg {
  width: 14px;
  height: 14px;
}

.capsule-arrow:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.capsule-label {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 0 16px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.capsule-label:hover {
  color: var(--rp-foam);
  background: var(--surface-hover);
}

/* Stepper Controls */
.period-steppers {
  display: flex;
  align-items: center;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 800px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Project Breakdown */
.projects-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stacked-bar-container {
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}

.stacked-bar-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.proj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}

.proj-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-dim);
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.proj-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .stats-two-col {
    grid-template-columns: 1fr;
  }
}

/* Chart SVGs */
.chart-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.svg-chart {
  width: 100%;
  height: auto;
  max-height: 180px;
  display: block;
}

/* ==================== EDIT SESSION MODAL ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  z-index: 1100;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  animation: modalIn 0.15s ease-out;
  margin: auto;
  box-sizing: border-box;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close-icon {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close-icon:hover {
  color: var(--text);
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.form-row {
  display: flex;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.form-input:focus {
  border-color: var(--rp-pine);
}

input[type="datetime-local"].form-input {
  padding: 8px 10px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  position: relative;
  min-height: 38px;
}

.modal-delete-group {
  display: flex;
  align-items: center;
}

.delete-confirm-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(235, 111, 146, 0.12);
  border: 1px solid rgba(235, 111, 146, 0.4);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  box-sizing: border-box;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--rp-love);
  white-space: nowrap;
}

.confirm-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.delete-confirm-box .btn {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-height: 30px;
  height: 30px;
}

.delete-confirm-box .btn-danger-solid {
  background: var(--rp-love);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(235, 111, 146, 0.35);
}

.delete-confirm-box .btn-danger-solid:hover {
  background: #eb6f92;
  filter: brightness(1.1);
}

.delete-confirm-box .btn-secondary {
  padding: 6px 12px;
  background: var(--surface-hover);
}

.modal-actions-right {
  display: flex;
  gap: 8px;
}

/* Custom Tooltip */
.custom-tooltip {
  position: fixed;
  background: var(--rp-overlay);
  border: 1px solid var(--rp-hl-med);
  color: var(--rp-text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  pointer-events: none;
  z-index: 1200;
  box-shadow: var(--shadow-md);
  display: none;
}

/* ==================== AUTH OVERLAY ==================== */
body.auth-locked {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  background-color: var(--bg) !important;
}

body.auth-locked .app-container {
  display: none !important;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  margin: auto;
  animation: modalIn 0.2s ease-out;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-brand .brand-focus-icon {
  width: 28px;
  height: 28px;
  color: var(--rp-pine);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 24px 0;
  line-height: 1.4;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.auth-error-msg {
  background: rgba(235, 111, 146, 0.12);
  border: 1px solid var(--rp-love);
  color: var(--rp-love);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.auth-submit-btn {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
}

/* ==================== MOBILE / TOUCH SPECIFIC & RESPONSIVE DESIGN ==================== */
@media (max-width: 768px), (pointer: coarse) {
  /* Suppress keyboard hints and callouts on mobile touch screens */
  .keyboard-hint,
  .kbd-shortcut,
  [data-keyboard-hint] {
    display: none !important;
  }

  /* Prevent iOS Safari from auto-zooming and shifting layout on focus */
  .form-input,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select {
    font-size: 16px !important;
  }
}

@media (max-width: 768px) {
  /* Layout container padding with safe area for iOS bottom tab bar */
  .app-container {
    padding: 10px 12px calc(115px + env(safe-area-inset-bottom, 24px)) 12px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Header on Mobile */
  .app-header {
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-focus-icon {
    width: 20px;
    height: 20px;
  }

  .header-actions {
    gap: 8px;
  }

  /* iOS-Style Bottom Navigation Tab Bar */
  .nav-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 12px));
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
  }

  /* Extension below nav-tabs to solidly cover iOS Safari address bar area and prevent table content bleed */
  .nav-tabs::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 160px;
    background: var(--surface);
    pointer-events: none;
  }

  .nav-tab {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    padding: 4px 2px;
    border-radius: var(--radius-sm);
    text-align: center;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-muted);
    min-height: 44px; /* iOS standard tap target */
    transition: color 0.15s ease, transform 0.15s ease;
  }

  .nav-tab:hover {
    background: transparent !important;
    color: var(--text);
  }

  .nav-tab.active {
    background: transparent !important;
    color: var(--rp-pine) !important;
    font-weight: 700;
    box-shadow: none !important;
  }

  .nav-tab.active .tab-icon {
    transform: scale(1.1);
  }

  .nav-tab .tab-icon {
    width: 18px;
    height: 18px;
  }

  /* ==================== TAB 1 : TIMER PAGE MOBILE ==================== */
  .timer-page-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .timer-card {
    padding: 14px 12px;
  }

  .mode-selector {
    max-width: 100%;
    margin-bottom: 10px;
  }

  .project-selector-bar {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
  }

  .project-input-wrapper {
    width: 100%;
    height: 42px;
    box-sizing: border-box;
    padding: 0 8px 0 12px;
    gap: 8px;
  }

  .durations-config {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    height: auto;
    padding: 8px 10px;
    margin-bottom: 12px;
    box-sizing: border-box;
    overflow: hidden;
  }

  .duration-separator {
    display: none;
  }

  .duration-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .duration-label {
    font-size: 12px;
    font-weight: 600;
  }

  .duration-controls {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .preset-btn {
    padding: 3px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .custom-input-box {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .custom-input-box input {
    width: 48px;
    padding: 2px 4px;
    font-size: 13px !important;
    text-align: center;
  }

  .timer-display-container {
    margin: 4px 0 12px 0 !important;
  }

  .timer-circle-wrap {
    width: 185px !important;
    height: 185px !important;
  }

  .timer-display {
    font-size: 38px !important;
    letter-spacing: -1px;
    margin-bottom: 2px;
  }

  .phase-badge {
    font-size: 10px !important;
    margin-bottom: 2px;
  }

  .timer-project-badge {
    font-size: 11px !important;
    padding: 2px 8px !important;
  }

  .timer-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
  }

  .timer-controls .btn {
    flex: 1;
    max-width: 150px;
    min-height: 42px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .today-sessions-card {
    padding: 14px 12px;
  }

  .sessions-list {
    max-height: 360px;
  }

  .session-item {
    padding: 8px 10px;
  }

  /* ==================== TAB 2 : MONTH VIEW MOBILE ==================== */
  .month-view-wrapper {
    gap: 12px;
  }

  .month-toolbar {
    display: none !important;
  }

  .months-scroll-container {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .month-block {
    margin-bottom: 14px;
  }

  .month-block-header {
    padding: 8px 12px;
  }

  .month-block-title {
    font-size: 14px;
  }

  .month-projects-legend {
    padding: 6px 12px;
    gap: 6px 10px;
  }

  .timeline-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .timeline-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
  }

  /* Mobile: Leave ONLY the number for the date, no day name or week number */
  .date-full {
    display: none !important;
  }

  .date-mobile-short {
    display: block !important;
    font-weight: 700;
    text-align: center;
    font-size: 11px;
    line-height: 1;
  }

  .th-date,
  .td-date {
    width: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    padding: 3px 2px !important;
    text-align: center !important;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 4;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15);
  }

  .timeline-header-row .th-date {
    background: var(--bg);
  }

  .th-total,
  .td-total {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    padding: 2px 4px !important;
    font-size: 10px !important;
  }

  .th-hours-container {
    height: 20px;
  }

  .th-hour {
    font-size: 8px;
    padding: 0;
  }

  /* Show numbers every 3 hours (0, 3, 6, 9, 12, 15, 18, 21) on mobile */
  .th-hour:not(:nth-child(3n+1)) {
    color: transparent;
  }

  .track-timeline {
    height: 18px;
  }

  .timeline-day-row {
    height: 20px;
  }

  .session-block {
    font-size: 8px;
    line-height: 14px;
    padding: 0 2px;
  }

  /* ==================== TAB 3 : STATS VIEW MOBILE ==================== */
  .stats-page-layout {
    gap: 16px;
  }

  .stats-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pill-group {
    width: 100%;
    height: 38px;
    padding: 3px;
    justify-content: space-between;
  }

  .pill-group .stats-pill {
    flex: 1;
    text-align: center;
    justify-content: center;
    padding: 6px 8px;
    font-size: 13px;
  }

  .period-steppers {
    width: 100%;
  }

  .period-steppers .unified-capsule-btn {
    width: 100%;
    height: 38px;
    justify-content: space-between;
  }

  .period-steppers .capsule-label {
    flex: 1;
    font-size: 13px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 76px;
  }

  .kpi-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .kpi-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.2;
  }

  #kpi-top-project {
    font-size: 15px;
    line-height: 1.25;
    word-break: break-word;
  }

  .kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
  }

  .stats-card {
    padding: 16px 14px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
  }

  .stats-card .card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
  }

  .stats-two-col {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chart-container {
    padding: 4px 0;
    width: 100%;
    overflow: hidden;
  }

  .svg-chart {
    width: 100%;
    height: auto;
    max-height: 160px;
    display: block;
  }

  .stacked-bar-container {
    height: 16px;
    margin-bottom: 10px;
  }

  .col-sessions,
  .col-avg-dur {
    display: none !important;
  }

  .cell-time {
    white-space: nowrap;
  }

  .proj-table {
    width: 100%;
    table-layout: auto;
  }

  .proj-table th,
  .proj-table td {
    padding: 6px 8px;
    font-size: 12px;
  }

  /* Modals on Mobile */
  .modal-overlay {
    padding: 14px;
  }

  .modal-card {
    width: 100%;
    max-width: 440px;
    padding: 20px 16px;
    margin: auto;
    box-sizing: border-box;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
    align-items: stretch;
  }

  .modal-delete-group {
    width: 100%;
  }

  .modal-delete-group .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-actions-right {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .modal-actions-right .btn {
    flex: 1;
    justify-content: center;
  }

  .delete-confirm-box {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    width: 100%;
  }

  .delete-confirm-box .confirm-text {
    text-align: center;
    font-size: 13px;
    white-space: normal;
  }

  .delete-confirm-box .confirm-btns {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .delete-confirm-box .confirm-btns .btn {
    flex: 1;
    height: 38px;
    min-height: 38px;
    font-size: 13px;
    justify-content: center;
  }

  .auth-overlay {
    padding: 14px;
  }

  .auth-card {
    max-width: 100%;
    width: 100%;
    padding: 24px 18px;
  }
}

/* Completely disable hover tooltip on touch screens (kills ghost tooltip) */
@media (hover: none), (pointer: coarse) {
  #session-tooltip,
  .custom-tooltip {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (max-width: 480px) {
  .system-theme-pill #theme-label {
    display: none;
  }

  .system-theme-pill {
    padding: 4px 6px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 12px 10px;
  }

  .kpi-value {
    font-size: 19px;
  }
}

