/* ─────────────────────────────────────────────────────────────
   Brand colours — change these two lines to re-theme the app
   ───────────────────────────────────────────────────────────── */
:root {
  --brand: #1C3F49;          /* deep teal: buttons, highlights, headings */
  --brand-ink: #FFFFFF;      /* text on top of the main colour */
  --brand-light: #AAD0DB;    /* pale teal: soft highlights */
  --brand-paper: #F5F4F2;    /* warm off-white: sidebar, panels */
  --gold: #C7A252;           /* brand gold */
  --yellow: #F2B200;         /* urgent stars */

  --bg: #AAD0DB;             /* page background: your pale teal */
  --side-bg: var(--brand-paper);
  --surface: #FFFFFF;
  --surface-2: var(--brand-paper);
  --line: #CBD7DA;
  --line-soft: #E4EAEB;
  --ink: #142428;
  --ink-2: #4C5F64;
  --ink-3: #85969A;
  --danger: #C8341F;
  --star: var(--yellow);
  --gold-ink: #7A5E22;
  --ok: #2E7D5B;
  --brand-soft: color-mix(in srgb, var(--brand-light) 45%, white);
  --brand-line: color-mix(in srgb, var(--brand) 35%, white);

  --r-card: 16px;
  --r-tile: 20px;
  --shadow-card: 0 1px 2px rgba(22, 32, 52, .06), 0 1px 1px rgba(22, 32, 52, .03);
  --shadow-pop: 0 18px 50px rgba(15, 22, 38, .22);
  --font: Aptos, "Aptos Display", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ── Layout ─────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--side-bg); border-right: 1px solid var(--line);
  padding: 18px 16px 16px; display: flex; flex-direction: column; gap: 16px;
}
.main { width: 100%; max-width: 860px; justify-self: center; padding: 0 32px 64px; min-width: 0; }
.scrim { display: none; }

@media (min-width: 900px) { .mobile-only { display: none !important; } }
@media (max-width: 899px) {
  .desktop-only { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(86vw, 330px);
    transform: translateX(-102%); transition: transform .25s ease;
    box-shadow: var(--shadow-pop); padding-top: calc(16px + env(safe-area-inset-top));
  }
  body.drawer-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(15, 20, 30, .4); opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .main { padding: 0 12px calc(110px + env(safe-area-inset-bottom)); }
}

