/* OpenBoard web app. Every color and size is a variable at the top, matching the desktop app's
   app/ui/theme.slint, so restyling means editing this block. */

@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/JetBrainsMono-Regular.ttf) format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url(/fonts/JetBrainsMono-Medium.ttf) format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/JetBrainsMono-SemiBold.ttf) format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700 800; font-style: normal; font-display: swap; src: url(/fonts/JetBrainsMono-Bold.ttf) format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: italic; font-display: swap; src: url(/fonts/JetBrainsMono-Italic.ttf) format("truetype"); }

:root {
  --accent: #0A84FF;
  --c1: #8E8E93; --c2: #8E8E93; --c3: #8E8E93;
  --strength: .5; --wash: .08; --grain: 0;

  --text: #1C1C1E; --text-2: #3C3C43A6; --text-3: #3C3C4361;
  --window: #ECECF0; --backdrop: #F6F6F8;
  --page: #FAFAFCE6; --page-solid: #FAFAFC;
  --lane: #0000000A; --card: #FFFFFFE0; --card-border: #0000000F;
  --chip: #FFFFFF99; --chip-border: #0000001A; --separator: #00000014;
  --hover: #0000000A; --pressed: #00000014; --control: #FFFFFFB3; --control-border: #00000017;
  --popup: #FCFCFE; --scrim: #00000033; --field: #FFFFFF;

  --side-text: #1C1C1E; --side-text-2: #3C3C43A0; --side-hover: #0000000D; --side-selected: #FFFFFF8C;

  --indigo: #5856D6; --blue: #007AFF; --teal: #30B0C7; --green: #34C759; --yellow: #FFCC00;
  --orange: #FF9500; --red: #FF3B30; --pink: #FF2D55; --purple: #AF52DE; --gray: #8E8E93;

  --radius-page: 12px; --radius-card: 10px; --radius-control: 7px;
  --card-pad: 11px; --card-gap: 7px;
  --fs-small: 11px; --fs: 13px; --fs-title: 15px; --fs-large: 26px;
  --frame: 10px; --sidebar-w: 240px; --panel-w: 360px; --lane-w: 284px;
  --font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-pop: 0 10px 30px #0000002E, 0 0 0 .5px #0000001F;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  --left: env(safe-area-inset-left, 0px); --right: env(safe-area-inset-right, 0px);
}
html.compact { --card-pad: 8px; --card-gap: 5px; }
html.solid-cards { --card: #FFFFFF; }
html.no-frame { --frame: 0px; }

html.dark {
  --text: #F2F2F7; --text-2: #EBEBF5A6; --text-3: #EBEBF561;
  --window: #1C1C1E;
  --page: #1E1E20F0; --page-solid: #1E1E20;
  --lane: #FFFFFF0A; --card: #2C2C2EE6; --card-border: #FFFFFF14;
  --chip: #FFFFFF0D; --chip-border: #FFFFFF1F; --separator: #FFFFFF1A;
  --hover: #FFFFFF0F; --pressed: #FFFFFF1A; --control: #FFFFFF1A; --control-border: #FFFFFF1F;
  --popup: #2A2A2C; --scrim: #00000080; --field: #FFFFFF12;
  --indigo: #5E5CE6; --blue: #0A84FF; --teal: #40C8E0; --green: #30D158; --yellow: #FFD60A;
  --orange: #FF9F0A; --red: #FF453A; --pink: #FF375F; --purple: #BF5AF2;
  --shadow-pop: 0 10px 30px #00000080, 0 0 0 .5px #FFFFFF26;
}
html.dark.solid-cards { --card: #2C2C2E; }
html.side-dark { --backdrop: #212123; --side-text: #F2F2F7; --side-text-2: #EBEBF59E; --side-hover: #FFFFFF14; --side-selected: #FFFFFF26; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 var(--fs)/1.4 var(--font); color: var(--text); background: var(--backdrop);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow: hidden;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: default; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
[hidden] { display: none !important; }

/* Icons: Lucide SVGs as masks, so they take the text color. */
.ic { display: inline-block; flex: none; width: 15px; height: 15px; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ic.s11 { width: 11px; height: 11px; } .ic.s13 { width: 13px; height: 13px; }
.ic.s17 { width: 17px; height: 17px; } .ic.s20 { width: 20px; height: 20px; }

/* ---------- Window ---------- */
#app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--sidebar-w) 1fr auto; grid-template-rows: 1fr; }
#app.no-sidebar { grid-template-columns: 0 1fr auto; }
#app.loading > * { visibility: hidden; }
.backdrop { position: absolute; inset: 0; background: var(--backdrop); z-index: 0; pointer-events: none; transition: background .3s; }
.backdrop .grad { position: absolute; inset: 0; background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 50%, var(--c3) 100%); opacity: var(--strength); transition: opacity .38s ease-in-out; }
.backdrop .grain { position: absolute; inset: 0; opacity: var(--grain); background-image: var(--grain-image); background-size: 128px; }
#sidebar, #page, #panel, #topbar { position: relative; z-index: 1; }
#topbar { display: none; }
#scrim { display: none; }

#page {
  grid-column: 2; margin: var(--frame) var(--frame) var(--frame) 0; min-width: 0; min-height: 0;
  background: var(--page); border-radius: var(--radius-page); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 0 0 .5px var(--card-border), 0 1px 4px #0000000A;
}
html.no-frame #page { border-radius: 0; box-shadow: -0.5px 0 0 var(--separator); }
#app.no-sidebar #page { margin-left: var(--frame); }
#panel { grid-column: 3; width: 0; overflow: hidden; display: flex; flex-direction: column; color: var(--text); }
#app.panel-open #panel { width: var(--panel-w); margin: var(--frame) var(--frame) var(--frame) 0;
  background: var(--page); border-radius: var(--radius-page); box-shadow: 0 0 0 .5px var(--card-border); }
html.no-frame #app.panel-open #panel { margin: 0; border-radius: 0; box-shadow: -0.5px 0 0 var(--separator); }

/* ---------- Sidebar ---------- */
#sidebar { grid-column: 1; display: flex; flex-direction: column; min-height: 0; color: var(--side-text); overflow: hidden; padding-top: var(--top); }
#app.no-sidebar #sidebar { visibility: hidden; }
.side-top { display: flex; gap: 6px; padding: 12px 10px 6px 12px; align-items: center; }
.side-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 8px;
  background: var(--side-hover); border: 0; color: var(--side-text-2); text-align: left; }
