/* Tomato Timer — a warm, low-chrome workspace that stays legible for hours. */

:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #fbf9f6;
  --border: #e7e2da;
  --text: #2c2a27;
  --text-dim: #6f6a63;
  --text-faint: #a29c93;
  --tomato: #d1492f;
  --tomato-dark: #b23b24;
  --break: #2f7d67;
  --interrupt: #b7791f;
  --shadow: 0 1px 2px rgba(40, 34, 28, .05), 0 6px 20px rgba(40, 34, 28, .06);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --surface: #201e1c;
    --surface-2: #262320;
    --border: #363230;
    --text: #f0ece7;
    --text-dim: #a8a29a;
    --text-faint: #7a746c;
    --tomato: #e35c40;
    --tomato-dark: #c9482d;
    --break: #4aa88c;
    --interrupt: #d9a13f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

/* An explicit `display` in this sheet would otherwise beat the UA stylesheet's
   [hidden] rule, leaving hidden panels visible. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }

.muted { color: var(--text-dim); }
.hint  { color: var(--text-dim); font-size: 13px; margin: 0 0 14px; }

/* ------------------------------------------------------------- buttons */

.btn {
  font: inherit;
  font-weight: 500;
  /* Also used on <a> for the landing page CTAs, which need these resets. */
  display: inline-block;
  text-decoration: none;
  text-align: center;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover  { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--tomato);
  border-color: var(--tomato);
  color: #fff;
}
.btn-primary:hover { background: var(--tomato-dark); border-color: var(--tomato-dark); }

.btn-ghost { background: transparent; }
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
  padding: 6px 10px;
}
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }

.btn-lg    { padding: 13px 34px; font-size: 16px; }
.btn-block { display: block; width: 100%; }
.btn-danger { color: var(--tomato); }


/* The alarm's stop button — prominent while ringing, absent otherwise. */
.btn-alarm {
  margin: 18px auto 0;
  display: block;
  background: var(--interrupt);
  border-color: var(--interrupt);
  color: #fff;
  font-weight: 600;
  padding: 11px 26px;
  animation: alarm-pulse 1s ease-in-out infinite;
}
.btn-alarm:hover { background: var(--interrupt); border-color: var(--interrupt); opacity: .9; }

@keyframes alarm-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-alarm { animation: none; }
}

input[type="range"] { width: 100%; accent-color: var(--tomato); }

/* -------------------------------------------------------------- fields */

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-dim);
}
.field small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

input[type="text"], input[type="email"], select {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus {
  outline: 2px solid var(--tomato);
  outline-offset: -1px;
  border-color: var(--tomato);
}

.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.inline-field select { width: auto; }

.notice {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.notice.is-error { border-color: var(--tomato); color: var(--tomato); }
.notice a { color: var(--tomato); }

.saved-flag { margin-left: 10px; font-size: 13px; color: var(--break); }

/* ------------------------------------------------------------- sign in */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  text-align: center;
}
.login-card h1 { margin: 0 0 10px; font-size: 24px; }
.login-card .logo { font-size: 44px; line-height: 1; }
.login-card form { text-align: left; margin-top: 22px; }
.lede { color: var(--text-dim); font-size: 14px; margin: 0; }
.fineprint {
  margin: 26px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
}

/* -------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.logo-sm { font-size: 18px; }

.tabs { display: flex; gap: 2px; }
.tab {
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active { background: var(--surface-2); color: var(--text); font-weight: 500; }

.account { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }

.tabpanel { padding: 32px 22px 72px; max-width: 1080px; margin: 0 auto; }

/* --------------------------------------------------------------- timer */

.timer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 820px) {
  .timer-layout { grid-template-columns: 1fr; }
}

.timer-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 32px 36px;
  text-align: center;
}

.clock {
  font-size: clamp(64px, 15vw, 112px);
  font-weight: 200;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
}
.clock.is-running { color: var(--tomato); }
.clock.is-paused  { color: var(--text-faint); }
.clock.is-over    { color: var(--interrupt); }

.clock-caption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 20px;
}

.task-row { margin: 28px auto 0; max-width: 460px; }
.task-row input { text-align: center; font-size: 16px; padding: 12px; }

.controls { margin-top: 20px; display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------- side panel */

.side-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.side-break-list { display: flex; flex-direction: column; gap: 7px; }

.sb-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  font: inherit;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.sb-btn:hover:not(:disabled) { border-color: var(--tomato); }
.sb-btn:disabled { opacity: .5; cursor: not-allowed; }
.sb-btn .sb-time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.sb-btn .sb-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.sb-kind.break     { color: var(--break); }
.sb-kind.interrupt { color: var(--interrupt); }

.active-break {
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--tomato);
  text-align: center;
}
.active-break-name  { font-weight: 600; font-size: 14px; }
.active-break-clock {
  font-size: 32px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 12px;
  color: var(--tomato);
}