/* ── Sidebar ────────────────────────────────────────────── */
.side-head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; height: 42px; color: var(--ink-3);
}
.search-box svg { width: 18px; height: 18px; }
.search-box input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.side-section { display: flex; flex-direction: column; gap: 6px; }
.side-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 0 6px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-link {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 10px; border: 0; background: none;
  border-radius: 12px; text-align: left; color: var(--ink);
}
.cat-link:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.cat-link.active { background: var(--surface); box-shadow: var(--shadow-card); font-weight: 600; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cat); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 18%, transparent); }
.cat-dot.big { width: 14px; height: 14px; display: inline-block; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* ── Tiles (Today / Scheduled / Urgent …) ───────────────── */
.tiles { display: grid; gap: 10px; }
.tiles-side { grid-template-columns: 1fr 1fr; }
.tiles-main { grid-template-columns: repeat(3, 1fr); margin: 4px 0 8px; }
.tile {
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; row-gap: 10px;
  text-align: left; padding: 12px 12px 10px; border-radius: var(--r-tile); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-card); color: var(--ink); transition: transform .12s, border-color .12s;
}
.tile:hover { border-color: var(--brand-line); }
.tile:active { transform: scale(.98); }
.tile.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-card); }
.tile-ic { grid-column: 1 / -1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; }
.tile-ic svg { width: 18px; height: 18px; }
.tile[data-view="starred"] .tile-ic svg { fill: #fff; }
.tile-label { font-size: 14px; color: var(--ink-2); align-self: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-count { font-size: 20px; font-weight: 700; line-height: 1; align-self: end; font-variant-numeric: tabular-nums; }
.tile.alerting .tile-count { color: var(--danger); }
@media (max-width: 440px) {
  .tiles-main { gap: 8px; }
  .tiles-main .tile { padding: 10px 10px 9px; }
  .tiles-main .tile-label { font-size: 13px; }
  .tiles-main .tile-count { font-size: 18px; }
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(14px + env(safe-area-inset-top)) 0 12px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.titles { flex: 1; min-width: 0; }
.titles h1 { color: var(--brand); margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; display: grid; place-items: center; color: var(--ink); flex: none;
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.mobile-search { padding: 0 0 10px; }
.mobile-search input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; }

.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.sync.s-synced i { background: var(--ok); }
.sync.s-syncing i { background: #E8A317; animation: pulse 1s infinite alternate; }
.sync.s-offline i, .sync.s-signed-out i { background: #E8A317; }
.sync.s-error i { background: var(--danger); }
@keyframes pulse { to { opacity: .3; } }

/* ── Quick add ──────────────────────────────────────────── */
.quickadd { margin: 4px 0 6px; position: relative; }
.qa-row {
  display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 5px 5px 14px; box-shadow: var(--shadow-card); transition: border-color .15s, box-shadow .15s;
}
.qa-row:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qa-ic { color: var(--brand); }
.qa-ic svg { width: 20px; height: 20px; }
.qa-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 40px; font-size: 16px; }
.qa-row input::placeholder { color: var(--ink-3); }
.qa-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.qa-btn svg { width: 18px; height: 18px; }
.qa-preview { display: none; flex-wrap: wrap; gap: 6px; padding: 0 6px 8px; }
.qa-preview.show { display: flex; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px 4px 8px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.pchip svg { width: 14px; height: 14px; }
.pchip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cat); }
.pchip.star-chip { background: color-mix(in srgb, var(--gold) 18%, white); color: var(--gold-ink); }
.pchip.star-chip svg { fill: var(--star); stroke: var(--star); }
@media (max-width: 899px) {
  .quickadd {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; margin: 0;
  }
  .qa-row { box-shadow: 0 8px 28px rgba(15, 22, 38, .18); }
  .qa-preview { padding: 0 4px 8px; }
  .pchip { box-shadow: var(--shadow-card); background: var(--surface); }
}

/* ── Groups and items ───────────────────────────────────── */
.view-tools { display: flex; justify-content: flex-end; gap: 8px; margin: 6px 0 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.chip-btn svg { width: 15px; height: 15px; }
.chip-btn.danger { color: var(--danger); }
.group { margin-top: 18px; }
.group-label {
  display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 14px; font-weight: 700; color: var(--ink-2);
}
.group.danger .group-label { color: var(--danger); }
.group-count { font-size: 12px; font-weight: 600; color: var(--ink-3); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 8px; border-radius: 999px; }
details.group > summary { cursor: pointer; list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin-left: 2px; transition: transform .15s; }
details.group[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }

.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { position: relative; border-radius: var(--r-card); transition: opacity .2s, transform .2s; }
.item.leaving { opacity: 0; transform: translateX(12px); }
.item-card {
  position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 13px 8px 13px 16px; box-shadow: var(--shadow-card); touch-action: pan-y;
}
.item-card::before {
  content: ''; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cat);
}
.check { flex: none; width: 28px; height: 28px; border: 0; background: none; padding: 0; margin-top: -2px; display: grid; place-items: center; }
.ring {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #B7BDC8; display: grid; place-items: center;
  color: transparent; transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.ring svg { width: 14px; height: 14px; }
@media (hover: hover) { .check:hover .ring { border-color: var(--cat); color: color-mix(in srgb, var(--cat) 60%, white); } }
.item.done .ring, .item.completing .ring { background: var(--cat); border-color: var(--cat); color: #fff; }
.item.completing .ring { transform: scale(1.12); }
.item-text { flex: 1; min-width: 0; cursor: pointer; padding-top: 1px; outline-offset: 4px; }
.item-title { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; transition: color .2s; }
.item.done .item-title, .item.completing .item-title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-3); }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.due { font-weight: 600; color: var(--ink-2); }
.due.late { color: var(--danger); }
.meta-ic { display: inline-flex; align-items: center; gap: 4px; }
.meta-ic svg { width: 14px; height: 14px; }
.meta-ic.snoozed { color: var(--gold-ink); }
.meta-done { color: var(--ink-3); }
.cat-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.cat-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.star { flex: none; width: 36px; height: 36px; margin: -6px 0; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; color: #C7CCD5; }
.star svg { width: 20px; height: 20px; }
.star:hover { color: var(--star); }
.star.on { color: var(--star); }
.star.on svg { fill: var(--star); }
.item.done .star { opacity: .5; }

/* swipe backgrounds (mobile) */
.swipe-hint {
  position: absolute; inset: 0; border-radius: var(--r-card); display: flex; align-items: center; gap: 8px;
  padding: 0 22px; color: #fff; font-weight: 600; opacity: 0;
}
.swipe-hint svg { width: 20px; height: 20px; }
.swipe-done { background: var(--ok); justify-content: flex-start; }
.swipe-del { background: var(--danger); justify-content: flex-end; }
.item.swipe-right .swipe-done, .item.swipe-left .swipe-del { opacity: .75; }
.item.armed .swipe-done, .item.armed .swipe-del { opacity: 1; }

.empty { text-align: center; color: var(--ink-2); padding: 56px 16px; }
.empty-ic { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink-3); border: 1px solid var(--line); }
.empty p { margin: 0 auto; max-width: 320px; }

/* ── Sheets (editor, settings, lists) ───────────────────── */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(15, 20, 30, .45); }
dialog.sheet {
  border: 0; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: min(88dvh, 820px);
  border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-pop); overflow-y: auto;
  animation: pop .18s ease-out;
}
dialog.sheet.small { width: min(440px, calc(100vw - 32px)); }
dialog.closing { animation: fadeout .16s ease-in forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fadeout { to { opacity: 0; transform: translateY(8px); } }
@media (max-width: 899px) {
  dialog.sheet, dialog.sheet.small {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; max-height: 92dvh;
    padding-bottom: env(safe-area-inset-bottom); animation: slideup .22s ease-out;
  }
  @keyframes slideup { from { transform: translateY(40px); opacity: .4; } }
}
.sheet-inner { padding: 14px 20px 20px; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -8px 4px; }
.sheet-title { font-size: 17px; font-weight: 700; margin: 6px 0 12px; }
.sheet-head .sheet-title { margin: 0; }
.sheet-title.center, .center { text-align: center; }
.star-toggle { color: var(--ink-3); }
.star-toggle.on { color: var(--star); }
.star-toggle.on svg { fill: var(--star); }
#edTitle {
  width: 100%; border: 0; outline: 0; resize: none; font-size: 22px; font-weight: 500; padding: 10px 2px 14px;
  border-bottom: 1px solid var(--line); background: none; overflow: hidden; line-height: 1.3;
}
#edTitle::placeholder { color: var(--ink-3); }
.parse-hint { margin: 8px 2px 0; font-size: 13px; color: var(--brand); font-weight: 600; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.fields { display: flex; flex-direction: column; }
.frow { display: flex; align-items: center; gap: 14px; min-height: 58px; border-bottom: 1px solid var(--line-soft); padding: 4px 2px; }
.frow.disabled { opacity: .45; }
.fic { width: 24px; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.frow input, .frow select {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 8px 0; appearance: none; -webkit-appearance: none;
}
.frow select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 24px; cursor: pointer; }
.frow input[type="date"]:invalid, .frow input[type="time"]:not(:valid) { color: var(--ink-3); }
.hint { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.clear-btn { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid #F2B8B4; color: var(--danger); background: none; display: grid; place-items: center; flex: none; }
.clear-btn svg { width: 14px; height: 14px; }
.repeat-more { display: flex; flex-direction: column; gap: 10px; padding: 12px 0 14px 38px; border-bottom: 1px solid var(--line-soft); }
.rm-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.rm-label { width: 48px; color: var(--ink-2); font-size: 14px; }
.rm-unit { color: var(--ink); }
.repeat-more input[type="number"] { width: 72px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 16px; background: var(--surface); text-align: center; }
.repeat-more input[type="date"], .repeat-more select { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 15px; background: var(--surface); min-width: 0; flex: 1 1 160px; max-width: 260px; }
.repeat-more input:focus, .repeat-more select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.quick-dates { display: flex; gap: 8px; padding: 10px 0 12px 38px; border-bottom: 1px solid var(--line-soft); }
.quick-dates button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.quick-dates button:hover { border-color: var(--brand); color: var(--brand); }

.ed-actions { display: flex; justify-content: space-around; gap: 6px; margin-top: 16px; padding: 8px; border-radius: 20px; background: var(--surface-2); }
.ed-actions button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 8px 4px; border-radius: 14px; font-size: 13px; color: var(--ink); }
.ed-actions button:hover { background: var(--surface); }
.ed-actions svg { width: 22px; height: 22px; }
.danger-text { color: var(--danger) !important; }
.primary-text { color: var(--brand) !important; font-weight: 700; }

.pill-actions {
  display: flex; align-self: center; margin-top: 20px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--line-soft);
}
.pill-actions button { border: 0; background: none; padding: 12px 30px; font-size: 16px; font-weight: 600; min-width: 120px; border-radius: 999px; }
.pill-actions button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.pill-actions button + button { border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; }
.pill-actions button:first-child { border-radius: 999px 0 0 999px; }
.modified { text-align: center; font-size: 12px; color: var(--ink-3); margin: 14px 0 0; }

.snooze-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.snooze-grid button {
  border: 1px solid var(--line); background: var(--brand-paper); border-radius: 14px; padding: 10px 6px; font-weight: 600; font-size: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 48px;
}
.snooze-grid button small { font-weight: 500; font-size: 11px; color: var(--ink-3); }
.snooze-grid button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* list editor */
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 10px 0 6px; }
.text-input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 16px; background: var(--surface); outline: 0; }
.text-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.text-input.narrow { width: 130px; }
.text-input.code { letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--sw); position: relative; }
.swatch.on::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--sw); }
.swatch.custom { background: conic-gradient(#EF4444, #F59E0B, #84CC16, #14B8A6, #3B82F6, #8B5CF6, #EC4899, #EF4444); display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.swatch.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.text-btn { border: 0; background: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 6px; font-weight: 600; color: var(--ink-2); border-radius: 10px; }
.text-btn svg { width: 18px; height: 18px; }
.text-btn:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.text-btn.small { font-size: 13px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* settings */
.set-block { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.set-block:first-of-type { border-top: 0; }
.set-block h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 8px; }
.set-block h3 svg { width: 18px; height: 18px; color: var(--brand); }
.set-block p { margin: 0 0 8px; }
.set-block code { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 6px; padding: 1px 5px; font-size: 12.5px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form .text-input { flex: 1 1 200px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--brand-line); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.block { width: 100%; height: 48px; font-size: 16px; }
.form-msg { font-size: 13px; color: var(--ink-2); min-height: 1em; margin: 6px 0 0 !important; }
.form-msg.bad { color: var(--danger); }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 6px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }
.sound-row { margin: 6px 0 8px; }
.select-input { width: auto; min-width: 150px; height: 42px; padding: 0 12px; cursor: pointer; }

/* ── Alert modal ────────────────────────────────────────── */
dialog.alert-dlg {
  border: 0; padding: 0; width: min(400px, calc(100vw - 32px)); border-radius: 28px; background: var(--surface);
  box-shadow: var(--shadow-pop); animation: alertpop .25s cubic-bezier(.2, 1.3, .5, 1);
}
dialog.alert-dlg::backdrop { background: rgba(15, 20, 30, .55); backdrop-filter: blur(2px); }
@keyframes alertpop { from { opacity: 0; transform: scale(.9); } }
.alert-inner { padding: 26px 22px 18px; display: flex; flex-direction: column; align-items: stretch; text-align: center; border-top: 6px solid var(--cat); border-radius: 28px; }
.alert-bell {
  width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-light); color: var(--brand);
}
.alert-bell svg { width: 30px; height: 30px; animation: ring 1.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-14deg); } }
.alert-when { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.alert-title { font-size: 22px; margin: 6px 0 10px; line-height: 1.25; overflow-wrap: anywhere; }
.alert-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 13px; margin-bottom: 18px; color: var(--ink-2); }
.tag-star { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-ink); font-weight: 600; }
.tag-star svg { width: 14px; height: 14px; fill: var(--star); stroke: var(--star); }
.snooze-label { font-size: 13px; font-weight: 700; color: var(--ink-2); text-align: left; margin: 16px 2px 0; }
.alert-inner .btn.ghost { margin-top: 10px; }
.alert-more { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--brand); color: #fff; border-radius: 14px; padding: 12px 12px 12px 16px; font-size: 14px;
  box-shadow: var(--shadow-pop); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast button { border: 0; background: none; color: var(--brand-light); font-weight: 700; padding: 4px 8px; border-radius: 8px; }
