/* DayLog — dark, indigo-accented dashboard theme. Palette, surfaces and chart
   chrome are tuned for the dark surface as the primary look; a light variant
   is available via [data-theme="light"] for anyone who wants it. */

:root {
  color-scheme: dark;

  --page: #0a0a12;
  --sidebar-bg: #0c0c16;
  --surface: #15151f;
  --surface-2: #1d1d2b;
  --text: #f7f7fb;
  --text-2: #a6a6bd;
  --muted: #6f6f85;
  --grid: #24242f;
  --baseline: #35354a;
  --border: rgba(255, 255, 255, 0.08);

  --accent: #7c5cff;
  --accent-2: #4c8dff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 92, 255, 0.18);

  --good: #22c55e;
  --warning: #f5a623;
  --critical: #f4405c;

  --series-1: #4c8dff;
  --series-2: #f2994a;
  --series-3: #2ecc71;
  --series-4: #f0c239;
  --series-5: #ec4899;
  --series-6: #14b8a6;
  --series-7: #8b5cf6;
  --series-8: #ef4444;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 16px 36px -14px rgba(0, 0, 0, 0.65);
}

:root[data-theme="light"] {
  color-scheme: light;

  --page: #f9f9f7;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);

  --accent: #6c4fe0;
  --accent-2: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(108, 79, 224, 0.1);

  --good: #0ca30c;
  --warning: #c98500;
  --critical: #d03b3b;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #c98500;
  --series-5: #e34d8f;
  --series-6: #0d9488;
  --series-7: #6c4fe0;
  --series-8: #e34948;

  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 1px 1px rgba(11, 11, 11, 0.03);
  --shadow-hover: 0 10px 28px -10px rgba(11, 11, 11, 0.18), 0 2px 6px -2px rgba(11, 11, 11, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  background-image: radial-gradient(760px 420px at 12% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* --------------------------------------------------------------- shell */

.app-shell { display: flex; min-height: 100dvh; }
.app-main { flex: 1; min-width: 0; }

.sidebar { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--page);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px;
}

.wordmark {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-local {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.bar-right { display: flex; align-items: center; gap: 8px; }

.logo-mark {
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 7px;
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--accent) 78%, white) 0%,
    var(--accent) 50%,
    var(--accent-2) 100%
  );
  box-shadow: 0 2px 5px -1px color-mix(in srgb, var(--accent) 55%, transparent);
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  transition: color 0.12s ease, background 0.12s ease;
}

.icon-btn:hover { color: var(--text); background: var(--surface); }

.notif-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--critical);
  box-shadow: 0 0 0 2px var(--surface-2);
}

.avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px;
}

.stepper[hidden] { display: none; }

.step {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}

.step:hover { color: var(--text); background: var(--surface); }
.step:disabled { opacity: 0.3; cursor: default; }

.period {
  border: 0;
  background: transparent;
  padding: 0 10px;
  min-width: 116px;
  height: 34px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 58px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 2px;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab { transition: color 0.12s ease, background 0.12s ease; }
.tab:hover { color: var(--text-2); }
.tab[aria-selected="true"] { color: var(--accent); }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px calc(78px + env(safe-area-inset-bottom));
}

.panel { display: grid; gap: 12px; }
.panel[hidden] { display: none; }

.section-title {
  margin: 10px 2px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.85; font-size: 12px; color: var(--text-2); }

.daymeta { margin: 0 2px; font-size: 13px; color: var(--muted); }

.list { display: grid; gap: 8px; }

/* -------------------------------------------------------------- greeting */

.greeting { padding: 4px 2px 2px; }
.greeting-title { margin: 0; font-size: clamp(21px, 4vw, 26px); font-weight: 700; letter-spacing: -0.01em; }
.greeting-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-hover); }
}

.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.composer {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.composer-input, .note {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  font-size: 16px;
  outline: none;
}

.composer-input::placeholder, .note::placeholder, .amount::placeholder { color: var(--muted); }

.composer-go {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white) 0%, var(--accent) 100%);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 15px;
  padding: 0 16px;
  min-height: 42px;
  transition: filter 0.15s ease, transform 0.08s ease;
}

