/* =========================================================
   Tugas Harian — styles
   ========================================================= */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --accent-1: #7c8cff;
  --accent-2: #b074ff;
  --ok: #38d39f;
  --danger: #ff6b81;
  --warn: #ffb347;
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #070b16;
  --bg-1: #0c1324;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-3: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #edf1ff;
  --muted: #98a4c4;
  --muted-2: #74809c;
  --accent-soft: rgba(124, 140, 255, 0.16);
  --shadow: 0 30px 70px -34px rgba(0, 0, 0, 0.95);
  --ring: rgba(124, 140, 255, 0.45);
  --glow-1: rgba(124, 140, 255, 0.2);
  --glow-2: rgba(176, 116, 255, 0.14);
  --danger-soft: rgba(255, 107, 129, 0.14);
  --ok-soft: rgba(56, 211, 159, 0.14);
  --warn-soft: rgba(255, 179, 71, 0.14);
  --lb-penting-bg: rgba(255, 179, 71, 0.14);
  --lb-penting-fg: #ffc471;
  --lb-penting-bd: rgba(255, 179, 71, 0.32);
  --lb-urgent-bg: rgba(255, 107, 129, 0.14);
  --lb-urgent-fg: #ff92a3;
  --lb-urgent-bd: rgba(255, 107, 129, 0.34);
  --lb-standar-bg: rgba(124, 140, 255, 0.14);
  --lb-standar-fg: #aeb8ff;
  --lb-standar-bd: rgba(124, 140, 255, 0.32);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-0: #f2f4fb;
  --bg-1: #ffffff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-2: rgba(17, 24, 50, 0.045);
  --surface-3: rgba(17, 24, 50, 0.08);
  --border: rgba(17, 24, 50, 0.1);
  --border-strong: rgba(17, 24, 50, 0.2);
  --text: #131a2e;
  --muted: #5c6784;
  --muted-2: #7a86a3;
  --accent-soft: rgba(101, 118, 255, 0.12);
  --shadow: 0 26px 60px -34px rgba(23, 32, 64, 0.4);
  --ring: rgba(101, 118, 255, 0.35);
  --glow-1: rgba(124, 140, 255, 0.22);
  --glow-2: rgba(176, 116, 255, 0.16);
  --danger-soft: rgba(229, 62, 84, 0.1);
  --ok-soft: rgba(13, 158, 116, 0.1);
  --warn-soft: rgba(214, 138, 20, 0.12);
  --lb-penting-bg: rgba(214, 138, 20, 0.12);
  --lb-penting-fg: #9a6208;
  --lb-penting-bd: rgba(214, 138, 20, 0.28);
  --lb-urgent-bg: rgba(221, 52, 77, 0.1);
  --lb-urgent-fg: #c22341;
  --lb-urgent-bd: rgba(221, 52, 77, 0.26);
  --lb-standar-bg: rgba(86, 103, 235, 0.1);
  --lb-standar-fg: #4353cd;
  --lb-standar-bd: rgba(86, 103, 235, 0.26);
}

* { box-sizing: border-box; }

/* Pastikan atribut hidden selalu menang atas display/kelas lain. */
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 620px at 8% -12%, var(--glow-1), transparent 62%),
    radial-gradient(820px 520px at 102% -4%, var(--glow-2), transparent 58%),
    var(--bg-0);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

h1, h2, h3, p { margin: 0; }

.app {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-logo {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 12px 28px -12px rgba(124, 140, 255, 0.75);
}
.brand-logo svg { width: 22px; height: 22px; }

.brand-text { min-width: 0; }
.brand-text h1 { font-size: 19px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.brand-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.16s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg-0);
}

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

.menu-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 246px;
  padding: 8px;
  border-radius: 15px;
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: pop 0.14s ease-out;
}
.menu[hidden] { display: none; }
.menu-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 8px 10px 4px;
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}
.menu button svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.menu button:hover { background: var(--surface-2); }
.menu button.is-danger { color: var(--danger); }
.menu button.is-danger svg { color: var(--danger); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar { display: flex; flex-direction: column; gap: 14px; }
.content { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 44px -40px rgba(0, 0, 0, 0.9);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h2, .card > h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent-1);
  font-size: 12.5px;
  font-weight: 650;
  padding: 3px 4px;
  border-radius: 6px;
}
.link-btn:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Calendar ---------- */

