:root {
  --lime: #bcd142;
  --lime-deep: #8fa52a;
  --lime-soft: #e7efb8;
  --olive: #6f7d3b;
  --olive-dark: #46511f;
  --forest: #2c3611;      /* sidebar: deep turtle green, not black */
  --forest-2: #3a4618;
  --ink: #1b2108;
  --cream: #f6f4e3;
  --bg: #eef2dd;
  --panel: #fbfcf3;
  --line: #dde5c4;
  --sky: #3f9fe6;
  --muted: #55602f;
  --err: #a3341f;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --body: "Anuphan", system-ui, sans-serif;           /* real fonts come from themes/*.css */
  --display: "Bai Jamjuree", "Anuphan", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--body); }
.defs { position: absolute; }
h1, h2 { font-family: var(--display); font-weight: 500; line-height: 1.2; margin: 0 0 18px; }
h1 { font-size: 30px; }
h2 { font-size: 18px; margin: 0 0 12px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; gap: 0; }
.nav {
  background: var(--forest); color: var(--cream);
  margin: 12px 0 12px 12px; border-radius: var(--r-lg);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 12px; height: calc(100vh - 24px);
}
.nav-head { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.brand-name { font-family: var(--display); font-size: 19px; line-height: 1.1; }
.brand-name span { color: var(--lime); }
.nav nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; border-radius: 999px; padding: 9px 14px;
  color: #dfe5c6; cursor: pointer; text-align: left;
  transition: background-color .15s, color .15s;
}
.nav-item span:first-of-type { flex: 1; }
.nav-item:hover { background: var(--forest-2); color: var(--cream); }
.nav-item[aria-current="page"] { background: var(--lime); color: var(--ink); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge { font-size: 12px; background: var(--forest-2); color: var(--lime); border-radius: 999px; padding: 0 9px; font-variant-numeric: tabular-nums; }
.nav-item[aria-current="page"] .badge { background: var(--ink); color: var(--lime); }
.kc-line { margin: auto 8px 0; font-size: 13px; color: #c3cba6; display: flex; gap: 8px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #6f7656; flex: none; }
.dot.on { background: var(--lime); }

main { padding: 32px 40px 40px; max-width: 920px; width: 100%; min-width: 0; }   /* min-width: wide tables and boards scroll inside, not the page */
/* page switches happen many times a day: keep it short and strong (Emil Kowalski standards) */
.view:not([hidden]) { animation: viewIn .15s cubic-bezier(.23, 1, .32, 1); }
/* transform only: content stays visible even if the animation never runs */
@keyframes viewIn { from { transform: translateY(6px); } to { transform: none; } }

/* ---------- controls ---------- */
.btn {
  background: var(--ink); color: var(--cream); border: 1.5px solid var(--ink);
  border-radius: 999px; padding: 8px 20px; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, transform 160ms cubic-bezier(.23, 1, .32, 1);
}
.btn:hover { background: var(--olive-dark); border-color: var(--olive-dark); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--olive); }
.btn.ghost:hover { background: var(--lime-soft); }
.btn.big { padding: 11px 30px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { background: var(--panel); border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.chip:hover { background: var(--lime-soft); border-color: var(--lime-deep); }

input[type="text"], input[type="url"], input[type="password"] {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 9px 14px; min-width: 0;
  transition: border-color .15s;
}
input:focus { border-color: var(--lime-deep); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.center { justify-content: center; text-align: center; }
.hint { color: var(--muted); font-size: 14px; max-width: 62ch; }
.hint.center { margin-left: auto; margin-right: auto; }
.err { color: var(--err); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 16px; }
.add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.add input[type="text"] { flex: 1 1 240px; }
.num { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }

/* ---------- fields: steppers and the reminder picker (themed; no native spinners or date popup) ---------- */
input::placeholder { color: var(--muted); opacity: .7; }
.field-btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 9px 14px; color: var(--muted);
  transition: border-color .15s;
}
.field-btn .ic { width: 18px; height: 18px; }
.field-btn:hover, .field-btn[aria-expanded="true"] { border-color: var(--lime-deep); }
.field-btn.on { color: var(--ink); }
.stepper {
  display: inline-flex; align-items: center; gap: 2px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 3px;
}
.stepper:focus-within { border-color: var(--lime-deep); }
.stepper input { width: 3.4ch; border: 0 !important; padding: 4px 0 !important; background: transparent !important; text-align: center; outline: none; font-variant-numeric: tabular-nums; }
.stepper .step { width: 30px; height: 30px; font-size: 16px; }
.when-pick { position: relative; }
.pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; width: 344px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
  box-shadow: 0 18px 36px -18px rgb(27 33 8 / .4);
  transform-origin: top left; animation: popIn .15s cubic-bezier(.23, 1, .32, 1);
}
.pop.end { left: auto; right: 0; transform-origin: top right; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.pop-h { margin: 2px 0 8px; font-size: 13px; color: var(--muted); }
.pop .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pop .chip { padding: 5px 12px; font-size: 14px; }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--olive-dark); border-color: var(--olive-dark); color: var(--cream); }
.time-pick { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.colon { font-family: var(--display); font-size: 20px; color: var(--muted); }
.pop-actions { justify-content: flex-end; margin-top: 6px; }
.pop .hint { margin: 0 0 6px; }
@media (max-width: 640px) { .pop, .pop.end { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; max-height: calc(100vh - 32px); overflow-y: auto; transform-origin: bottom center; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

.pill-input {
  display: flex; gap: 6px; align-items: center;
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 20px;
}
.pill-input:focus-within { border-color: var(--lime-deep); }
.pill-input input { flex: 1; border: 0 !important; padding: 6px 0 !important; background: transparent !important; outline: none; }

/* ---------- today ---------- */
.hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px;
  /* cream, not lime: the green turtle needs a light ground to stand out */
  background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 26px; margin-bottom: 16px;
  overflow: hidden;
}
.date { margin: 0 0 10px; color: var(--olive-dark); font-weight: 600; }
.bubble {
  position: relative; display: inline-block; margin: 0;
  background: var(--lime); border-radius: 20px; padding: 12px 20px; font-size: 24px;
}
.bubble::after {
  content: ""; position: absolute; right: -9px; top: 50%; margin-top: -9px;
  border: 9px solid transparent; border-left-color: var(--lime); border-right: 0;
}
#mascot { width: 280px; height: auto; display: block; cursor: pointer; margin: -14px -6px -18px 0; }
#mascot[hidden] { display: none; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; min-height: 92px;
}
.tile .k { font-size: 14px; color: var(--muted); display: block; }
.tile .v { font-family: var(--display); font-size: 24px; line-height: 1.2; display: block; }
.tile .v small { font-family: var(--body); font-size: 14px; color: var(--muted); margin-left: 4px; }
.tile .ic { width: 26px; height: 26px; color: var(--olive-dark); }
.tile-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--lime-soft); display: grid; place-items: center; flex: none; }

