/* Daybook: warm paper, ink, and one tomato red for today. Each area has its own colour (--c). */

:root {
  --bg: #F4EFE6;
  --paper: #FFFCF6;
  --raised: #FFFFFF;
  --ink: #1D1A15;
  --ink-2: #4A443A;
  --muted: #857D6F;
  --line: #E7DFD1;
  --line-2: #D6CBB8;
  --today: #D94F2B;
  --today-soft: #FBE4DA;
  --star: #E39B12;
  --ok: #2F8F5B;
  --danger: #C2412D;
  --shadow: 0 1px 2px rgba(45, 33, 12, .06), 0 10px 30px rgba(45, 33, 12, .10);
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120E;
    --paper: #1C1915;
    --raised: #24201A;
    --ink: #F2EDE3;
    --ink-2: #D2CABB;
    --muted: #958C7C;
    --line: #2D2922;
    --line-2: #3D372D;
    --today: #FF7A52;
    --today-soft: #3B2219;
    --star: #F5B83D;
    --ok: #5CC28A;
    --danger: #FF7A63;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
code, kbd { font: 500 .86em var(--mono); background: var(--line); border-radius: 5px; padding: 1px 5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--today); outline-offset: 2px; border-radius: 6px; }

/* ---------- the mark ---------- */
.mark { display: inline-block; width: 44px; height: 44px; border-radius: 13px; background: var(--ink); position: relative; overflow: hidden; flex: none; }
.mark::before { content: ''; position: absolute; left: 22%; right: 22%; top: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--today); }
.mark::after { content: ''; position: absolute; left: 0; right: 0; top: 62%; bottom: 0; background: var(--ink); border-top: 3px solid var(--bg); }
.mark.sm { width: 26px; height: 26px; border-radius: 8px; }
.mark.sm::after { border-top-width: 2px; }

