:root {
  color-scheme: light dark;
  --bg: #faf8f3; --surface: #ffffff; --text: #1f1d1a; --muted: #6b665d; --line: #e4dfd4;
  --accent: #f6c343; --accent-text: #3d2e00; --danger: #b3261e; --focus: #2b6cb0;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1b19; --surface: #26241f; --text: #f1ede4; --muted: #b2ab9e; --line: #3a372f; --accent: #e0ad2b; --accent-text: #2a1f00; --danger: #ff8a80; --focus: #8ab4f8; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 600; }
.account { display: flex; align-items: center; gap: 10px; font-size: 14px; }
main { max-width: 980px; margin: 0 auto; padding: 28px 18px 60px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 420px; margin: 40px auto; }
.card h1 { font-size: 22px; margin: 0 0 6px; }
.muted { color: var(--muted); }
label { display: block; font-size: 14px; margin: 14px 0 6px; }
input { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text); min-height: 44px; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button { font: inherit; min-height: 44px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; width: 100%; margin-top: 18px; }
button.link { border: 0; background: none; color: var(--focus); padding: 6px 0; min-height: 0; text-decoration: underline; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 1em; }
.ok { color: var(--muted); font-size: 14px; margin-top: 12px; }
.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.placeholder { border: 1px dashed var(--line); border-radius: 14px; padding: 28px; text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
section { margin-top: 28px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 180px; }
.linkbox { word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: 13px; }

/* ---- slice 1: the board ---- */
main { max-width: 1240px; }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; }
.side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; align-self: start; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; width: 100%; }
.navitem { text-align: left; border: 0; background: none; border-radius: 0 22px 22px 0; padding: 10px 16px; min-height: 44px; }
.navitem.active { background: color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.search { margin-bottom: 18px; }
.composer { display: flex; gap: 8px; max-width: 600px; margin: 0 auto 28px; }
.composer-open { flex: 1; text-align: left; color: var(--muted); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.gridhead { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; }
.grid { columns: 240px; column-gap: 14px; }
.note { break-inside: avoid; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); cursor: pointer; white-space: pre-wrap; overflow-wrap: anywhere; }
.note:hover { box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.note h3 { font-size: 16px; margin: 0 0 8px; }
.cardbody { margin: 0; font-size: 14px; line-height: 1.45; }
.cardlist { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.5; }
.cardlist .done { text-decoration: line-through; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: rgba(0,0,0,.08); }
.emptymsg { text-align: center; margin-top: 40px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.editor { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 12px; padding: 16px 18px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.ed-title { font-size: 20px; font-weight: 600; border: 0; background: transparent; padding: 6px 0; }
.ed-body textarea { width: 100%; font: inherit; border: 0; background: transparent; color: var(--text); resize: vertical; min-height: 160px; padding: 6px 0; }
.ed-body textarea:focus, .ed-title:focus { outline: none; }
.item { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.item.indent { padding-left: 28px; }
.item input[type=checkbox] { width: 20px; height: 20px; min-height: 0; flex: none; }
.itemtext { border: 0; background: transparent; padding: 6px 2px; min-height: 36px; }
.itemtext.done { text-decoration: line-through; color: var(--muted); }
.x { border: 0; background: none; min-height: 32px; padding: 0 8px; font-size: 18px; color: var(--muted); }
.ed-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ed-tools { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.ed-tools button { min-height: 36px; padding: 6px 10px; font-size: 14px; background: transparent; }
.primary-sm { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.small { font-size: 13px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.swatch { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
.swatch.on { border-color: var(--focus); }
.labelpick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 14px; }
.labelopt { display: flex; align-items: center; gap: 4px; margin: 0; }
.labelopt input { width: 18px; height: 18px; min-height: 0; }
/* Keep's note colours (light), muted in dark mode */
.color-red { background: #f6aea9; } .color-orange { background: #fbbc04; } .color-yellow { background: #fff8b8; }
.color-green { background: #e2f6d3; } .color-teal { background: #b4ddd3; } .color-blue { background: #d4e4ed; }
.color-darkblue { background: #aeccdc; } .color-purple { background: #d3bfdb; } .color-pink { background: #f6e2dd; }
.color-brown { background: #e9e3d4; } .color-gray { background: #efeff1; }
.note[class*="color-"]:not(.color-none), .editor[class*="color-"]:not(.color-none) { color: #202124; }
@media (prefers-color-scheme: dark) {
  .color-red { background: #77172e; } .color-orange { background: #692b17; } .color-yellow { background: #7c4a03; }
  .color-green { background: #264d3b; } .color-teal { background: #0c625d; } .color-blue { background: #256377; }
  .color-darkblue { background: #284255; } .color-purple { background: #472e5b; } .color-pink { background: #6c394f; }
  .color-brown { background: #4b443a; } .color-gray { background: #232427; }
  .note[class*="color-"]:not(.color-none), .editor[class*="color-"]:not(.color-none) { color: #e8eaed; }
}
.swatch.color-none { background: var(--surface); }
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; overflow-x: auto; gap: 4px; }
  .side hr { display: none; }
  .navitem { border-radius: 20px; white-space: nowrap; padding: 8px 14px; }
  .grid { columns: 2 150px; column-gap: 10px; }
}

@media (max-width: 720px) { .bar { padding: 10px 12px; } .account { gap: 6px; } .account button { padding: 8px 10px; white-space: nowrap; min-height: 40px; } .brand span { font-size: 18px; } }

.bigbutton { display: flex; align-items: center; justify-content: center; text-decoration: none; min-height: 48px; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font-weight: 600; margin: 18px 0 10px; }
