
/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

/* NOTE: this file is served from the project root (index.html links to
   "design/design-system.css"), so no relative "../" paths back out of
   this directory are used anywhere below. */

/* ===========================================================
   DESIGN TOKENS
   =========================================================== */
:root,
[data-theme="light"] {
  /* Color — surfaces & text */
  --color-bg: #FAF7F2;
  --color-surface: #FFFFFF;
  --color-surface-2: #F1ECE3;
  --color-surface-3: #E9E1D3;
  --color-fg: #2A2420;
  --color-fg-mid: #4D453D;
  --color-fg-muted: #786F64;
  --color-fg-faint: #A69C8E;
  --color-border: #E6DFD3;
  --color-border-soft: #EFE9DF;

  /* Color — semantic */
  --color-primary: #C1502E;       /* work */
  --color-primary-soft: #F3DBCF;
  --color-primary-contrast: #FFFFFF;
  --color-accent: #5C8368;        /* break */
  --color-accent-soft: #DCE7DD;
  --color-accent-contrast: #FFFFFF;
  --color-ok: #4C8C5B;
  --color-ok-soft: #DCEBDE;
  --color-crit: #B4432F;
  --color-crit-soft: #F4DCD6;
  --color-tomato: #E2542D;
  --color-tomato-leaf: #5C8368;

  --ring-track: #EDE6D9;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;

  /* Radius */
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-pill: 9999px;

  /* Shadow (restrained) */
  --shadow-card: 0 1px 2px rgba(42,36,32,0.04), 0 4px 16px rgba(42,36,32,0.06);
  --shadow-ring: 0 8px 32px rgba(193,80,46,0.14);
  --shadow-modal: 0 12px 48px rgba(42,36,32,0.22);
  --shadow-drawer: -8px 0 32px rgba(42,36,32,0.12);

  /* Motion */
  --motion-fast: 120ms ease-out;
  --motion-base: 180ms ease-out;
  --motion-drawer: 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --motion-shimmer: 1.6s ease-in-out infinite;
}

[data-theme="dark"] {
  --color-bg: #1C1A18;
  --color-surface: #262320;
  --color-surface-2: #2F2B27;
  --color-surface-3: #3A352F;
  --color-fg: #F3EEE6;
  --color-fg-mid: #D8CFC3;
  --color-fg-muted: #B4AA9C;
  --color-fg-faint: #7A7166;
  --color-border: #3A352F;
  --color-border-soft: #332F2A;

  --color-primary: #E0724A;
  --color-primary-soft: #4A2C21;
  --color-primary-contrast: #1C1A18;
  --color-accent: #7FA888;
  --color-accent-soft: #2B3A30;
  --color-accent-contrast: #16211A;
  --color-ok: #6FB97F;
  --color-ok-soft: #223527;
  --color-crit: #D8684F;
  --color-crit-soft: #3D241F;
  --color-tomato: #E2542D;
  --color-tomato-leaf: #7FA888;

  --ring-track: #332F2A;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-ring: 0 8px 36px rgba(224,114,74,0.22);
  --shadow-modal: 0 12px 48px rgba(0,0,0,0.5);
  --shadow-drawer: -8px 0 32px rgba(0,0,0,0.4);
}

/* ===========================================================
   RESET & BASE
   =========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-fg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--motion-base), color var(--motion-base);
}
h1, h2, h3, .font-display { font-family: var(--font-display); }
button { font-family: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* Focus ring — 2px surface + 2px accent halo */
:focus-visible {
  outline: 2px solid var(--color-surface);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-primary);
  border-radius: var(--radius-control);
}

/* ===========================================================
   LAYOUT SHELL
   =========================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr;
  position: relative;
}

.topbar {
  grid-row: 1;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 16px;
}
.topbar__brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; color: var(--color-fg);
}
.topbar__brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius-control);
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar__brand-mark svg { width: 16px; height: 16px; stroke: var(--color-primary-contrast); }

.topbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Mini status chip — persists in topbar while drawer is closed and a
   session is running, so dismissing the drawer never loses state */
.mini-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-fg);
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.mini-status-chip:hover { background: var(--color-surface-2); }
.mini-status-chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary);
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.mini-status-chip__dot.is-break { background: var(--color-accent); }
.mini-status-chip__time {
  font-variant-numeric: tabular-nums;
  color: var(--color-fg-muted);
}