.date-row { display: flex; align-items: center; gap: 6px; }
.date-row .icon-btn { width: 36px; height: 38px; flex: none; }
.date-row .date-input { flex: 1; min-width: 0; }

.date-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}
.date-input::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
:root[data-theme="light"] .date-input::-webkit-calendar-picker-indicator { filter: none; }

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.day-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 9px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.day-pill:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.day-name { font-size: 10px; font-weight: 650; letter-spacing: 0.03em; }
.day-num { font-size: 14px; font-weight: 700; line-height: 1.1; }
.day-pill.is-today { border-color: var(--border-strong); }
.day-pill.is-selected {
  background: linear-gradient(145deg, rgba(124, 140, 255, 0.9), rgba(176, 116, 255, 0.9));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px -8px rgba(124, 140, 255, 0.8);
}
.day-pill .day-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-1);
  opacity: 0;
}
.day-pill.has-todo .day-dot { opacity: 1; }
.day-pill.is-selected .day-dot { background: #fff; }

/* ---------- Stats ---------- */

.stats { display: flex; flex-direction: column; gap: 7px; margin-bottom: 13px; }
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.stat-row strong { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-row .stat-label { display: flex; align-items: center; gap: 7px; }
.stat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-1); }
.stat-dot.ok { background: var(--ok); }
.stat-dot.warn { background: var(--warn); }

.progress {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  transition: width 0.35s ease;
}
.hint { font-size: 11.5px; line-height: 1.5; color: var(--muted-2); margin-top: 8px; }

/* ---------- Alarm list ---------- */

.alarm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alarm-list:empty { display: none; }
.alarm-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.alarm-item:hover { border-color: var(--border-strong); background: var(--surface-3); }
.alarm-item.is-missed { border-color: rgba(255, 107, 129, 0.4); background: var(--danger-soft); }
.alarm-item .a-icon {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
}
.alarm-item .a-icon svg { width: 15px; height: 15px; }
.alarm-item.is-missed .a-icon { background: var(--danger-soft); color: var(--danger); }
.alarm-item .a-body { min-width: 0; flex: 1; }
.alarm-item .a-title {
  display: block;
  font-size: 12.6px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alarm-item .a-when { display: block; font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.alarm-item.is-missed .a-when { color: var(--danger); }

.data-note {
  display: flex;
  gap: 8px;
  padding: 0 4px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted-2);
}
.data-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* ---------- View tabs ---------- */

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  align-self: flex-start;
  backdrop-filter: blur(16px);
}
.tab {
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s, color 0.16s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.5); }

/* ---------- Content card ---------- */

.content-card { padding: 20px; }

