:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #6366f1;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0f4f8;
    --surface: #ffffff;
    --border: #d1d5db;
    --text: #0f172a;
    --muted: #64748b;
  }
}

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

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 26px 16px;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 720px) { .wrap { gap: 14px; } }

/* ---- header ---- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header h1 {
  font-size: 26px;
  font-weight: 650;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 500;
}

/* ---- totals ---- */
.totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.total {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.total .label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.total .value {
  font-size: 22px;
  font-weight: 650;
}

/* ---- entry ---- */
.entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline-offset: 0;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.hint {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  align-self: end;
  padding-bottom: 2px;
}

/* ---- actions ---- */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  min-width: 120px;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px 0 color-mix(in srgb, var(--accent) 32%, transparent);
}
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- sessions list ---- */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.session_row {
  display: grid;
  grid-template-columns: 1fr auto 36px;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.s_left { display: flex; flex-direction: column; gap: 2px; }
.s_date { font-size: 12px; color: var(--muted); }
.s_range { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.s_dur { font-weight: 650; color: var(--accent); font-variant-numeric: tabular-nums; }
.del {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.del:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-color: var(--danger); }
.del:disabled { opacity: 0.5; cursor: not-allowed; }
.empty { color: var(--muted); text-align: center; font-style: italic; padding: 12px 6px; }

/* ---- toast ---- */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  background: #16a34a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}
.toast.show { opacity: 1; }

.footer { color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 720px) {
  .header h1 { font-size: 22px; }
  .entry { grid-template-columns: 1fr; }
  .totals { grid-template-columns: 1fr; }
}
