@font-face { font-family: "DM Sans"; src: url("assets/fonts/dmsans-light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dmsans-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dmsans-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dmsans-semibold.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("assets/fonts/dmsans-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }

:root {
  --deep-ink: #171A24;
  --slate-night: #222634;
  --soft-graphite: #2D3242;
  --peri: #7C8CFF;
  --mist: #AEB8FF;
  --coral: #FF8D7B;
  --sage: #82C9AE;
  --amber: #E9B96E;
  --cloud: #F4F5F8;
  --cool: #A9ADBA;
  --dust: #737887;
  --line: #383D4C;
  --counter-tile: #5C6484;
  --tile: rgba(45, 50, 66, .5);
  --highlight: rgba(124, 140, 255, .35);
  --glow: rgba(124, 140, 255, .2);
  --shadow: rgba(9, 11, 18, .35);
  --surface: linear-gradient(135deg, #30364A, #1E222E);
  --raised: linear-gradient(135deg, #3A4163, #242A3E);
  --bar: linear-gradient(90deg, #7C8CFF, #AEB8FF);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--deep-ink); }
body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.35; color: var(--cloud);
  overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; flex: none; }
mark { background: var(--highlight); color: inherit; border-radius: 2px; }
.noscript { padding: 24px; color: var(--cool); }

#app {
  position: relative; height: 100%; max-width: 600px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden; background: var(--deep-ink);
}
@media (min-width: 601px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
#tabs { position: relative; flex: 1; min-height: 0; }

/* ---------- Screen / app bar ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--deep-ink); }
.screen[hidden] { display: none; }
.appbar {
  flex: none; display: flex; align-items: center; gap: 4px;
  min-height: calc(56px + var(--sat)); padding: var(--sat) 4px 0 4px;
}
.appbar.large { min-height: calc(68px + var(--sat)); padding-left: 24px; }
.appbar h1 {
  flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 12px;
}
.appbar.large h1 { font-size: 30px; font-weight: 400; letter-spacing: -.4px; padding-left: 0; }
.appbar .search {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 16px; color: var(--cloud); padding: 8px 0;
}
.appbar .search::placeholder { color: var(--dust); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--cloud); position: relative; flex: none;
}
.icon-btn:hover { background: rgba(174, 184, 255, .08); }
.icon-btn:active { background: rgba(174, 184, 255, .16); }
.icon-btn:disabled { opacity: .38; }
.badge-dot { position: absolute; top: 11px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--peri); }
.battery {
  display: flex; align-items: center; gap: 4px; min-width: 48px; height: 48px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--cool); margin-right: 4px;
}
.battery:active { background: rgba(174, 184, 255, .12); }
.battery.low { color: var(--amber); }
.battery.critical { color: var(--coral); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); animation: pulse .9s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0; } to { opacity: 1; } }

.body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; padding-bottom: 32px;
}
.body.pad { padding: 16px 16px 32px; }
.body.list { padding: 8px 16px 96px; }
.col { display: flex; flex-direction: column; }
.px { padding-left: 16px; padding-right: 16px; }
.gap8 > * + * { margin-top: 8px; }

/* ---------- Nav bar ---------- */
#nav {
  flex: none; display: flex; background: var(--slate-night); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px var(--shadow); padding-bottom: var(--sab); position: relative; z-index: 2;
}
.nav-item {
  flex: 1; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--cool); font-size: 11px; line-height: 1.2; min-width: 0;
}
.nav-item .ind { width: 64px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .2s; }
.nav-item:hover .ind { background: rgba(174, 184, 255, .08); }
.nav-item.on { color: var(--peri); font-weight: 500; }
.nav-item.on .ind { background: rgba(124, 140, 255, .2); }

/* ---------- Cards ---------- */
.card {
  position: relative; display: block; width: 100%; text-align: left; background: var(--surface);
  border: 1px solid rgba(56, 61, 76, .8); border-radius: 20px; box-shadow: 0 10px 24px var(--shadow);
  color: var(--cloud); overflow: hidden;
}
.card.raised { background: var(--raised); border-radius: 24px; box-shadow: 0 8px 32px var(--glow), 0 10px 24px var(--shadow); }
.card.r24 { border-radius: 24px; }
.card.r22 { border-radius: 22px; }
.card.tap { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card.tap > .in { transition: transform .15s; }
.card.tap:active > .in { transform: scale(.97); }
.card.tap::after { content: ""; position: absolute; inset: 0; background: rgba(124, 140, 255, 0); transition: background .15s; pointer-events: none; }
.card.tap:hover::after { background: rgba(124, 140, 255, .04); }
.card.tap:active::after { background: rgba(124, 140, 255, .08); }
.in { padding: 16px; }
.in20 { padding: 20px; }

.section-h { display: flex; align-items: center; padding: 24px 16px 4px 24px; min-height: 52px; box-sizing: content-box; }
.section-h h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 500; line-height: 1.3; }
.title-m { font-size: 17px; font-weight: 500; line-height: 1.3; margin: 0; }
.label-l { font-size: 14px; font-weight: 500; color: var(--cool); }
.label-s { font-size: 12px; color: var(--cool); line-height: 1.3; }
.muted { color: var(--cool); }
.quote { font-style: italic; font-size: 15px; line-height: 1.45; color: var(--cloud); white-space: pre-wrap; word-wrap: break-word; }
.txt15 { font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.clamp1, .clamp2, .clamp3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.clamp1 { -webkit-line-clamp: 1; } .clamp2 { -webkit-line-clamp: 2; } .clamp3 { -webkit-line-clamp: 3; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row { display: flex; align-items: center; min-width: 0; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.cap { text-transform: uppercase; font-size: 12px; letter-spacing: 1px; font-weight: 500; }
.cap10 { text-transform: uppercase; font-size: 10px; letter-spacing: 1px; font-weight: 500; }

.pill {
  display: inline-block; max-width: 100%; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35;
}
.status { border: 1px solid; font-weight: 600; flex: none; }
.status.open { color: var(--amber); border-color: rgba(233, 185, 110, .8); }
.status.done { color: var(--sage); border-color: rgba(130, 201, 174, .8); }
.accent { border: 1px solid var(--line); font-weight: 400; }
.date-badge {
  width: 54px; padding: 8px 0; border-radius: 14px; text-align: center; flex: none;
  background: rgba(130, 201, 174, .1); border: 1px solid rgba(130, 201, 174, .35);
}
.date-badge .m { color: var(--sage); font-size: 10px; letter-spacing: 1.2px; font-weight: 500; }
.date-badge .d { font-size: 22px; font-weight: 300; line-height: 1.1; }

/* Full path card rail */
.rail { padding-left: 24px; }
.rail .blk { position: relative; }
.rail .blk::before {
  content: ""; position: absolute; left: -18.5px; top: 5.5px; width: 5px; height: 5px; border-radius: 50%; background: var(--line); z-index: 1;
}
.rail .blk:not(:last-child)::after {
  content: ""; position: absolute; left: -16.75px; top: 8px; width: 1.5px; height: 100%; background: var(--line); transform-origin: top;
}
.rail.anim .blk::after { animation: grow .1s linear both; }
.rail.anim .blk:nth-child(2)::after { animation-delay: .1s; }
.rail.anim .blk:nth-child(3)::after { animation-delay: .2s; }
.rail.anim .blk::before { animation: fade .1s linear both; }
.rail.anim .blk:nth-child(2)::before { animation-delay: .1s; }
.rail.anim .blk:nth-child(3)::before { animation-delay: .2s; }
.rail.anim .blk:nth-child(4)::before { animation-delay: .3s; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Summary */
.period-switch { display: flex; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(23, 26, 36, .45); }
.period-switch button {
  flex: 1; height: 44px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--cool); transition: background .2s, color .2s;
}
.period-switch button.on { background: var(--bar); color: var(--deep-ink); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile { padding: 16px; border-radius: 16px; background: var(--counter-tile); }
.big { font-size: 30px; font-weight: 300; line-height: 1.15; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 8px 16px 16px; scrollbar-width: none; scroll-padding: 16px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex: none; width: 264px; min-height: 160px; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border-radius: 16px;
  font-size: 16px; font-weight: 500; padding: 0 24px; transition: filter .15s, background .15s;
}
.btn.fill { background: var(--peri); color: var(--deep-ink); }
.btn.fill:hover { filter: brightness(1.06); }
.btn.fill:active { filter: brightness(.92); }
.btn.fill:disabled { background: rgba(124, 140, 255, .38); color: rgba(23, 26, 36, .38); }
.btn.outline { border: 1px solid var(--peri); color: var(--peri); }
.btn.outline:active { background: rgba(124, 140, 255, .12); }
.tbtn {
  min-height: 48px; min-width: 48px; padding: 0 12px; border-radius: 999px; color: var(--peri); font-size: 14px; font-weight: 500; flex: none;
}
.tbtn:hover { background: rgba(124, 140, 255, .08); }
.tbtn:active { background: rgba(124, 140, 255, .16); }
.tbtn.danger { color: var(--coral); }
.fab {
  position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 18px; z-index: 3;
  background: var(--peri); color: var(--deep-ink); display: grid; place-items: center; box-shadow: 0 8px 28px var(--glow);
  transition: filter .15s, transform .15s;
}
.fab:hover { filter: brightness(1.06); }
.fab:active { transform: scale(.95); }

/* Empty state */
.empty { flex: 1; display: flex; align-items: center; justify-content: center; overflow-y: auto; }
.empty .box { padding: 32px; display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 420px; }
.empty p { margin: 16px 0 24px; color: var(--cool); font-size: 16px; }
.empty .btn { width: auto; }

.filter-banner { display: flex; align-items: center; padding: 0 8px 0 16px; flex: none; }
.filter-banner .label-s { flex: 1; min-width: 0; }
.day-h { padding: 20px 4px 10px; font-size: 14px; font-weight: 500; color: var(--cool); }
.day-h.today { color: var(--cloud); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--slate-night); color: var(--cloud); font-size: 14px; font-weight: 600;
  margin: 4px 0; white-space: nowrap;
}
.chip.on { background: var(--peri); border-color: var(--peri); color: var(--deep-ink); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.on .dot { background: var(--deep-ink) !important; }
.type-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px; flex: none; scrollbar-width: none; min-height: 56px; align-items: center; }
.type-chips::-webkit-scrollbar { display: none; }
.type-chips .chip { background: var(--tile); font-weight: 500; flex: none; margin: 0; }
.type-chips .chip.on { background: var(--peri); }

/* Form */
.field { display: block; }
.input, .select {
  display: block; width: 100%; background: var(--tile); border: 1px solid var(--line); border-radius: 16px; padding: 15px 16px;
  color: var(--cloud); font-size: 16px; line-height: 1.35; outline: none; resize: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--dust); }
.input:focus, .select:focus { border-color: var(--peri); box-shadow: inset 0 0 0 .5px var(--peri); }
.input.quote { font-size: 15px; line-height: 1.45; }
.field.err .input { border-color: var(--coral); }
.field.err .input:focus { box-shadow: inset 0 0 0 .5px var(--coral); }
.help { display: flex; gap: 8px; padding: 4px 12px 0 12px; font-size: 12px; min-height: 20px; }
.help .e { flex: 1; color: var(--coral); }
.help .c { margin-left: auto; color: var(--dust); }
.select {
  -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23A9ADBA'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 24px;
}
.select option { background: var(--soft-graphite); color: var(--cloud); }
.datefield {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: 16px;
  background: var(--tile); border: 1px solid var(--line); cursor: pointer; font-size: 15px;
}
.datefield:hover { background: rgba(45, 50, 66, .7); }
.datefield.err { border-color: var(--coral); }
.datefield input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0;
  -webkit-appearance: none; appearance: none; color-scheme: dark;
}
.err-txt { color: var(--coral); font-size: 12px; margin-top: 8px; }
.mt4 { margin-top: 4px; } .mt6 { margin-top: 6px; } .mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt12 { margin-top: 12px; }
.mt14 { margin-top: 14px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }

/* Timeline notes */
.tl { position: relative; padding: 0 0 12px 24px; }
.tl::before { content: ""; position: absolute; left: 5.5px; top: 13.5px; width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.tl.up::after { content: ""; position: absolute; left: 7.25px; top: 0; height: 16px; width: 1.5px; background: var(--line); }
.tl .down { position: absolute; left: 7.25px; top: 16px; bottom: 0; width: 1.5px; background: var(--line); }
.tl .hit { display: block; width: 100%; text-align: left; min-height: 48px; padding: 8px 0; border-radius: 12px; }
.tl .hit:active { background: rgba(124, 140, 255, .08); }

.link-row { display: flex; align-items: center; gap: 8px; min-height: 48px; width: 100%; color: var(--mist); font-size: 14px; border-radius: 8px; text-align: left; }
.link-row:active { background: rgba(124, 140, 255, .08); }

/* Stats */
.bars { display: flex; align-items: flex-end; height: 96px; }
.bars .slot { flex: 1; display: flex; justify-content: center; align-items: flex-end; height: 100%; }
.bars .b { width: 55%; max-width: 14px; border-radius: 7px; background: linear-gradient(180deg, var(--mist), rgba(174, 184, 255, .18)); }
.bars .b.today { background: linear-gradient(180deg, var(--peri), rgba(124, 140, 255, .35)); }
.bars .z { width: 4px; height: 4px; border-radius: 50%; background: var(--line); margin-bottom: 0; }
.track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.track > i { display: block; height: 100%; background: var(--bar); border-radius: 999px; }
.stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; }
.stack > i { display: block; height: 100%; margin-right: 2px; }
.legend { display: flex; align-items: center; gap: 12px; min-height: 32px; font-size: 14px; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.card-t { text-transform: uppercase; color: var(--cool); font-size: 12px; letter-spacing: 1.2px; font-weight: 500; margin: 0; }
.hero-n { font-size: 36px; font-weight: 300; line-height: 1.15; }
.wait { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Pages ---------- */
#pages { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.page { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--deep-ink); pointer-events: auto; animation: pageIn .28s cubic-bezier(.2, .8, .2, 1) both; }
.page.out { animation: pageOut .22s ease-in both; }
@keyframes pageIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pageOut { from { transform: none; } to { transform: translateX(100%); } }
.page .body { padding-bottom: calc(32px + var(--sab)); }

/* ---------- Overlay: dialogs, sheets, menus ---------- */
#overlay { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); pointer-events: auto; animation: fade .2s both; }
.scrim.clear { background: transparent; }
.scrim.out { animation: fadeOut .18s both; }
@keyframes fadeOut { to { opacity: 0; } }
.dialog {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(calc(100% - 48px), 360px);
  background: var(--soft-graphite); border-radius: 24px; padding: 24px 24px 12px; pointer-events: auto; animation: pop .2s both;
  max-height: calc(100% - 48px); overflow-y: auto;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.92); } }
.dialog h3 { margin: 0 0 16px; font-size: 20px; font-weight: 500; }
.dialog p { margin: 0 0 12px; color: var(--cool); font-size: 14px; line-height: 1.45; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 4px; margin: 12px -12px 0 0; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px; background: var(--soft-graphite);
  border-radius: 24px 24px 0 0; pointer-events: auto; animation: sheetIn .25s cubic-bezier(.2, .8, .2, 1) both;
  max-height: 85%; display: flex; flex-direction: column; padding-bottom: var(--sab);
}
.sheet.out { animation: sheetOut .2s ease-in both; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet .sc { overflow-y: auto; padding: 8px 16px 24px; }
.sheet .act { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 16px; font-size: 16px; text-align: left; }
.sheet .act:hover { background: rgba(174, 184, 255, .06); }
.sheet .act:active { background: rgba(174, 184, 255, .14); }
.sheet .act.danger { color: var(--coral); }
.sheet .acts-list { padding: 8px 0; }
.sheet .pick { display: block; width: 100%; text-align: left; padding: 12px 16px; min-height: 48px; font-size: 15px; }
.sheet .pick:active { background: rgba(174, 184, 255, .14); }
.switch-row { display: flex; align-items: center; min-height: 56px; gap: 16px; cursor: pointer; font-size: 16px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--line); border: 2px solid var(--cool); transition: background .2s, border-color .2s; }
.switch i::after { content: ""; position: absolute; left: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--cool); transition: all .2s; }
.switch input:checked + i { background: var(--peri); border-color: var(--peri); }
.switch input:checked + i::after { left: 22px; top: 2px; width: 24px; height: 24px; background: var(--deep-ink); }
.menu {
  position: absolute; right: 8px; top: calc(var(--sat) + 48px); min-width: 140px; background: var(--soft-graphite);
  border-radius: 16px; padding: 8px 0; pointer-events: auto; box-shadow: 0 8px 24px var(--shadow); animation: fade .15s both;
}
.menu button { display: block; width: 100%; text-align: left; min-height: 48px; padding: 0 16px; font-size: 14px; }
.menu button:active { background: rgba(174, 184, 255, .12); }

#snack {
  position: absolute; left: 16px; right: 16px; bottom: calc(92px + var(--sab)); z-index: 20; pointer-events: none;
  display: flex; justify-content: center;
}
#snack .s {
  max-width: 560px; width: 100%; background: var(--soft-graphite); border-radius: 16px; padding: 14px 16px; font-size: 14px;
  box-shadow: 0 6px 20px var(--shadow); animation: snackIn .2s both;
}
#snack .s.out { animation: fadeOut .2s both; }
@keyframes snackIn { from { opacity: 0; transform: translateY(12px); } }

:focus-visible { outline: 2px solid var(--peri); outline-offset: 2px; }
.input:focus-visible, .select:focus-visible, .search:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