.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.day-heading { min-width: 0; }
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-1);
  margin-bottom: 5px;
}
.day-heading h2 { font-size: clamp(20px, 2.6vw, 26px); font-weight: 740; letter-spacing: -0.025em; line-height: 1.2; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 650;
  transition: filter 0.16s, background 0.16s, border-color 0.16s, transform 0.16s, color 0.16s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  color: #fff;
  background: linear-gradient(140deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 14px 28px -16px rgba(124, 140, 255, 0.9);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.soft { background: var(--accent-soft); color: var(--text); border-color: var(--border); }
.btn.soft:hover { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.segmented button {
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface-3); color: var(--text); }

.label-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-btn:hover { background: var(--surface-2); color: var(--text); }
.chip-btn.is-active { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.chip-btn.lb-penting.is-active { background: var(--lb-penting-bg); color: var(--lb-penting-fg); border-color: var(--lb-penting-bd); }
.chip-btn.lb-urgent.is-active { background: var(--lb-urgent-bg); color: var(--lb-urgent-fg); border-color: var(--lb-urgent-bd); }
.chip-btn.lb-standar.is-active { background: var(--lb-standar-bg); color: var(--lb-standar-fg); border-color: var(--lb-standar-bd); }

.search-wrap {
  position: relative;
  margin-left: auto;
  min-width: 170px;
  flex: 1 1 180px;
  max-width: 260px;
}
.search-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 8px 12px 8px 33px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.search-wrap input::placeholder { color: var(--muted-2); }
.search-wrap input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Todo list ---------- */

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.todo {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
  animation: rise 0.18s ease-out;
}
.todo:hover { border-color: var(--border-strong); background: var(--surface-2); }
.todo.is-done { opacity: 0.62; }
.todo.is-done:hover { opacity: 0.8; }

.check {
  width: 26px;
  height: 26px;
  flex: none;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: transparent;
  display: grid;
  place-items: center;
  transition: background 0.16s, border-color 0.16s, color 0.16s, box-shadow 0.16s;
}
.check svg { width: 14px; height: 14px; stroke-width: 3; }
.check:hover { border-color: var(--accent-1); background: var(--accent-soft); color: var(--accent-1); }
.check.checked {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(140deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.todo-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.todo-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.todo-title {
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.todo.is-done .todo-title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.todo-desc {
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.todo.is-done .todo-desc { color: var(--muted-2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.lb-penting { background: var(--lb-penting-bg); color: var(--lb-penting-fg); border-color: var(--lb-penting-bd); }
.badge.lb-urgent { background: var(--lb-urgent-bg); color: var(--lb-urgent-fg); border-color: var(--lb-urgent-bd); }
.badge.lb-standar { background: var(--lb-standar-bg); color: var(--lb-standar-fg); border-color: var(--lb-standar-bd); }

.todo-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 1px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 7px;
  white-space: nowrap;
}
.chip svg { width: 12px; height: 12px; }
.chip.chip-warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(255, 179, 71, 0.28); }
.chip.chip-danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(255, 107, 129, 0.32); }
.chip.chip-ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(56, 211, 159, 0.3); }
.chip.chip-off { opacity: 0.75; }

.todo-actions { display: flex; align-items: center; gap: 2px; flex: none; margin-top: -3px; }
.todo-actions .icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
.todo-actions .icon-btn svg { width: 16px; height: 16px; }
.todo-actions .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.todo-actions .icon-btn.on { color: var(--warn); }
.todo-actions .icon-btn.is-danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  padding: 40px 20px 32px;
}
.empty[hidden] { display: none; }
.empty-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted-2);
  margin-bottom: 4px;
}
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; font-weight: 650; }
.empty p { font-size: 13px; color: var(--muted); max-width: 340px; line-height: 1.55; }
.empty .btn { margin-top: 8px; }

/* ---------- History ---------- */

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  user-select: none;
  cursor: pointer;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.toggle-inline input { accent-color: var(--accent-1); width: 15px; height: 15px; cursor: pointer; }

.history-summary { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }

.history-group { margin-bottom: 22px; }
.history-group:last-child { margin-bottom: 0; }
.history-group > header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px dashed var(--border);
}
.history-group > header h3 { font-size: 13.5px; font-weight: 680; letter-spacing: -0.01em; }
.history-group > header span { font-size: 11.5px; color: var(--muted-2); }

/* ---------- Dialog ---------- */

