:root,
:root[data-theme="dark"] {
  --bg: #070a08;
  --surface: rgba(14, 22, 17, 0.75);
  --card: rgba(16, 26, 19, 0.6);
  --border: rgba(255, 255, 255, 0.055);
  --border-active: rgba(74, 222, 128, 0.28);

  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.08);
  --green-mid: rgba(74, 222, 128, 0.16);
  --green-glow: rgba(74, 222, 128, 0.35);
  --coral: #fb7185;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --blue: #60a5fa;

  --text: #daf0e3;
  --muted: #567065;
  --dim: #2a3d32;

  --input-bg: rgba(0, 0, 0, 0.22);
  --modal-bg: #0e1611;
  --header-bg: rgba(7, 10, 8, 0.82);
  --section-tint: rgba(0, 0, 0, 0.14);
  --track-bg: rgba(255, 255, 255, 0.05);
  --orb-a: rgba(74, 222, 128, 0.13);
  --orb-b: rgba(167, 139, 250, 0.10);
  --primary-ink: #030b05;
  --chart-dim: var(--dim);

  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="light"] {
  --bg: #f6faf7;
  --surface: rgba(255, 255, 255, 0.82);
  --card: rgba(255, 255, 255, 0.78);
  --border: rgba(11, 40, 20, 0.09);
  --border-active: rgba(22, 163, 74, 0.45);

  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.10);
  --green-mid: rgba(22, 163, 74, 0.20);
  --green-glow: rgba(22, 163, 74, 0.30);
  --coral: #e11d48;
  --violet: #7c3aed;
  --amber: #d97706;
  --blue: #2563eb;

  --text: #0a2014;
  --muted: #587062;
  --dim: #a8c4b2;

  --input-bg: rgba(10, 32, 20, 0.04);
  --modal-bg: #ffffff;
  --header-bg: rgba(246, 250, 247, 0.85);
  --section-tint: rgba(10, 32, 20, 0.025);
  --track-bg: rgba(10, 32, 20, 0.06);
  --orb-a: rgba(22, 163, 74, 0.14);
  --orb-b: rgba(124, 58, 237, 0.08);
  --primary-ink: #ffffff;
  --chart-dim: rgba(10, 32, 20, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 10px; }

/* ─── Background orbs ─── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
}

.bg-orb--a {
  width: 800px;
  height: 800px;
  top: -350px;
  left: -250px;
  background: radial-gradient(circle, var(--orb-a) 0%, transparent 65%);
}

.bg-orb--b {
  width: 600px;
  height: 600px;
  bottom: 10%;
  right: -200px;
  background: radial-gradient(circle, var(--orb-b) 0%, transparent 65%);
}

/* ─── Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  height: 58px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-clock {
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.5));
}

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

.streak-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--green-dim);
  transition: border-color 0.3s ease, color 0.3s ease;
}

.streak-pill.has-streak {
  border-color: var(--border-active);
  color: var(--green);
}

.streak-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  flex-shrink: 0;
}

.streak-pill.has-streak .streak-pip {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pip-pulse 2s ease-in-out infinite;
}

@keyframes pip-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--green); }
  50% { box-shadow: 0 0 10px var(--green); }
}

.header-date {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ─── Main ─── */
main { position: relative; z-index: 1; }

/* ─── Hero ─── */
.hero {
  display: flex;
  align-items: center;
  padding: 48px 32px 40px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 56px;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

.hero-copy {
  max-width: 560px;
}

/* ─── Typography ─── */
.eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 12px;
}

h1 {
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1.0;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 16px;
}

h2 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--text);
}

h3 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.lede {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 38ch;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 26px;
}

.workflow-step {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  backdrop-filter: blur(12px);
}

.workflow-step span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--green-dim);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
}

.workflow-step strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
  font-size: 0.88rem;
}

.workflow-step p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

/* ─── Timer widget ─── */
.timer-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  transition: border-color 0.45s ease, box-shadow 0.45s ease;
}

.timer-widget.is-running {
  border-color: var(--border-active);
  animation: widget-glow 2.6s ease-in-out infinite;
}

@keyframes widget-glow {
  0%, 100% { box-shadow: 0 0 50px rgba(74, 222, 128, 0.08); }
  50%       { box-shadow: 0 0 90px rgba(74, 222, 128, 0.22); }
}

/* Mode buttons */
.mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.mode-btn {
  padding: 9px 4px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  min-height: unset;
  font-family: inherit;
  transition: all 0.16s ease;
}

