:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1d1f22;
  --muted: #6b6f76;
  --line: #e4e2dc;
  --accent: #2f6f5e;
  --accent-soft: #e2efe9;
  --danger: #b4412f;
  --warn: #a86a00;
  --warn-soft: #fbefd6;
  --danger-soft: #f8e1dc;
  --chip: #eeece6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c; --card: #1f2227; --text: #e9eaec; --muted: #9a9fa8; --line: #30343b;
    --accent: #5fb89c; --accent-soft: #1f3a32; --danger: #e5735f; --warn: #e3a94a;
    --warn-soft: #3a2f1a; --danger-soft: #42241e; --chip: #2a2e35;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
#app { margin: 0 auto; padding: 8px 14px 48px; }
@media (min-width: 1100px) { #app { padding: 10px 20px 48px; } }
h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); min-height: 1.2em; margin: 0; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 9px 14px; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0f1a16; } }
.btn.danger { color: var(--danger); }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 6px 8px; color: var(--muted); border-radius: 8px; font-size: 16px; }
.icon-btn:hover { background: var(--chip); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { display: grid; gap: 12px; width: min(320px, 100%); text-align: center; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; padding: 2px 0 8px; }
.sync { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.sync.on { background: var(--accent); }

/* widgets */
.widget { padding: 11px 12px; min-width: 0; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.toolbar input[type=search] { flex: 1; }
.toggle { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 14px; color: var(--muted); cursor: pointer; }
.toggle input { width: auto; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  border: 1px solid transparent; background: var(--chip); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #0f1a16; } }
.chip .n { opacity: .65; margin-left: 4px; }
.small-chips { margin: -4px 0 0; }
.small-chips .chip { font-size: 12px; padding: 2px 9px; }

/* tasks */
.heading { margin-bottom: 8px; overflow: hidden; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; }
.heading > .row { padding: 9px 6px 9px 10px; align-items: center; }
.head-row .body { cursor: pointer; }
.head-row .icon-btn { padding: 4px 7px; }
.heading > .row .title { font-weight: 600; font-size: 15px; }
.subs { border-top: 1px solid var(--line); }
.subs .row { padding-left: 14px; border-bottom: 1px solid var(--line); }
.subs .row:last-child { border-bottom: 0; }
.row .body { flex: 1; min-width: 0; cursor: pointer; }
.row .title { word-wrap: break-word; }
.row.done .title { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.meta:empty { display: none; }
.tag { font-size: 11.5px; background: var(--chip); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.badge { font-size: 11.5px; border-radius: 6px; padding: 0 6px; background: var(--chip); color: var(--muted); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.badge.today { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.badge.soon { background: var(--accent-soft); color: var(--accent); }
.crumb { font-size: 12px; color: var(--muted); }
.notes-ic { font-size: 12px; color: var(--muted); }

.check {
  appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0;
  border: 2px solid var(--muted); border-radius: 7px; cursor: pointer; display: grid; place-items: center;
  background: var(--card); padding: 0;
}
.check.recur { border-style: dashed; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.collapse { flex: none; }
.add-sub { display: flex; gap: 8px; padding: 2px 10px 2px 14px; border-top: 1px solid var(--line); }
.add-sub input { border: 0; padding: 7px 0; background: none; font-size: 14px; }
.add-sub input:focus { outline: 0; }
.add-row { display: flex; gap: 8px; margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* links */
.link-list { display: grid; gap: 10px; }
.link { display: flex; gap: 12px; padding: 12px; align-items: flex-start; }
.link .ftype { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--chip); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.link .body { flex: 1; min-width: 0; }
.link a.title { color: var(--text); font-weight: 600; text-decoration: none; word-break: break-word; }
.link a.title:hover { text-decoration: underline; }
.link .sub { font-size: 12px; color: var(--muted); word-break: break-all; }
.link .notes { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }

/* forms & dialogs */
.form { display: grid; gap: 12px; padding: 16px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form label > input, .form label > textarea, .form label > select { color: var(--text); font-size: 15px; }
.settings-body .card { margin-bottom: 0; }
.settings-body .btn { justify-self: start; }
.row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.repeat { display: flex; gap: 6px; }
.repeat select:first-child { flex: 1.1; }
.repeat input { width: 64px; flex: none; }
.repeat select:last-child { flex: 1.3; }
.sheet {
  border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px));
  background: var(--card); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.sheet::backdrop { background: rgba(0,0,0,.35); }
@media (max-width: 640px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-actions { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.sheet-actions #fDone { justify-self: end; }
progress { width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 10; max-width: calc(100vw - 32px);
}
#fLastDone:empty { display: none; }
.sheet { overflow-y: auto; }

/* calendar */
.agenda { min-width: 0; }
.agenda-day { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
.agenda-day:first-of-type { border-top: 0; }
.agenda-day .d { font-size: 12px; color: var(--muted); padding-top: 1px; }
.agenda-day .d b { color: var(--text); display: block; }
.agenda-ev { display: flex; gap: 8px; align-items: baseline; font-size: 14px; padding: 1px 0; min-width: 0; }
.agenda-ev .t { flex: none; width: 44px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda-ev .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-ev.task .n { cursor: pointer; }
.agenda-ev .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #3b7bbf; align-self: center; }
.agenda-ev.task .dot { background: var(--accent); border-radius: 2px; }
.agenda-ev.overdue .dot { background: var(--danger); }
.agenda-ev.overdue .n { color: var(--danger); }
.agenda-ev .loc { color: var(--muted); font-size: 12px; }
.agenda-foot { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.agenda-foot .k { display: inline-flex; gap: 5px; align-items: center; }
.agenda-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: #3b7bbf; }
.agenda-foot .dot.task { background: var(--accent); border-radius: 2px; }
h3 { font-size: 14px; margin: 8px 0 -6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-size: 13px; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; justify-self: start; }
.unit { align-self: center; font-size: 14px; }
#fRemind { width: 80px; flex: none; }
.toast { display: flex; gap: 14px; align-items: center; }
.toast-btn { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px 4px; margin-bottom: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--text); background: none; border: 0; padding: 4px 0; cursor: pointer; position: relative; font: inherit; min-width: 0; }
.tile-ic {
  width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 20px; font-weight: 650; color: #fff;
}
.tile-ic img { width: 100%; height: 100%; object-fit: contain; }
.tile-ic.small-img img { width: 62%; height: 62%; }
.tile-ic.big { width: 72px; height: 72px; border-radius: 18px; flex: none; }
.tile-name { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile:hover .tile-ic { transform: translateY(-1px); }
.tile.ghost .tile-ic { background: none; border: 1.5px dashed var(--line); box-shadow: none; color: var(--muted); font-weight: 400; }
.tile.ghost .tile-name { color: var(--muted); }
.tiles.editing .tile:not(.ghost) .tile-ic { animation: wiggle .3s ease-in-out infinite alternate; }
.tiles.editing .tile:not(.ghost)::after { content: "✎"; position: absolute; top: 0; right: calc(50% - 30px); width: 20px; height: 20px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 11px; display: grid; place-items: center; }
@keyframes wiggle { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .tiles.editing .tile .tile-ic { animation: none; } }
.tile-thumb-row { display: flex; gap: 14px; align-items: center; }
.tile-thumb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.small-btn { padding: 6px 10px; font-size: 13px; cursor: pointer; }
.form label.small-btn { display: inline-block; color: var(--text); }

.bday-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.form label.inline { display: flex; align-items: center; gap: 8px; }
.form label.inline input { width: 150px; }
.badge.bday { background: #f6e3ef; color: #9b3a73; }
@media (prefers-color-scheme: dark) { .badge.bday { background: #3d2332; color: #e9a2cb; } }
code { font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: 5px; }

/* compact controls */
.btn.slim { padding: 7px 10px; font-size: 13px; }
.done-chip { margin-left: auto; }
.more-btn { margin-top: 4px; color: var(--accent); text-decoration: none; }
.agenda-day:empty { display: none; }
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .toolbar input[type=search] { padding: 7px 10px; }
}

/* tiles: one row that scrolls sideways on a phone */
@media (max-width: 640px) {
  .tiles { display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; margin: 0 -14px 10px; padding: 0 14px; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 64px; }
}
.tile.ghost .tile-ic { width: 40px; height: 40px; margin: 4px 0; font-size: 16px; }

/* ---------- page layout ----------
   phone (<700px): Coming up, weather, tasks, links (one column)
   tablet (700-1099px): left = weather, Coming up, links; right = tasks
   desktop (>=1100px): Coming up | weather + links | tasks */
.layout { display: grid; gap: 12px; align-items: start; grid-template-columns: 1fr; }
.col { min-width: 0; display: grid; gap: 10px; align-content: start; }
@media (max-width: 699px) {
  .layout { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .col-mid { display: contents; }
  .col-left { order: 1; } #weather { order: 2; } .col-right { order: 3; } #linksCard { order: 4; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .layout { grid-template-columns: minmax(280px, 1fr) minmax(340px, 1.2fr); grid-template-areas: "w t" "a t" "l t"; grid-template-rows: auto auto 1fr; }
  .col-mid { display: contents; }
  #weather { grid-area: w; } .col-left { grid-area: a; } #linksCard { grid-area: l; } .col-right { grid-area: t; }
}
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(280px, 1fr) minmax(400px, 1.4fr) minmax(340px, 1.1fr); }
  /* side columns stay in view and scroll on their own */
  .col-left, .col-mid { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow-y: auto; scrollbar-width: thin; }
}
.agenda-week { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 0 2px; border-top: 1px solid var(--line); }
.agenda-week + .agenda-day { border-top: 0; }

.top-actions { display: flex; align-items: center; gap: 12px; }
#undoBtn:disabled { opacity: .45; cursor: default; }
.check.mini { width: 16px; height: 16px; border-width: 1.5px; border-radius: 5px; align-self: center; }
.check.mini:checked::after { width: 4px; height: 8px; border-width: 0 2px 2px 0; }
.agenda-ev.task .n { cursor: pointer; }
.agenda-ev .dot { margin: 0 4.5px; } /* same 16px slot as the tick box, so titles line up */

/* ---------- header with centred search ---------- */
.top { display: grid; grid-template-columns: 1fr minmax(280px, 640px) 1fr; align-items: center; gap: 12px; }
.top-actions { justify-self: end; }
.search-wrap { position: relative; }
#globalSearch {
  border-radius: 999px; padding: 10px 18px; font-size: 15px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08); border-color: var(--line);
}
#globalSearch:focus { box-shadow: 0 1px 10px rgba(0,0,0,.14); }
.search-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(70vh, 560px); overflow-y: auto; padding: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.sr-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.sr-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.sr-item.sel, .sr-item:hover { background: var(--chip); }
.sr-item[tabindex="-1"] { cursor: default; }
.sr-item.done .sr-title { text-decoration: line-through; color: var(--muted); }
.sr-ic { flex: none; width: 20px; text-align: center; }
.sr-text { min-width: 0; display: grid; }
.sr-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }
@media (max-width: 699px) {
  .top { grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "search search"; row-gap: 8px; }
  .brand { grid-area: brand; } .top-actions { grid-area: actions; } .search-wrap { grid-area: search; }
  .top-actions .lbl { display: none; }
  #globalSearch { padding: 9px 16px; }
}

/* ---------- cards in the columns ---------- */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.links-card .chips { margin-bottom: 6px; }
.links-card .link-list { gap: 0; }
.links-card .link { border: 0; box-shadow: none; border-radius: 0; padding: 8px 0; border-top: 1px solid var(--line); background: none; }
.links-card .link .ftype { width: 34px; height: 34px; font-size: 10px; }
.links-card .empty { padding: 14px 6px; }
#addHeading.toolbar input { padding: 7px 12px; }
.settings-sheet { width: min(620px, calc(100vw - 24px)); }
.settings-body { padding: 0 16px 16px; display: grid; gap: 12px; }
.settings-body .card { box-shadow: none; }

/* ---------- wrapping: nothing may push a column wider than the screen ---------- */
.col { grid-template-columns: minmax(0, 1fr); }
.row .title, .link a.title, .sr-title, .agenda-ev .n, .tile-name, .crumb { overflow-wrap: anywhere; }
.agenda-ev .n { white-space: normal; overflow: visible; text-overflow: clip; }
.agenda-ev { align-items: flex-start; }
.agenda-ev .dot, .agenda-ev .check.mini { margin-top: 3px; align-self: flex-start; }
.toolbar { flex-wrap: wrap; }
#addHeading.toolbar input { flex: 1 1 140px; width: auto; }
.chips { min-width: 0; }

/* calendar events: round tick box in calendar blue; ticked ones are crossed out */
.check.round { border-radius: 50%; border-color: #3b7bbf; }
.check.round:checked { background: #3b7bbf; border-color: #3b7bbf; }
.agenda-ev.ev-done .n { text-decoration: line-through; color: var(--muted); }
.agenda-ev.ev-done .t { opacity: .6; }
.key-box { width: 9px; height: 9px; border: 1.5px solid var(--accent); border-radius: 3px; display: inline-block; }
.key-box.round { border-radius: 50%; border-color: #3b7bbf; }

/* one-off to-dos */
.todo-card { margin-bottom: 8px; }
.todo-head { cursor: default; }
.todo-head .body { cursor: default !important; }
.todo-card #todoList:not([hidden]) { border-top: 1px solid var(--line); }
.fab {
  display: none; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 15;
  width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 28px; line-height: 1; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer;
}
@media (prefers-color-scheme: dark) { .fab { color: #0f1a16; } }
@media (max-width: 699px) { .fab { display: block; } }
@media (max-width: 699px) { #app { padding-bottom: 96px; } } /* room for the floating + */

/* tiles now sit in the middle column above the weather */
.tiles { margin-bottom: 0; }
@media (max-width: 699px) { #tiles { order: 0; } }
@media (min-width: 700px) and (max-width: 1099px) {
  .layout { grid-template-areas: "k t" "w t" "a t" "l t"; grid-template-rows: auto auto auto 1fr; }
  #tiles { grid-area: k; }
}
.update-banner { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; font-size: 14px; }

/* tiles get a card background like the other panels */
.tiles { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 6px 6px; }
@media (max-width: 699px) { .tiles { margin: 0; padding: 8px 6px 6px; } }
/* multi-day calendar events: shown once with their date range */
.span-pill { display: inline-block; font-size: 11.5px; color: #3b7bbf; background: rgba(59,123,191,.1); border-radius: 6px; padding: 0 6px; margin-left: 2px; white-space: nowrap; }


/* ================= v2 layout: search + tiles in the header, jotter in the middle ================= */
.top { display: flex; align-items: center; gap: 14px; }
.top .brand { flex: none; }
.top .search-wrap { flex: 0 1 520px; min-width: 200px; }
.top-actions { margin-left: auto; flex: none; }
/* tiles become a strip of small icons next to search (names on hover) */
.top .tiles { display: flex; gap: 6px; align-items: center; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none;
  background: none; border: 0; box-shadow: none; padding: 2px; margin: 0; }
.top .tiles::-webkit-scrollbar { display: none; }
.top .tile { flex: 0 0 auto; padding: 0; gap: 0; }
.top .tile-name { display: none; }
.top .tile-ic { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
.top .tile.ghost .tile-ic { width: 30px; height: 30px; margin: 3px; font-size: 13px; }
.top .tiles.editing .tile:not(.ghost)::after { top: -4px; right: -4px; width: 16px; height: 16px; font-size: 9px; }
@media (max-width: 699px) {
  .top { flex-wrap: wrap; row-gap: 8px; }
  .top .brand { flex: 1; }
  .top .search-wrap { order: 3; flex: 1 1 100%; }
  .top .tiles { order: 4; flex: 1 1 100%; padding: 2px 0; }
}

/* column order: phone = Coming up, To do, tasks, links */
@media (max-width: 699px) {
  .col-left { order: 1; } #jotter { order: 2; } .col-right { order: 3; } #linksCard { order: 4; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .layout { grid-template-areas: "j t" "a t" "l t"; grid-template-rows: auto auto 1fr; }
  #jotter { grid-area: j; } .col-left { grid-area: a; } #linksCard { grid-area: l; } .col-right { grid-area: t; }
}

/* ---------- To do jotter: a sticky note, not a heading ---------- */
.jotter { --note: #fdf6d6; --note-line: #eadfa6; --note-ink: #5b4d17; background: var(--note); border-color: var(--note-line); }
@media (prefers-color-scheme: dark) { .jotter { --note: #2f2a1b; --note-line: #4a4228; --note-ink: #e6d9a3; } }
.jotter h2 { color: var(--note-ink); margin-bottom: 4px; }
.jot-add input { background: transparent; border: 0; border-bottom: 1.5px dashed var(--note-line); border-radius: 0; padding: 7px 2px; font-size: 15px; }
.jot-add input:focus { outline: 0; border-bottom-color: var(--note-ink); }
.jot-list { margin-top: 4px; }
.jot { display: flex; align-items: flex-start; gap: 9px; padding: 6px 2px; border-bottom: 1px dashed var(--note-line); }
.jot:last-child { border-bottom: 0; }
.jot-check { width: 17px; height: 17px; border-radius: 50%; border-width: 1.5px; border-color: var(--note-ink); background: transparent; margin-top: 2px; }
.jot-check:checked { background: var(--note-ink); border-color: var(--note-ink); }
.jot-check:checked::after { width: 4px; height: 8px; border-width: 0 2px 2px 0; }
.jot-text { flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.jot.done .jot-text { text-decoration: line-through; color: var(--muted); }
.jot-age { flex: none; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.jot .badge { flex: none; margin-top: 2px; }
.jot-empty { color: var(--muted); font-size: 13px; padding: 8px 2px 2px; }

/* phone quick-add pop-up */
.quick-sheet { width: min(480px, calc(100vw - 24px)); }
.quick-sheet #quickInput { font-size: 16px; }
@media (max-width: 699px) {
  .top .brand { order: 1; } .top-actions { order: 2; }
  .quick-sheet { width: 100vw; max-width: 100vw; }
}
@media (max-width: 699px) { .top #tiles { order: 4; } }
.late-group .d b { color: var(--danger); }
.late-group .d { color: var(--muted); }

/* jotter: folded Done section */
.jot-done { margin-top: 6px; border-top: 1.5px dashed var(--note-line); padding-top: 4px; }
.jot-done-head { border: 0; background: none; padding: 6px 2px; color: var(--note-ink); font-size: 13px; cursor: pointer; }
.jot-done-head .n { opacity: .6; margin: 0 2px; }
.jot-done .jot { opacity: .8; }
.jot-older { font-size: 12px; color: var(--muted); padding: 6px 2px 2px; }