/* ---------- buttons, chips, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.full { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 700; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 0; background: transparent; color: var(--ink-2); font-size: 20px; flex: none;
}
.icon-btn:hover { background: var(--line); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chips, .row-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper); font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none;
}
button.chip:hover, label.chip:hover { border-color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.hi.on, .chip.hi { color: var(--today); border-color: color-mix(in srgb, var(--today) 45%, transparent); }
.chip.hi.on { background: var(--today); color: #fff; border-color: var(--today); }
.chip.ghost { background: transparent; border-style: dashed; color: var(--muted); }
.chip small { color: var(--muted); font-weight: 500; }
.chip.on small { color: inherit; opacity: .7; }
.chip.star-chip.on { background: var(--star); border-color: var(--star); color: #2A1E05; }
.tag-chip i, .tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip.link { font-weight: 700; }
.date-chip { position: relative; cursor: pointer; }
.date-chip input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--ink-2); font-size: 12px; font-weight: 700; white-space: nowrap; }

input:not([type=checkbox]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--raised); font-size: 16px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--muted); margin-bottom: 6px; }
.label small { font-weight: 500; letter-spacing: 0; }
.field-row { display: block; margin: 14px 0 0; }
.field-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.toggle input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-error { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 1em; margin: 10px 0 0; }
.seg { display: flex; padding: 3px; border-radius: 12px; background: var(--line); gap: 2px; }
.seg button { flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- sign in ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(340px, 100%); text-align: center; }
.login-card h1 { font: 400 46px/1 var(--serif); margin: 18px 0 6px; letter-spacing: -.01em; }
.login-card .field { text-align: left; margin: 18px 0 12px; display: block; font-weight: 700; font-size: 13px; color: var(--muted); }
.login-card .field input { margin-top: 6px; }
.pin { margin-top: 22px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 20px; margin-bottom: 26px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); transition: background .12s, border-color .12s, transform .12s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); transform: scale(1.05); }
.pin.ok .pin-dots i { background: var(--ok); border-color: var(--ok); }
.pin.bad .pin-dots { animation: shake .4s; }
.pin.bad .pin-dots i { border-color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; justify-content: center; }
.keypad button { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--paper); font: 600 28px var(--sans); }
.keypad button:active { background: var(--ink); color: var(--bg); }
.keypad .del { border-color: transparent; background: transparent; font-size: 24px; color: var(--muted); }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.page { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 90px); }
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.top-title { flex: 1; min-width: 0; margin: 0; font: 400 26px/1.1 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 2px; }
.main { max-width: 760px; margin: 0 auto; padding: 0 16px; outline: none; }
.main.wide { max-width: 1240px; }
.banner { margin: 0 16px 10px; padding: 10px 14px; border-radius: 12px; background: var(--today-soft); color: var(--ink); font-size: 13.5px; font-weight: 600; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 4px var(--safe-b);
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav a[data-view] {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; border-radius: 12px;
}
.nav a[data-view] svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a[data-view].active { color: var(--ink); }
.nav a[data-view].active svg { stroke-width: 2.1; }
.nav a[data-view="today"].active { color: var(--today); }
.badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--today); color: #fff; font: 700 10.5px/18px var(--sans); text-align: center; }
.nav-brand, .nav-areas { display: none; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 11;
  width: 58px; height: 58px; border-radius: 20px; border: 0; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.fab:active { transform: scale(.96); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 236px 1fr; }
  .page { padding-bottom: 80px; min-width: 0; }
  .nav {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 18px 12px; border-top: 0; border-right: 1px solid var(--line); background: var(--paper);
  }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font: 400 25px var(--serif); text-decoration: none; }
  .nav a[data-view] { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 9px 12px; font-size: 14.5px; }
  .nav a[data-view].active { background: var(--line); }
  .nav a[data-view] svg { width: 21px; height: 21px; }
  .badge { position: static; margin-left: auto; }
  .nav-areas { display: flex; flex-direction: column; gap: 1px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
  .nav-areas a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-2); }
  .nav-areas a:hover, .nav-areas a.active { background: var(--line); }
  .nav-areas i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
  .top { padding: 14px 24px 10px 28px; }
  .main { padding: 0 28px; }
  .fab { bottom: 28px; right: 28px; }
}

/* ---------- sections and tasks ---------- */
.lede { color: var(--muted); margin: 4px 0 14px; font-size: 14px; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 2px 2px; margin: 0; }
.sec { margin: 22px 0 0; }
.sec-head { display: flex; align-items: center; gap: 10px; min-height: 32px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.sec h2, .group-title, .sheet-body h3 { margin: 0; font-size: 12.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.sec-head h2 { flex: 1; }
.group-title { margin: 26px 0 -10px; }
.count { font: 500 11.5px var(--mono); color: var(--muted); letter-spacing: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; vertical-align: middle; }
details.sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 32px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '▸'; color: var(--muted); margin-left: auto; transition: transform .15s; }
details.sec[open] > summary::after { transform: rotate(90deg); }

.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: start;
  padding: 9px 0; border-bottom: 1px solid var(--line); transition: opacity .25s;
}
.task.ticking.done { opacity: .45; }
.check {
  width: 22px; height: 22px; margin: 1px 0 0 4px; border-radius: 50%; border: 2px solid var(--line-2); background: transparent; position: relative; padding: 0;
  transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--ink-2); }