.composer-go:hover:not(:disabled) { filter: brightness(1.06); }
.composer-go:active:not(:disabled) { transform: scale(0.96); }
.composer-go:disabled { opacity: 0.5; }
.composer.money { flex-direction: column; gap: 10px; padding: 12px; }
.amount-row { display: flex; align-items: center; gap: 6px; }
.currency { font-size: 26px; font-weight: 600; color: var(--muted); padding-left: 4px; }

.amount {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding: 4px 0;
  outline: none;
}

.note { padding: 8px 4px; border-top: 1px solid var(--border); border-radius: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 550;
  min-height: 34px;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.chip:hover { border-color: var(--muted); }

.chip[aria-checked="true"] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--slot, var(--muted)); }

.chip-add {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

.chip-add:hover { color: var(--text-2); }

.chip-add-form { display: inline-flex; align-items: center; gap: 6px; }

.chip-add-form input {
  width: 130px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 7px 12px;
  min-height: 34px;
  font-size: 13px;
  outline: none;
}

.chip-add-form input:focus { border-color: var(--accent); }

.row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px 10px 10px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease;
}

@media (hover: hover) {
  .row:hover { box-shadow: var(--shadow-hover); }
}

.check {
  flex: none;
  width: 40px;
  height: 40px;
  margin: -6px 0 -6px -4px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 999px;
}

.check i {
  width: 21px;
  height: 21px;
  border-radius: 999px;
  border: 2px solid var(--baseline);
  display: grid;
  place-items: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.check svg { opacity: 0; }
.check:hover i { border-color: var(--text-2); }
.row.done .check i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
.row.done .check svg { opacity: 1; color: #fff; }

@keyframes pop {
  from { transform: scale(0.7); }
  to { transform: scale(1); }
}

.row-body { flex: 1; min-width: 0; padding-top: 8px; }
.row-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.row.done .row-title { color: var(--muted); text-decoration: line-through; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.ghost {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.ghost:hover { background: var(--surface-2); color: var(--text); }
.ghost.danger:hover { color: var(--critical); }

.habit { padding: 12px 14px 10px; }
.habit-head { display: flex; align-items: center; gap: 9px; }
.habit-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

.streak {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.streak.zero { color: var(--muted); }

.habit-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -6px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 999px;
}

.habit-toggle i {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--baseline);
  display: grid;
  place-items: center;
  color: transparent;
}

.habit-toggle:hover i { border-color: var(--text-2); }

.habit-toggle[aria-pressed="true"] i {
  background: var(--slot, var(--accent));
  border-color: var(--slot, var(--accent));
  color: #fff;
  animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grid30 { display: grid; grid-template-columns: repeat(var(--days, 30), 1fr); gap: 3px; margin-top: 10px; }
.cell { height: 28px; border: 0; background: transparent; padding: 0; display: grid; place-items: center; }
.cell i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 16px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--grid);
  color: transparent;
  transition: transform 0.12s ease;
}
.cell:hover i { transform: scale(1.2); }
.cell.done i { background: var(--slot, var(--accent)); color: #fff; }
.cell.rest i { background: transparent; box-shadow: inset 0 0 0 1px var(--grid); }
.cell.today i { outline: 2px solid var(--text-2); outline-offset: 2px; }

.habit-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.chart-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Category bars carry one measure across labelled categories, so every bar
   wears the same colour. Identity lives in the dot beside each name. */
.bars { display: grid; gap: 12px; margin-top: 10px; }
.bar-label { display: flex; align-items: baseline; gap: 7px; font-size: 13px; margin-bottom: 5px; }
.bar-name { color: var(--text); font-weight: 550; }
.bar-value { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-share { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bar-track { position: relative; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  min-width: 3px;
}

.bar-fill.over { background: var(--critical); }
.bar-budget { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--baseline); border-radius: 1px; }

.txn-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 8px; }

.datehead {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin: 10px 2px 0;
  font-variant-numeric: tabular-nums;
}

.adder { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 14px; }

.adder > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.adder > summary::-webkit-details-marker { display: none; }
.adder[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.adder form { display: grid; gap: 12px; padding-bottom: 14px; }

.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 12px; font-weight: 650; color: var(--muted); padding: 0; }

.field input, .field select {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  min-height: 44px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.swatch-pick {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

.swatch-pick i { width: 16px; height: 16px; border-radius: 5px; background: var(--slot); }
.swatch-pick[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--text-2); }

.primary {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white) 0%, var(--accent) 100%);
  color: var(--accent-ink);
  font-weight: 650;
  min-height: 46px;
  transition: filter 0.15s ease, transform 0.08s ease;
}

.primary:hover { filter: brightness(1.06); }
.primary:active { transform: scale(0.98); }

.toast {
  position: fixed;
  left: 50%;
  transform: translate(-50%, 20px);
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 40;
  background: var(--text);
  color: var(--page);
  font-size: 14px;
  font-weight: 550;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: min(92vw, 420px);
  text-align: center;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (min-width: 720px) {
  .tabs {
    position: static;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 10px;
    flex-wrap: wrap;
    gap: 4px;
    background: transparent;
    backdrop-filter: none;
    border-top: 0;
  }

  .tab { flex: none; flex-direction: row; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px; }
  .tab-label { font-size: 14px; max-width: none; overflow: visible; }
  .tab[aria-selected="true"] { background: var(--surface-2); }

  main { padding-bottom: 64px; }
  .toast { bottom: 28px; }
}

/* -------------------------------------------------------------- sidebar */

@media (min-width: 960px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 22px 14px;
    overflow-y: auto;
    z-index: 25;
  }

  .app-main { margin-left: 240px; }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 24px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .sidebar-brand .logo-mark { width: 24px; height: 24px; border-radius: 8px; }

  .sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
  .sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }

  .sidebar .tabs {
    display: flex;
    flex-direction: column;
    position: static;
    max-width: none;
    margin: 0;
    padding: 0;
    gap: 3px;
    background: transparent;
    backdrop-filter: none;
    border-top: 0;
  }

  .sidebar .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--text-2);
  }

  .sidebar .tab-label { font-size: 14px; }

  .sidebar .tab:hover { background: var(--surface-2); color: var(--text); }

  .sidebar .tab[aria-selected="true"] {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  }

  .settings-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-2);
  }

  .settings-btn:hover { background: var(--surface-2); color: var(--text); }

  .topbar .wordmark { display: none; }
  .topbar .tabs { display: none; }

  main { max-width: 880px; padding: 22px 28px 40px; }
  .toast { bottom: 28px; }
}