.main-layout {
  grid-row: 2;
  padding: 32px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===========================================================
   THEME SWITCHER
   =========================================================== */
.theme-switch {
  display: inline-flex;
  align-items: center;
  background: var(--color-surface-3);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.theme-switch__btn {
  border: none;
  background: transparent;
  color: var(--color-fg-muted);
  width: 36px; height: 32px;
  border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.theme-switch__btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.theme-switch__btn[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-card);
}
.theme-switch__btn:hover:not([aria-pressed="true"]) {
  background: var(--color-border-soft);
  color: var(--color-fg);
}

/* ===========================================================
   MAIN VIEW HEADER (quick actions above the list)
   =========================================================== */
.main-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.main-view-header__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-fg);
}
.main-view-header__subtitle {
  font-size: 13px;
  color: var(--color-fg-muted);
  margin-top: 2px;
}

/* ===========================================================
   OPEN-TIMER CTA CARD (default closed-drawer state)
   =========================================================== */
.open-timer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.open-timer-card__ring-preview {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 6px solid var(--ring-track);
  border-top-color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
}
.open-timer-card__ring-preview svg { width: 32px; height: 32px; stroke: var(--color-primary); fill: none; }

/* ===========================================================
   BUTTONS
   =========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-ghost {
  background: transparent;
  color: var(--color-fg);
  border-color: var(--color-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-2); }

.btn-text {
  background: transparent;
  color: var(--color-fg-muted);
  border-color: transparent;
  padding: 8px 12px;
}
.btn-text:hover:not(:disabled) { color: var(--color-fg); background: var(--color-surface-2); }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-fg);
  border-radius: var(--radius-pill);
}
.btn-icon:hover:not(:disabled) { background: var(--color-surface-2); }

/* ===========================================================
   HISTORY PANEL / LIST
   =========================================================== */
.history-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.history-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.history-panel__title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}
.history-panel__count {
  font-size: 12px;
  color: var(--color-fg-muted);
  background: var(--color-surface-2);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
}
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-control);
  background: var(--color-bg);
}
.history-row__icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.history-row__icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.history-row__icon.is-break {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.history-row__title {
  flex: 1;
  font-size: 13px;
  color: var(--color-fg);
}
.type-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.type-badge.is-break {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.history-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: var(--color-fg-muted);
}
.history-panel__footer {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* ===========================================================
   EMPTY / LOADING STATES
   =========================================================== */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--color-fg-muted);
}
.history-empty svg { width: 32px; height: 32px; stroke: var(--color-fg-faint); fill: none; }
.history-empty__title { font-weight: 600; color: var(--color-fg); margin: 0; }
.history-empty__body { font-size: 13px; margin: 0; max-width: 280px; }

.skeleton-block {
  display: inline-block;
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-surface-3) 50%, var(--color-surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer var(--motion-shimmer);
  border-radius: var(--radius-control);
}
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.skeleton-block.is-icon { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-block.is-title { flex: 1; height: 14px; }
.skeleton-block.is-badge { width: 50px; height: 18px; border-radius: var(--radius-pill); }
.skeleton-block.is-meta { width: 60px; height: 14px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===========================================================
   TIMER DRAWER
   =========================================================== */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-drawer);
  z-index: 40;
}
.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}
.timer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--color-surface);
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform var(--motion-drawer);
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.timer-drawer.is-open {
  transform: translateX(0);
}
.timer-drawer__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.timer-drawer__esc-hint {
  font-size: 12px;
  color: var(--color-fg-faint);
  margin-right: auto;
}
.kbd-chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 11px;
}
.timer-drawer__close {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--color-fg-muted);
  border-radius: var(--radius-control);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.timer-drawer__close:hover { background: var(--color-surface-2); color: var(--color-fg); }
.timer-drawer__close svg { width: 16px; height: 16px; stroke: currentColor; }

.timer-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.mode-tabs {
  display: inline-flex;
  background: var(--color-surface-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.mode-tabs__btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-fg-muted);
  cursor: pointer;
}
.mode-tabs__btn[aria-selected="true"].is-work {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}
.mode-tabs__btn[aria-selected="true"].is-break {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.session-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-fg-muted);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-fg-faint);
}

.timer-ring-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
}
.timer-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring-track { fill: none; stroke: var(--ring-track); stroke-width: 14; }
.timer-ring-progress {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.timer-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.timer-readout__time {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
}
.timer-readout__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-fg-muted);
}

.cycle-dots {
  display: flex;
  gap: 8px;
}
.cycle-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ring-track);
}
.cycle-dot.is-complete { background: var(--color-primary); }

.timer-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-meta {
  font-size: 12px;
  color: var(--color-fg-muted);
  margin: 0;
}

/* ===========================================================
   COMPLETION CARD
   =========================================================== */