.mode-btn:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.mode-btn.is-active {
  border-color: var(--border-active);
  color: var(--green);
  background: var(--green-dim);
}

/* Timer face */
.timer-face {
  text-align: center;
  padding: 22px 0 18px;
}

.mode-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

.time-display {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 5.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}

.status-line {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.3em;
}

/* Controls */
.control-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

button, .btn-log {
  min-height: 42px;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  transition: all 0.16s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--green);
  color: var(--primary-ink);
  border-color: var(--green);
}

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

.btn-primary.is-running {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

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

.btn-ghost:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.btn-ghost.is-active {
  border-color: var(--border-active);
  color: var(--green);
  background: var(--green-dim);
}

/* Note form */
.note-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.note-form input {
  padding: 0 14px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.83rem;
  transition: border-color 0.16s ease;
}

.note-form input::placeholder { color: var(--dim); }

.note-form input:focus {
  outline: none;
  border-color: var(--border-active);
}

.btn-log {
  padding: 0 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.83rem;
}

.btn-log:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.timer-more {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.timer-more summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  list-style: none;
  transition: color 0.16s ease;
}

.timer-more summary::-webkit-details-marker { display: none; }

.timer-more summary:hover {
  color: var(--green);
}

.timer-more summary::after {
  content: "+";
  margin-left: 7px;
  color: var(--green);
}

.timer-more[open] summary::after {
  content: "-";
}

.timer-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.btn-tool {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  transition: all 0.16s ease;
}

.btn-tool:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.btn-tool.is-active {
  border-color: var(--border-active);
  color: var(--green);
  background: var(--green-dim);
}

.btn-tool:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ─── Today section ─── */
.today-section {
  padding: 44px 32px;
  background: var(--section-tint);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-wrap {
  max-width: 1240px;
  margin: 0 auto;
}

.section-head { margin-bottom: 20px; }

.section-intro {
  max-width: 58ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.today-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 14px;
}

.stat-card {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(12px);
}

.stat-card--primary {
  border-color: var(--border-active);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.07) 0%, rgba(16, 26, 19, 0.6) 100%);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 6px;
}

.stat-value--md { font-size: 1.7rem; }

.stat-sub {
  font-size: 0.73rem;
  color: var(--muted);
}

/* ─── Insights section ─── */
.insights-section {
  padding: 48px 32px;
}

.insights-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  align-items: start;
}

.insights-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.insights-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.insight-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  backdrop-filter: blur(12px);
}

.advanced-insights {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  backdrop-filter: blur(12px);
}

.advanced-insights summary {
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  list-style: none;
}

.advanced-insights summary::-webkit-details-marker { display: none; }

.advanced-insights summary::after {
  content: "Open";
  float: right;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.advanced-insights[open] summary::after {
  content: "Hide";
}

.advanced-insights .insight-card {
  margin-top: 16px;
  padding: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
}

/* ─── Activity clock ─── */
.insight-card--clock {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clock-face-wrap {
  width: 100%;
  aspect-ratio: 1;
}

.clock-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: auto;
}

.clock-legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.clock-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.clock-legend-item span {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

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

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

/* ─── Weekly chart ─── */
.weekly-chart {
  display: flex;
  align-items: stretch;
  gap: 8px;
  height: 150px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-bar-outer {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.chart-bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  background: var(--green-mid);
  border-top: 1px solid rgba(74, 222, 128, 0.22);
  min-height: 0;
  transition: height 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-col.is-today .chart-bar {
  background: var(--green);
  border-top: none;
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.45);
}

.chart-col.is-empty .chart-bar {
  min-height: 3px;
  background: var(--chart-dim);
  border-top: none;
}

.chart-day {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.63rem;
  font-weight: 600;
  color: var(--muted);
  width: 100%;
}

.chart-col.is-today .chart-day {
  color: var(--green);
  font-weight: 800;
}

/* ─── Mode breakdown ─── */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.breakdown-track { display: flex; flex-direction: column; gap: 8px; }

.breakdown-topline {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}

.breakdown-topline span { color: var(--muted); }
.breakdown-topline strong { color: var(--text); }

.bar-shell {
  height: 5px;
  border-radius: 100px;
  background: var(--track-bg);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.breakdown-track:nth-child(1) .bar-fill { background: var(--green); }
.breakdown-track:nth-child(2) .bar-fill { background: var(--coral); }
.breakdown-track:nth-child(3) .bar-fill { background: var(--violet); }
.breakdown-track:nth-child(4) .bar-fill { background: var(--amber); }

/* ─── Streak card ─── */
.insight-card--streak {
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.07) 0%, rgba(16, 26, 19, 0.6) 100%);
  border-color: rgba(74, 222, 128, 0.14);
}

.streak-hero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.streak-number {
  font-size: 3.6rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--green);
}

.streak-unit {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muted);
}