/* backdrop-filter makes an element the containing block for its
   position:fixed descendants, which would pin the mobile tab bar to the
   bottom of the header instead of the screen. It is only safe once the tabs
   are laid out statically, so it lives here. */
@media (min-width: 720px) {
  .topbar {
    background: color-mix(in srgb, var(--page) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
  }
}

.habit-head .ghost { margin-left: 2px; }

/* --------------------------------------------------------- dashboard tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.tile-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; }
.tile-progress { height: 4px; border-radius: 999px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.tile-progress i { display: block; height: 100%; border-radius: 999px; background: var(--warning); }
.tile-link { display: block; margin-top: 6px; padding: 0; }

.card-pad { padding: 16px 18px; }
.card-title { font-size: 14.5px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-link { font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; }

/* ---------------------------------------------------------------- donut */

.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.donut {
  width: 120px;
  height: 120px;
  flex: none;
  border-radius: 50%;
  position: relative;
}

.donut-hole {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.donut-hole .tile-value { font-size: 16px; margin-top: 0; }
.donut-hole .hint { font-size: 10px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 160px; }

.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-value { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.sparkline { margin-top: 10px; line-height: 0; }

/* --------------------------------------------------------------- budgets */

.budget-list { display: grid; gap: 14px; }

.budget-row { display: flex; align-items: center; gap: 12px; }

.budget-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--slot, var(--muted)) 18%, transparent);
  color: var(--slot, var(--muted));
}

.budget-body { flex: 1; min-width: 0; }
.budget-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.budget-name { font-size: 13.5px; font-weight: 600; }
.budget-amt { margin-left: auto; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget-pct { flex: none; font-size: 12px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }

/* ----------------------------------------------------------- week chart */

.week-chart { display: flex; gap: 12px; height: 170px; }

.chart-yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  padding-bottom: 22px;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.week-bars { flex: 1; display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.week-bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }

.week-bar { width: 100%; max-width: 30px; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.week-bar i {
  display: block;
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, white), var(--accent));
}

