/* Figtree (SIL Open Font License, fonts/LICENSE-Figtree.txt), served from this server */
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/figtree-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/figtree-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/figtree-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/figtree-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/figtree-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/figtree-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/figtree-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/figtree-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* =========================================================
   Simple, flat interface
   - Solid panels with a soft shadow and 12 px corners
   - Grouped buttons separated by thin dividers (zoom bar)
   - No blur, transparency or highlight effects; quick, plain fades
   ========================================================= */
:root {
  --board: #EEF1F5;
  --connector: #8A94A3;
  --dot: rgba(60, 75, 95, .32);
  --dot-major: rgba(60, 75, 95, .20);
  --ink: #1C2530;
  --muted: #5B6775;
  --sel: #0A84FF;
  --shadow: rgba(20, 30, 45, .14);

  --panel: #FFFFFF;                     /* bars, menus, cards */
  --surface-2: #EEF1F5;                 /* selected / pressed fill inside a panel */
  --line: #E6E9EE;                      /* dividers */
  --panel-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  --press: rgba(28, 37, 48, .06);

  --f-white: #FFFFFF;
  --f-yellow: #FFE58F;
  --f-blue: #CFE3FF;
  --f-green: #CDEFD7;
  --f-pink: #FFD4DE;
  --f-grey: #E3E7EB;
  --f-orange: #FFDDBF;
  --f-purple: #E6DAFB;
  /* line colours (borders, text): the fill colours in a darker shade */
  --s-yellow: #D4A72C;
  --s-orange: #E07F3E;
  --s-purple: #9572D6;
  --s-blue: #5089E6;
  --s-green: #42A872;
  --s-pink: #DB6A93;
  --s-grey: #8A939F;

  --pad: 6px;          /* container padding */
  --btn: 40px;         /* control size */
  --spring: cubic-bezier(.2, .7, .2, 1);   /* plain ease-out, no overshoot */
  --font: "Figtree", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Dark theme: the app's own choice (data-wb-theme on <html>, set from the account menu).
   Until the user has picked one, the system look is used. A theme attribute set by a host page is ignored. */
@media (prefers-color-scheme: dark) {
  :root:not([data-wb-theme]) {
    --board: #10161D;
    --connector: #A6ADBA;
    --dot: rgba(140, 158, 182, .22);
    --dot-major: rgba(140, 158, 182, .16);
    --ink: #ECEEF2;
    --muted: #9CA3AF;
    --sel: #0A84FF;
    --shadow: rgba(0, 0, 0, .5);

    --panel: #1D232A;
    --surface-2: #2A3139;
    --line: #2E353D;
    --panel-shadow: 0 0 0 1px #2B3239, 0 2px 8px rgba(0, 0, 0, .35);
    --press: rgba(255, 255, 255, .08);

    --f-white: #2A2E34;
    --f-yellow: #614900;
    --f-blue: #10427B;
    --f-green: #0C532F;
    --f-pink: #712643;
    --f-grey: #34383E;
    --f-orange: #733301;
    --f-purple: #4D2F77;
    /* on dark fills a darker line would vanish: same hues, brighter and stronger */
    --s-yellow: #F0C543;
    --s-orange: #FA934E;
    --s-purple: #B995F6;
    --s-blue: #65A7FA;
    --s-green: #52CD86;
    --s-pink: #F889AD;
    --s-grey: #9DA5B1;
    color-scheme: dark;
  }
}
:root[data-wb-theme="dark"] {
  --board: #10161D;
  --connector: #A6ADBA;
  --dot: rgba(140, 158, 182, .22);
  --dot-major: rgba(140, 158, 182, .16);
  --ink: #ECEEF2;
  --muted: #9CA3AF;
  --sel: #0A84FF;
  --shadow: rgba(0, 0, 0, .5);

  --panel: #1D232A;
  --surface-2: #2A3139;
  --line: #2E353D;
  --panel-shadow: 0 0 0 1px #2B3239, 0 2px 8px rgba(0, 0, 0, .35);
  --press: rgba(255, 255, 255, .08);

  --f-white: #2A2E34;
  --f-yellow: #614900;
  --f-blue: #10427B;
  --f-green: #0C532F;
  --f-pink: #712643;
  --f-grey: #34383E;
  --f-orange: #733301;
  --f-purple: #4D2F77;
  /* on dark fills a darker line would vanish: same hues, brighter and stronger */
  --s-yellow: #F0C543;
  --s-orange: #FA934E;
  --s-purple: #B995F6;
  --s-blue: #65A7FA;
  --s-green: #52CD86;
  --s-pink: #F889AD;
  --s-grey: #9DA5B1;
  color-scheme: dark;
}
:root[data-wb-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--board); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }

body.board { height: 100vh; overflow: hidden;
  /* the board's dot grid; the app moves it with the view (--gx/--gy/--gs) */
  background-image: radial-gradient(circle, var(--dot) .8px, transparent 1.2px);
  background-size: var(--gs, 14px) var(--gs, 14px);
  background-position: var(--gx, -7px) var(--gy, -7px); }
#board { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#board[data-cursor="crosshair"] { cursor: crosshair; }
#board[data-cursor="grab"] { cursor: grab; }
#board[data-cursor="grabbing"] { cursor: grabbing; }
#board[data-cursor="ew"] { cursor: ew-resize; }
#board[data-cursor="nwse"] { cursor: nwse-resize; }
#board[data-cursor="nesw"] { cursor: nesw-resize; }
#board[data-cursor="ns"] { cursor: ns-resize; }

/* ---------- Panels ---------- */
.bar, .tools, .toast, .pop, .card, .sidebar {
  position: fixed; z-index: 10;
  background: var(--panel);
  box-shadow: var(--panel-shadow);
}

/* ---------- Layout ---------- */
.bar { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 12px; }

.top-left { top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px; padding-left: 10px; }
.top-right { top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }

.mark { width: 24px; height: 24px; border-radius: 7px; flex: none; position: relative; background: var(--ink); }
.mark::after { content: ""; position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px; border-radius: 4px; background: #FFD24D; border: 2px solid var(--panel); }

#title { border: 0; background: transparent; color: var(--ink); font: 600 15px var(--font); width: 220px; height: var(--btn); padding: 0 12px; border-radius: 8px; transition: background .2s; }
#title:hover { background: var(--press); }
#title::placeholder { color: var(--muted); }

.status { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 10px; white-space: nowrap; }
.status.has-help { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; border-radius: 8px; }
.status.has-help:hover { color: var(--ink); background: var(--press); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-s="live"]::before { background: #22A06B; }
.status[data-s="local"]::before { background: #E2A300; }
.status[data-s="offline"]::before { background: #E5484D; }

.people { display: flex; padding: 0 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 600 12px var(--font); margin-left: -8px;
  box-shadow: 0 0 0 2px var(--panel); }
.avatar:first-child { margin-left: 0; }

/* ---------- Controls ---------- */
.btn, .tools button, .ctx button, .zoom button {
  appearance: none; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  height: var(--btn); border-radius: 8px;
  transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.tools button, .ctx button, .zoom button { width: var(--btn); display: grid; place-items: center; padding: 0; }
.btn { font: 600 14px var(--font); padding: 0 16px; white-space: nowrap; }
:is(.btn, .tools button, .ctx button, .zoom button):hover { background: var(--press); }
:is(.btn, .tools button, .ctx button, .zoom button):active { background: var(--surface-2); }

/* Primary action: flat accent */
.btn.primary { color: #fff; background: var(--sel); }
.btn.primary:hover { background: color-mix(in srgb, var(--sel) 88%, #000); }
.btn.primary:active { background: color-mix(in srgb, var(--sel) 80%, #000); }

/* Selected tool */
.tools button[aria-pressed="true"] { background: var(--surface-2); color: var(--sel); }
.tools svg, .ctx svg, .zoom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.tools { left: calc(14px + var(--sb)); transition: left .2s ease-out; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 12px; }
.sep { display: block; height: 1px; margin: 3px 6px; background: var(--line); }
.sep.v { width: 1px; height: 24px; margin: 0 4px; background: var(--line); }

button:focus-visible, input:focus-visible { outline: 2px solid var(--sel); outline-offset: 2px; }

/* Context bar morphs in from the selection */
.ctx { top: calc(72px + env(safe-area-inset-top, 0px)); left: calc(50% + var(--sb) / 2); transform: translateX(-50%); --btn: 36px; }
.ctx:not([hidden]) { animation: glass-in .14s ease-out; }
.ctx .group { display: flex; align-items: center; gap: 2px; }
.ctx button[aria-pressed="true"]:not([data-fill]) { background: var(--surface-2); color: var(--sel); }
.swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 16%, transparent); }
.swatch.auto { background: linear-gradient(135deg, var(--s-yellow) 0 33%, var(--s-blue) 33% 66%, var(--s-green) 66%); }
.swatch.none { background: linear-gradient(135deg, transparent 44%, #FF453A 44% 56%, transparent 56%), var(--panel); }
.ctx button[aria-pressed="true"] .swatch { outline: 2px solid var(--sel); outline-offset: 2px; }

.zoom { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); gap: 0; padding: 0; overflow: hidden; --btn: 44px; }
.zoom button { border-radius: 0; }
.zoom button + button, .history button + button { border-left: 1px solid var(--line); }
.history { left: calc(14px + var(--sb)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); gap: 0; padding: 0; overflow: hidden; --btn: 44px; transition: left .2s ease-out; view-transition-name: history; }
.history button { appearance: none; border: 0; background: transparent; color: var(--ink); width: var(--btn); height: var(--btn); border-radius: 0; display: grid; place-items: center; cursor: pointer; padding: 0; }
.history button:hover:not(:disabled) { background: var(--press); }
.history button:disabled { color: var(--muted); opacity: .45; cursor: default; }
.history svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#zoomPct { width: auto; min-width: 74px; padding: 0 10px; font: 600 15px var(--font); font-variant-numeric: tabular-nums; }

#editor {
  position: fixed; z-index: 5; margin: 0; padding: 0; border: 0; outline: none; resize: none; overflow: hidden;
  background: transparent; color: var(--ink); font-family: var(--font); font-weight: 500; caret-color: var(--sel); white-space: pre-wrap;
}

.toast { left: calc(50% + var(--sb) / 2); bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 6px);
  color: var(--ink); font: 500 14px var(--font); padding: 10px 16px; border-radius: 10px; max-width: calc(100vw - 32px);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes glass-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Phones: the tool bar becomes a floating bottom capsule ---------- */
@media (max-width: 720px) {
  #title { width: 130px; }
  #export { display: none; }
  .status { font-size: 0; gap: 0; padding: 0 8px; }
  .tools { top: auto; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); flex-direction: row; }
  .tools .sep { width: 1px; height: 22px; margin: auto 3px; }
  .top-right { top: calc(68px + env(safe-area-inset-top, 0px)); }
  .ctx { top: calc(130px + env(safe-area-inset-top, 0px)); }
  .zoom { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .history { left: 14px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Accessibility ---------- */
@media (prefers-contrast: more) {
  :is(.bar, .tools, .toast, .pop, .card, .sidebar) { outline: 1px solid var(--ink); box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}

/* =========================================================
   Popovers, forms, access gate
   ========================================================= */
.pop { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 12px; width: min(340px, calc(100vw - 28px)); }
#sharePop { top: calc(80px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 15; }
#sharePop:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: top right; }
.pop h1, .pop h2 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
.pop h2 { font-size: 17px; }
.note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.error { margin: 0; color: #FF453A; font-size: 14px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select {
  font: 500 15px var(--font); color: var(--ink); height: 42px; padding: 0 12px; border-radius: 8px; border: 0; width: 100%;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s;
}
.field select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--sel); }
.btn.wide { width: 100%; height: 42px; border-radius: 8px; display: inline-grid; place-items: center; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: progress; }
.link { appearance: none; border: 0; background: none; padding: 0; font: 600 14px var(--font); color: var(--sel); cursor: pointer; }
.link:hover { text-decoration: underline; }
a.mark { display: block; }

.gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; }
.card-static { position: relative; inset: auto; animation: pop-in .14s ease-out; }
body.gated :is(.bar, .tools, #ctx, #sharePop) { display: none !important; }

@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* =========================================================
   Board list (index.html)
   ========================================================= */
body.dash {
  min-height: 100vh;
  background-color: var(--board);   /* plain on "Your boards" and the legal pages */
}
/* dots only behind the sign-in card */
body.dash:has(> #authView:not([hidden])) {
  background-image: radial-gradient(circle, var(--dot) .8px, transparent 1.2px);
  background-size: 14px 14px;
  background-position: 0 0;
  background-attachment: fixed;
}
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); padding: 28px; gap: 16px; }
.auth-card h1 { font-size: 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.mark.lg { width: 36px; height: 36px; border-radius: 11px; }
.mark.lg::after { width: 17px; height: 17px; border-radius: 5px; right: -5px; bottom: -5px; }
.switch { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }

.dash-head { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 0; pointer-events: none; }
.dash-head .bar { position: relative; pointer-events: auto; }
.brand { padding: 6px 16px 6px 10px; gap: 10px; height: 52px; }
.brand strong { font-size: 15px; }
.who { font-size: 14px; font-weight: 600; padding: 0 6px 0 12px; }

.dash-main { max-width: 1120px; margin: 0 auto; padding: 36px 24px calc(48px + env(safe-area-inset-bottom, 0px)); }
.dash-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.dash-title h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.dash-title .btn { height: 44px; padding: 0 20px; }
.empty { color: var(--muted); font-size: 15px; margin: 40px 0; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
/* board tile: the miniature runs edge to edge at the top, the name and details below it */
.card { position: relative; inset: auto; z-index: auto; border-radius: 16px; overflow: hidden; transition: box-shadow .15s, transform .15s;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent), 0 1px 3px rgba(16, 24, 40, .06); }
.card:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent), 0 6px 18px rgba(16, 24, 40, .10); }
.card-link { display: flex; flex-direction: column; gap: 6px; padding: 0 0 18px; color: inherit; text-decoration: none; border-radius: inherit; }
.card-link:focus-visible { outline: 2px solid var(--sel); outline-offset: 3px; }
.thumb { display: block; height: 136px; border-radius: 16px 16px 12px 12px; margin-bottom: 12px;
  background-color: color-mix(in srgb, var(--board) 70%, transparent);
  background-image: radial-gradient(circle, var(--dot) .7px, transparent 1.1px);
  background-size: 10px 10px; background-position: 0 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 9%, transparent); }
/* the board's own miniature (thumb.php), in the theme the list is shown in */
.thumb { position: relative; overflow: hidden; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.thumb .thumb-dark { display: none; }
:root[data-wb-theme="dark"] .thumb .thumb-light { display: none; }
:root[data-wb-theme="dark"] .thumb .thumb-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-wb-theme="light"]) .thumb .thumb-light { display: none; }
  :root:not([data-wb-theme="light"]) .thumb .thumb-dark { display: block; }
}
.card-title { font-size: 16px; font-weight: 600; padding: 0 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 16px; font-size: 13px; color: var(--muted); }
.ago { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 7%, transparent); white-space: nowrap; }
.badge[data-s="view"], .badge[data-s="edit"] { color: var(--sel); background: color-mix(in srgb, var(--sel) 14%, transparent); }
.card-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.icon { appearance: none; border: 0; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: var(--panel); box-shadow: var(--panel-shadow); }
.icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: none) { .card-actions { opacity: 1; } }
@media (max-width: 720px) {
  .dash-title h1 { font-size: 24px; }
  .dash-main { padding: 24px 14px 40px; }
}

/* Drop images onto the board */
.drop-hint { position: fixed; inset: 10px; z-index: 25; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--sel); border-radius: 12px; background: color-mix(in srgb, var(--sel) 8%, transparent); }
.drop-hint .pop { align-items: center; text-align: center; gap: 4px; width: auto; padding: 16px 24px; }
.drop-hint strong { font-size: 16px; }

