:root {
  --sidebar-bg: #101210;
  --sidebar-text: #EDEFEA;
  --sidebar-muted: #8A9088;
  --accent: #C8FF3D;
  --accent-ink: #0E1206;
  --bg: #F4F3EE;
  --card-bg: #FFFFFF;
  --card-border: #E8E6DE;
  --ink: #14150F;
  --ink-muted: #6B6E64;
  --radius-card: 16px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 24px rgba(20, 21, 15, 0.06);
  --shadow-float: 0 12px 32px rgba(20, 21, 15, 0.16);
}

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

html, body {
  height: 100%;
}

body {
  font-family: "Manrope", -apple-system, "Segoe UI Variable", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-weight: 500;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font-family: inherit;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

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

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-control);
  color: var(--sidebar-muted);
  font-size: 14px;
  font-weight: 600;
}

.nav-item:hover {
  background: rgba(237, 239, 234, 0.06);
  color: var(--sidebar-text);
}

.nav-item.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.sidebar-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sidebar-muted);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.history-empty {
  font-size: 13px;
  color: var(--sidebar-muted);
  padding: 8px 14px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
}

.history-item:hover {
  background: rgba(237, 239, 234, 0.06);
}

.history-item.is-active {
  background: rgba(237, 239, 234, 0.1);
  color: var(--accent);
}

.history-count {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-pomodoro {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(237, 239, 234, 0.08);
}

.pomodoro-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pomodoro-settings > span {
  font-size: 13px;
  color: var(--sidebar-text);
  font-weight: 500;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  color: var(--sidebar-text);
  transition: background-color 200ms ease, color 200ms ease;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: rgba(237, 239, 234, 0.1);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: rgba(237, 239, 234, 0.05);
  border-radius: var(--radius-control);
}

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

.settings-field span {
  font-size: 12px;
  color: var(--sidebar-muted);
  font-weight: 600;
}

.settings-field input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(237, 239, 234, 0.15);
  background: rgba(237, 239, 234, 0.06);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-control);
  font-weight: 700;
  font-size: 14px;
  transition: background-color 200ms ease, transform 200ms ease, opacity 200ms ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 20px;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  margin-left: 260px;
  padding: 40px 48px 160px;
  max-width: 860px;
}

.main-header {
  margin-bottom: 26px;
}

.page-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--ink-muted);
  font-weight: 500;
  margin-top: 4px;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.summary-text {
  font-size: 14px;
  color: var(--ink-muted);
  font-weight: 600;
}

.carried-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: #E9E7DE;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

/* ---------- Tasks ---------- */
.tasks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.tasks-empty {
  text-align: center;
  color: var(--ink-muted);
  font-size: 14px;
  padding: 40px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
}

.task-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: transform 200ms ease, border-color 200ms ease, opacity 200ms ease;
}

.task-card:hover {
  border-color: #D9D6CB;
}

.task-card.is-done {
  opacity: 0.55;
}

.task-card.is-done .task-title {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.task-check {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  border: 2px solid #C9C7BD;
  background: transparent;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.task-check svg {
  width: 14px;
  height: 14px;
  color: var(--accent-ink);
  opacity: 0;
  transition: opacity 200ms ease;
}

.task-check.is-checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-check.is-checked svg {
  opacity: 1;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.task-duration {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
}

.task-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.task-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

.tag-work { background: #E4E7FF; color: #3A43B0; }
.tag-calls { background: #E5F3FF; color: #18559B; }
.tag-personal { background: #FBE8E0; color: #A34A24; }
.tag-break { background: #E5F3EA; color: #2C7A4F; }

.carried-mini {
  font-size: 11px;
  font-weight: 700;
  color: #9A6B13;
  background: #FBF0CE;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.task-play {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.task-play svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
}

.task-play:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.task-play:active {
  transform: scale(0.94);
}

/* ---------- Task form ---------- */
.task-form {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.task-form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
}

.form-field-grow {
  flex: 1;
  min-width: 200px;
}

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

.form-field input,
.form-field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--card-border);
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
}

.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 255, 61, 0.35);
}

.btn-add {
  min-width: 120px;
}

/* ---------- Floating timer ---------- */
.timer {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 160px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-float);
  z-index: 50;
}

.timer-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.timer-ring circle {
  fill: none;
  stroke-width: 6;
}

.timer-ring-track {
  stroke: rgba(237, 239, 234, 0.12);
}

.timer-ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
}

.timer-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.timer-time {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sidebar-muted);
}

.timer-task {
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-muted);
  text-align: center;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-controls {
  display: flex;
  gap: 8px;
}

.timer-btn {
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: var(--accent-ink);
}

.timer-btn:hover {
  filter: brightness(0.95);
}

.timer-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
  z-index: 100;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .nav-item, .history-item, .icon-btn, .btn, .task-check, .task-play, .task-card, .timer-ring-progress {
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease, transform 200ms ease, opacity 200ms ease, filter 200ms ease, stroke-dashoffset 200ms linear;
  }

  .toast {
    animation: toast-in 250ms ease;
  }

  @keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px;
  }

  .side-nav {
    flex-direction: row;
  }

  .sidebar-history {
    flex: 1 1 100%;
    order: 5;
  }

  .history-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-pomodoro {
    margin-left: auto;
    border-top: none;
    padding-top: 0;
  }

  .main {
    margin-left: 0;
    padding: 24px 18px 160px;
  }

  .task-form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-add {
    width: 100%;
  }
}