.streak-msg {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.streak-meta {
  display: flex;
  gap: 24px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.streak-meta-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.streak-meta-item span {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.streak-meta-item strong {
  font-size: 0.98rem;
  color: var(--text);
  font-weight: 700;
}

/* ─── Peak patterns ─── */
.peak-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.peak-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  gap: 12px;
}

.peak-item:last-child { border-bottom: none; }
.peak-item span { color: var(--muted); }
.peak-item strong { color: var(--text); font-weight: 700; }

/* ─── History ─── */
.history-section {
  padding: 44px 32px 64px;
  background: var(--section-tint);
  border-top: 1px solid var(--border);
}

.empty-state {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 20px 0;
}

.empty-state.is-hidden { display: none; }

.session-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  display: grid;
  grid-template-columns: 120px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  backdrop-filter: blur(8px);
  transition: border-color 0.18s ease;
  position: relative;
}

.session-item:hover { border-color: var(--border-active); }

.session-mode {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 10px;
  border-radius: 7px;
  width: fit-content;
  max-width: 100%;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(74, 222, 128, 0.14);
}

.session-mode[data-mode="projects"] {
  color: var(--coral);
  background: rgba(251, 113, 133, 0.08);
  border-color: rgba(251, 113, 133, 0.14);
}

.session-mode[data-mode="work"] {
  color: var(--violet);
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.14);
}

.session-mode[data-mode="entertainment"] {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.14);
}

.session-info { display: flex; flex-direction: column; gap: 3px; }

.session-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.session-note { font-size: 0.83rem; color: var(--text); }
.session-note.is-empty { color: var(--muted); font-style: italic; }

.session-duration {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

/* ─── Auth UI ─── */
.auth-area {
  display: flex;
  align-items: center;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--dim);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-signin {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: unset;
  transition: all 0.16s ease;
}

.btn-signin:hover {
  border-color: var(--border-active);
  background: var(--green-dim);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  object-fit: cover;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.btn-signout {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 10px;
  min-height: unset;
  font-family: inherit;
  transition: all 0.16s ease;
}

.btn-signout:hover {
  color: var(--coral);
  border-color: rgba(251, 113, 133, 0.3);
}

/* Sync indicator */
.sync-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 6px;
  vertical-align: middle;
  animation: pip-pulse 2s ease-in-out infinite;
}

/* ─── Timer toolbar (type tabs + manual log button) ─── */
.timer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.timer-type {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  gap: 2px;
}

.type-btn {
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-height: unset;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: color 0.16s ease, background 0.16s ease;
}

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

.type-btn.is-active {
  background: var(--green-dim);
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--border-active);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  min-height: unset;
  font-family: inherit;
  transition: all 0.16s ease;
}

.btn-icon:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.btn-icon svg { flex-shrink: 0; }

/* ─── Countdown presets ─── */
.countdown-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.2fr;
  gap: 6px;
  margin-top: 8px;
}

.preset-btn {
  padding: 8px 0;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-height: unset;
  font-family: inherit;
  transition: all 0.16s ease;
}

.preset-btn:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.preset-btn.is-active {
  border-color: var(--border-active);
  color: var(--green);
  background: var(--green-dim);
}

.preset-custom {
  padding: 0 10px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: center;
  transition: border-color 0.16s ease;
}

.preset-custom::placeholder { color: var(--dim); }
.preset-custom:focus { outline: none; border-color: var(--border-active); }
.preset-custom::-webkit-outer-spin-button,
.preset-custom::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.time-display.is-warning { color: var(--amber); }
.time-display.is-done    { color: var(--coral); animation: done-flash 1.2s ease-in-out 3; }
@keyframes done-flash {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ─── Goal ring card ─── */
.stat-card--goal {
  display: flex;
  align-items: center;
  gap: 18px;
  border-color: var(--border-active);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.07) 0%, rgba(16, 26, 19, 0.6) 100%);
}

.goal-ring-wrap {
  flex-shrink: 0;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
}

.goal-body { flex: 1; min-width: 0; }

.goal-body .stat-value { font-size: 1.9rem; }