.completion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 12px 4px;
}
.completion-card__illustration { width: 88px; height: 88px; }
.completion-card__title {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0;
}
.completion-card__body {
  font-size: 13px;
  color: var(--color-fg-muted);
  margin: 0;
  max-width: 320px;
}
.completion-card__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}ry); }
.open-timer-card__title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--color-fg); }
.open-timer-card__body { font-size: 13.5px; color: var(--color-fg-muted); max-width: 320px; }

/* ===========================================================
   TIMER DRAWER (the "detail" surface — slide-over, dismissible)
   =========================================================== */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 40;
  pointer-events: none;
}
.drawer-scrim.is-open { pointer-events: auto; }

.timer-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 420px;
  max-width: 92vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-drawer);
  z-index: 41;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--motion-drawer);
}
.timer-drawer.is-open { transform: translateX(0); }

.timer-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}
.timer-drawer__close {
  width: 36px; height: 36px;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-fg-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.timer-drawer__close:hover { background: var(--color-surface-2); }
.timer-drawer__close svg { width: 16px; height: 16px; }
.timer-drawer__esc-hint {
  font-size: 12px;
  color: var(--color-fg-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.mode-tabs {
  display: inline-flex;
  background: var(--color-surface-3);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
}
.mode-tabs__btn {
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--color-fg-muted);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.mode-tabs__btn[aria-selected="true"].is-work {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.mode-tabs__btn[aria-selected="true"].is-break {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.mode-tabs__btn:not([aria-selected="true"]):hover {
  color: var(--color-fg);
}

/* Status pill shown above the ring */
.session-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-fg-muted);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-fg-faint);
}
.status-dot.is-running { background: var(--color-primary); animation: pulse 1.6s ease-in-out infinite; }
.status-dot.is-break-running { background: var(--color-accent); animation: pulse 1.6s ease-in-out infinite; }
.status-dot.is-paused { background: var(--color-fg-faint); }
.status-dot.is-done { background: var(--color-ok); }
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.35; }
}

/* The ring */
.timer-ring-wrap {
  position: relative;
  width: 280px; height: 280px;
  display: flex; align-items: center; justify-content: center;
}
.timer-ring-wrap svg { transform: rotate(-90deg); width: 280px; height: 280px; }
.timer-ring-track { stroke: var(--ring-track); stroke-width: 10; fill: none; }
.timer-ring-progress {
  stroke: var(--color-primary);
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--motion-base), stroke var(--motion-base);
}
.timer-ring-progress.is-break { stroke: var(--color-accent); }
.timer-ring-progress.is-paused { stroke: var(--color-fg-faint); }
.timer-ring-progress.is-done { stroke: var(--color-ok); }

/* Legacy alias retained intentionally: some earlier specs referenced
   `.timer-ring-pro` as a shorthand class name for the "progress" ring.
   Kept as a full alias (not truncated) so any markup using the older
   name still resolves to identical styling. */
.timer-ring-pro {
  stroke: var(--color-primary);
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--motion-base), stroke var(--motion-base);
}
.timer-ring-pro.is-break { stroke: var(--color-accent); }
.timer-ring-pro.is-paused { stroke: var(--color-fg-faint); }
.timer-ring-pro.is-done { stroke: var(--color-ok); }

.timer-readout {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.timer-readout__time {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 56px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--color-fg);
}
.timer-readout__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-fg-muted);
}

/* Controls row */
.timer-controls {
  display: flex; gap: 12px; align-items: center;
}
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-control);
  padding: 12px 24px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  transition: background var(--motion-fast), transform var(--motion-fast), border-color var(--motion-fast);
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-primary) 88%, black); }
.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-fg-mid);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-surface-2); }
.btn-text {
  background: transparent;
  color: var(--color-fg-muted);
  padding: 8px 10px;
  min-height: 36px;
  font-size: 13px;
}
.btn-text:hover:not(:disabled) { color: var(--color-crit); }
.btn-icon {
  width: 44px; height: 44px; padding: 0;
  justify-content: center;
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-fg-mid);
}
.btn-icon:hover:not(:disabled) { background: var(--color-surface-2); }

.session-meta {
  font-size: 13px;
  color: var(--color-fg-faint);
  text-align: center;
}

/* Cycle dots (pomodoro #N of 4) */
.cycle-dots { display: flex; gap: 8px; }
.cycle-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ring-track);
  border: 1px solid var(--color-border);
}
.cycle-dot.is-complete { background: var(--color-primary); border-color: var(--color-primary); }
.cycle-dot.is-current { background: var(--color-primary-soft); border-color: var(--color-primary); }