.task.hi .check { border-color: color-mix(in srgb, var(--today) 70%, var(--line-2)); }
.task.done .check, .check.on { background: var(--ink); border-color: var(--ink); }
.task.done .check::after, .check.on::after { content: ''; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check.big { width: 28px; height: 28px; margin: 6px 4px 0 0; flex: none; }
.check.big.on::after { left: 8px; top: 3.5px; width: 7px; height: 13px; }
.body { display: block; min-width: 0; text-align: left; background: none; border: 0; padding: 0; }
.title { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.38; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; text-decoration-color: var(--line-2); color: var(--muted); }
.hi-mark { color: var(--today); font-weight: 800; }
.meta { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink-2); }
.m.late { color: var(--today); font-weight: 700; }
.m.wait { color: var(--ink-2); font-weight: 700; }
.m.time { font-family: var(--mono); font-size: 11.5px; }
.star { width: 36px; height: 30px; border: 0; background: transparent; color: var(--line-2); font-size: 18px; line-height: 1; padding: 0; }
.star:hover { color: var(--star); }
.star.on { color: var(--star); }
.triage { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.triage .chip { min-height: 30px; font-size: 12.5px; }
.slot { padding: 12px 0 12px 36px; color: var(--muted); font-size: 14px; border-bottom: 1px dashed var(--line-2); }
.add-line { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; }
.add-line span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--line-2); font-size: 15px; line-height: 1; }
.add-line:hover { color: var(--ink); }

/* ---------- today ---------- */
.hero { padding: 6px 0 4px; }
.eyebrow { margin: 0; font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--today); }
.hero h1 { margin: 4px 0 4px; font: 400 clamp(36px, 9vw, 52px)/1.02 var(--serif); letter-spacing: -.015em; }
.hero .sub { margin: 0; color: var(--muted); font-size: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; }
.hero-actions .add-line { margin: 0; }
.top3 { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px 4px; margin-top: 20px; }
.top3 .sec-head { border: 0; padding-bottom: 0; }
.top3 .sec-head h2 { color: var(--star); }
.top3 .task:last-child, .top3 .slot:last-child { border-bottom: 0; }
.done-sec { opacity: .85; }