.goal-edit {
  display: inline;
  padding: 0;
  background: none;
  border: none;
  color: var(--green);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  min-height: unset;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.goal-edit:hover { color: #6ee7a0; }

/* ─── Session item actions ─── */
.session-edit {
  opacity: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  min-height: unset;
  font-family: inherit;
  transition: all 0.16s ease;
}

.session-item:hover .session-edit,
.session-edit:focus-visible { opacity: 1; }

.session-edit:hover {
  border-color: var(--border-active);
  color: var(--green);
}

/* ─── Modal ─── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-root[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 4, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.16s ease;
}

:root[data-theme="light"] .modal-backdrop { background: rgba(10, 32, 20, 0.28); }

.modal-panel {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px 22px 20px;
  background: var(--modal-bg);
  border: 1px solid var(--border-active);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--green-dim);
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

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

.modal-head h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.modal-x {
  padding: 6px;
  min-height: unset;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.16s ease;
}

.modal-x:hover { color: var(--coral); border-color: rgba(251, 113, 133, 0.3); }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.field-input,
.field-select {
  padding: 0 12px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  transition: border-color 0.16s ease;
}

.field-input:focus,
.field-select:focus { outline: none; border-color: var(--border-active); }

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23567065' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row .field-input { text-align: center; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-ghost   { flex: 1; }
.modal-actions .btn-danger {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 9px;
  background: transparent;
  color: var(--coral);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.modal-actions .btn-danger:hover {
  background: rgba(251, 113, 133, 0.08);
  border-color: var(--coral);
}

/* ─── Shortcuts list ─── */
.shortcut-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.shortcut-row:last-child { border-bottom: none; }

.shortcut-label { color: var(--text); }

.shortcut-keys {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

/* ─── Theme toggle ─── */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: unset;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.theme-icon { display: none; }
:root[data-theme="dark"]  .theme-icon--sun  { display: block; }
:root[data-theme="light"] .theme-icon--moon { display: block; }

/* ─── Log section head with action ─── */
.section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head--row .section-head { margin-bottom: 0; }

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  min-height: unset;
  transition: all 0.16s ease;
}

.btn-export:hover {
  border-color: var(--border-active);
  color: var(--green);
}

.btn-export:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Tags ─── */
.session-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tag-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: -2px;
}

/* ─── Settings toggle row (used in goal modal) ─── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
}

.toggle-row-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.toggle-row-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.toggle-row-sub   { font-size: 0.73rem; color: var(--muted); }

.switch {
  --w: 36px;
  --h: 20px;
  position: relative;
  display: inline-block;
  width: var(--w);
  height: var(--h);
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--track-bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(var(--h) - 6px);
  height: calc(var(--h) - 6px);
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.16s ease, background 0.16s ease;
}

.switch input:checked + .switch-track { background: var(--green-mid); border-color: var(--border-active); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(calc(var(--w) - var(--h))); background: var(--green); }

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  h1 { font-size: 3.4rem; }

  .hero-inner { grid-template-columns: 1fr; gap: 44px; }
  .hero { min-height: auto; padding: 88px 32px 56px; }

  .today-grid { grid-template-columns: 1fr 1fr; }

  .insights-grid { grid-template-columns: 1fr; }
  .insights-bottom { grid-template-columns: 1fr 1fr; }
  .advanced-insights { grid-column: 1 / -1; }

  .insight-card--clock { max-width: 320px; }
}

@media (max-width: 720px) {
  h1 { font-size: 2.6rem; }
  h2 { font-size: 2rem; }

  .hero { padding: 44px 20px 36px; }
  .today-section,
  .insights-section,
  .history-section { padding-left: 20px; padding-right: 20px; }
  .header-inner { padding: 0 20px; }

  .today-grid { grid-template-columns: 1fr; }
  .insights-bottom { grid-template-columns: 1fr; }
  .workflow-steps { grid-template-columns: 1fr; }
  .timer-tools-grid { grid-template-columns: 1fr; }

  .insight-card--clock { max-width: 100%; }

  .mode-row { grid-template-columns: 1fr 1fr; }
  .control-row { grid-template-columns: 1fr 1fr; }
  .control-row .btn-primary { grid-column: 1 / -1; }

  .time-display { font-size: 3.6rem; }

  .countdown-presets { grid-template-columns: repeat(4, 1fr); }
  .countdown-presets .preset-custom { grid-column: 1 / -1; }

  .session-item { grid-template-columns: 1fr auto auto; }
  .session-mode { display: none; }
  .session-edit { opacity: 1; }

  .header-date { display: none; }
  .weekly-chart { height: 140px; }
}
