/* SÍNOP Tasks — "Real notebook" design (0.3.0)
   An open spiral notebook on a desk: ruled paper with a red margin, handwritten
   task titles, sticky notes, and finished tasks highlighted with a marker in the
   owner's colour. Includes the week / month calendar.
   Fonts (self-hosted, SIL Open Font License): Caveat (headings), Patrick Hand
   (handwriting), Nunito (small print). */
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url("/fonts/caveat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Patrick Hand"; font-weight: 400; font-display: swap; src: url("/fonts/patrick-hand-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("/fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 600; font-display: swap; src: url("/fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  --acc: #ffd43b;          /* each person's own colour (set by the app) */
  --on-acc: #1d1a2c;
  --desk: #d9cfbf;
  --paper: #fffdf6;
  --paper-2: #fbf7ec;
  --rule: #cfe0f1;
  --margin: #f3a3b0;
  --ink: #2f3b5c;          /* blue-black pen */
  --ink-2: #5d6782;
  --pencil: #8b8a86;
  --line: #e8e0cf;
  /* traffic-light priorities */
  --urgent: #b42318; --high: #e5484d; --normal: #f5c518; --low: #2fb35a;
  --red-pen: #d23b3b;
  --green-pen: #1f8a4c;
  --hand: "Patrick Hand", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --display: "Caveat", "Patrick Hand", cursive;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --line-h: 34px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  background-color: var(--desk);
  background-image:
    radial-gradient(120% 80% at 20% 0%, #e7dfd1 0, transparent 60%),
    repeating-linear-gradient(97deg, #0000 0 18px, #00000006 18px 19px, #0000 19px 41px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #8ec5ff; outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; display: block; }
i[data-icon] { display: inline-flex; vertical-align: -3px; margin-right: 6px; }
i[data-icon] svg.i { width: 16px; height: 16px; }
.badge { display: none; }
.ava { display: block; flex: none; }

/* ---------- buttons & fields ---------- */
.btn { border: 2px solid var(--ink); background: #fff; border-radius: 10px 12px 9px 13px; padding: 7px 15px; font: 400 17px/1.2 var(--hand); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .1s; }
.btn:hover { transform: rotate(-1deg) translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.block { width: 100%; }
.btn.small { padding: 4px 11px; font-size: 15px; }
.btn.danger { color: var(--red-pen); border-color: var(--red-pen); }
.btn.primary.danger { background: var(--red-pen); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.linkbtn { border: 0; background: none; padding: 4px 6px; color: var(--ink-2); font: 400 17px var(--hand); border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.linkbtn:hover { color: var(--ink); background: #ffe9734d; }
.iconbtn { border: 0; background: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink); }
.iconbtn:hover { background: #2f3b5c12; }
.field { display: grid; gap: 4px; margin-bottom: 14px; min-width: 0; }
.field label { font: 700 22px/1 var(--display); color: var(--ink-2); }
.field input, .field textarea, .field select, select, .search, .props select, .props input {
  width: 100%; border: 0; border-bottom: 2px solid #2f3b5c33; border-radius: 0; padding: 6px 2px; background: transparent; color: var(--ink); outline: none; font: 400 18px var(--hand);
}
select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 22px; }
.field input:focus, .field textarea:focus, .field select:focus, .props select:focus, .props input:focus { border-bottom-color: var(--ink); }
.field textarea { resize: vertical; min-height: 84px; line-height: var(--line-h); background: repeating-linear-gradient(transparent 0 33px, var(--rule) 33px 34px); padding-top: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 14px; }
.formerror { color: var(--red-pen); background: #ffe3e3; border-left: 4px solid var(--red-pen); padding: 8px 12px; font: 400 17px var(--hand); margin-bottom: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brandmark { width: 36px; height: 36px; border-radius: 4px; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; font: 700 26px/1 var(--display); transform: rotate(-5deg); box-shadow: 1px 2px 3px #0002; }
.brandname { font: 700 30px/1 var(--display); }
.brandname span { color: var(--red-pen); }

/* ---------- auth ---------- */
.loading { padding: 80px 20px; text-align: center; font: 700 30px var(--display); }
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authcard {
  position: relative; width: min(460px, 100%); padding: 30px 28px 26px 52px; border-radius: 6px;
  background: var(--paper) repeating-linear-gradient(transparent 0 33px, var(--rule) 33px 34px);
  box-shadow: 0 1px 1px #0001, 0 14px 40px #0003;
}
.authcard::before { content: ""; position: absolute; top: 0; bottom: 0; left: 36px; width: 2px; background: var(--margin); }
.authart { display: flex; justify-content: center; margin: 10px 0 0; }
.authart .illus { width: 210px; }
.authcard .tagline { text-align: center; margin: 4px 0 16px; font: 700 26px var(--display); }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { flex: 1; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 6px; color: var(--ink-2); font: 400 17px var(--hand); white-space: nowrap; }
.tabs button.active { color: var(--ink); background: linear-gradient(transparent 55%, #ffe14d99 55% 90%, transparent 90%); }

/* ---------- the open notebook ---------- */
.app { display: grid; grid-template-columns: 290px minmax(0, 1fr); max-width: 1380px; margin: 18px auto; min-height: calc(100vh - 36px); filter: drop-shadow(0 18px 30px #0000003a); }
/* left page: contents */
.sidebar {
  background: var(--paper-2); border-radius: 10px 0 0 10px; padding: 24px 22px 16px 20px;
  display: flex; flex-direction: column; gap: 10px; position: sticky; top: 18px; height: calc(100vh - 36px); overflow-y: auto;
  background-image: linear-gradient(to left, #0000001c, transparent 26px);
}
.sidebar .brand { padding: 0 4px 4px; }
.newtask { margin: 4px 0 6px; font-size: 19px; padding: 8px 16px; transform: rotate(-1deg); }
.nav { display: grid; gap: 0; }
.nav button {
  border: 0; color: var(--ink); padding: 3px 4px; text-align: left; display: flex; gap: 8px; align-items: center; font: 400 19px/1.3 var(--hand); width: 100%;
  background: radial-gradient(circle, #b9ae98 1px, transparent 1.4px) 0 calc(100% - 9px) / 7px 7px repeat-x;
}
.nav .ico, .nav .lbl, .nav .count, .nav .projdot { background: var(--paper-2); position: relative; z-index: 1; }
.nav .ico { width: 24px; height: 24px; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.nav .ico svg.i { width: 17px; height: 17px; }
.nav .lbl { flex: none; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.nav .count { margin-left: auto; padding-left: 6px; font: 700 20px/1 var(--display); color: var(--ink-2); min-width: 10px; text-align: right; }
.nav .count:empty { padding: 0; }
.nav .count.accent:not(:empty) { color: var(--red-pen); }
.nav button:hover .lbl { color: #000; }
.nav button.active .lbl { background: linear-gradient(100deg, transparent 2%, var(--acc) 3% 96%, transparent 97%) 0 62% / 100% 62% no-repeat, var(--paper-2); }
.navlabel { font: 700 24px/1 var(--display); color: var(--red-pen); padding: 14px 4px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navlabel-row { display: flex; justify-content: space-between; align-items: center; }
.navlabel-row .linkbtn { font-size: 22px; padding: 0 6px; }
.projdot { width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.projdot::before { content: "#"; font: 700 20px var(--display); color: var(--pencil); }
.sidefoot { margin-top: auto; display: grid; gap: 2px; border-top: 2px solid var(--line); padding-top: 10px; }
.sidefoot > .linkbtn { justify-content: flex-start; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 2px 0; }
.avatar { width: 36px; height: 36px; flex: none; display: grid; place-items: center; }
.meinfo { flex: 1; min-width: 0; line-height: 1.1; }
.meinfo b { display: block; font: 400 19px var(--hand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meinfo small { color: var(--pencil); font-size: 12px; }
.scrim { display: none; }

/* right page: ruled paper with a red margin, spiral binding on its left edge */
.main {
  position: relative; min-width: 0; border-radius: 0 10px 10px 0; padding: 26px clamp(18px, 4vw, 52px) 70px 104px;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, #00000022, transparent 30px),
    linear-gradient(to right, transparent 82px, var(--margin) 82px 84px, transparent 84px);
}
.main::before {
  content: ""; position: absolute; left: -15px; top: 14px; bottom: 14px; width: 30px; z-index: 3; pointer-events: none;
  background:
    radial-gradient(circle at 5px 13px, #3d362c 0 3.6px, transparent 4.2px) 0 0 / 30px 26px repeat-y,
    radial-gradient(circle at 25px 13px, #3d362c 0 3.6px, transparent 4.2px) 0 0 / 30px 26px repeat-y,
    linear-gradient(to bottom, transparent 9px, #8f877a 9px, #e8e2d6 12px, #a39a8b 15px, transparent 16px) 0 0 / 30px 26px repeat-y;
}
.topbar { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.menubtn { display: none; }
.titles { flex: 1; min-width: 230px; }
.eyebrow { font: 400 16px var(--hand); color: var(--pencil); }
.titles h1 { font: 700 52px/1 var(--display); margin: 0; display: flex; align-items: center; gap: 10px; }
.titles h1 > span:last-child { background: linear-gradient(100deg, transparent 1%, var(--acc) 2% 97%, transparent 98%) 0 78% / 100% 34% no-repeat; padding: 0 6px; }
.titles .sub { margin: 4px 0 0; color: var(--ink-2); font: 400 17px var(--hand); }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tools .search, .tools select { width: auto; font-size: 17px; padding: 4px 2px; }
.tools .search { width: 160px; padding-left: 26px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6782' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 20 20'/%3E%3C/svg%3E") 2px 50% / 17px no-repeat; }

/* sticky-note stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin: 14px 0 26px; }
.stat { position: relative; border: 0; padding: 16px 12px 10px; text-align: left; font: 400 17px/1.15 var(--hand); color: #4b3f1e; box-shadow: 0 2px 2px #0001, 0 8px 14px -6px #0003; display: block; }
.stat::before { content: ""; position: absolute; top: -9px; left: 50%; width: 52px; height: 18px; margin-left: -26px; background: #ffffff99; box-shadow: 0 0 0 1px #00000008; transform: rotate(-4deg); }
.stat b { display: block; font: 700 40px/1 var(--display); }
.stat:nth-child(1) { background: #ffb8c6; transform: rotate(-2deg); }
.stat:nth-child(2) { background: #ffe873; transform: rotate(1.5deg); }
.stat:nth-child(3) { background: #a8d8ff; transform: rotate(-1deg); }
.stat:nth-child(4) { background: #b5ecc2; transform: rotate(2deg); }
button.stat:hover { transform: rotate(0) translateY(-3px); }

/* ---------- quick add (writing on the next line) ---------- */
.page { display: block; }
.quickadd { position: relative; display: flex; align-items: center; gap: 10px; height: calc(var(--line-h) * 1.5); margin-left: -76px; padding-left: 20px; }
.qa-plus { width: 30px; height: 30px; display: grid; place-items: center; color: var(--ink); flex: none; margin-right: 30px; }
.qa-plus svg.i { width: 22px; height: 22px; stroke-width: 2.4; }
.quickadd input { flex: 1; border: 0; outline: none; padding: 2px 0; font: 400 22px var(--hand); background: transparent; color: var(--ink); min-width: 0; }
.quickadd input::placeholder { color: #a9a8b7; }
.qa-where { white-space: nowrap; border: 1.5px dashed #2f3b5c55; background: #fff; border-radius: 999px; padding: 2px 10px; display: inline-flex; align-items: center; gap: 5px; font: 400 15px var(--hand); color: var(--ink-2); }
.qa-where svg.i { width: 15px; height: 15px; }
.qa-where:hover { border-style: solid; color: var(--ink); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 6px; font: 400 15px var(--hand); color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.legend .p-urgent::before { display: none; }
.legend .p-high::before { background: var(--high); }
.legend .p-normal::before { background: var(--normal); }
.legend .p-low::before { background: var(--low); }

/* ---------- task lines ---------- */
.group { margin-top: 6px; }
.grouphead { display: flex; align-items: baseline; gap: 8px; font: 700 30px/1.2 var(--display); color: var(--ink); padding: 8px 0 0; }
.grouphead small { font: 400 16px var(--hand); color: var(--pencil); }
.grouphead.overdue { color: var(--red-pen); }
.task { position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: calc(var(--line-h) * 2); padding: 7px 0 6px; margin-left: -84px; }
.margin { width: 72px; flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 3px 12px 0 0; }
.check {
  position: relative; width: 22px; height: 22px; padding: 0; flex: none; background: #fff;
  border: 2px solid var(--ink); border-radius: 3px 6px 4px 5px; color: var(--ink);
}
.check .tick { position: absolute; width: 26px; height: 26px; left: -1px; top: -9px; opacity: 0; }
.check:hover .tick { opacity: .25; }
.check.done .tick { opacity: 1; }
.task.fresh .check.done .tick, .ev.fresh .evcheck.done .tick { animation: draw .35s ease-out; }
@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.pdot { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--normal); font-size: 13px; line-height: 11px; text-align: center; }
.task.p-urgent .pdot { background: none; width: 16px; }
.task.p-high .pdot { background: var(--high); }
.task.p-low .pdot { background: var(--low); }
.taskbody { flex: 1; min-width: 0; cursor: pointer; padding-top: 1px; }
.tasktitle { font: 400 21px/1.25 var(--hand); color: var(--ink); overflow-wrap: anywhere; }
/* the marker highlight on finished tasks (owner's colour) */
.task.is-done .txt, .ev.is-done .txt, .mev.is-done .txt {
  background-image: linear-gradient(100deg, transparent 0.5%, var(--hl, #ffe14d) 1.5% 98%, transparent 99.5%);
  background-repeat: no-repeat; background-size: 100% 78%; background-position: 0 62%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 5px; margin: 0 -5px; border-radius: 4px 9px 5px 10px;
}
.task.fresh.is-done .txt, .ev.fresh.is-done .txt { animation: marker .55s ease-out both; }
@keyframes marker { from { background-size: 0% 78%; } to { background-size: 100% 78%; } }
.task.is-cancelled .txt { text-decoration: line-through; color: var(--pencil); }
.meta { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--pencil); }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.meta .overdue { color: var(--red-pen); font-weight: 800; }
.meta .today { color: var(--green-pen); font-weight: 800; }
.meta .review { color: #7b5ea7; font-weight: 800; }
.meta .personal { color: var(--ink-2); }
.status { font: 400 14px var(--hand); border: 1.5px solid currentColor; border-radius: 8px 10px 7px 11px; padding: 0 7px; color: var(--ink-2); }
.status.in_progress { color: #2b6cb0; } .status.waiting { color: #b7791f; } .status.ready_for_review { color: #7b5ea7; }
.side { flex: none; display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.owner { display: grid; padding: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px #0003; transform: rotate(-6deg); }
.claim { border: 0; background: #ffe873; color: #4b3f1e; padding: 6px 12px 7px; font: 400 17px var(--hand); transform: rotate(3deg); box-shadow: 0 2px 2px #0001, 0 6px 10px -4px #0003; }
.claim:hover { transform: rotate(0) translateY(-1px); }
.empty { padding: 26px 12px 20px; text-align: center; color: var(--ink-2); font: 400 18px var(--hand); }
.empty .illus { width: 200px; display: block; margin: 0 auto 10px; }
.empty b { display: block; color: var(--ink); font: 700 32px/1.1 var(--display); }
.completed { margin-top: 10px; }
.completedtoggle { border: 0; background: none; color: var(--ink); font: 700 26px var(--display); padding: 4px 0; display: inline-flex; align-items: center; gap: 8px; }
.completedtoggle .chev { transition: transform .15s; display: inline-block; font-family: var(--font); font-size: 18px; color: var(--pencil); }
.completedtoggle.open .chev { transform: rotate(90deg); }
.syncnote { color: var(--pencil); font: 400 15px var(--hand); text-align: center; margin-top: 30px; }
.fab { display: none; }

/* ---------- calendar ---------- */
.calbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.calnav { display: flex; align-items: center; gap: 8px; }
.calnav b { font: 700 28px/1 var(--display); min-width: 170px; text-align: center; }
.calmode { display: flex; gap: 4px; }
.calmode button { border: 0; background: none; padding: 4px 10px; font: 400 19px var(--hand); color: var(--ink-2); }
.calmode button.on { color: var(--ink); background: linear-gradient(100deg, transparent 2%, var(--acc) 3% 96%, transparent 97%) 0 65% / 100% 60% no-repeat; }
.people { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.person { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--pc, #eee); border-radius: 999px; padding: 3px 12px 3px 3px; font: 400 17px var(--hand); color: var(--ink); box-shadow: 0 1px 2px #0002; }
.person small { font: 800 12px var(--font); background: #ffffffb3; border-radius: 999px; padding: 1px 7px; }
.person.off { opacity: .4; filter: grayscale(1); box-shadow: none; }
.person .nobody { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px dashed var(--pencil); font: 800 13px var(--font); color: var(--pencil); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--ink); margin-left: -20px; }
.day { min-height: 300px; border-right: 1.5px dashed #2f3b5c33; padding: 6px 5px 10px; background: #fffdf6cc; }
.day:last-child { border-right: 0; }
.day.past { background: #f6f1e4cc; }
.day header { display: flex; align-items: baseline; gap: 5px; padding: 0 2px 6px; position: relative; }
.day .dow { font: 400 16px var(--hand); color: var(--ink-2); }
.day .dnum { font: 700 30px/1 var(--display); position: relative; }
.day.today .dnum::after { content: ""; position: absolute; inset: -4px -8px -4px -8px; border: 2.5px solid var(--red-pen); border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%; transform: rotate(-6deg); }
.day header small { font-size: 11px; font-weight: 800; color: var(--pencil); }
.dayadd { margin-left: auto; border: 0; background: none; width: 26px; height: 26px; border-radius: 50%; color: var(--ink-2); font-size: 16px; line-height: 1; opacity: .35; }
.day:hover .dayadd, .dayadd:focus-visible { opacity: 1; background: #2f3b5c12; }
.evs { display: grid; gap: 6px; }
.ev { position: relative; display: flex; gap: 6px; align-items: flex-start; background: var(--pc, #eee); border-radius: 3px 8px 6px 4px; padding: 6px 6px 6px 5px; border-left: 4px solid var(--normal); box-shadow: 0 1px 1px #0001; }
.ev.p-urgent { border-left-color: var(--urgent); } .ev.p-high { border-left-color: var(--high); } .ev.p-low { border-left-color: var(--low); }
.ev.unclaimed { background: #fff; outline: 1.5px dashed #2f3b5c40; outline-offset: -1.5px; }
.ev.is-done { background: #fff; }
.evcheck { position: relative; flex: none; width: 16px; height: 16px; margin-top: 2px; padding: 0; background: #fff; border: 1.5px solid var(--ink); border-radius: 2px 4px 3px 4px; color: var(--ink); }
.evcheck .tick { position: absolute; width: 20px; height: 20px; left: -2px; top: -7px; opacity: 0; }
.evcheck.done .tick { opacity: 1; }
.evbody { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; display: grid; gap: 3px; }
.evbody .txt { font: 400 16px/1.2 var(--hand); color: var(--ink); overflow-wrap: anywhere; }
.evmeta { display: flex; align-items: center; gap: 4px; color: var(--ink-2); }
.evmeta svg.i { width: 12px; height: 12px; }
.evmeta em { font: 400 13px var(--hand); color: var(--pencil); }
.free { font: 400 15px var(--hand); color: #b6b2a6; text-align: center; padding: 10px 0; }
.month { margin-left: -20px; }
.mhead, .mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mhead span { font: 400 16px var(--hand); color: var(--ink-2); padding: 0 6px 4px; border-bottom: 2px solid var(--ink); }
.mday { min-height: 104px; border-right: 1.5px dashed #2f3b5c26; border-bottom: 1.5px dashed #2f3b5c26; padding: 4px; display: grid; align-content: start; gap: 3px; background: #fffdf6cc; }
.mday:nth-child(7n) { border-right: 0; }
.mday.other { background: #f3eee2b3; }
.mday.other .mnum { color: #b6b2a6; }
.mnum { justify-self: start; border: 0; background: none; padding: 0 4px; font: 700 24px/1 var(--display); color: var(--ink); position: relative; }
.mday.today .mnum::after { content: ""; position: absolute; inset: -3px -5px; border: 2.5px solid var(--red-pen); border-radius: 48% 52% 45% 55% / 55% 45% 55% 45%; }
.mev { border: 0; background: var(--pc, #eee); border-left: 3px solid var(--normal); border-radius: 2px 5px 4px 2px; padding: 1px 5px; text-align: left; font: 400 14px/1.25 var(--hand); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mev.p-urgent { border-left-color: var(--urgent); } .mev.p-high { border-left-color: var(--high); } .mev.p-low { border-left-color: var(--low); }
.mev.is-done { background: #fff; }
.more { justify-self: start; border: 0; background: none; padding: 0 4px; font: 400 14px var(--hand); color: var(--ink-2); text-decoration: underline; }
.calnote { margin: 14px 0 0; font: 400 16px var(--hand); color: var(--ink-2); }

/* ---------- modals: an index card ---------- */
.modalback, .drawerback { position: fixed; inset: 0; background: #3b33264d; display: none; z-index: 30; }
.modalback.show { display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal {
  position: relative; width: min(560px, 100%); padding: 26px 26px 22px; border-radius: 4px; max-height: calc(100vh - 32px); overflow: auto;
  background: #fff linear-gradient(to bottom, transparent 54px, #f3a3b0 54px 56px, transparent 56px);
  box-shadow: 0 2px 2px #0001, 0 20px 50px #0004;
}
.modal.small { width: min(420px, 100%); }
#askBack { z-index: 45; }
.modal h2 { margin: -4px 0 18px; font: 700 34px/1 var(--display); }
.segmented { display: flex; gap: 10px; margin-bottom: 14px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; padding: 6px; font: 400 18px var(--hand); color: var(--ink-2); cursor: pointer; border-bottom: 2px solid var(--line); }
.segmented input:checked + span { color: var(--ink); border-bottom-color: transparent; background: linear-gradient(100deg, transparent 2%, var(--acc) 3% 96%, transparent 97%) 0 65% / 100% 60% no-repeat; }
.segmented input:focus-visible + span { outline: 3px solid #8ec5ff; }
.codebox { font: 800 20px/1.3 ui-monospace, Menlo, monospace; letter-spacing: 1px; background: #fff8c4; color: var(--ink); padding: 14px; text-align: center; margin: 8px 0 12px; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; transform: rotate(-1deg); box-shadow: 0 6px 12px -6px #0004; }
h3.section { font: 700 26px/1 var(--display); margin: 22px 0 8px; }
.invlist { display: grid; gap: 8px; }
.invrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; border-bottom: 1.5px dashed var(--line); padding: 6px 2px; font-size: 13px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.swatch { width: 48px; height: 48px; border-radius: 50%; border: 3px solid transparent; background: none; padding: 3px; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 46% 54% 50% 50% / 52% 46% 54% 48%; }
.swatch.on { border-color: var(--ink); }

/* ---------- drawer: a yellow legal pad ---------- */
.drawerback.show { display: block; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(540px, 100%); overflow-y: auto; padding: 22px 26px 36px 62px; animation: slidein .22s ease-out; color: var(--ink);
  background-color: #fff6c2;
  background-image: linear-gradient(to right, transparent 44px, #e8909c 44px 45.5px, transparent 45.5px 48px, #e8909c 48px 49.5px, transparent 49.5px), repeating-linear-gradient(transparent 0 33px, #c3d6e6 33px 34px);
  box-shadow: -10px 0 40px #0004;
}
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawerhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawerhead .where { display: inline-flex; align-items: center; gap: 6px; font: 400 16px var(--hand); color: var(--ink-2); }
.drawerhead .where svg.i { width: 15px; height: 15px; }
.titlerow { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 2px -40px; }
.titlerow .check { margin-top: 10px; }
.titleinput { flex: 1; min-height: 40px; border: 0; outline: none; font: 700 36px/1.05 var(--display); padding: 2px 0; resize: none; min-width: 0; background: transparent; color: var(--ink); }
.titleinput:focus { background: #ffffff80; }
.descinput { width: 100%; border: 0; outline: none; resize: vertical; min-height: 68px; color: var(--ink); padding: 0; font: 400 19px/34px var(--hand); background: transparent; }
.props { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; align-items: center; margin: 12px 0 6px; }
.props > label, .props > .k { font: 700 22px var(--display); color: var(--ink-2); }
.props select, .props input { font-size: 18px; padding: 3px 22px 3px 2px; }
.props .v { font: 400 18px var(--hand); }
.ownerrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ownerrow select { flex: 1; min-width: 130px; width: auto; }
.drawer .actions { justify-content: flex-start; margin: 16px 0 8px; }
.reviewbanner { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 400 17px var(--hand); background: #ffffff8c; padding: 6px 10px; margin: 6px 0; border-left: 4px solid #7b5ea7; }
.feed { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.feed li { font: 400 16px var(--hand); color: var(--ink-2); }
.feed li::before { content: "– "; }
.feed li b { color: var(--ink); font-weight: 400; }
.feed time { margin-left: 6px; color: var(--pencil); font: 600 11px var(--font); }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment > div { flex: 1; background: #fff; padding: 6px 10px; min-width: 0; transform: rotate(-.4deg); box-shadow: 0 2px 4px #0002; }
.comment b { font: 400 17px var(--hand); }
.comment time { color: var(--pencil); font: 600 11px var(--font); margin-left: 6px; }
.comment p { margin: 0; font: 400 18px/1.3 var(--hand); white-space: pre-wrap; overflow-wrap: anywhere; }
.commentform { display: flex; gap: 8px; margin-top: 10px; }
.commentform input { flex: 1; border: 0; border-bottom: 2px solid #2f3b5c40; padding: 6px 2px; min-width: 0; outline: none; background: transparent; font: 400 18px var(--hand); color: var(--ink); }

/* ---------- toast: a sticky note ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) rotate(-2deg); background: #ffe873; color: #4b3f1e; box-shadow: 0 2px 2px #0001, 0 12px 20px -6px #0005; padding: 12px 12px 12px 16px; font: 400 21px/1.1 var(--hand); z-index: 50; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 12px; animation: drop .25s ease-out; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -10px) rotate(-6deg); } }
.toast.error { background: #ffb8c6; color: #6b1d2a; }
.toast .linkbtn { color: inherit; text-decoration: underline; font-size: 18px; }

/* ---------- phones & small tablets ---------- */
@media (max-width: 900px) {
  input, select, textarea { font-size: 16px; }
  .app { display: block; margin: 0; min-height: 100vh; filter: none; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; height: auto; width: 290px; border-radius: 0 10px 10px 0; transform: translateX(-110%); transition: transform .22s; padding-top: calc(20px + env(safe-area-inset-top)); box-shadow: 10px 0 30px #0004; }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open .scrim { display: block; position: fixed; inset: 0; background: #3b33264d; z-index: 35; }
  .menubtn { display: grid; margin-left: -6px; }
  .main {
    border-radius: 0; min-height: 100vh; padding: calc(62px + env(safe-area-inset-top)) 14px 120px 58px;
    background-image:
      linear-gradient(to right, transparent 44px, var(--margin) 44px 46px, transparent 46px);
  }
  .main::before {
    left: 10px; right: 10px; top: calc(4px + env(safe-area-inset-top)); bottom: auto; width: auto; height: 26px;
    background:
      radial-gradient(circle at 13px 21px, #3d362c 0 3.4px, transparent 4px) 0 0 / 26px 26px repeat-x,
      linear-gradient(to right, transparent 9px, #8f877a 9px, #e8e2d6 12px, #a39a8b 15px, transparent 16px) 0 0 / 26px 19px repeat-x;
  }
  .topbar { align-items: flex-start; gap: 10px; }
  .menubtn { position: absolute; left: 4px; top: calc(58px + env(safe-area-inset-top)); }
  .tools { margin-left: -44px; width: calc(100% + 44px) !important; }
  .titles h1 { font-size: 42px; }
  .tools { width: 100%; }
  .tools .search { flex: 1 1 100%; width: auto; }
  .tools select { flex: 1; }
  .stats { grid-template-columns: 1fr 1fr; gap: 14px; margin-left: -40px; }
  .quickadd { margin-left: -56px; padding-left: 8px; }
  .qa-plus { margin-right: 14px; }
  .task { margin-left: -58px; }
  .margin { width: 50px; padding-right: 8px; gap: 5px; flex-direction: column-reverse; align-items: flex-end; }
  .legend, .grouphead, .completed, .empty, .calnote { margin-left: -40px; }
  .calbar, .people { margin-left: -44px; }
  .week { grid-template-columns: 1fr; margin-left: -58px; margin-right: -14px; }
  .day { min-height: 0; border-right: 0; border-bottom: 1.5px dashed #2f3b5c33; display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 8px 14px 8px 4px; }
  .day header { flex-direction: column; align-items: center; gap: 0; padding: 0; }
  .day header small { display: none; }
  .dayadd { margin: 4px 0 0; opacity: .7; }
  .free { text-align: left; padding: 6px 0; }
  .month { margin-left: -58px; margin-right: -14px; }
  .mday { min-height: 64px; padding: 2px; }
  .mev { font-size: 0; height: 8px; padding: 0; border-left-width: 0; border-radius: 4px; }
  .mev .txt { display: none; }
  .mnum { font-size: 20px; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; box-shadow: 0 8px 18px #0005; z-index: 20; }
  .fab svg.i { width: 28px; height: 28px; stroke-width: 2.6; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .drawer { width: 100%; padding: calc(16px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom)) 58px; background-image: linear-gradient(to right, transparent 40px, #e8909c 40px 41.5px, transparent 41.5px 44px, #e8909c 44px 45.5px, transparent 45.5px), repeating-linear-gradient(transparent 0 33px, #c3d6e6 33px 34px); }
  .titlerow { margin-left: -36px; }
  .props { grid-template-columns: 100px 1fr; }
  .qa-where span { display: none; }
}
@media (max-width: 480px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .modal { padding: 22px 18px 18px; }
  .meta .status { display: none; }
  .tasktitle { font-size: 20px; }
  .calnav b { min-width: 0; font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* style picker */
.stylecards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stylecard { border: 0; background: #fff; padding: 10px; text-align: left; display: grid; gap: 4px; color: var(--ink); box-shadow: 0 1px 2px #0002, 0 6px 12px -6px #0003; transform: rotate(-1deg); }
.stylecard:nth-child(2) { transform: rotate(1deg); }
.stylecard.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.stylecard b { font: 700 24px/1 var(--display); }
.stylecard small { color: var(--ink-2); font: 400 14px/1.25 var(--hand); }
.sc-prev { display: grid; gap: 4px; padding: 8px; height: 64px; align-content: center; }
.sc-prev i { display: block; height: 10px; border-radius: 3px; }
.sc-notebook { background: #fffdf6 repeating-linear-gradient(transparent 0 13px, #cfe0f1 13px 14px); border-left: 3px solid #f3a3b0; }
.sc-notebook i { background: #2f3b5c33; width: 70%; height: 6px; }
.sc-notebook i:first-child { background: #ffe14d; }
.sc-tickets { background: #262338; border-radius: 4px; }
.sc-tickets i:nth-child(1) { background: #ffd3cc; } .sc-tickets i:nth-child(2) { background: #fff0b8; } .sc-tickets i:nth-child(3) { background: #d6f2dc; }
.tornpiece { display: none; }


/* ===================== Writing on the lines =====================
   The list area is ruled paper. Every line of writing is exactly one ruled
   line tall (--line-h) and each font is nudged so its baseline sits on the
   rule, the way handwriting sits on a real notebook line. Measured baselines
   (34px line box): Patrick Hand 20-22px ≈ 24-25px, Caveat 26-30px ≈ 25-27px,
   Nunito 12.5px ≈ 21px. The rule is drawn at 26px. */
:root { --line-h: 34px; --rule-y: 26px; }
.page {
  position: relative;
  background-image: repeating-linear-gradient(to bottom,
    transparent 0 var(--rule-y), var(--rule) var(--rule-y) calc(var(--rule-y) + 1px), transparent calc(var(--rule-y) + 1px) var(--line-h));
  margin-left: -104px; margin-right: calc(-1 * clamp(18px, 4vw, 52px)); padding: 0 clamp(18px, 4vw, 52px) var(--line-h) 104px;
}
.page.nolines { background-image: none; }
.stats { margin-bottom: var(--line-h); }

.quickadd { height: var(--line-h); margin: 0 0 0 -76px; }
.quickadd input { height: var(--line-h); line-height: var(--line-h); font-size: 22px; padding: 0; }
.qa-plus { height: var(--line-h); }
.qa-where { position: relative; top: -2px; }
.legend { height: var(--line-h); line-height: var(--line-h); margin: 0; align-items: center; overflow: hidden; }
.legend .lg { line-height: var(--line-h); position: relative; top: 1px; }

.group { margin: 0; padding-top: var(--line-h); }          /* one blank line above each heading */
.group:first-child { padding-top: 0; }
.grouphead { height: var(--line-h); line-height: var(--line-h); padding: 0; font-size: 30px; position: relative; top: -1px; }

.task { min-height: var(--line-h); padding: 0; margin-top: 0; margin-bottom: 0; align-items: flex-start; }
.taskbody { padding: 0; }
.tasktitle { font-size: 21px; line-height: var(--line-h); }
.task.is-done .txt, .task.fresh.is-done .txt { background-position: 0 70%; background-size: 100% 62%; }
.task.fresh.is-done .txt { animation-name: marker-lines; }
@keyframes marker-lines { from { background-size: 0% 62%; } to { background-size: 100% 62%; } }
.meta { height: var(--line-h); line-height: var(--line-h); margin: 0; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; position: relative; top: 3px; }
.meta .status { line-height: 1.2; }
.margin { height: var(--line-h); padding: 0 12px 0 0; align-items: center; }
.margin .check { position: relative; top: 1px; }
.side { height: var(--line-h); padding: 0; align-items: center; }
.owner, .claim { position: relative; top: 1px; }
.claim { padding: 2px 12px 3px; }
.side .ava { width: 30px; height: 30px; }

.completed { margin: 0; padding-top: var(--line-h); }
.completedtoggle { height: var(--line-h); line-height: var(--line-h); padding: 0; font-size: 26px; }
.empty { padding: 0 12px; line-height: var(--line-h); }
.empty .illus { height: calc(var(--line-h) * 5); width: auto; margin: 0 auto; }
.empty b { line-height: calc(var(--line-h) * 2); }
.syncnote { line-height: var(--line-h); margin: var(--line-h) 0 0; }

@media (max-width: 900px) {
  .page { margin-left: -58px; margin-right: -14px; padding: 0 14px var(--line-h) 58px; }
  .quickadd { margin-left: -56px; }
  .margin { flex-direction: row; align-items: center; width: 50px; padding-right: 6px; gap: 4px; }
  .margin .pdot { width: 9px; height: 9px; }
  .task.p-urgent .margin .pdot { width: 14px; }
  .legend, .grouphead, .completed, .empty, .calnote { margin-left: 0; }
}

/* picture picker */
.avpick { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.avnow .ava { width: 64px; height: 64px; }
.photobtn { cursor: pointer; }
.avchoices { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.avopt { border: 0; background: none; padding: 2px; border-radius: 50%; display: grid; place-items: center; }
.avopt.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.avopt:hover { transform: scale(1.08); }

/* face builder */
.pickhint { margin: 10px 0 6px; }
.facebuilder { margin: 10px 0 4px; }
.facebuilder summary { cursor: pointer; font-weight: 800; padding: 6px 0; }
.facehair { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.fchoice { display: grid; justify-items: center; gap: 2px; }
.fchoice small { font-size: 11px; color: var(--ink-2); }
.dots { display: flex; flex-wrap: wrap; gap: 8px; }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; background: var(--pc, #ccc); box-shadow: 0 0 0 1.5px #0002; padding: 0; }
.dot.on { box-shadow: 0 0 0 3px var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { border: 1.5px solid #0002; background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; color: var(--ink); }
.chipbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- 🔔 updates corner & new-version note ---------- */
.corner { position: fixed; top: 16px; right: 18px; z-index: 26; display: flex; align-items: center; gap: 8px; }
.bell { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; padding: 0; cursor: pointer; }
.bell b { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font: 800 11px/20px var(--font); text-align: center; border: 2px solid #fff; }
.newver { border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 13px; cursor: pointer; animation: nudge 2s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.updpanel { position: absolute; top: 52px; right: 0; width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto; border-radius: 14px; padding: 6px 6px 10px; box-shadow: 0 18px 50px #0005; }
.updhead { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 4px 10px; }
.updhead b { font-size: 16px; }
.updlist { display: grid; gap: 2px; }
.upd { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; width: 100%; color: inherit; font-size: 14px; line-height: 1.35; cursor: pointer; position: relative; }
.upd > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.upd small { display: block; font-size: 12px; opacity: .65; margin-top: 2px; }
.upd q { font-style: italic; opacity: .85; }
.upd.new::after { content: ""; position: absolute; right: 10px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; }
.upd.forme small { opacity: 1; font-weight: 800; }
@media (max-width: 900px) { .corner { top: calc(10px + env(safe-area-inset-top)); right: 12px; } }

.bell { background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 4px #0002; }
.newver { background: #ffe873; color: #4b3f1e; font-family: var(--hand); font-size: 16px; transform: rotate(-1deg); box-shadow: 0 6px 12px -6px #0004; }
.updpanel { background: #fffdf6 repeating-linear-gradient(transparent 0 33px, #cfe0f1 33px 34px); color: var(--ink); border-radius: 6px; }
.updhead b { font: 700 26px var(--display); }
.upd { font-family: var(--hand); font-size: 17px; }
.upd:hover { background: #ffe9734d; }
.upd.forme { background: #fff6c4; }
.titles { padding-right: 60px; }

/* app icon: notepad with a push pin (replaces the old yellow "S") */
img.brandmark { width: 42px; height: 42px; background: none; border-radius: 0; box-shadow: none; transform: none; display: block; flex: none; }

/* start-up problem message */
.startfail { max-width: 420px; margin: 0 auto; display: grid; gap: 10px; justify-items: center; font-family: var(--font); font-size: 15px; }
.startfail b { font-size: 18px; }
.startfail p { margin: 0; }

/* empty state: sticky note sits between ruled lines; text on its own lines below */
.empty .illus { height: calc(var(--line-h) * 5); width: auto; margin: 0 auto var(--line-h); display: block; }