.side-search kbd { margin-left: auto; font: inherit; font-size: 10.5px; opacity: .8; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: none; }
.side-scroll::-webkit-scrollbar { display: none; }
.space-head { display: flex; align-items: center; gap: 8px; padding: 10px 6px 8px; min-height: 40px; }
.space-head .name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: 7px; color: var(--side-text);
  border: 0; background: none; width: 100%; text-align: left; position: relative; }
.row:hover { background: var(--side-hover); }
.row.on { background: var(--side-selected); font-weight: 500; box-shadow: 0 0 0 .5px #0000000A; }
.row .ic { color: var(--side-text-2); }
.row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .count { color: var(--side-text-2); font-size: 11px; }
.row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin: 0 3.5px; }
.section { margin-top: 14px; }
.section-title { display: flex; align-items: center; gap: 4px; padding: 0 8px; height: 24px; font-size: 11px; font-weight: 600;
  color: var(--side-text-2); border: 0; background: none; width: 100%; text-align: left; letter-spacing: .02em; }
.section-title .ic { transition: transform .15s; }
.section-title.folded .ic { transform: rotate(-90deg); }
.section-title .add { margin-left: auto; opacity: 0; }
.section:hover .section-title .add { opacity: 1; }
.spacebar { display: flex; align-items: center; gap: 4px; padding: 8px 10px calc(10px + var(--bottom)); }
.spacebar .dots { flex: 1; display: flex; justify-content: center; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.spacebar .dots::-webkit-scrollbar { display: none; }
.sdot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; border: 0; background: none; color: var(--side-text-2); flex: none; }
.sdot i.d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.sdot:hover { background: var(--side-hover); }
.sdot.on { color: var(--side-text); }
.sdot.home.on, .sdot.on .glyph { color: var(--side-text); }

/* Project glyph: an icon or emoji, never on a color tile. */
.glyph { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; line-height: 1; font-size: 14px; }
.glyph .ic { width: 100%; height: 100%; }
.glyph.big { width: 26px; height: 26px; font-size: 21px; }