/* ---------- week ---------- */
.week-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; }
.week-head h2 { margin: 0 4px; font: 400 26px var(--serif); }
.week-head small { display: block; font: 500 12px var(--sans); color: var(--muted); }
.week-head .icon-btn { font-size: 26px; border: 1px solid var(--line-2); width: 36px; height: 36px; border-radius: 50%; }
.week { display: grid; gap: 10px; }
.day { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 8px; min-width: 0; transition: border-color .15s, background .15s; }
.day h3 { margin: 0 0 4px; display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.day h3 b { font: 400 24px var(--serif); letter-spacing: 0; color: var(--ink); }
.day h3 em { font-style: normal; color: var(--today); font-size: 11px; }
.day.is-today { border-color: var(--today); box-shadow: 0 0 0 1px var(--today) inset; }
.day.past { opacity: .72; }
.day .task { grid-template-columns: 30px minmax(0, 1fr) 30px; padding: 7px 0; }
.day .task:last-child { border-bottom: 0; }
.day .title { font-size: 14px; }
.day .add-line { margin-top: 2px; font-size: 13px; }
.due-line button { border: 0; background: none; padding: 5px 0 5px 30px; color: var(--today); font-size: 12.5px; font-weight: 700; text-align: left; }
.drop-over { border-color: var(--ink-2) !important; background: color-mix(in srgb, var(--ink) 5%, var(--paper)); }
.task.dragging { opacity: .4; }
li[draggable="true"] { cursor: grab; }
.tray { margin-top: 26px; border-radius: 16px; }
@media (min-width: 1100px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .day { min-height: 220px; padding: 10px 8px 8px; }
  .day .task { grid-template-columns: 26px minmax(0, 1fr); }
  .day .task .star { display: none; }
  .day .check { width: 18px; height: 18px; margin-left: 2px; }
  .day .task.done .check::after { left: 4.5px; top: 1.5px; width: 4px; height: 8px; }
  .day .meta { font-size: 11.5px; gap: 2px 8px; }
}

/* ---------- lists, projects ---------- */
.smart { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 4px; }
@media (min-width: 640px) { .smart { grid-template-columns: repeat(4, 1fr); } }
.smart a { display: flex; flex-direction: column; padding: 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; }
.smart a:hover { border-color: var(--line-2); }
.smart b { font: 400 34px/1 var(--serif); }
.smart span { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.area-block { margin-top: 24px; }
.area-head { display: flex; align-items: center; gap: 10px; border-bottom: 2px solid var(--c); padding-bottom: 6px; }
.area-head a { flex: 1; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.area-head i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.area-head h2 { margin: 0; font: 400 26px var(--serif); }
.area-blurb { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.area-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.area-foot a { text-decoration: none; }
.projects { list-style: none; margin: 4px 0 0; padding: 0; }
.projects a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 2px; border-bottom: 1px solid var(--line); text-decoration: none; }
.projects a:hover .p-name { text-decoration: underline; text-underline-offset: 3px; }
.p-name { flex: 1; min-width: 0; font-weight: 700; }
.p-name em { font-style: normal; font-weight: 600; font-size: 12px; color: var(--muted); }
.p-count { font: 500 12px var(--mono); color: var(--muted); }
.p-count.late { color: var(--today); }
.projects.card { margin-top: 16px; padding: 2px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.projects.card li:last-child a { border-bottom: 0; }
.projects .empty { padding: 12px 0; }

.p-head { padding: 4px 0 2px; }
.crumb { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; color: var(--ink-2); }
.crumb i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.p-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.p-title h1 { margin: 4px 0 2px; font: 400 clamp(32px, 8vw, 44px)/1.05 var(--serif); }
.p-note { margin: 6px 0 0; color: var(--ink-2); white-space: pre-wrap; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.p-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.p-actions .add-line { margin: 0; }
.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- the sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(20, 16, 10, .38); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-height: min(92dvh, 900px); overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  padding: 4px 16px calc(16px + var(--safe-b));
  transform: translateY(16px); opacity: 0; transition: transform .2s ease, opacity .2s ease;
}
.sheet.open { transform: none; opacity: 1; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 6px auto 8px; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 7vh; width: 580px; max-height: 86vh; border-radius: 22px; transform: translate(-50%, 12px); padding: 8px 22px 20px; }
  .sheet.open { transform: translate(-50%, 0); }
  .grab { display: none; }
}
.sheet-body { padding-bottom: 4px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.sheet-head h2:not(.sr-only) { flex: 1; margin: 6px 0 0; font: 400 28px/1.1 var(--serif); }
.sheet-head .pill { margin-top: 10px; }
.sheet-head input[type=search] { flex: 1; }
.sheet-body h3 { margin: 18px 0 6px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.title-input { flex: 1; min-height: 40px; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 6px 0; font: 700 19px/1.3 var(--sans); resize: none; overflow: hidden; }
.task-sheet .row-chips { margin: 4px 0 2px 38px; }

#add-text { font-size: 17px; font-weight: 600; min-height: 64px; resize: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.suggest:empty { display: none; }
.preview { margin-top: 10px; min-height: 30px; }
.preview-title { margin: 0 0 8px; font-weight: 700; color: var(--ink-2); }
.hint-box { margin-top: 12px; font-size: 13.5px; color: var(--ink-2); }
.hint-box summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.hint-box ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.9; }

.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plan-row .tag i { width: 9px; height: 9px; }
.plan-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.plan-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.plan-row.on .plan-title { color: var(--ink); }

.menu { list-style: none; margin: 4px 0 14px; padding: 0; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; text-decoration: none; font-weight: 700; }
.menu small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
#search-results .projects { margin-bottom: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 86px); z-index: 30;
  display: flex; align-items: center; gap: 14px; width: max-content; max-width: calc(100% - 32px); margin: 0 auto;
  padding: 11px 12px 11px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  transform: translateY(10px); opacity: 0; transition: transform .2s, opacity .2s;
}
.toast.show { transform: none; opacity: 1; }
.toast button { border: 0; background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); padding: 6px 12px; border-radius: 9px; font-weight: 800; }
@media (min-width: 900px) { .toast { bottom: 32px; left: 236px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- from the AI apps ---------- */
.src { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink-2); font: 700 10.5px/18px var(--sans); letter-spacing: .02em; }
.kind { display: inline-flex; padding: 0 7px; border-radius: 999px; font: 700 10.5px/18px var(--sans); letter-spacing: .02em; background: var(--line); color: var(--ink-2); }
.kind-decision { background: color-mix(in srgb, #5B5BD6 16%, transparent); color: color-mix(in srgb, #5B5BD6 75%, var(--ink)); }
.kind-fact { background: color-mix(in srgb, #1F8A70 16%, transparent); color: color-mix(in srgb, #1F8A70 75%, var(--ink)); }
.kind-idea { background: color-mix(in srgb, var(--star) 22%, transparent); color: color-mix(in srgb, var(--star) 60%, var(--ink)); }
.check-banner { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 12px; border-radius: 999px; background: var(--today-soft); color: var(--ink); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.check-banner b { color: var(--today); }
.to-check { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px 6px; }
.to-check .sec-head { border: 0; }
.to-check .lede { margin: 0 0 6px; font-size: 13px; }
.checks, .notes { list-style: none; margin: 0; padding: 0; }
.check-row { display: grid; gap: 4px; padding: 11px 0; border-top: 1px solid var(--line); }
.check-row .title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.check-row .meta, .note-row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.check-row .triage { grid-column: auto; margin-top: 4px; }
blockquote { margin: 4px 0 0; padding: 6px 10px; border-left: 3px solid var(--line-2); color: var(--ink-2); font-size: 13px; font-style: italic; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-row { border-bottom: 1px solid var(--line); }
.note-row .body { display: block; width: 100%; padding: 10px 2px; }
.note-row .title { font-weight: 600; font-size: 15px; line-height: 1.4; white-space: pre-wrap; }
.note-row .meta { margin-top: 4px; }
.provenance { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: 13.5px; }
.provenance p { margin: 0; color: var(--ink-2); }
.provenance .chips { margin-top: 8px; }

/* ---------- connected apps ---------- */
.card { margin: 16px 0 0; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.card h2 { margin: 0 0 6px; font: 400 24px var(--serif); }
.card p { margin: 6px 0 0; }
.steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; }
.copy-box { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 6px 6px 10px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--raised); }
.copy-box code { flex: 1; min-width: 0; background: none; padding: 0; font-size: 12.5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.warn-box { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--today-soft); font-size: 13.5px; font-weight: 600; }
.grants, .activity { list-style: none; margin: 0; padding: 0; }
.grant { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grant p { margin: 2px 0 0; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.activity li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.activity li > span:nth-child(2) { overflow-wrap: anywhere; }
@media (max-width: 420px) { .activity li { grid-template-columns: 22px minmax(0, 1fr); } .activity time { grid-column: 2; } }
.activity time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.mark-act { color: var(--muted); text-align: center; font-weight: 700; }
.act-proposed .mark-act, .act-pin .mark-act, .act-limit .mark-act { color: var(--today); }
.act-logged .mark-act, .act-kept .mark-act, .act-connected .mark-act { color: var(--ok); }

/* ---------- the connection page (lib/consent-page.js) ---------- */
.consent .login-card { width: min(380px, 100%); text-align: left; }
.consent .login-card > .mark, .consent .login-card > h1 { display: block; text-align: center; margin-left: auto; margin-right: auto; }
.consent h1 { font-size: 38px; }
.consent-what { margin: 14px 0 0; font-size: 14.5px; }
.consent-what p { margin: 0; }
.consent-what ul { margin: 8px 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.consent-warn { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--today-soft); font-size: 13.5px; font-weight: 600; }
.consent #pin-note { text-align: center; margin: 18px 0 0; }
.consent .pin { margin-top: 14px; }
.consent #deny { margin-top: 10px; }