.toast button:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 899px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* "Back to calendar" sheet after Mark completed */
.cal-done-tick { width: 56px; height: 56px; margin: 4px auto 8px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 30px; font-weight: 700; }
#catDlg .btn.block + .btn.block { margin-top: 8px; }
#catDlg .btn.primary.block { margin-top: 14px; }
#catDlg .btn[disabled] { opacity: .6; }

/* Back to All reminders */
.brand { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 700; font-size: 20px; cursor: pointer; text-align: left; }
#backBtn { color: var(--brand); margin-left: -8px; }
#backBtn[hidden] { display: none; }
@media (max-width: 899px) { body.in-sub #menuBtn { display: none; } }

/* ── List | Board switch ────────────────────────────────── */
.mode-seg { display: inline-flex; background: color-mix(in srgb, white 55%, transparent); border-radius: 999px; padding: 3px; gap: 2px; flex: none; }
.mode-seg button { width: 36px; height: 32px; border: 0; border-radius: 999px; background: none; display: grid; place-items: center; color: var(--ink-2); }
.mode-seg button svg { width: 19px; height: 19px; }
.mode-seg button.on { background: var(--brand); color: var(--brand-ink); }

/* ── Board ──────────────────────────────────────────────── */
body.board-mode .main { max-width: none; }
.board-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.seg { display: inline-flex; background: color-mix(in srgb, white 55%, transparent); border-radius: 999px; padding: 3px; flex: none; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
.bchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; padding: 2px; }
.bchips::-webkit-scrollbar { display: none; }
.bchip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.bchip i { width: 9px; height: 9px; border-radius: 50%; }
.bchip.on { box-shadow: inset 0 0 0 2px var(--brand); }
.board-hint { margin: 6px 4px 10px; font-size: 13px; color: var(--ink-2); }
.board {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(210px, 1fr)); gap: 12px; align-items: stretch;
  overflow-x: auto; padding-bottom: 8px;
}
.bcol { background: color-mix(in srgb, var(--brand-paper) 72%, transparent); border-radius: 18px; padding: 10px; min-height: 180px; transition: box-shadow .12s, background .12s; }
.bcol h3 { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 10px; font-size: 14px; color: var(--brand); }
.bcol h3 b { background: color-mix(in srgb, var(--brand) 12%, transparent); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.bcol.danger h3 { color: var(--danger); }
.bcol.b-over { box-shadow: inset 0 0 0 2px var(--brand); background: color-mix(in srgb, white 70%, transparent); }
.bcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.b-empty { font-size: 13px; color: var(--ink-3); text-align: center; padding: 14px 0; border: 1.5px dashed var(--line); border-radius: 12px; }
.b-foot { margin-top: 10px; border: 0; background: none; font-size: 12.5px; color: var(--brand); font-weight: 600; padding: 4px; text-align: left; }
.bcard {
  position: relative; background: var(--surface); border-radius: 14px; padding: 10px 12px 10px 14px; box-shadow: var(--shadow-card);
  border-left: 5px solid var(--cat); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: pan-x pan-y;
}
.bcard:hover { box-shadow: 0 2px 8px rgba(15, 22, 38, .12); }
.b-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; padding-right: 20px; overflow-wrap: break-word; hyphens: auto; }
.bcard.done .b-title { text-decoration: line-through; color: var(--ink-3); font-weight: 600; }
.b-star { position: absolute; right: 9px; top: 9px; color: var(--star); }
.b-star svg { width: 15px; height: 15px; fill: var(--star); }
.b-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; margin-top: 5px; font-size: 12.5px; color: var(--ink-2); }
.b-meta .late { color: var(--danger); font-weight: 700; }
.b-ic svg { width: 13px; height: 13px; }
.b-cat { font-weight: 700; color: color-mix(in srgb, var(--cat) 80%, var(--ink)); }
.b-status { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 6px; color: #5B4A8F; background: #EFEAFB; }
.b-status.hold { color: var(--gold-ink); background: #F7EFD9; }
.b-notes { font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 0 6px; }
.b-placeholder { opacity: .35; }
.b-ghost {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; cursor: grabbing;
  box-shadow: 0 14px 34px rgba(15, 22, 38, .28); outline: 2px solid var(--brand);
}
body.b-dragging, body.b-dragging * { cursor: grabbing !important; user-select: none; }
@media (max-width: 899px) {
  .board-tools { gap: 8px; }
  .board {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 0 16px 96px;
    scroll-padding: 0 16px;
  }
  .bcol { flex: 0 0 84%; scroll-snap-align: start; }
  body.b-dragging .board { scroll-snap-type: none; }
}

/* ── Card sheet: status + notes ─────────────────────────── */
.card-sheet { gap: 2px; }
.card-list { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; color: var(--ink-2); margin-right: auto; }
.card-list i { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); }
.card-title { margin: 6px 0 2px; font-size: 21px; color: var(--brand); line-height: 1.25; overflow-wrap: anywhere; }
.card-title.done { text-decoration: line-through; color: var(--ink-3); }
.card-when { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.card-when .late { color: var(--danger); font-weight: 700; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--brand); font-weight: 600; font-size: 13.5px; text-align: left; }
.status-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 8px; }
.status-pills button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.status-pills button.on { background: var(--cat, var(--brand)); border-color: var(--cat, var(--brand)); color: var(--cat-ink, var(--brand-ink)); }
.notes-head { font-weight: 700; color: var(--brand); margin: 10px 0 8px; }
.note-add { display: flex; gap: 8px; align-items: flex-end; }
.note-add textarea, .note textarea {
  flex: 1; width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 15px; resize: vertical; min-height: 46px; background: var(--surface);
}
.note-add textarea:focus, .note textarea:focus { outline: none; border-color: var(--brand); }
.note-add .btn { height: 46px; }
.notes-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.note { border-left: 3px solid var(--brand-light); padding: 1px 0 1px 11px; }
.note-when { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.note-when .edited { font-weight: 500; color: var(--ink-3); }
.note-actions { margin-left: auto; display: inline-flex; gap: 2px; opacity: .7; }
.note-actions:hover { opacity: 1; }
.icon-btn.xs { width: 30px; height: 30px; }
.icon-btn.xs svg { width: 16px; height: 16px; }
.note-text { font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.note-edit-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 6px; }
.note-edit-actions button { border: 0; background: none; font-weight: 600; font-size: 14px; }
.notes-empty { color: var(--ink-3); font-size: 14px; }
.ed-card { margin: 12px 0 0; }

/* ✎ in the list view */
.note-btn { border: 0; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 0 7px; font-size: 13px; font-weight: 700; line-height: 20px; }
@media (min-width: 900px) {
  body.board-mode .main { padding-left: 20px; padding-right: 20px; }
  .board.by-date { grid-template-columns: repeat(var(--cols), minmax(136px, 1fr)); gap: 10px; }
  .board.by-date .bcard { padding: 9px 10px 9px 12px; }
  .board.by-date .b-title { font-size: 13.5px; }
}