.ring { width: 46px; height: 46px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .track { stroke: var(--line); }
.ring .prog { stroke: var(--lime-deep); transition: stroke-dasharray .4s ease; }
.ring.full .prog { stroke: var(--olive-dark); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px;
}
.list .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .when { font-size: 13px; color: var(--olive-dark); background: var(--lime-soft); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.list .when.late { color: #fff; background: var(--err); }
.list.done li { background: transparent; }
.list.done .t { color: var(--muted); text-decoration: line-through; }
.list input[type="checkbox"] {
  appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--olive);
  display: grid; place-items: center; cursor: pointer; flex: none; margin: 0;
}
.list input[type="checkbox"]:checked { background: var(--olive-dark); border-color: var(--olive-dark); }
.list input[type="checkbox"]:checked::after { content: ""; width: 6px; height: 10px; border: solid var(--cream); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 10px; border-radius: 999px; }
.x:hover { background: var(--line); color: var(--ink); }
.empty { color: var(--muted); justify-content: center; background: transparent !important; border-style: dashed !important; }
#done-head { margin-top: 8px; }

.habits li { gap: 14px; }
.habits .ring { width: 52px; height: 52px; }
.habits .name { flex: 1 1 140px; font-weight: 600; }
.habits .sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.count { display: flex; align-items: center; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.count .n { font-family: var(--display); font-size: 17px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.step { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--lime-soft); cursor: pointer; font-size: 18px; line-height: 1; }
.step:hover { background: var(--lime); }

/* ---------- focus ---------- */
.timer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 30px 20px; }
.dial { position: relative; width: min(300px, 80vw); aspect-ratio: 1; margin: 0 auto 24px; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.dial .track { stroke: var(--lime-soft); }
.dial .prog { stroke: var(--lime-deep); transition: stroke-dasharray 1s linear; }
.dial-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.clock { font-family: var(--display); font-size: 68px; line-height: 1; margin: 0; font-variant-numeric: tabular-nums; }
.mode { margin: 8px 0 0; color: var(--muted); }

/* ---------- chat ---------- */
.ai-off { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 16px; max-width: 64ch; }
.ai-off p { margin: 0 0 4px; }
.chat { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; }
.chat li { max-width: 70ch; padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat .user { align-self: flex-end; background: var(--forest); color: var(--cream); border-bottom-right-radius: 6px; }
.chat .assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.chat .pending { color: var(--muted); }
.settings { margin-top: 14px; font-size: 14px; }
.settings summary { cursor: pointer; color: var(--olive-dark); font-weight: 600; }
.settings label { display: grid; grid-template-columns: 90px minmax(0, 360px); gap: 8px; align-items: center; margin: 10px 0; }
.settings input { width: 100%; }

/* ---------- keychain ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 18px 0 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.toast {
  position: fixed; right: 20px; bottom: 20px; margin: 0; max-width: 360px;
  background: var(--forest); color: var(--cream); padding: 12px 18px; border-radius: 16px;
  animation: viewIn .2s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .view:not([hidden]), .toast { animation: none; }
  * { transition: none !important; }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; margin: 12px 12px 0; padding: 12px; gap: 10px; }
  .nav nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; padding: 7px 12px; }
  .kc-line { margin: 0 8px; }
  main { padding: 20px 16px; }
  .hero { grid-template-columns: 1fr; padding: 20px; }
  #mascot { width: 180px; justify-self: center; grid-row: 1; margin: -10px 0; }
  .bubble::after { display: none; }
  .bubble { font-size: 20px; }
}

/* ---------- settings ---------- */
.theme-pick { border: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.theme-pick legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.theme-pick label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.theme-pick input { accent-color: var(--olive-dark); }

/* ---------- planner: tasks as a database (planner.js) ---------- */
main.wide { max-width: 1240px; }
.pl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pl-filters { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.seg { display: inline-flex; gap: 2px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 999px; padding: 6px 16px; cursor: pointer; color: var(--muted); font: inherit; transition: background-color .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--cream); }
.seg.small button { padding: 3px 12px; font-size: 14px; }
.btn.small { padding: 5px 14px; font-size: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 999px; background: none; color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--lime-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* dropdown, date picker, tag picker: themed popovers placed by planner.js */
.field-btn.dd .ic { width: 16px; height: 16px; opacity: .7; }
.field-btn.mini { padding: 5px 10px; font-size: 14px; gap: 6px; }
.field-btn.ghosty { background: transparent; border-color: transparent; }
.field-btn.ghosty:hover, .field-btn.ghosty[aria-expanded="true"] { background: #fff; border-color: var(--line); }
.field-btn.date-btn.on { color: var(--ink); }
.field-btn.late, .field-btn.date-btn.late { color: var(--err); }
.pop.float { position: fixed; z-index: 45; width: auto; min-width: 210px; max-width: 340px; max-height: calc(100vh - 32px); overflow-y: auto; }
.pop.float.up { transform-origin: bottom left; }
.pop.menu { padding: 6px; }
.dd-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.dd-opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; }
.dd-opt:hover, .dd-opt:focus { background: var(--lime-soft); outline: none; }
.dd-opt[aria-selected="true"] { font-weight: 600; }
.dd-opt[aria-selected="true"]::after { content: ""; margin-left: auto; width: 6px; height: 11px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.dot-s { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-s.s-todo { background: #c3cba3; }
.dot-s.s-doing { background: var(--sky); }
.dot-s.s-done { background: var(--lime-deep); }
.dp { width: 292px; max-width: 100%; }
.dp .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; }
.dp-title { font-family: var(--display); font-weight: 600; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-w { font-size: 12px; color: var(--muted); padding: 4px 0; }
.dp-d { height: 34px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; font: inherit; font-variant-numeric: tabular-nums; }
.dp-d:hover { background: var(--lime-soft); }
.dp-d.out { color: var(--muted); opacity: .55; }
.dp-d.today { box-shadow: inset 0 0 0 1.5px var(--lime-deep); }
.dp-d[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.tag { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; line-height: 1.5; padding: 0 9px; border-radius: 999px; white-space: nowrap; color: var(--ink); }
.t0 { background: #e7efb8; } .t1 { background: #d7eaf7; } .t2 { background: #f2e4c2; } .t3 { background: #e5def0; } .t4 { background: #f1d9cc; }
.tag-x { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: -5px; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.tag-x .ic { width: 12px; height: 12px; }
.tag-x:hover { background: rgb(27 33 8 / .12); }
.tag-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-pick { width: 280px; max-width: 100%; }
.tag-pick input[type="text"] { width: 100%; margin-bottom: 10px; }
.tag-pick .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick .hint { margin: 2px 0 0; font-size: 13px; }
.chip.tag-opt { border-color: transparent; }
.chip.tag-opt:hover { border-color: var(--lime-deep); }

/* table */
.tbl-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.pl-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.pl-table th { text-align: left; font-weight: 400; font-size: 13px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pl-table td { padding: 3px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pl-table tbody tr:last-child td { border-bottom: 0; }
.pl-table tbody tr:hover { background: rgb(188 209 66 / .09); }
.c-chk { width: 42px; text-align: center; }
.c-text { min-width: 200px; }
.c-status { width: 136px; } .c-date { width: 112px; } .c-tags { width: 150px; }
.c-remind { width: 128px; font-size: 13px; color: var(--muted); white-space: nowrap; }
/* the app opens 1040 px wide: drop the reminder column there and show a bell beside the title instead */
.rem-ic { display: none; color: var(--muted); }
.rem-ic .ic { width: 14px; height: 14px; }
@media (max-width: 1199px) { .pl-table .c-remind, .pl-table .c-remindAt { display: none; } .rem-ic { display: inline-flex; } .pl-table { min-width: 600px; } }
.c-remind.late { color: var(--err); }
.c-tags .tag { margin: 2px 4px 2px 0; }
.sort { background: none; border: 0; padding: 4px 2px; color: inherit; font: inherit; cursor: pointer; }
.sort:hover { color: var(--ink); }
.sort.on { color: var(--ink); font-weight: 600; }
.sort.on::after { content: ""; display: inline-block; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.sort.on[data-dir="up"]::after { border-top-color: transparent; border-bottom-color: currentColor; transform: translateY(-2px); }
.open-task { display: flex; gap: 8px; align-items: baseline; width: 100%; padding: 7px 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.open-task:hover { text-decoration: underline; text-underline-offset: .18em; }
.untitled { color: var(--muted); }
.has-note { font-size: 12px; color: var(--muted); white-space: nowrap; }
.is-done .open-task { color: var(--muted); text-decoration: line-through; }
.empty-row td { text-align: center; color: var(--muted); padding: 24px; }
.cb { appearance: none; display: inline-grid; place-items: center; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--olive); border-radius: 6px; background: #fff; cursor: pointer; vertical-align: middle; flex: none; }
.cb:checked { background: var(--olive-dark); border-color: var(--olive-dark); }
.cb:checked::after { content: ""; width: 5px; height: 9px; border: solid var(--cream); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.cb.small { width: 18px; height: 18px; }
.tbl-add { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 4px 12px; color: var(--muted); border-radius: var(--r-sm); }
.tbl-add:focus-within { color: var(--ink); box-shadow: inset 0 -2px 0 var(--lime-deep); }
.tbl-add input[type="text"] { flex: 1; border: 0; background: transparent; padding: 8px 0; }
.tbl-add input[type="text"]:focus { outline: none; }
.tbl-add .ic, .col-add .ic { width: 18px; height: 18px; }
.tbl-foot { margin-top: 12px; }

/* board */
.board { display: grid; grid-template-columns: repeat(3, minmax(200px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding: 0 4px 6px 0; }
.col { min-height: 170px; padding: 10px; border-radius: var(--r-md); background: rgb(221 229 196 / .4); transition: background-color .15s, box-shadow .15s; }
.col.over { background: var(--lime-soft); box-shadow: inset 0 0 0 2px var(--lime-deep); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; }
.col-name { font-weight: 600; }
.col-n { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.col-b { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: grab; transition: border-color .15s, transform 160ms cubic-bezier(.23, 1, .32, 1); }
.card:hover { border-color: var(--lime-deep); }
.card:active { transform: scale(.98); }
.card.dragging { opacity: .45; }
.card-t { overflow-wrap: anywhere; }
.card.is-done .card-t { color: var(--muted); text-decoration: line-through; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.card-date.late { color: var(--err); }
.card-rem { display: inline-flex; }
.card-rem .ic { width: 15px; height: 15px; }
.col-add { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 6px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: inherit; cursor: pointer; }
.col-add:hover { background: rgb(255 255 255 / .75); color: var(--ink); }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-title { margin: 0 6px; font-size: 20px; }
.cal-head .btn { margin-left: 8px; }
.cal-head .seg { margin-left: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--panel); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-w { padding: 6px 8px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 106px; padding: 4px 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background-color .15s; }
.cal-grid.week .cal-cell { min-height: 340px; }
.cal-cell.out { background: rgb(221 229 196 / .28); }
.cal-cell.out .cal-n { opacity: .55; }
.cal-cell.over { background: var(--lime-soft); }
.cal-top { display: flex; align-items: center; justify-content: space-between; }
.cal-n { padding: 0 7px; border-radius: 999px; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-n { background: var(--ink); color: var(--cream); }
.cal-add { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .15s; }
.cal-add .ic { width: 16px; height: 16px; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--lime-soft); color: var(--ink); }
@media (hover: none) { .cal-add { opacity: .7; } }
.cal-chip { display: block; width: 100%; padding: 1px 7px; border: 0; border-radius: 6px; font: inherit; font-size: 13px; line-height: 1.55; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: #eceedf; cursor: grab; }
.cal-chip.s-doing { background: #d9e9f6; }
.cal-chip.s-done { background: var(--lime-soft); color: var(--muted); text-decoration: line-through; }
.cal-chip:hover { box-shadow: inset 0 0 0 1px var(--lime-deep); }
.cal-chip.dragging { opacity: .45; }
.cal-more { padding: 0 7px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.cal-more:hover { color: var(--ink); text-decoration: underline; }
.cal-tray { margin-top: 18px; padding: 12px 14px; border: 1px dashed #c3cba3; border-radius: var(--r-md); transition: background-color .15s; }
.cal-tray.over { background: var(--lime-soft); }
.cal-tray h2 { margin: 0 0 8px; font-size: 15px; }
.cal-tray-items { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-tray .cal-chip { width: auto; max-width: 260px; }
.cal-tray .hint { margin: 8px 0 0; font-size: 13px; }

/* task page: a drawer from the right (occasional, so it may take 300 ms; iOS-like drawer curve) */
.tp-scrim { position: fixed; inset: 0; z-index: 30; background: rgb(27 33 8 / .28); animation: fadeIn .2s ease-out; }
.tp {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(580px, 100vw); overflow-y: auto;
  padding: 14px 32px 40px; background: var(--bg); box-shadow: -18px 0 40px -24px rgb(27 33 8 / .45);
  animation: tpIn .3s cubic-bezier(.32, .72, 0, 1);
}
.tp[hidden], .tp-scrim[hidden] { display: none; }
@keyframes tpIn { from { transform: translateX(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
.tp-top { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.tp input.tp-title { width: 100%; margin-bottom: 14px; padding: 4px 0; border: 0; border-radius: 0; background: transparent; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.25; }
.tp input.tp-title:focus { outline: none; box-shadow: 0 2px 0 var(--lime-deep); }
.tp-props { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px 12px; align-items: center; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.tp-k { font-size: 14px; color: var(--muted); }
.tp-props > div { justify-self: start; max-width: 100%; }
.tp-note-h { margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.tp-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }

/* note blocks */
.note { display: flex; flex-direction: column; gap: 1px; min-height: 120px; }
.nb { display: flex; align-items: flex-start; gap: 8px; }
.nb-text { flex: 1; min-width: 0; padding: 3px 0; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.nb.empty .nb-text:focus::before, .note > .nb.empty:only-child .nb-text::before { content: attr(data-ph); color: var(--muted); opacity: .7; pointer-events: none; }
.nb-h .nb-text { padding-top: 12px; font-family: var(--display); font-size: 20px; font-weight: 600; }
.nb-todo .cb { margin-top: 5px; }
.nb-todo.checked .nb-text { color: var(--muted); text-decoration: line-through; }
.bullet { width: 6px; height: 6px; margin: 12px 4px 0 6px; border-radius: 50%; background: var(--ink); flex: none; }

@media (max-width: 720px) {
  .board { grid-template-columns: repeat(3, 80vw); }
  .cal-cell { min-height: 74px; }
  .cal-chip { padding: 0 4px; font-size: 11px; }
  .cal-head .seg { margin-left: 0; }
  .tp { padding: 10px 16px 32px; }
  .tp-props { grid-template-columns: 70px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .tp, .tp-scrim { animation: none; } }

/* ---------- planner extras: search, trash, order, subtasks, repeat (planner.js) ---------- */
kbd { font: 12px var(--body); padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel); white-space: nowrap; }
.field-btn kbd { margin-left: 2px; }
#pl-trash .n:not(:empty) { font-size: 12px; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--lime-soft); color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast[hidden] { display: none; }
.toast-btn { flex: none; padding: 4px 12px; border: 1px solid currentColor; border-radius: 999px; background: none; color: var(--lime); font: inherit; font-size: 14px; cursor: pointer; }
.toast-btn:hover { background: rgb(255 255 255 / .12); }
.icon-btn.danger:hover { background: #f3dcd6; color: var(--err); }
.icon-btn .ic { width: 18px; height: 18px; }
.hint.inline { display: inline; margin-left: 10px; font-size: 13px; }
.tp-repeat[hidden] { display: none; }

/* drag to reorder: a line where the item will land */
.c-grip { width: 22px; padding: 0 !important; }
.grip { display: grid; place-items: center; width: 22px; height: 30px; color: var(--muted); cursor: grab; opacity: 0; transition: opacity .15s; }
.grip .ic { width: 16px; height: 16px; }
.pl-table tbody tr:hover .grip, .grip:focus-visible { opacity: 1; }
@media (hover: none) { .grip { opacity: .6; } }
.pl-table tr.dragging { opacity: .45; }
.pl-table tr.drop-before td { box-shadow: inset 0 2px 0 var(--lime-deep); }
.pl-table tbody.drop-end tr:last-child td { box-shadow: inset 0 -2px 0 var(--lime-deep); }
.card.drop-before { box-shadow: 0 -3px 0 -1px var(--lime-deep); }
.col-b.drop-end::after { content: ""; display: block; height: 2px; border-radius: 2px; background: var(--lime-deep); }

/* subtasks */
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-line .open-task { width: auto; flex: 0 1 auto; }
.tog { width: 26px; height: 26px; margin-left: -4px; }
.tog .ic { width: 16px; height: 16px; transition: transform .15s cubic-bezier(.23, 1, .32, 1); }
.tog[aria-expanded="true"] .ic { transform: rotate(90deg); }
.pl-table tr.sub .c-text { padding-left: 38px; }
.pl-table tr.sub .open-task { font-size: 14px; }
.sub-prog { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub-prog .ic { width: 14px; height: 14px; }
.sub-prog.full { color: var(--olive-dark); }
.rep { display: inline-flex; color: var(--muted); }
.rep .ic { width: 14px; height: 14px; }
.cal-chip.is-sub { font-size: 12px; }
.tp-parent { margin-bottom: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 2px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.crumb:hover { background: var(--lime-soft); color: var(--ink); }
.crumb .ic { width: 16px; height: 16px; }
.tp-repeat { display: flex; align-items: center; flex-wrap: wrap; }
.tp-sub { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tp-sub-h { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.sub-list { list-style: none; margin: 0; padding: 0; }
.sub-list li { display: flex; align-items: center; gap: 10px; }
.sub-list .open-task { width: auto; flex: 1; padding: 5px 0; }
.sub-list small { color: var(--muted); }
.sub-list small.late { color: var(--err); }
.sub-list .is-done .open-task { color: var(--muted); text-decoration: line-through; }
.sub-add { margin-top: 2px; padding-left: 0; }

/* trash popover */
.trash { width: 340px; max-width: 100%; }
.trash-list { list-style: none; margin: 0 0 6px; padding: 0; max-height: 300px; overflow-y: auto; }
.trash-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.trash-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trash-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-t small { color: var(--muted); font-size: 12px; }

/* search palette: opened by keyboard many times a day, so it appears without animation */
.cmdk-scrim { position: fixed; inset: 0; z-index: 40; background: rgb(27 33 8 / .25); }
.cmdk { position: fixed; z-index: 41; top: 12vh; left: 50%; transform: translateX(-50%); width: min(600px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 24px 48px -20px rgb(27 33 8 / .45); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmdk-in .ic { color: var(--muted); }
.cmdk-in input[type="text"] { flex: 1; border: 0; padding: 4px 0; background: transparent; font-size: 17px; }
.cmdk-in input[type="text"]:focus { outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 60vh); overflow-y: auto; }
.cmdk-opt { padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; }
.cmdk-opt[aria-selected="true"] { background: var(--lime-soft); }
.cmdk-t { display: flex; align-items: center; gap: 10px; }
.cmdk-t small { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.cmdk-s { margin: 2px 0 0 20px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-empty { padding: 18px; text-align: center; color: var(--muted); }
@media (max-width: 720px) { #pl-search kbd { display: none; } .cmdk { top: 16px; } }

/* Browser surfaces from the palette (Impeccable craft floor, 2026-11-30) */
html { scrollbar-color: var(--olive) transparent; }
::selection { background: var(--lime); color: var(--ink); }
input, textarea { caret-color: var(--olive-dark); }
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--olive-dark); }
a { text-underline-offset: .18em; }