/* ---------- Buttons and controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px;
  border: .5px solid var(--control-border); background: var(--control); color: var(--text); font-weight: 500; white-space: nowrap;
  box-shadow: 0 1px 2px #0000000D, inset 0 .5px 0 #FFFFFF40; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn:hover { background: color-mix(in srgb, var(--control) 70%, var(--text) 6%); }
.btn:active { background: var(--pressed); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { color: var(--red); }
.btn.round { width: 28px; padding: 0; }
.btn.small { height: 24px; padding: 0 9px; font-size: 12px; }
.btn.round.small { width: 24px; padding: 0; }
.btn.bare { background: none; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; color: inherit; }
.btn.bare:hover { background: var(--hover); }
.btn:disabled { opacity: .45; }
.btn .ic { color: inherit; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--lane); border: .5px solid var(--control-border); }
.seg button { height: 24px; padding: 0 10px; border: 0; border-radius: 999px; background: none; display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px #0000001A; }
.field { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--radius-control); border: .5px solid var(--control-border);
  background: var(--field); outline: none; }
.field:focus, textarea.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea.field { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.switch { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--pressed); position: relative; flex: none; margin: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0000004D; transition: transform .15s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(14px); }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=color] { width: 34px; height: 26px; padding: 0; border: .5px solid var(--control-border); border-radius: 6px; background: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 18px; min-height: 52px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: var(--fs-title); font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-head .grow { flex: 1; }
.chipbar { display: flex; gap: 6px; padding: 0 18px 10px; flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 9px; border-radius: 999px; border: .5px solid var(--chip-border);
  background: var(--chip); font-size: 12px; color: var(--text-2); }
.filter-chip button { border: 0; background: none; padding: 0; display: grid; place-items: center; color: var(--text-3); }
.content { flex: 1; min-height: 0; overflow: auto; }

/* ---------- Board ---------- */
.board { display: flex; gap: 12px; padding: 2px 18px 18px; height: 100%; overflow-x: auto; overflow-y: hidden; align-items: stretch; }
.lane { flex: 0 0 var(--lane-w); display: flex; flex-direction: column; min-height: 0; background: var(--lane); border-radius: 12px; }
.lane-head { display: flex; align-items: center; gap: 7px; padding: 10px 8px 6px 12px; font-weight: 600; }
.lane-head .n { color: var(--text-3); font-weight: 500; font-size: 12px; }
.lane-head .grow { flex: 1; }
.lane-head .btn { opacity: .0; }
.lane:hover .lane-head .btn, .lane-head .btn:focus-visible { opacity: 1; }
.cards { flex: 1; overflow-y: auto; padding: 2px 8px 8px; min-height: 40px; scrollbar-width: thin; }
.lane-add { display: flex; align-items: center; gap: 6px; margin: 0 8px 8px; height: 30px; padding: 0 8px; border-radius: 8px; border: 0; background: none; color: var(--text-3); text-align: left; }
.lane-add:hover { background: var(--hover); color: var(--text-2); }
.new-lane { flex: 0 0 200px; display: flex; align-items: flex-start; }