.dialog {
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  color: var(--text);
  background: var(--bg-1);
  box-shadow: var(--shadow);
  overflow: auto;
  overscroll-behavior: contain;
}
:root[data-theme="light"] .dialog {
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(124, 140, 255, 0.1), transparent 60%),
    #fff;
}
.dialog::backdrop {
  background: rgba(4, 7, 16, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dialog[open] { animation: dialog-in 0.18s ease-out; }

#todoForm { padding: 20px; display: flex; flex-direction: column; gap: 15px; }

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.dialog-head h2 { font-size: 18px; font-weight: 720; letter-spacing: -0.02em; }
.dialog-head .icon-btn { width: 32px; height: 32px; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.hint-inline { font-weight: 450; color: var(--muted-2); }

.field input[type="text"],
.field input[type="date"],
.field input[type="time"],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field textarea { resize: vertical; min-height: 74px; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ring);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:invalid:not(:placeholder-shown) { border-color: rgba(255, 107, 129, 0.5); }
.field input[type="date"]::-webkit-calendar-picker-indicator,
.field input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
:root[data-theme="light"] .field input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="light"] .field input[type="time"]::-webkit-calendar-picker-indicator { filter: none; }

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

.label-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.label-opt { position: relative; cursor: pointer; }
.label-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.label-opt span {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.label-opt:hover span { background: var(--surface-2); color: var(--text); }
.label-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.label-opt.lb-penting input:checked + span { background: var(--lb-penting-bg); color: var(--lb-penting-fg); border-color: var(--lb-penting-bd); }
.label-opt.lb-urgent input:checked + span { background: var(--lb-urgent-bg); color: var(--lb-urgent-fg); border-color: var(--lb-urgent-bd); }
.label-opt.lb-standar input:checked + span { background: var(--lb-standar-bg); color: var(--lb-standar-fg); border-color: var(--lb-standar-bd); }

.alarm-box {
  padding: 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row > div > label { font-size: 13.5px; font-weight: 650; }
.switch-row .hint { margin-top: 3px; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.2s, border-color 0.2s;
}
.switch .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .slider { background: linear-gradient(140deg, var(--accent-1), var(--accent-2)); border-color: transparent; }
.switch input:checked + .slider::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px var(--accent-soft); }

.alarm-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alarm-inputs[hidden] { display: none; }

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

/* ---------- Alarm dialog ---------- */

.alarm-dialog {
  text-align: center;
  padding: 28px 24px 24px;
  width: min(440px, calc(100vw - 28px));
  background:
    radial-gradient(420px 260px at 50% -10%, var(--warn-soft), transparent 70%),
    var(--bg-1);
}
.alarm-bell {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid rgba(255, 179, 71, 0.35);
  animation: ring-bell 1s ease-in-out infinite;
}
.alarm-bell svg { width: 30px; height: 30px; }
.alarm-dialog .eyebrow { color: var(--warn); }
.alarm-dialog h2 { font-size: 21px; font-weight: 730; letter-spacing: -0.02em; line-height: 1.3; overflow-wrap: anywhere; }
.alarm-desc { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin-top: 7px; overflow-wrap: anywhere; }
.alarm-time {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}
.alarm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 18px);
  z-index: 100;
  max-width: min(460px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast[hidden] { display: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(255, 107, 129, 0.45); }
.toast.is-success { border-color: rgba(56, 211, 159, 0.45); }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding: 0 4px;
  font-size: 11.5px;
  color: var(--muted-2);
}

/* ---------- Animations ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ring-bell {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-9deg); }
  35% { transform: rotate(9deg); }
  55% { transform: rotate(-6deg); }
  75% { transform: rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .layout { grid-template-columns: 290px minmax(0, 1fr); }
  .content-card { padding: 16px; }
  .search-wrap { max-width: none; flex-basis: 100%; margin-left: 0; }
}

@media (max-width: 820px) {
  .app { padding: 16px 14px 32px; }
  .layout { grid-template-columns: 1fr; }
  .content { order: 1; }
  .sidebar { order: 2; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .sidebar .calendar-card { grid-column: 1 / -1; }
  .sidebar .data-note { grid-column: 1 / -1; }
  .brand-sub { white-space: normal; }
}

@media (max-width: 560px) {
  .brand-text h1 { font-size: 17px; }
  .brand-logo { width: 38px; height: 38px; border-radius: 11px; }
  .sidebar { grid-template-columns: 1fr; }
  .topbar { gap: 10px; }
  .topbar-actions { gap: 6px; }
  #notifBtn { display: none; }
  .day-head { flex-direction: column; align-items: stretch; }
  .day-head .btn.primary { justify-content: center; }
  .field-row, .alarm-inputs { grid-template-columns: 1fr; }
  .todo { padding: 12px; gap: 10px; }
  .todo-actions { flex-direction: column; }
  .toolbar { gap: 8px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .alarm-actions { flex-direction: column-reverse; }
  .alarm-actions .btn { width: 100%; }
  .dialog-foot .btn { flex: 1; }
  .content-card { padding: 14px; }
  .footer { justify-content: center; text-align: center; }
}
