:root {
  --bg: #0f1220;
  --bg-2: #171a2b;
  --card: #1c2036;
  --card-2: #232842;
  --line: #2c3252;
  --text: #eef1ff;
  --muted: #9aa3c7;
  --accent: #ff6b5e;
  --accent-2: #ffb15c;
  --work: #ff6b5e;
  --short: #4fd1a5;
  --long: #5b9bff;
  --ring-w: 14px;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0,0,0,.35);
  --font: 'Inter', system-ui, sans-serif;
  --display: 'Sora', var(--font);
}
[data-theme="light"] {
  --bg: #f4f5fb;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f2f4fc;
  --line: #e4e7f4;
  --text: #1a1d33;
  --muted: #6b7398;
  --shadow: 0 20px 50px rgba(80,90,140,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(255,107,94,.10), transparent 60%),
              radial-gradient(1000px 500px at -10% 110%, rgba(91,155,255,.10), transparent 60%),
              var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .4s, color .3s;
}

/* ================= LAYOUT ================= */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
}
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; padding-left: 6px; }
.brand__logo {
  width: 42px; height: 42px; display: grid; place-items: center;
  font-size: 22px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(255,107,94,.35);
}
.brand__text h1 { font-family: var(--display); font-size: 20px; letter-spacing: -.5px; }
.brand__text span { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 6px; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border: none; border-radius: 12px;
  background: transparent; color: var(--muted);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .18s;
}
.nav__item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav__item:hover { background: var(--card); color: var(--text); }
.nav__item.is-active { background: var(--card); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }

.sidebar__footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 18px; transition: transform .2s;
}
.theme-toggle:hover { transform: rotate(-15deg); }
.today-pill {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: var(--card); border-radius: 12px; padding: 8px; border: 1px solid var(--line);
}
.today-pill strong { font-family: var(--display); font-size: 18px; }
.today-pill small { font-size: 11px; color: var(--muted); }

.main { padding: 40px 46px; overflow-y: auto; }

/* ================= VIEWS ================= */
.view { display: none; animation: fade .4s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view__head { margin-bottom: 24px; }
.view__head h2 { font-family: var(--display); font-size: 26px; letter-spacing: -.5px; }
.view__head p { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* ================= TIMER ================= */
.mode-switch {
  display: flex; gap: 6px; padding: 6px; width: fit-content; margin: 0 auto 30px;
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
}
.mode-switch__btn {
  padding: 9px 20px; border: none; border-radius: 10px; background: transparent;
  color: var(--muted); font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.mode-switch__btn.is-active { background: var(--accent); color: #fff; }

.timer { display: flex; flex-direction: column; align-items: center; }
.timer__ring { position: relative; width: min(74vw, 380px); aspect-ratio: 1; }
.timer__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: var(--ring-w); }
.ring-progress {
  fill: none; stroke: var(--accent); stroke-width: var(--ring-w); stroke-linecap: round;
  stroke-dasharray: 741.4; stroke-dashoffset: 0;
  transition: stroke-dashoffset .3s linear, stroke .4s;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 55%, transparent));
}
.timer__center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.timer__time { font-family: var(--display); font-size: clamp(48px, 11vw, 76px); font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.timer__label { color: var(--muted); font-size: 15px; font-weight: 600; margin-top: 2px; }
.timer__task { margin-top: 12px; font-size: 13px; color: var(--accent); font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.timer__controls { display: flex; align-items: center; gap: 16px; margin-top: 34px; }
.btn {
  font-family: var(--font); font-weight: 700; cursor: pointer; border: none;
  border-radius: 14px; transition: transform .12s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.95); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; padding: 16px 48px; font-size: 17px; letter-spacing: .3px;
  box-shadow: 0 12px 30px rgba(255,107,94,.35);
}
.btn--ghost {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  width: 54px; height: 54px; display: grid; place-items: center;
}
.btn--ghost svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--ghost:hover { background: var(--card-2); }
.btn--wide { width: 100%; padding: 13px; margin-top: 8px; }

.timer__dots { display: flex; gap: 8px; margin-top: 28px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s; }
.dot.is-done { background: var(--accent); }
.dot.is-current { background: var(--accent); transform: scale(1.4); }

/* mode theming */
[data-active-mode="short"] { --accent: var(--short); --accent-2: #7ee0bd; }
[data-active-mode="long"]  { --accent: var(--long);  --accent-2: #86b6ff; }

/* ================= TASKS ================= */
.task-add { display: flex; gap: 10px; margin-bottom: 22px; align-items: flex-end; flex-wrap: wrap; }
.task-add input[type=text] {
  flex: 1; min-width: 200px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: var(--font); font-size: 15px;
}
.task-add__est { display: flex; flex-direction: column; gap: 4px; }
.task-add__est label { font-size: 11px; color: var(--muted); padding-left: 4px; }
.task-add__est input, .setting-row input[type=number], .setting-row select {
  width: 74px; padding: 13px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: var(--font); font-size: 15px; text-align: center;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.task-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.task {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s, transform .1s;
}
.task.is-active { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.task.is-done { opacity: .55; }
.task.is-done .task__name { text-decoration: line-through; }
.task__check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line);
  cursor: pointer; flex-shrink: 0; display: grid; place-items: center; color: transparent; transition: all .2s;
}
.task.is-done .task__check { background: var(--short); border-color: var(--short); color: #fff; }
.task__body { flex: 1; min-width: 0; cursor: pointer; }
.task__name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.task__pips { display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap; }
.pip { width: 8px; height: 8px; border-radius: 2px; background: var(--line); }
.pip.is-full { background: var(--accent); }
.task__del {
  background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 18px;
  width: 30px; height: 30px; border-radius: 8px; transition: all .2s; flex-shrink: 0;
}
.task__del:hover { background: var(--card-2); color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }

/* ================= STATS ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 6px;
}
.stat-card__num { font-family: var(--display); font-size: 32px; font-weight: 800; }
.stat-card__label { font-size: 13px; color: var(--muted); }

.goal-card, .chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px;
}
.goal-card__head, .chart-card__head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.goal-bar { height: 12px; background: var(--card-2); border-radius: 99px; overflow: hidden; }
.goal-bar__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 99px; transition: width .5s; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.chart__bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart__fill { width: 100%; max-width: 40px; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .5s; }
.chart__day { font-size: 11px; color: var(--muted); }
.chart__val { font-size: 11px; font-weight: 700; }

/* ================= SETTINGS ================= */
.settings-group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; max-width: 560px;
}
.settings-group h3 { font-size: 14px; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-size: 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-of-type { border-bottom: none; }
.setting-row label:first-child { font-size: 14px; font-weight: 500; }
.settings-group--danger .btn { color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

.switch { position: relative; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--card-2); border: 1px solid var(--line); border-radius: 99px; cursor: pointer; transition: .25s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: var(--muted); border-radius: 50%; transition: .25s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); background: #fff; }

/* ================= TOAST ================= */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  padding: 14px 22px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px;
  transition: transform .35s cubic-bezier(.2,.8,.3,1.2); z-index: 100; pointer-events: none;
}
.toast.is-show { transform: translateX(-50%) translateY(0); }

/* ================= RESPONSIVE ================= */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--line);
    padding: 12px 16px; position: sticky; top: 0; z-index: 10; background: var(--bg);
  }
  .brand { margin-bottom: 0; }
  .brand__text { display: none; }
  .nav { flex-direction: row; margin: 0 auto; }
  .nav__item span { display: none; }
  .nav__item.is-active { box-shadow: none; }
  .sidebar__footer { margin: 0; }
  .today-pill { display: none; }
  .main { padding: 24px 18px; }
}