/* Round icon button inside a bar (theme switch) */
.btn.round { width: var(--btn); padding: 0; display: grid; place-items: center; }
.btn.round svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Style panel */
.style-pop { gap: 12px; padding: 14px; width: 288px; z-index: 16; }
.style-pop:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: top center; }
.style-row { display: flex; flex-direction: column; gap: 6px; }
.style-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.seg { display: flex; gap: 0; padding: 0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--ink); height: 34px; border-radius: 0; cursor: pointer; font: 500 13px var(--font); display: grid; place-items: center; transition: background .15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--press); }
.seg button[aria-checked="true"] { background: var(--surface-2); color: var(--sel); }
.seg svg { width: 40px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches button { appearance: none; border: 0; background: transparent; padding: 3px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.swatches .swatch { width: 22px; height: 22px; }
.swatches button[aria-checked="true"] .swatch { outline: 2px solid var(--sel); outline-offset: 2px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { appearance: none; border: 0; width: 36px; height: 34px; border-radius: 8px; cursor: pointer; color: var(--ink); font: 600 16px var(--font); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.stepper button:hover { background: var(--press); }
.stepper output { min-width: 48px; text-align: center; font: 600 14px var(--font); font-variant-numeric: tabular-nums; }

/* Right-click menu */
.menu { gap: 0; padding: 4px; width: 236px; border-radius: 10px; z-index: 40; }
.menu:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: top left; }
.menu-item { appearance: none; border: 0; background: transparent; color: var(--ink); width: 100%; height: 32px; padding: 0 10px; border-radius: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 500 14px var(--font); cursor: pointer; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item kbd { font: 500 12px var(--font); color: var(--muted); }
.menu-item.danger { color: #FF453A; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* Theme change: cross-fade the whole screen (View Transitions), or fade colours where unsupported */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .45s; animation-timing-function: ease-in-out; }
.theme-fading, .theme-fading *, .theme-fading *::before {
  transition: background-color .45s ease-in-out, color .45s ease-in-out, border-color .45s ease-in-out,
              box-shadow .45s ease-in-out, fill .45s ease-in-out, stroke .45s ease-in-out !important;
}
.theme-ghost { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity .45s ease-in-out; }

/* =========================================================
   Sidebar: workspace, Recent, Favourites, Private tree
   ========================================================= */
:root { --sb: 0px; --sb-w: 304px; }
:root.sb-open { --sb: var(--sb-w); }
.sidebar {
  top: 0; bottom: 0; left: 0; width: var(--sb-w); z-index: 14;
  display: flex; flex-direction: column; border-radius: 0; padding: calc(10px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: 1px 0 0 var(--line);
  transform: translateX(-100%); visibility: hidden;
  transition: transform .2s ease-out, visibility 0s .2s;
}
.sb-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease-out, visibility 0s; }
.sb-scrim { position: fixed; inset: 0; z-index: 13; background: rgba(0, 0, 0, .3); }
.sb-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 10px 4px; }
.sb-hide { appearance: none; border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; cursor: pointer; }
.sb-hide:hover { background: var(--press); color: var(--ink); }
.sb-hide svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-ws { appearance: none; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; height: 36px; padding: 0 4px; border-radius: 8px; font: 600 14px var(--font); }
.sb-ws:hover { background: var(--press); }
.sb-ws-caret { display: grid; place-items: center; color: var(--muted); flex: none; }
.sb-ws-caret svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font: 700 12px var(--font); background: #7C3AED; }
.sb-new { appearance: none; border: 0; width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: var(--surface-2); }
.sb-new:hover { background: color-mix(in srgb, var(--ink) 12%, var(--surface-2)); }
.sb-new svg, .sb-link svg, .sb-sec-head svg:not(.sb-twisty svg) { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 2px 8px; scrollbar-width: thin; }
.sb-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font: 500 14px var(--font); }
.sb-link:hover { background: var(--press); }
.sb-section { margin-top: 10px; }
.sb-sec-head { appearance: none; border: 0; background: transparent; width: 100%; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font: 700 11.5px var(--font); letter-spacing: .09em; text-transform: uppercase; }
.sb-sec-head:hover { background: var(--press); color: var(--ink); }
.sb-sec-head .sb-twisty svg { transition: transform .15s ease-out; }
.sb-sec-head[aria-expanded="true"] .sb-twisty svg { transform: rotate(90deg); }
.sb-sec-head > span:last-child { display: flex; align-items: center; gap: 8px; }
.sb-tree { list-style: none; margin: 2px 0 0; padding: 0; }
.sb-tree li { position: relative; }
.sb-row { appearance: none; border: 0; background: transparent; width: 100%; height: 32px; display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 0 34px 0 calc(6px + var(--depth) * 16px); border-radius: 6px; color: var(--ink); text-decoration: none; font: 500 14px var(--font); text-align: left; }
.sb-row:hover { background: var(--press); }
.sb-row:focus-visible { outline: 2px solid var(--sel); outline-offset: -2px; }
.sb-row.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.sb-row.flash { animation: sb-flash .9s ease; }
@keyframes sb-flash { 30% { background: color-mix(in srgb, var(--sel) 26%, transparent); } }
.sb-twisty { width: 16px; height: 16px; flex: none; display: grid; place-items: center; color: var(--muted); }
.sb-twisty svg { width: 10px; height: 10px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; transition: transform .15s ease-out; }
.sb-twisty.none svg { display: none; }
.sb-twisty.dim { opacity: .35; }
li[aria-expanded="true"] > .sb-row .sb-twisty svg { transform: rotate(90deg); }
.sb-icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.sb-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sb-icon.folder { color: var(--muted); }
.sb-icon.board, .crumb-icon.board { color: #8E4EC6; }
:root[data-wb-theme="dark"] .sb-icon.board, :root[data-wb-theme="dark"] .crumb-icon.board { color: #B794F6; }
@media (prefers-color-scheme: dark) { :root:not([data-wb-theme]) .sb-icon.board, :root:not([data-wb-theme]) .crumb-icon.board { color: #B794F6; } }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-row.renaming .sb-label { visibility: hidden; }
.sb-rename { position: absolute; top: 3px; right: 6px; min-width: 0; height: 26px; border: 0; border-radius: 7px; padding: 0 6px; font: 500 14px var(--font); color: var(--ink);
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--sel); outline: none; }
.sb-more { position: absolute; right: 4px; top: 4px; width: 26px; height: 24px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.sb-more svg { width: 18px; height: 18px; }
.sb-tree li:hover > .sb-more, .sb-row:focus-visible + .sb-more, .sb-more:focus-visible { opacity: 1; }
.sb-more:hover { background: var(--press); color: var(--ink); }
.sb-hint { font-size: 13px; color: var(--muted); padding: 6px 12px 4px 30px; }
li.dragging > .sb-row { opacity: .4; }
.drop-into { background: color-mix(in srgb, var(--sel) 18%, transparent) !important; box-shadow: inset 0 0 0 2px var(--sel); }
.menu-item.indent { padding-left: calc(10px + var(--depth) * 14px); }
.menu-item:disabled { opacity: .45; cursor: default; }
@media (hover: none) { .sb-more { opacity: 1; } }

/* =========================================================
   Board header:  [≡]  🔒 Private / Folder / ▦ Board name  ⌄  ☆
   ========================================================= */
.crumbs { top: calc(14px + env(safe-area-inset-top, 0px)); left: calc(14px + var(--sb)); transition: left .2s ease-out;
  max-width: calc(100vw - var(--sb) - 330px); padding-right: 8px; }
.crumb-path { display: flex; align-items: center; min-width: 0; overflow: hidden; }
.crumb { appearance: none; border: 0; background: transparent; color: var(--muted); height: 34px; padding: 0 8px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; gap: 7px; font: 500 14px var(--font); min-width: 0; flex-shrink: 1; white-space: nowrap; }
.crumb:hover { background: var(--press); color: var(--ink); }
.crumb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.crumb-icon { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.crumb-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.crumb-sep { color: color-mix(in srgb, var(--muted) 60%, transparent); font-size: 18px; padding: 0 1px; user-select: none; }
.crumb-board { display: flex; align-items: center; gap: 6px; padding-left: 4px; flex: none; }
.crumb-path:not(:empty) + .crumb-board::before { content: "/"; color: color-mix(in srgb, var(--muted) 60%, transparent); font-size: 18px; margin-right: 4px; }
.crumbs #title { width: 160px; padding: 0 6px; height: 34px; }
.btn.round.small { --btn: 32px; }
#favBtn[aria-pressed="true"] { color: #F5B700; }
#favBtn[aria-pressed="true"] svg { fill: currentColor; }
@media (max-width: 900px) {
  :root.sb-open { --sb: 0px; }
  .crumbs { max-width: calc(100vw - 28px); }
  .crumb-path .crumb:not(:first-child), .crumb-path .crumb-sep { display: none; }
}
@media (max-width: 720px) { .crumb-path { display: none; } .crumb-board::before { display: none; } }

/* Board list next to the sidebar */
body.dash .dash-head { padding-left: calc(14px + var(--sb)); transition: padding-left .2s ease-out; }
body.dash .dash-main { padding-left: calc(24px + var(--sb)); transition: padding-left .2s ease-out; max-width: calc(1120px + var(--sb)); margin-left: 0; }
@media (min-width: 1500px) { body.dash .dash-main { margin: 0 auto; } }
.brand { padding-left: 6px; gap: 6px; }
.dash-actions { display: flex; gap: 8px; }
.dash-actions .btn { height: 44px; padding: 0 18px; }

/* In-app dialogs (confirm / rename) */
.dlg-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(15, 20, 28, .38); animation: dlg-fade .12s ease-out; }
.dlg { position: relative; inset: auto; width: min(400px, 100%); gap: 12px; padding: 20px; animation: pop-in .14s ease-out; }
.dlg h2 { font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.dlg-input { font: 500 15px var(--font); color: var(--ink); height: 42px; padding: 0 12px; border-radius: 8px; border: 0; width: 100%; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.dlg-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--sel); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-actions .btn { height: 38px; padding: 0 16px; }
.btn.danger { color: #fff; background: #E5484D; }
.btn.danger:hover { background: #D13B40; }
@keyframes dlg-fade { from { opacity: 0; } }

.brand:has(#sbToggle[hidden]) { padding-left: 14px; }

/* =========================================================
   Smooth page changes (switching boards from the sidebar)
   ========================================================= */
/* while the page starts: no slide-ins or fades from the initial state */
.booting *, .booting *::before, .booting *::after { transition: none !important; animation: none !important; }
/* signed in last time: the sidebar is there from the first paint (filled from memory) */
.has-account .sidebar[hidden] { display: flex !important; }
.has-account:not(.sb-open) #sbToggle[hidden] { display: grid !important; }
/* the board appears once it's fitted to its content */
#board { opacity: 0; transition: opacity .16s ease-out; }
#board.ready { opacity: 1; }
#board.leaving { opacity: 0; transition: opacity .12s ease-out; }
#board.leaving.now { transition: none; }
/* page to page: a quick cross-fade; the sidebar, header and bars stay put */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: sidebar; }
.crumbs { view-transition-name: crumbs; }
.tools { view-transition-name: tools; }
.top-right { view-transition-name: top-right; }
.zoom { view-transition-name: zoom; }
::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .16s; }
/* a theme change keeps its slower, softer fade */
html.vt-theme::view-transition-group(*), html.vt-theme::view-transition-old(*), html.vt-theme::view-transition-new(*) { animation-duration: .45s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  #board { transition: none; }
}

/* =========================================================
   Plans & admin
   ========================================================= */
.plan-chip { appearance: none; border: 0; cursor: pointer; vertical-align: middle; margin-left: 10px; font: 600 13px var(--font); color: var(--muted);
  background: var(--surface-2); padding: 5px 10px; border-radius: 999px; }
.plan-chip:hover { color: var(--ink); }
.plan-chip.full { color: #B4232A; background: color-mix(in srgb, #E5484D 14%, transparent); }
.plans-dlg { width: min(560px, 100%); }
.usage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.usage > div { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.usage strong { font-size: 15px; }
.meter { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--sel); border-radius: 3px; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.plan-card { padding: 12px 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 4px; }
.plan-card.current { box-shadow: inset 0 0 0 2px var(--sel); }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-card ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.plans-dlg a { color: var(--sel); }

.admin-main h1 { margin: 0 0 16px; font-size: 28px; letter-spacing: -.02em; }
.admin-main h2 { margin: 32px 0 10px; font-size: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { position: relative; inset: auto; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 12px; background: var(--panel); box-shadow: var(--panel-shadow); }
.stat strong { font-size: 24px; }
.admin-tools { display: flex; gap: 12px; align-items: end; margin-bottom: 12px; }
.admin-tools .grow { flex: 1; }
.table-wrap { overflow-x: auto; background: var(--panel); border-radius: 12px; box-shadow: var(--panel-shadow); }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.users td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.users tr:last-child td { border-bottom: 0; }
.acct { display: flex; align-items: center; gap: 10px; }
.badge.plan-pro { color: #fff; background: #7C3AED; }
.badge.warn { color: #9A6700; background: color-mix(in srgb, #E2A300 22%, transparent); }
.status-ok { color: #1F8A55; font-weight: 600; } .status-off { color: #C33; font-weight: 600; }
.small-btn { height: 32px; padding: 0 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.log { list-style: none; margin: 0; padding: 0; background: var(--panel); border-radius: 12px; box-shadow: var(--panel-shadow); }
.log li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.log li:last-child { border-bottom: 0; }
.manage { width: min(440px, 100%); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--sel); }
.dlg-actions.spread { justify-content: space-between; align-items: center; }
.dlg-actions.spread > span { display: flex; gap: 8px; }
.danger-text { color: #D13B40; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.admin .dash-main { padding-left: 24px; max-width: 1180px; margin: 0 auto; }
body.admin .dash-head { padding-left: 14px; }
.brand a.btn { text-decoration: none; display: inline-grid; place-items: center; height: 36px; padding: 0 12px; }
body.admin .brand strong { padding-right: 10px; }

/* sign-in extras */
.forgot-row { margin: -6px 0 0; text-align: right; }
.forgot-row .link { font-size: 13px; }
.check.terms { align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.45; }
.check.terms input { margin-top: 2px; flex: none; }
.check.terms a, .legal-links a { color: var(--sel); }
.info { margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; line-height: 1.45; background: color-mix(in srgb, var(--sel) 10%, var(--panel)); }
.legal-links { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }
.legal-links a { text-decoration: none; }
.banner { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 10px 14px; margin: 0 0 18px; border-radius: 10px; font-size: 14px;
  background: color-mix(in srgb, #E2A300 14%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #E2A300 35%, transparent); }

/* Legal pages */
body.legal { overflow: auto; }
.legal-main { max-width: 820px; margin: 0 auto; padding: 32px 20px 64px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-bottom: 16px; font-size: 14px; }
.legal-nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.legal-nav a[aria-current="page"], .legal-nav a:hover { color: var(--ink); }
.legal-nav .link { margin-left: auto; font-size: 14px; }
.draft { padding: 10px 14px; border-radius: 10px; font-size: 14px; background: color-mix(in srgb, #E2A300 16%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #E2A300 40%, transparent); }
.legal-doc { position: relative; inset: auto; background: var(--panel); box-shadow: var(--panel-shadow); border-radius: 12px; padding: 32px 36px; line-height: 1.6; font-size: 15px; }
.legal-doc h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.01em; }
.legal-doc h2 { margin: 28px 0 8px; font-size: 18px; }
.legal-doc .meta { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.legal-doc a { color: var(--sel); }
.legal-doc ul { padding-left: 20px; }
.legal-doc li { margin: 6px 0; }
.legal-doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.legal-doc th, .legal-doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.legal-doc th { color: var(--muted); font-weight: 600; }
.legal-doc mark { background: color-mix(in srgb, #E2A300 30%, transparent); color: inherit; padding: 0 3px; border-radius: 3px; }
@media print { .legal-nav, .draft { display: none; } .legal-doc { box-shadow: none; padding: 0; } body.dash { background: #fff; } }
@media (max-width: 640px) { .legal-doc { padding: 22px 18px; } }

/* admin: tabs, links, checks, backups */
.tabs { display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 1px solid var(--line); }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 15px var(--font); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sel); }
.tab-badge { font-size: 11px; font-weight: 700; color: #7a5600; background: color-mix(in srgb, #E2A300 28%, transparent); border-radius: 999px; padding: 1px 7px; }
.tab-badge.fail { color: #fff; background: #E5484D; }
.link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.link-row .note { margin-right: auto; }
.checks li { justify-content: flex-start; align-items: flex-start; gap: 12px; }
.chk { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--muted); }
.chk.ok { background: #22A06B; } .chk.warn { background: #E2A300; } .chk.fail { background: #E5484D; }
.chk-body { display: flex; flex-direction: column; gap: 2px; }
.cmd { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; font-size: 13px; overflow-x: auto; }
.admin-tools .btn { height: 42px; }

/* start-up failure message (board.html) */
.boot-error { position: fixed; z-index: 100; left: 50%; top: 80px; transform: translateX(-50%); width: min(560px, calc(100vw - 24px));
  display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 14px 16px; border-radius: 12px; font: 14px/1.5 var(--font); color: var(--ink);
  background: var(--panel); box-shadow: 0 0 0 1px #E5484D, var(--panel-shadow); }
.boot-error code { display: block; width: 100%; font-size: 12px; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); overflow-wrap: anywhere; }
.boot-error kbd { font: 600 12px var(--font); padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }

/* Board page on touch screens: pinching anywhere (toolbars included) zooms the board, never the page */
body.board { touch-action: none; overscroll-behavior: none; }
body.board .sidebar, body.board .menu, body.board .pop, body.board .dlg-back, body.board textarea { touch-action: pan-x pan-y; }

/* version history */
.history-dlg { width: min(560px, 100%); max-height: min(720px, calc(100vh - 40px)); display: flex; flex-direction: column; }
.history-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.history-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; }
.history-list li:hover { background: var(--press); }
.h-thumb { flex: none; width: 112px; height: 63px; border-radius: 8px; overflow: hidden; background-color: var(--board);
  background-image: radial-gradient(circle, var(--dot) .8px, transparent 1.2px); background-size: 8px 8px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.h-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.h-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; }
.h-meta .note { font-size: 13px; }

/* Continue with Google (Google's button style: white, grey border, the four-colour G) */
.google-box { display: flex; flex-direction: column; gap: 10px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 10px; text-decoration: none;
  font: 600 15px var(--font); color: #1F1F1F; background: #FFFFFF; box-shadow: inset 0 0 0 1px #747775; }
.google-btn:hover { background: #F7F8F8; }
.google-btn svg { width: 18px; height: 18px; }
:root[data-wb-theme="dark"] .google-btn { color: #E3E3E3; background: #131314; box-shadow: inset 0 0 0 1px #8E918F; }
:root[data-wb-theme="dark"] .google-btn:hover { background: #1F1F20; }
.google-terms { margin: 0; font-size: 12px; text-align: center; }
.google-terms a { color: var(--sel); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.banner.bad { background: color-mix(in srgb, #E5484D 12%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #E5484D 40%, transparent); }

/* account menu open: the rest of the sidebar steps back (blurred), the workspace button stays sharp */
.sidebar .sb-scroll, .sidebar .sb-hide, .sidebar .sb-new { transition: filter .18s ease-out, opacity .18s ease-out; }
.sidebar.dimmed .sb-scroll, .sidebar.dimmed .sb-hide, .sidebar.dimmed .sb-new { filter: blur(3px); opacity: .5; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .sidebar .sb-scroll, .sidebar .sb-hide, .sidebar .sb-new { transition: none; } }

/* the Nodi logo, small, in the bottom-left corner above everything (but under menus and dialogs) */
.nodi-logo { position: fixed; z-index: 35; left: calc(22px + env(safe-area-inset-left, 0px)); bottom: calc(22px + env(safe-area-inset-bottom, 0px));   /* 22 px from the edges */
  display: block; line-height: 0; opacity: .9; transition: opacity .15s; view-transition-name: nodi-logo; }
.nodi-logo:hover, .nodi-logo:focus-visible { opacity: 1; }
.nodi-logo img { height: 22px; width: auto; display: block; }
.nodi-logo .logo-dark { display: none; }
:root[data-wb-theme="dark"] .nodi-logo .logo-light { display: none; }
:root[data-wb-theme="dark"] .nodi-logo .logo-dark { display: block; }
.sidebar .sb-scroll { padding-bottom: 56px; }                     /* the last items can scroll clear of the logo */
:root:not(.sb-open) body.board .history { left: calc(22px + 73px + 14px); }   /* undo/redo moves aside when the sidebar is hidden */
@media (max-width: 720px) { body.board .nodi-logo { display: none; } }  /* phones: the tool bar is at the bottom */

/* share panel: download the board (or the selection) as a file */
.share-download { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.share-download .note { margin: 0 auto 0 0; font-size: 13px; }
.share-download .btn { min-width: 52px; }

/* invitation to sign up, for people who opened a shared board without an account */
.signup-nudge { position: fixed; z-index: 20; left: 50%; top: calc(76px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px); opacity: 0;   /* below the top bars, whatever the board's name length */
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--panel); box-shadow: var(--panel-shadow);
  font-size: 14px; color: var(--ink); white-space: nowrap; transition: opacity .25s ease-out, transform .25s ease-out; }
.signup-nudge.in { opacity: 1; transform: translate(-50%, 0); }
.signup-nudge .btn { height: 32px; display: inline-flex; align-items: center; text-decoration: none; }
.nudge-close { appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }
.nudge-close:hover { background: var(--press); color: var(--ink); }
@media (max-width: 720px) { .signup-nudge { top: calc(128px + env(safe-area-inset-top, 0px)); } }       /* phones: the top bars take two rows */
@media (max-width: 560px) { .signup-nudge { white-space: normal; width: calc(100vw - 28px); font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { .signup-nudge { transition: none; } }

/* the Nodi logo on the sign-in / sign-up card (dark letters in light mode, white letters in dark mode) */
.auth-logo { display: block; line-height: 0; margin-bottom: 4px; }
.auth-logo img { height: 32px; width: auto; }
.auth-logo .logo-dark { display: none; }
:root[data-wb-theme="dark"] .auth-logo .logo-light { display: none; }
:root[data-wb-theme="dark"] .auth-logo .logo-dark { display: inline; }

/* dark theme: notices get only a light warm tint (yellow mixed into a dark surface turns olive) and a clear outline */
:root[data-wb-theme="dark"] .banner { background: color-mix(in srgb, #F5A524 7%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #F5A524 45%, transparent); }
:root[data-wb-theme="dark"] .banner.bad { background: color-mix(in srgb, #F2555A 9%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #F2555A 50%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-wb-theme]) .banner { background: color-mix(in srgb, #F5A524 7%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #F5A524 45%, transparent); }
  :root:not([data-wb-theme]) .banner.bad { background: color-mix(in srgb, #F2555A 9%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #F2555A 50%, transparent); }
}

/* icon picker (Lucide icons) */
.icon-pop { position: fixed; z-index: 16; left: calc(70px + var(--sb, 0px)); top: 50%;   /* next to the tool bar, which moves with the sidebar */ transform: translateY(-50%); width: 336px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.icon-pop:not([hidden]) { animation: pop-in .14s ease-out; transform-origin: left center; }
.icon-search { width: 100%; box-sizing: border-box; height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--board); color: var(--ink); font: inherit; font-size: 14px; }
.icon-search:focus { outline: 2px solid var(--sel); outline-offset: -1px; border-color: transparent; }
.icon-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; max-height: min(330px, 52vh); overflow-y: auto; overscroll-behavior: contain; }
.icon-cell { appearance: none; border: 0; background: transparent; color: var(--ink); aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-cell:hover, .icon-cell:focus-visible { background: var(--press); }
.icon-cell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-note { margin: 0; font-size: 12px; }
@media (max-width: 720px) { .icon-pop { left: 50%; top: auto; bottom: 84px; transform: translateX(-50%); width: min(336px, calc(100vw - 28px)); } }

/* ================= Home page (signed out) ================= */
body.on-landing { overflow-y: auto; }
.landing { max-width: 1120px; margin: 0 auto; padding: 0 24px calc(40px + env(safe-area-inset-bottom, 0px)); color: var(--ink); }
.landing .logo-dark { display: none; }
:root[data-wb-theme="dark"] .landing .logo-light { display: none; }
:root[data-wb-theme="dark"] .landing .logo-dark { display: block; }
.lp-top { display: flex; align-items: center; gap: 24px; padding: calc(18px + env(safe-area-inset-top, 0px)) 0 18px; }
.lp-logo { line-height: 0; } .lp-logo img { height: 30px; width: auto; }
.lp-nav { display: flex; gap: 22px; margin-right: auto; } .lp-nav a { color: var(--muted); text-decoration: none; font-weight: 500; } .lp-nav a:hover { color: var(--ink); }
.lp-actions { display: flex; gap: 8px; }
.lp-hero { text-align: center; padding: 56px 0 24px; }
.lp-hero h1 { font-size: clamp(36px, 6vw, 60px); line-height: 1.05; letter-spacing: -.02em; margin: 0 auto 18px; max-width: 14ch; }
.lp-sub { font-size: clamp(16px, 2vw, 19px); line-height: 1.5; color: var(--muted); max-width: 40em; margin: 0 auto 28px; }
.lp-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lp-big { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; }
.lp-big svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lp-note { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.lp-shot { margin: 44px 0 0; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(16, 24, 40, .14); line-height: 0; }
.lp-shot img { width: 100%; height: auto; }
.lp-section { padding: 72px 0 8px; } .lp-section h2 { text-align: center; font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 10px; letter-spacing: -.01em; }
.lp-section-sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.lp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.lp-card { background: var(--panel); border-radius: 14px; padding: 22px; box-shadow: var(--panel-shadow); }
.lp-card h3 { font-size: 17px; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; } .lp-card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 15px; }
.lp-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--sel) 12%, transparent); color: var(--sel); }
.lp-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lp-pro { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--sel) 14%, transparent); color: var(--sel); }
.lp-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 340px)); justify-content: center; gap: 16px; }
.lp-plan { background: var(--panel); border-radius: 16px; padding: 26px; box-shadow: var(--panel-shadow); display: flex; flex-direction: column; }
.lp-plan-top { box-shadow: 0 0 0 2px var(--sel), var(--panel-shadow); }
.lp-plan h3 { margin: 0 0 4px; font-size: 22px; } .lp-price { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.lp-plan ul { list-style: none; padding: 0; margin: 12px 0 22px; display: grid; gap: 9px; flex: 1; }
.lp-plan li { padding-left: 24px; position: relative; color: var(--ink); line-height: 1.4; }
.lp-plan li::before { content: ""; position: absolute; left: 2px; top: .3em; width: 12px; height: 7px; border-left: 2px solid var(--sel); border-bottom: 2px solid var(--sel); transform: rotate(-45deg); }
.lp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 80px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.lp-foot a { color: var(--muted); } .lp-foot a:hover { color: var(--ink); }
.lp-lang { margin-left: auto; display: flex; gap: 4px; }
.lp-lang button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.lp-lang button[aria-pressed="true"] { color: var(--ink); background: var(--press); font-weight: 600; }
@media (max-width: 860px) { .lp-grid { grid-template-columns: 1fr 1fr; } .lp-nav { display: none; } .lp-top { justify-content: space-between; } }
@media (max-width: 560px) { .lp-grid { grid-template-columns: 1fr; } .lp-hero { padding-top: 28px; } .lp-actions .btn.ghost { display: none; } .lp-lang { margin-left: 0; } }
/* the sign-in card's logo leads home */
a.auth-logo { width: max-content; }
body.on-landing .nodi-logo { display: none; }   /* the home page has its own logo at the top */

/* keyboard shortcuts sheet */
.shortcuts-dlg { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.sc-cols { columns: 2 300px; column-gap: 32px; margin-top: 6px; }
.sc-cols section { break-inside: avoid; margin-bottom: 16px; }
.sc-cols h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.sc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; font-size: 14px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.sc-keys { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.sc-keys kbd, .sc-foot kbd { font: 600 12px/1 var(--font, inherit); min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 6px; background: var(--surface-2); box-shadow: inset 0 -1px 0 var(--line); color: var(--ink); }
.sc-keys .plus { color: var(--muted); font-size: 12px; padding: 0 1px; }
.sc-extra { color: var(--muted); font-size: 13px; margin-left: 4px; }
.sc-foot { margin: 4px 0 0; }

/* search boards (sidebar) */
.sb-search { position: relative; margin: 0 8px 8px; }
.sb-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.sb-search input { width: 100%; box-sizing: border-box; height: 34px; padding: 0 52px 0 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--board); color: var(--ink); font: inherit; font-size: 14px; }
.sb-search input::-webkit-search-cancel-button { display: none; }
.sb-search input:focus { outline: 2px solid var(--sel); outline-offset: -1px; border-color: transparent; }
.sb-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 600 11px/1 inherit; color: var(--muted); padding: 3px 6px; border-radius: 5px; background: var(--surface-2); pointer-events: none; }
.sb-search input:focus ~ kbd, .sb-search input:not(:placeholder-shown) ~ kbd { display: none; }
.sidebar.searching .sb-link, .sidebar.searching .sb-section { display: none; }
.sb-results { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.sb-result { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.sb-result:hover, .sb-result.active { background: var(--press); }
.sb-r-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-r-snip { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-result mark { background: color-mix(in srgb, #F5C542 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sb-r-tag { font-size: 11px; color: var(--muted); }

/* admin: statistics */
.statistics h3 { font-size: 14px; margin: 24px 0 10px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.stat-card { background: var(--panel); border-radius: 12px; padding: 14px 16px; box-shadow: var(--panel-shadow); display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-big { font-size: 28px; line-height: 1.2; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat-chart { width: 100%; max-width: 760px; height: auto; display: block; background: var(--panel); border-radius: 12px; box-shadow: var(--panel-shadow); padding: 12px; box-sizing: border-box; }
.stat-chart rect { fill: var(--sel); opacity: .85; } .stat-chart rect:hover { opacity: 1; }
.stat-chart text { font-size: 10px; fill: var(--muted); }
.funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }
.funnel { background: var(--panel); border-radius: 12px; padding: 4px 16px 12px; box-shadow: var(--panel-shadow); }
.funnel h3 { margin: 12px 0 6px; }
.funnel-step { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 7px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.funnel-step strong { text-align: right; } .funnel-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.sources div { background: var(--panel); border-radius: 10px; padding: 10px 12px; box-shadow: var(--panel-shadow); display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