.card { position: relative; margin-bottom: 8px; padding: var(--card-pad); border-radius: var(--radius-card); background: var(--card);
  border: 1px solid var(--card-border); box-shadow: 0 1px 3px #0000000F; display: flex; flex-direction: column; gap: var(--card-gap);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.card:hover { border-color: color-mix(in srgb, var(--card-border) 50%, var(--text-3)); }
.card.on { border: 2px solid var(--accent); padding: calc(var(--card-pad) - 1px); }
.card.done .title { color: var(--text-2); }
.card .meta { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 11.5px; font-weight: 500; }
.card .meta .grow { flex: 1; }
.card .title { font-weight: 500; overflow-wrap: anywhere; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.card.dragging { opacity: .25; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; box-shadow: 0 12px 30px #00000038; transform: rotate(1.5deg) scale(1.02); transition: transform .12s; }
.drop-gap { height: 0; transition: height .12s; }
.drop-gap.show { height: var(--gap-h, 60px); margin-bottom: 8px; border-radius: var(--radius-card); background: color-mix(in srgb, var(--accent) 10%, transparent); outline: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -1.5px; }
.lane.drop-target { background: color-mix(in srgb, var(--accent) 7%, var(--lane)); }
body.dragging, body.dragging * { cursor: grabbing !important; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 5px; background: var(--chip); border: 1px solid var(--chip-border);
  font-size: var(--fs-small); font-weight: 500; color: var(--text-2); white-space: nowrap; max-width: 150px; }
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip .ic { color: var(--text-3); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip.overdue, .chip.overdue .ic { color: var(--red); }
.chip.soon { color: var(--text); }

.kind { width: 16px; height: 16px; border-radius: 4px; display: inline-grid; place-items: center; flex: none; }
.kind .ic { width: 66%; height: 66%; }
.prio { width: 14px; height: 14px; display: inline-flex; align-items: flex-end; justify-content: center; gap: 1.2px; flex: none; }
.prio i { width: 3px; border-radius: 1px; background: var(--text-3); opacity: .35; }
.prio i:nth-child(1) { height: 40%; } .prio i:nth-child(2) { height: 70%; } .prio i:nth-child(3) { height: 100%; }
.prio i.on { opacity: 1; background: var(--pc); }
.prio.urgent { align-items: center; } .prio.urgent b { width: 12px; height: 12px; border-radius: 3px; background: var(--red); color: #fff; font-size: 9.5px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.prio.none { align-items: center; } .prio.none b { width: 8px; height: 1.5px; background: var(--text-3); }
.status { width: 15px; height: 15px; flex: none; display: inline-grid; place-items: center; }
.status .half { width: 13px; height: 13px; border-radius: 50%; border: 1.6px solid var(--orange); background: linear-gradient(90deg, transparent 50%, var(--orange) 50%); }

/* ---------- List ---------- */
.list { padding: 0 10px 24px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px; font-weight: 600; position: sticky; top: 0; background: var(--page-solid); z-index: 1; }
.group-head .n { color: var(--text-3); font-weight: 500; font-size: 12px; }
.trow { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 10px; border-radius: 8px; border: 0; background: none; width: 100%; text-align: left; }
.trow:hover { background: var(--hover); }
.trow.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.trow .ref { color: var(--text-3); font-size: 11.5px; font-weight: 500; width: 64px; flex: none; }
.trow .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.trow .chips { flex-wrap: nowrap; overflow: hidden; }
.trow .proj { color: var(--text-3); font-size: 11.5px; display: flex; align-items: center; gap: 5px; flex: none; max-width: 160px; overflow: hidden; white-space: nowrap; }
.empty { display: grid; place-items: center; text-align: center; color: var(--text-3); padding: 48px 20px; gap: 8px; }
.empty .ic { width: 34px; height: 34px; opacity: .6; }
.empty h3 { margin: 0; color: var(--text-2); font-size: 14px; font-weight: 600; }
.empty p { margin: 0; max-width: 320px; }

/* ---------- Home, Overview, Modules, Labels ---------- */
.home { padding: 30px 32px 40px; max-width: 980px; }
.home h2 { margin: 0; font-size: var(--fs-large); font-weight: 600; letter-spacing: -.01em; }
.home .sub { color: var(--text-2); margin: 4px 0 24px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 26px; }
.tile { padding: 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 4px; text-align: left; }
.tile .num { font-size: 22px; font-weight: 600; }
.tile .what { color: var(--text-2); font-size: 12px; display: flex; align-items: center; gap: 6px; }
button.tile:hover { border-color: color-mix(in srgb, var(--card-border) 40%, var(--text-3)); }
.block { margin-bottom: 26px; }
.block h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.block h3 .n { color: var(--text-3); font-weight: 500; }
.box { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 4px; }
.box .trow { border-radius: 8px; }
.progress { height: 6px; border-radius: 3px; background: var(--lane); overflow: hidden; flex: 1; min-width: 60px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.mod { padding: 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 8px; text-align: left; position: relative; }
.mod .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.mod .d { color: var(--text-2); font-size: 12px; min-height: 17px; }
.mod .p { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 11.5px; }
.mod .menu-btn { position: absolute; top: 8px; right: 8px; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.lrow:hover { background: var(--hover); }
.lrow .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lrow .name { flex: 1; font-weight: 500; }
.lrow .n { color: var(--text-3); font-size: 12px; }

/* ---------- Task panel ---------- */
.panel-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 4px 16px; min-height: 46px; }
.panel-head .ref { color: var(--text-2); font-weight: 500; font-size: 12px; }
.panel-head .grow { flex: 1; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 16px 24px; }
.title-input { width: 100%; border: 0; background: none; outline: none; resize: none; font-size: 17px; font-weight: 600; line-height: 1.35; padding: 4px 0; overflow: hidden; display: block; color: var(--text); }
.props { display: grid; grid-template-columns: 96px 1fr; gap: 2px 8px; margin: 10px 0 14px; align-items: center; }
.props .k { color: var(--text-3); font-size: 12px; }
.prop { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 8px; margin-left: -8px; border-radius: 7px; border: 0; background: none; text-align: left; max-width: 100%; flex-wrap: wrap; }
.prop:hover { background: var(--hover); }
.prop.placeholder { color: var(--text-3); }
.prop input[type=date] { border: 0; background: none; outline: none; padding: 0; min-height: 28px; color: inherit; }
.tabs { display: flex; gap: 2px; border-bottom: .5px solid var(--separator); margin: 0 -16px 12px; padding: 0 12px; }
.tabs button { border: 0; background: none; padding: 8px 8px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -.5px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.notes-view { min-height: 80px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; line-height: 1.55; overflow-wrap: anywhere; }
.notes-view:hover { background: var(--hover); }
.notes-view.placeholder { color: var(--text-3); }
.notes-edit { width: 100%; min-height: 180px; border: 0; outline: none; resize: none; background: var(--hover); border-radius: 8px; padding: 8px; line-height: 1.55; overflow: hidden; }
.save-hint { color: var(--text-3); font-size: 11px; margin-top: 6px; min-height: 16px; }
.history { display: flex; flex-direction: column; }
.change { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 8px 0; border-bottom: .5px solid var(--separator); }
.change:last-child { border-bottom: 0; }
.change .ic { color: var(--text-3); margin-top: 2px; }
.change .what { font-weight: 500; }
.change .vals { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.change .vals s { color: var(--text-3); }
.change .when { color: var(--text-3); font-size: 11px; }

/* Markdown, as notes show when not being edited. */
.md h1, .md h2, .md h3 { margin: .6em 0 .3em; line-height: 1.3; } .md h1 { font-size: 17px; } .md h2 { font-size: 15px; } .md h3 { font-size: 13.5px; }
.md p { margin: .35em 0; } .md ul, .md ol { margin: .35em 0; padding-left: 1.4em; } .md li { margin: .15em 0; }
.md ul.check { list-style: none; padding-left: .2em; } .md ul.check li { display: flex; gap: 7px; align-items: flex-start; }
.md ul.check input { margin: 3px 0 0; accent-color: var(--accent); }
.md li.checked > span { color: var(--text-3); text-decoration: line-through; }
.md blockquote { margin: .4em 0; padding: 2px 10px; border-left: 3px solid var(--separator); color: var(--text-2); }
.md code { background: var(--lane); border-radius: 4px; padding: 1px 4px; font-size: .95em; }
.md pre { background: var(--lane); border-radius: 8px; padding: 10px 12px; overflow-x: auto; position: relative; }
.md pre code { background: none; padding: 0; }
.md pre .lang { position: absolute; top: 4px; right: 8px; font-size: 10px; color: var(--text-3); }
.md hr { border: 0; border-top: .5px solid var(--separator); margin: 10px 0; }
.md > :first-child { margin-top: 0; }

/* ---------- Menus, sheets, palette ---------- */
#menu .menu { position: fixed; z-index: 900; min-width: 200px; max-width: 320px; max-height: min(70vh, 460px); overflow-y: auto; padding: 5px; border-radius: 10px; background: var(--popup); box-shadow: var(--shadow-pop); animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
.mi { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: none; text-align: left; color: var(--text); }
.mi:hover, .mi.hl { background: var(--accent); color: #fff; }
.mi:hover .ic, .mi.hl .ic, .mi:hover .sub, .mi.hl .sub { color: #fff; }
.mi .ic { color: var(--text-2); }
.mi .sub { margin-left: auto; color: var(--text-3); font-size: 11px; padding-left: 12px; }
.mi .check { margin-left: auto; }
.mi.danger { color: var(--red); } .mi.danger .ic { color: var(--red); }
.mi.danger:hover { background: var(--red); color: #fff; }
.mi .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msep { height: .5px; background: var(--separator); margin: 4px 6px; }
.mhead { padding: 6px 10px 3px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.menu-backdrop { position: fixed; inset: 0; z-index: 899; }

#overlay .scrim { position: fixed; inset: 0; z-index: 800; background: var(--scrim); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; background: var(--popup); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop .15s ease-out; }
.sheet.wide { max-width: 760px; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; }
.sheet-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.sheet-body { padding: 8px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px calc(14px + var(--bottom)); border-top: .5px solid var(--separator); }
.sheet-foot .grow { flex: 1; }
.sheet-foot .hint { color: var(--text-3); font-size: 11px; }
.formrow { display: flex; flex-direction: column; gap: 5px; }
.formrow > label, .formlabel { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.formline { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.formline > .k { flex: 1; }
.chiprow { display: flex; gap: 6px; flex-wrap: wrap; }
.big-title { font-size: 17px; font-weight: 600; border: 0; background: none; outline: none; width: 100%; padding: 4px 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 1px #0000001A; }
.swatch.on { outline: 2px solid var(--text); outline-offset: 2px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; max-height: 190px; overflow-y: auto; padding: 2px; }
.icon-grid button { height: 34px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; color: var(--text-2); font-size: 17px; }
.icon-grid button:hover { background: var(--hover); }
.icon-grid button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.settings-group { background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; padding: 2px 12px; }
.settings-group .formline { border-bottom: .5px solid var(--separator); padding: 6px 0; }
.settings-group .formline:last-child { border-bottom: 0; }
.settings-title { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin: 6px 2px -6px; }

.palette { max-width: 620px; }
.palette .search-line { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: .5px solid var(--separator); }
.palette .search-line input { flex: 1; border: 0; outline: none; background: none; font-size: 15px; min-width: 0; }
.palette .results { overflow-y: auto; padding: 6px; max-height: 60vh; }
.palette .mi { min-height: 36px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + var(--bottom)); transform: translate(-50%, 20px); z-index: 1100; padding: 9px 16px; border-radius: 999px; background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--window);
  font-weight: 500; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); color: #fff; }

.login { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; padding: 20px; }
.login form { width: 100%; max-width: 340px; background: var(--page); border-radius: 16px; padding: 26px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login h1 { margin: 6px 0 0; font-size: 18px; }
.login p { margin: 0 0 6px; color: var(--text-2); font-size: 12px; }
.login img { width: 56px; height: 56px; margin: 0 auto; }
.offline { position: fixed; top: calc(8px + var(--top)); left: 50%; transform: translateX(-50%); z-index: 1000; padding: 5px 12px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 600; }

/* ---------- Narrow windows and tablets: the sidebar slides over the page ---------- */
@media (max-width: 1100px) {
  #app.panel-open #panel { position: fixed; top: 0; right: 0; bottom: 0; margin: 0; border-radius: 0; background: var(--page-solid); z-index: 20; box-shadow: -10px 0 30px #00000026; width: min(var(--panel-w), 100vw); }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  :root { --fs: 14px; --fs-small: 11.5px; --lane-w: calc(100vw - 36px); --frame: 0px; }
  #app, #app.no-sidebar { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #topbar { display: flex; grid-row: 1; grid-column: 1; align-items: center; gap: 4px; padding: calc(var(--top) + 6px) calc(8px + var(--right)) 8px calc(8px + var(--left)); color: var(--side-text); }
  #topbar .title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; font-weight: 600; font-size: 16px; padding: 6px; border-radius: 8px; color: inherit; }
  #topbar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #topbar .btn { width: 38px; height: 38px; color: inherit; }
  #topbar .btn .ic { width: 19px; height: 19px; }
  #page, #app.no-sidebar #page { grid-row: 2; grid-column: 1; margin: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -0.5px 0 var(--card-border); }
  html.no-frame #page { border-radius: 16px 16px 0 0; }
  #sidebar, #app.no-sidebar #sidebar { visibility: visible; position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); z-index: 30; transform: translateX(-105%);
    transition: transform .28s cubic-bezier(.3,.8,.3,1); background: var(--backdrop); padding-left: var(--left); box-shadow: 0 0 40px #00000040; }
  #sidebar::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 50%, var(--c3) 100%); opacity: var(--strength); pointer-events: none; z-index: -1; }
  #app.drawer #sidebar { transform: none; }
  #scrim { display: block; position: fixed; inset: 0; z-index: 25; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s; }
  #app.drawer #scrim { opacity: 1; pointer-events: auto; }
  .row { height: 40px; font-size: 14.5px; }
  .section-title { height: 30px; font-size: 12px; }
  .section-title .add { opacity: 1; }
  .side-search { height: 38px; }
  .sdot { width: 34px; height: 34px; }

  .page-head { padding: 12px 14px 8px; min-height: 0; }
  .page-head h1 { font-size: 18px; }
  .page-head .desktop-only { display: none; }
  .chipbar { padding: 0 14px 8px; }
  .lane-tabs { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
  .lane-tabs::-webkit-scrollbar { display: none; }
  .lane-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: .5px solid var(--chip-border); background: var(--chip); color: var(--text-2); font-weight: 500; }
  .lane-tabs button.on { background: var(--text); color: var(--page-solid); border-color: transparent; }
  .lane-tabs button.on .status { color: inherit !important; }
  .lane-tabs .n { opacity: .65; font-size: 12px; }
  .board { gap: 10px; padding: 0 18px calc(84px + var(--bottom)); scroll-snap-type: x mandatory; scroll-padding: 0 18px; overscroll-behavior-x: contain; }
  .board.free { scroll-snap-type: none; }
  .lane { scroll-snap-align: center; scroll-snap-stop: always; }
  .lane-head .btn { opacity: 1; }
  .new-lane { flex-basis: 70vw; scroll-snap-align: center; }
  .cards { padding-bottom: 12px; }
  .card { padding: calc(var(--card-pad) + 2px); }
  .card.on { padding: calc(var(--card-pad) + 1px); }
  .list { padding-bottom: calc(90px + var(--bottom)); }
  .trow { min-height: 48px; flex-wrap: wrap; row-gap: 2px; }
  .trow .ref { width: auto; }
  .trow .title { flex-basis: calc(100% - 120px); }
  .trow .proj { max-width: 40vw; }
  .home { padding: 18px 16px calc(90px + var(--bottom)); }
  .home h2 { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .mods { grid-template-columns: 1fr; }
  .fab { position: fixed; right: calc(18px + var(--right)); bottom: calc(18px + var(--bottom)); z-index: 15; width: 56px; height: 56px; border-radius: 50%; border: 0;
    background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px #00000026; }
  .fab .ic { width: 24px; height: 24px; }
  .fab:active { transform: scale(.95); }

  /* The task panel is a full-screen sheet. */
  #panel, #app.panel-open #panel { position: fixed; inset: 0; width: auto; margin: 0; border-radius: 0; z-index: 40; background: var(--page-solid); transform: translateY(102%);
    transition: transform .3s cubic-bezier(.3,.8,.3,1); box-shadow: none; padding-top: var(--top); display: flex; }
  #app.panel-open #panel { transform: none; }
  .panel-head { padding: 8px 8px 4px 16px; }
  .panel-head .btn { width: 36px; height: 36px; }
  .panel-body { padding-bottom: calc(40px + var(--bottom)); }
  .title-input { font-size: 20px; }
  .props { grid-template-columns: 92px 1fr; }
  .prop { min-height: 40px; }
  .notes-edit, .field, .big-title, .palette .search-line input, .title-input, input, textarea { font-size: 16px; }

  /* Sheets come up from the bottom. */
  #overlay .scrim { align-items: flex-end; padding: 0; }
  .sheet, .sheet.wide { max-width: none; max-height: calc(100dvh - var(--top) - 12px); border-radius: 16px 16px 0 0; animation: rise .25s cubic-bezier(.3,.8,.3,1); }
  .palette.sheet { height: calc(100dvh - var(--top) - 12px); }
  .palette .results { max-height: none; flex: 1; }
  @keyframes rise { from { transform: translateY(40%); opacity: .4; } }
  #menu .menu.sheetlike { left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + var(--bottom)) !important; max-width: none; max-height: 70vh; border-radius: 14px; padding: 6px; animation: rise .2s ease-out; }
  .menu-backdrop.dim { background: var(--scrim); }
  .mi { min-height: 44px; font-size: 15px; }
  .desktop-only { display: none !important; }
}
@media (min-width: 761px) { .phone-only, .lane-tabs, .fab { display: none !important; } }
@media (hover: none) { .lane-head .btn, .section-title .add { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Sign-in and security */
.login .linkish, .linkish { background: none; border: 0; padding: 2px; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }
.login .code[hidden] { display: none; }
.settings-group .acc-form { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
.acc-buttons { display: flex; gap: 6px; justify-content: flex-end; }
.qr { align-self: center; width: 180px; height: 180px; background: #fff; border-radius: 10px; padding: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }
.hint { color: var(--text-3); font-size: 11.5px; font-weight: 400; }
.settings-group .formline .k .ic { vertical-align: -2px; }

/* Share links */
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.check input { accent-color: var(--accent); margin: 0; }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }

/* Templates */
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