/* ----------------------------------------------------------- statusbar */

.statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 9px 18px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.statusbar .sep { color: var(--text-faint); }

/* ----------------------------------------------------------- settings */

.settings-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.sb-editor, .wh-editor { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.sb-row, .wh-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.sb-row .row-line, .wh-row .row-line { display: flex; gap: 8px; align-items: center; }

.sb-grip {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  padding: 6px 2px;
  cursor: grab;
}
.sb-grip:hover:not(:disabled) { color: var(--text); }
.sb-grip:disabled { opacity: .3; cursor: default; }
.sb-row.is-dragging { opacity: .5; outline: 2px dashed var(--tomato); }
.sb-row .row-line + .row-line, .wh-row .row-line + .row-line { margin-top: 8px; }
.sb-row input[type="text"] { flex: 1; }
.sb-row .time-input { width: 104px; flex: none; text-align: center; font-variant-numeric: tabular-nums; }
.sb-row .time-input:disabled { opacity: .4; }

.kindpick { display: flex; gap: 12px; font-size: 13px; color: var(--text-dim); }
.kindpick label { display: flex; align-items: center; gap: 5px; cursor: pointer; }

.row-actions { margin-left: auto; display: flex; gap: 6px; }
.row-actions .btn { padding: 6px 12px; font-size: 13px; }

.wh-row input[type="text"] { flex: 1; font-size: 13px; }
.wh-status { font-size: 12px; color: var(--text-dim); margin-top: 8px; }

/* ---------------------------------------------------------------- log */

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 18px; }

.log-day { margin-bottom: 26px; }
.log-day-head {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.log-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 8px;
}
.log-entry-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.log-title { font-weight: 600; }
.log-times { font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.log-elapsed { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-dim); }
.log-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.log-badge.running { color: var(--tomato); border-color: var(--tomato); }

.log-breaks { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--border); }
.log-break {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-dim);
  padding: 3px 0;
}
.log-break .dot { color: var(--text-faint); }
.log-break .used { margin-left: auto; font-variant-numeric: tabular-nums; }

.empty { color: var(--text-faint); text-align: center; padding: 48px 0; font-size: 14px; }

/* --------------------------------------------------------------- summary */

/* Headline numbers as stat tiles — a KPI row, not a one-bar chart each. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-value {
  font-size: 24px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--text);
}
.stat-caption {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-dim);
}

.summary-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.summary-card h2 { font-size: 15px; }

/* One hue, length carries magnitude. A single series needs no legend —
   the section heading names it. */
.bars { display: flex; flex-direction: column; gap: 2px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 6px;
}
.bar-row:hover { background: var(--surface-2); }

.bar-label {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: 5px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--tomato);
  /* Rounded data-end, square against the baseline it grows from. */
  border-radius: 0 4px 4px 0;
  min-width: 3px;
}
.bar-value {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
}

.empty.small { padding: 18px 0; font-size: 13px; }

/* --------------------------------------------------------------- landing */

.landing { background: var(--bg); }

.lp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  max-width: 1040px;
  margin: 0 auto;
}

.lp-hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 24px 72px;
  text-align: center;
}
.lp-clock {
  font-size: clamp(56px, 12vw, 96px);
  font-weight: 200;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--tomato);
  line-height: 1;
}
.lp-hero h1 {
  font-size: clamp(30px, 5vw, 42px);
  margin: 22px 0 14px;
  letter-spacing: -.02em;
}
.lp-lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 28px;
}
.lp-note { margin: 14px 0 0; font-size: 13px; color: var(--text-faint); }

.lp-band {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 52px 24px;
}
.lp-prose { max-width: 620px; margin: 0 auto; }
.lp-prose h2 { font-size: 20px; margin: 0 0 14px; }
.lp-prose p { color: var(--text-dim); line-height: 1.7; margin: 0 0 14px; }

.lp-features {
  max-width: 1040px;
  margin: 0 auto;
  padding: 60px 24px;
  display: grid;
  gap: 28px 36px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.lp-feature h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.lp-feature p { margin: 0; color: var(--text-dim); line-height: 1.65; font-size: 14.5px; }
.lp-feature em { color: var(--text); font-style: normal; font-variant-numeric: tabular-nums; }

.lp-cta {
  text-align: center;
  padding: 20px 24px 76px;
}
.lp-cta h2 { font-size: 24px; margin: 0 0 22px; }

.lp-foot {
  border-top: 1px solid var(--border);
  padding: 26px 24px;
  text-align: center;
}
.lp-foot p {
  max-width: 620px;
  margin: 0 auto;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}