/* ===========================================================
   HISTORY LIST (the "list" — dense row discipline)
   =========================================================== */
.history-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}
.history-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border-soft);
}
.history-panel__title {
  font-size: 15px; font-weight: 700; color: var(--color-fg);
  display: flex; align-items: center; gap: 8px;
}
.history-panel__count {
  font-size: 12px; font-weight: 600;
  color: var(--color-fg-faint);
  background: var(--color-surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.history-list {
  list-style: none;
  margin: 0; padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
}

/* Dense row — timestamp, duration, type badge */
.history-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  transition: background var(--motion-fast);
}
.history-row:hover { background: var(--color-surface-2); }

.history-row__icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-row__icon.is-work { background: var(--color-primary-soft); color: var(--color-primary); }
.history-row__icon.is-break { background: var(--color-accent-soft); color: var(--color-accent); }
.history-row__icon svg { width: 16px; height: 16px; }

.history-row__title {
  font-size: 13.5px; font-weight: 600; color: var(--color-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Type badge — pill, explicit per row.3 */
.type-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.type-badge.is-work { background: var(--color-primary-soft); color: var(--color-primary); }
.type-badge.is-break { background: var(--color-accent-soft); color: var(--color-accent); }

/* Duration + timestamp — tabular, right-aligned */
.history-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.history-row__duration {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-fg-mid);
  font-variant-numeric: tabular-nums;
}
.history-row__time {
  font-size: 11.5px;
  color: var(--color-fg-faint);
  font-variant-numeric: tabular-nums;
}

.history-panel__footer {
  padding: 12px 20px;
  border-top: 1px solid var(--color-border-soft);
}

/* Inline destructive confirm (replaces footer content) */
.confirm-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--color-fg);
}
.confirm-inline__actions { display: flex; gap: 8px; }

/* ===========================================================
   EMPTY STATE
   =========================================================== */
.history-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 40px 32px;
  text-align: center;
  color: var(--color-fg-muted);
}
.history-empty svg { width: 40px; height: 40px; stroke: var(--color-fg-faint); }
.history-empty__title { font-weight: 600; color: var(--color-fg); font-size: 14px; }
.history-empty__body { font-size: 13px; max-width: 260px; }

/* ===========================================================
   LOADING / SKELETON STATE
   =========================================================== */
.skeleton-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.skeleton-block {
  background: linear-gradient(
    90deg,
    var(--color-surface-2) 25%,
    var(--color-surface-3) 37%,
    var(--color-surface-2) 63%
  );
  background-size: 400% 100%;
  animation: shimmer var(--motion-shimmer);
  border-radius: 6px;
}
.skeleton-block.is-icon { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-block.is-title { height: 13px; width: 70%; }
.skeleton-block.is-badge { height: 18px; width: 48px; border-radius: var(--radius-pill); }
.skeleton-block.is-meta { height: 11px; width: 54px; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skeleton-ring {
  width: 280px; height: 280px;
  border-radius: 50%;
  background: var(--color-surface-2);
  position: relative;
  overflow: hidden;
}
.skeleton-ring::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    90deg,
    transparent 25%,
    rgba(255,255,255,0.35) 50%,
    transparent 75%
  );
  animation: shimmer var(--motion-shimmer);
  background-size: 400% 100%;
}

/* ===========================================================
   COMPLETION CARD (drawer content on completion — concrete markup)
   =========================================================== */
.completion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 8px 8px 0;
}
.completion-card__illustration {
  width: 88px;
  height: 88px;
}
.completion-card__title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600; color: var(--color-fg);
}
.completion-card__body { font-size: 14px; color: var(--color-fg-muted); line-height: 1.5; max-width: 320px; }
.completion-card__actions { display: flex; gap: 10px; margin-top: 8px; width: 100%; }
.completion-card__actions .btn { flex: 1; justify-content: center; }

/* kbd chip */
.kbd-chip {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--color-fg-muted);
}

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1024px) {
  .timer-drawer { width: 100%; max-width: 100%; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 16px; }
  .main-layout { padding: 16px; gap: 16px; }
  .timer-drawer {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: auto; max-height: 92vh;
    border-left: none;
    border-top: 1px solid var(--color-border);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    transform: translateY(100%);
  }
  .timer-drawer.is-open { transform: translateY(0); }
  .timer-ring-wrap { width: 220px; height: 220px; }
  .timer-ring-wrap svg { width: 220px; height: 220px; }
  .timer-readout__time { font-size: 44px; }
  .timer-controls { flex-wrap: wrap; justify-content: center; }
  .open-timer-card { padding: 28px 20px; }
}