.week-bar-pair { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; width: 100%; }
.week-bar-pair .week-bar { max-width: 14px; }
.week-bar-pair .week-bar.income i { background: var(--good); border-radius: 4px 4px 2px 2px; }
.week-bar-pair .week-bar.expense i { background: var(--critical); border-radius: 4px 4px 2px 2px; }

.week-bar-label { font-size: 10.5px; color: var(--muted); font-weight: 600; }

.week-legend { display: flex; justify-content: center; gap: 18px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: middle; }
.legend-dot.income { background: var(--good); }
.legend-dot.expense { background: var(--critical); }

/* --------------------------------------------------------------- modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 20px;
  width: 440px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
}

.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.modal-fields { display: grid; gap: 12px; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.field-error { font-size: 11px; color: var(--critical); margin-top: 4px; }
.field-inline { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.modal-fields input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.btn-plain {
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
  padding: 0 18px;
  min-height: 40px;
}

.btn-plain:hover { background: var(--surface); box-shadow: var(--shadow); }
.btn-auto { width: auto; min-height: 40px; padding: 0 18px; }

/* --------------------------------------------------------------- planner */

.hour-row { display: flex; border-bottom: 1px solid var(--border); min-height: 48px; }
.hour-row:last-child { border-bottom: 0; }

.hour-label {
  width: 62px;
  flex: none;
  padding: 10px 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  border-right: 1px solid var(--border);
}

.hour-body { flex: 1; min-width: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }

.task-block {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--slot, var(--accent)) 14%, var(--surface-2));
  cursor: pointer;
  border-left: 3px solid var(--slot, var(--accent));
}

.task-block-title { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-block.done .task-block-title { color: var(--muted); text-decoration: line-through; }
.task-block-time { font-size: 11px; color: var(--muted); flex: none; }

/* ----------------------------------------------------------------- tasks */

.chip-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }

.task-group { margin-bottom: 20px; }
.task-group:last-child { margin-bottom: 0; }

.task-item { border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: 0; }

.task-tag {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--slot, var(--muted)) 20%, transparent);
  color: var(--slot, var(--text-2));
  font-weight: 650;
}

.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--slot, var(--muted)); }

.mini-check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--baseline);
  background: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.task-block.done .mini-check,
.subtask-row.done .mini-check {
  background: var(--slot, var(--accent));
  border-color: var(--slot, var(--accent));
  color: #fff;
  animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-recur {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
}

.subtask-row { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 12.5px; cursor: pointer; }
.subtask-row.done { color: var(--muted); text-decoration: line-through; }

.subtask-add { display: flex; gap: 6px; margin-top: 4px; }

.subtask-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
  outline: none;
}

/* -------------------------------------------------------------- calendar */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-dow { background: var(--surface-2); padding: 7px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; }

.cal-cell {
  background: var(--surface);
  padding: 6px;
  min-height: 58px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0;
  text-align: left;
  color: inherit;
  transition: background 0.12s ease;
}

.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { opacity: 0.35; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.selected { background: var(--accent-soft); }
.cal-daynum { font-size: 12.5px; font-weight: 600; }
.cal-cell.today .cal-daynum { color: var(--accent); font-weight: 800; }
.cal-dots { display: flex; gap: 3px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }

.cal-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }

@media (max-width: 720px) {
  .cal-layout { grid-template-columns: 1fr; }
}

.cal-day-list { display: flex; flex-direction: column; gap: 6px; }
.cal-day-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 0; }

/* ---------------------------------------------------------------- money */

.accounts-row { display: flex; gap: 12px; overflow: auto; padding-bottom: 4px; margin-bottom: 4px; }

.account-card {
  flex: none;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.account-balance { font-size: 18px; font-weight: 700; margin-top: 4px; }
.account-balance.negative { color: var(--critical); }

.segmented { display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; }

.segmented-btn {
  flex: 1;
  text-align: center;
  padding: 7px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--text-2);
}

.segmented-btn[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }

.money-field-row { display: flex; gap: 8px; }

.money-field-row select {
  flex: 1;
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  border-radius: 0;
  padding: 8px 4px;
  font-size: 14px;
  outline: none;
}

.txn-amount.income { color: var(--good); }
.txn-dot { margin-top: 13px; }
