/* OddBoard — a dark studio canvas (light theme too). Tokens first; then the frame (sidebar, top bar, canvas, dock),
   cards, panels, the AI, decks, and the drawing tools. */

:root {
  --sb-w: 252px;
  --top-h: 52px;
  --ai-w: 0px;
  --gap: 10px;
  --radius: 14px;
  /* SF Pro wherever it's installed, else Inter — bundled as "OddBoard Sans" (app/fonts), the closest open font to SF
     Pro. On Apple devices (data-os="apple", set in index.html) the system font is SF Pro itself. SF Pro can't be
     bundled: its licence doesn't allow it. (-apple-system stays out of this list: Chrome on Windows takes it as
     "the system font" and would never reach Inter.) */
  --font: "OddBoard UI", "OddBoard Sans", Inter, "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  /* dark (default) */
  --app: #151515;
  --canvas: #1b1b1b;
  --dot: rgba(255, 255, 255, .06);
  --panel: #1e1e1e;
  --surface: #262626;
  --surface-2: #2e2e2e;
  --surface-3: #363636;
  --hover: rgba(255, 255, 255, .06);
  --wall: #212121;
  --wall-line: #2d2d2d;
  --line: #2f2f2f;
  --line-2: #3b3b3b;
  --text: #ececec;
  --text-2: #bdbdbd; /* body copy under labels */
  --muted: #9a9a9a;
  --faint: #6c6c6c;
  --accent: #4a7cf7;
  --accent-2: #3d6ee6;
  --accent-text: #ffffff;
  --arrow: #7a7a7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .22);
  --shadow-lift: 0 14px 40px rgba(0, 0, 0, .55);
  --danger: #ef6a5b;
  --ok: #46c27a;
  --mm-card: #4b5568; --mm-wall: #2d2d2d; --mm-pic: #6c7a99;

  /* colours: soft card fill (c-) and strong accent (a-) */
  --c-yellow: #3b3420; --a-yellow: #e2b443;
  --c-orange: #3f2d1f; --a-orange: #ea8a3f;
  --c-red: #3d2422;    --a-red: #e5574e;
  --c-pink: #3b2333;   --a-pink: #e2609f;
  --c-purple: #2e2845; --a-purple: #9d80f2;
  --c-blue: #1f2c43;   --a-blue: #4a7cf7;
  --c-green: #1f3426;  --a-green: #4cb071;
  --c-brown: #4a3125;  --a-brown: #b07a54;
  --c-gray: #2f2f2f;   --a-gray: #8c8c8c;
  color-scheme: dark;
}
:root[data-os="apple"] { --font: -apple-system, BlinkMacSystemFont, "OddBoard UI", "OddBoard Sans", system-ui, sans-serif; }
:root[data-theme="light"] {
  --app: #f1f0ec;
  --canvas: #fbfaf7;
  --dot: rgba(0, 0, 0, .09);
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f3ef;
  --surface-3: #ebe9e3;
  --hover: rgba(0, 0, 0, .05);
  --wall: #f3f2ee;
  --wall-line: #e3e0d8;
  --line: #e4e1da;
  --line-2: #d6d2c9;
  --text: #1c1b19;
  --text-2: #57534c;
  --muted: #6d6962;
  --faint: #a19c92;
  --accent: #3b6ef0;
  --accent-2: #2f5fd9;
  --arrow: #8d877d;
  --shadow: 0 1px 2px rgba(20, 16, 10, .06), 0 4px 14px rgba(20, 16, 10, .07);
  --shadow-lift: 0 14px 34px rgba(20, 16, 10, .16);
  --danger: #cf3b2a;
  --ok: #1f9d55;
  --mm-card: #b9bfcb; --mm-wall: #e4e1da; --mm-pic: #93a0bd;
  --c-yellow: #fdf2c4; --c-orange: #ffe4cc; --c-red: #ffdcd7; --c-pink: #ffdcee;
  --c-purple: #ebe2ff; --c-blue: #dbe8ff; --c-green: #d8f2df; --c-brown: #efe0d2; --c-gray: #ebe9e4;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--app);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: "cv11", "ss01", "ss03"; /* Inter's single-storey a and rounder shapes, closer to SF Pro */
  letter-spacing: -.006em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.sb-collapsed { --sb-w: 0px; }
body.ai-open { --ai-w: 404px; }
button, input, textarea, select { font: inherit; color: inherit; }
kbd {
  font: 11px ui-monospace, Consolas, monospace;
  padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted);
}
code { font: 12.5px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 14px; height: 14px; }
.ic.flip { transform: scaleX(-1); }
.ic.red { color: #e5574e; } .ic.blue { color: var(--accent); } .ic.ok { color: var(--ok); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 550; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn .ic { width: 16px; height: 16px; }
.icon-btn {
  position: relative; width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover, .icon-btn.on { background: var(--hover); color: var(--text); }
.icon-btn.round { border-radius: 50%; border: 1px solid var(--line-2); width: 30px; height: 30px; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.seg.sm button { height: 24px; padding: 0 8px; font-size: 12px; }
.pill { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.pill.blue { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #9fb8ff; }
.pill.green { background: color-mix(in srgb, var(--ok) 22%, transparent); color: #8fdcab; }
:root[data-theme="light"] .pill.blue { color: var(--accent-2); }
:root[data-theme="light"] .pill.green { color: #1a7f45; }
.spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.spin.sm { width: 11px; height: 11px; border-width: 1.6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the sidebar ---------- */
.sidebar {
  position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 252px; padding: 10px 10px 12px;
  display: flex; flex-direction: column; gap: 6px; background: var(--app);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
body.sb-collapsed .sidebar { transform: translateX(-100%); }
body:not(.signed-in):not(.viewer) :is(.sidebar, .topbar, .dock) { visibility: hidden; }
.sb-top { display: flex; align-items: center; gap: 4px; height: 32px; }
.sb-top .account-wrap { flex: 1; min-width: 0; }
.sb-workspace {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border: 0; border-radius: 9px;
  background: transparent; cursor: pointer; color: var(--text); font-weight: 500;
}
.sb-workspace:hover, .sb-workspace[aria-expanded=true] { background: var(--hover); }
.sb-avatar, .tb-avatar {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #c9a27a, #8a6545); color: #fff; font-size: 11px; font-weight: 700;
}
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-left: auto; }
.live.on { background: var(--ok); }
.live.on.syncing { background: var(--accent); }
.live.on.offline { background: var(--a-yellow); }
.live.on.error { background: var(--danger); }
.sb-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sb-link {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-weight: 500;
}
.sb-link .ic { color: var(--muted); }
.sb-link:hover, .sb-link.here { background: var(--hover); }
.sb-search {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; border-radius: 10px; cursor: text; text-align: left;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.sb-search span { flex: 1; }
.sb-search:hover { border-color: var(--line-2); }
.sb-tree { flex: 1; overflow-y: auto; margin: 8px -4px 0; padding: 0 4px; }
.sb-section { font-size: 12px; color: var(--faint); font-weight: 500; padding: 8px 10px 6px; }
.sb-row {
  --d: 0; position: relative; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 calc(4px + var(--d) * 18px);
  border-radius: 9px; cursor: pointer; color: var(--text); font-weight: 500; user-select: none;
}
.sb-row:hover { background: var(--hover); }
.sb-row.here { background: var(--surface-2); }
.sb-row.drop-target { background: color-mix(in srgb, var(--accent) 30%, transparent); outline: 1px solid var(--accent); }
.sb-caret, .sb-caret-space { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border: 0; padding: 0; background: none; color: var(--faint); cursor: pointer; }
.sb-caret .ic { width: 13px; height: 13px; transition: transform .15s; }
.sb-caret.open .ic { transform: rotate(90deg); }
.sb-thumb { width: 20px; height: 20px; border-radius: 6px; flex: none; background: var(--surface-3) center / cover; display: grid; place-items: center; font-size: 13px; }
.sb-thumb.emoji { background: none; }
.sb-thumb[class*="c-"] { background: var(--accent-c, var(--a-blue)); }
.sb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.sb-rename { flex: 1; min-width: 0; height: 24px; padding: 0 6px; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); outline: none; }
.sb-count { font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.sb-more { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; display: none; place-items: center; }
.sb-row:hover .sb-more { display: grid; }
.sb-more:hover { background: var(--hover); color: var(--text); }
.sb-empty { color: var(--faint); font-size: 13px; padding: 4px 10px; }
.sb-new { width: 100%; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500; text-align: left; margin-top: 2px; padding-left: 8px; }
.sb-new .ic { width: 16px; height: 16px; margin: 0 4px 0 2px; }
.sb-new:hover { color: var(--text); }
.sb-foot { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.sb-foot-link { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; }
.sb-foot-link:hover { background: var(--hover); color: var(--text); }
.sb-foot-link .ic { width: 16px; height: 16px; }

/* ---------- the top bar ---------- */
.topbar {
  position: fixed; z-index: 28; top: 0; right: 0; left: var(--sb-w); height: var(--top-h);
  display: flex; align-items: center; gap: 6px; padding: 0 12px 0 8px; background: var(--app);
  transition: left .22s cubic-bezier(.2, .8, .2, 1);
}
.tb-logo { display: none; width: 22px; height: 22px; border-radius: 6px; background: conic-gradient(from 45deg, #ff5a36 0 25%, #ffb020 0 50%, #8338ec 0 75%, #3a86ff 0); flex: none; }
body.sb-collapsed .tb-logo, .viewer .tb-logo { display: block; margin: 0 4px 0 2px; }
.tb-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 2px; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 4px 7px; border-radius: 8px;
  overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs a.here { color: var(--text); }
.crumbs a.drop-target { background: var(--accent); color: #fff; }
.crumbs .sep { color: var(--faint); }
.crumbs .cr-home .ic { width: 16px; height: 16px; }
.cr-ic { font-size: 15px; line-height: 1; }
.cr-sw { width: 16px; height: 16px; border-radius: 5px; background: var(--accent-c, var(--a-blue)); display: inline-block; }
.seg.mode { margin: 0 4px; }
.seg.mode button { width: 30px; padding: 0; justify-content: center; }
.seg.mode .ic { width: 16px; height: 16px; }
.tb-avatar { width: 28px; height: 28px; border: 0; cursor: pointer; font-size: 12px; margin-left: 4px; }
.badge-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: #f05a3a; box-shadow: 0 0 0 2px var(--app); }
.pop-wrap { position: relative; display: inline-flex; }
.viewer-note { color: var(--muted); font-size: 12.5px; margin-right: 6px; }

/* menus & popovers */
.pop, .menu {
  position: absolute; z-index: 60; top: calc(100% + 8px); right: 0;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.menu { display: flex; flex-direction: column; padding: 6px; min-width: 230px; }
.menu > button, .menu > a {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); cursor: pointer; text-decoration: none; font: inherit;
}
.menu > button:hover, .menu > a:hover, .menu > button.on { background: var(--hover); }
.menu > button:disabled { opacity: .45; cursor: default; }
.menu > button small, .menu > a small { color: var(--muted); }
.menu .danger { color: var(--danger); }
.menu .mh { display: flex; align-items: center; gap: 8px; padding: 10px 10px 4px; font-weight: 500; font-size: 13px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.account-menu { left: 0; right: auto; top: 38px; min-width: 260px; }
.am-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
#amEmail { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.am-sync { color: var(--muted); font-size: 12px; }
.export-menu { width: 330px; }
.export-menu .ic { width: 18px; height: 18px; }
.sb-menu { z-index: 70; }

/* ---------- the canvas ---------- */
#viewport {
  position: fixed; z-index: 1; top: var(--top-h); bottom: var(--gap);
  left: max(var(--sb-w), var(--gap)); right: calc(var(--ai-w) + var(--gap));
  overflow: hidden; cursor: grab; touch-action: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  --grid: var(--canvas-dot, var(--dot));
  background-color: var(--canvas-bg, var(--canvas));
  background-image: none; /* plain by default; dots or lines from the board menu */
  background-size: 24px 24px;
  transition: left .22s cubic-bezier(.2, .8, .2, 1), right .22s cubic-bezier(.2, .8, .2, 1);
}
#viewport.grid-dots { background-image: radial-gradient(var(--grid) 1.2px, transparent 1.3px); }
#viewport.grid-lines { background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); }
#viewport.grid-none { background-image: none; }
#viewport.panning { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#world.animate { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
#lines { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#lines marker path { fill: var(--arrow); }
.ln .vis { fill: none; stroke: var(--arrow); stroke-width: 2; stroke-linecap: round; }
.ln .hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.ln.sel .vis, .ln:hover .vis { stroke: var(--accent); }
.ln.temp .vis { stroke: var(--accent); stroke-dasharray: 6 5; }

body.presenting .sidebar, body.presenting .topbar, body.presenting .dock, body.presenting .mapbox, body.presenting .ai-orb,
body.presenting .selbar, body.presenting .ai-panel, body.presenting .panel, body.presenting #toolbar { display: none !important; }
body.presenting #viewport { inset: 0; border: 0; border-radius: 0; }
body.presenting .card { pointer-events: none; }
.present-bar {
  position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px;
  background: rgba(20, 20, 20, .86); color: #eee; border: 1px solid #333; border-radius: 14px; backdrop-filter: blur(8px);
}
.present-bar span { min-width: 180px; text-align: center; font-weight: 500; font-size: 13px; }
.present-bar button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #ddd; cursor: pointer; }
.present-bar button:hover { background: rgba(255, 255, 255, .1); }

/* ---------- cards ---------- */
.card {
  --w: 240px;
  position: absolute; left: 0; top: 0; width: var(--w);
  background: var(--card-bg, var(--surface)); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .045);
  cursor: pointer; user-select: none;
  transition: box-shadow .15s, opacity .2s, outline-color .15s;
  outline: 2px solid transparent; outline-offset: 2px;
}
:root[data-theme="light"] .card { border-color: rgba(0, 0, 0, .05); }
.card > .clip { border-radius: inherit; overflow: hidden; }
.card:hover { box-shadow: var(--shadow-lift); }
.card.dragging { box-shadow: var(--shadow-lift); cursor: grabbing; transition: none; pointer-events: none; opacity: .94; transform-origin: 50% 0; }
.card.selected { outline-color: var(--accent); }
.card.dim { opacity: .14; }
.card.drop-target { outline: 3px solid var(--accent); outline-offset: 4px; }
.card.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { outline: 3px solid var(--accent); outline-offset: 6px; } 100% { outline-color: transparent; } }
.card.c-yellow { --card-bg: var(--c-yellow); } .card.c-orange { --card-bg: var(--c-orange); }
.card.c-red { --card-bg: var(--c-red); }       .card.c-pink { --card-bg: var(--c-pink); }
.card.c-purple { --card-bg: var(--c-purple); } .card.c-blue { --card-bg: var(--c-blue); }
.card.c-green { --card-bg: var(--c-green); }   .card.c-gray { --card-bg: var(--c-gray); }
.card.c-brown { --card-bg: var(--c-brown); }
.c-default { --accent-c: var(--a-gray); }
.c-yellow { --accent-c: var(--a-yellow); } .c-orange { --accent-c: var(--a-orange); }
.c-red { --accent-c: var(--a-red); }       .c-pink { --accent-c: var(--a-pink); }
.c-purple { --accent-c: var(--a-purple); } .c-blue { --accent-c: var(--a-blue); }
.c-green { --accent-c: var(--a-green); }   .c-gray { --accent-c: var(--a-gray); }
.c-brown { --accent-c: var(--a-brown); }

.card .media { position: relative; background: var(--surface-2); margin: 8px 8px 0; border-radius: 10px; overflow: hidden; }
.card.t-image .media { margin: 0; border-radius: 0; }
.card .media img, .card .media video { display: block; width: 100%; max-height: calc(var(--w) * 1.6); object-fit: cover; pointer-events: none; }
.card.t-image .media img { max-height: none; }
.badge {
  position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 7px;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px; font-weight: 500; letter-spacing: .02em;
}
.badge .ic { width: 11px; height: 11px; fill: #fff; stroke: none; }
.card .body { padding: 12px 14px 14px; }
.card .site { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; min-width: 0; }
.card .site-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .fav { width: 17px; height: 17px; border-radius: 4px; background: var(--surface-3); display: grid; place-items: center; font: 700 10px var(--serif); color: var(--text); flex: none; }
.card .title { font-weight: 500; margin-top: 6px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .desc { margin-top: 4px; font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .note {
  margin-top: 8px; padding: 7px 9px; border-radius: 9px; background: var(--surface-2);
  font-size: 13px; color: var(--text); white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card .tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; font-weight: 550; padding: 2px 8px; border-radius: 6px; background: var(--tg, var(--surface-3)); color: var(--tc, var(--muted)); }
.tag.t-blue { --tg: #26467a; --tc: #bcd2ff; } .tag.t-green { --tg: #234a31; --tc: #a3dcb4; } .tag.t-purple { --tg: #3b2f63; --tc: #cfc0ff; }
.tag.t-brown { --tg: #6b5230; --tc: #f0d39b; } .tag.t-red { --tg: #713430; --tc: #f6b9b1; } .tag.t-yellow { --tg: #66551f; --tc: #f2dd8f; }
.tag.t-gray { --tg: #444; --tc: #d0d0d0; } .tag.t-pink { --tg: #6a2e4f; --tc: #f6bcd8; } .tag.t-orange { --tg: #6e4224; --tc: #f8c79b; }
:root[data-theme="light"] .tag.t-blue { --tg: #dbe7ff; --tc: #2349a3; } :root[data-theme="light"] .tag.t-green { --tg: #d7f1df; --tc: #1d6b3b; }
:root[data-theme="light"] .tag.t-purple { --tg: #e9e1ff; --tc: #563ab0; } :root[data-theme="light"] .tag.t-brown { --tg: #f2e3cf; --tc: #7a5021; }
:root[data-theme="light"] .tag.t-red { --tg: #ffdcd7; --tc: #a3322a; } :root[data-theme="light"] .tag.t-yellow { --tg: #fbefbe; --tc: #7d6310; }
:root[data-theme="light"] .tag.t-gray { --tg: #ebe9e4; --tc: #5b5750; } :root[data-theme="light"] .tag.t-pink { --tg: #ffdcee; --tc: #9b2a64; }
:root[data-theme="light"] .tag.t-orange { --tg: #ffe4cc; --tc: #9a4b12; }
.card .ai-dot { color: var(--accent); margin-left: auto; display: inline-flex; }
.card .ai-dot .ic { width: 13px; height: 13px; }

/* notes */
.note-body { padding: 18px 20px; min-height: 56px; cursor: inherit; outline: none; overflow-wrap: anywhere; user-select: text; font-size: 14.5px; line-height: 1.6; }
.note-body[contenteditable=true] { cursor: text; }
.note-body:empty::before { content: 'Type something…'; color: var(--faint); }
.note-body > :first-child { margin-top: 0; } .note-body > :last-child { margin-bottom: 0; }
.note-body { color: var(--text-2); }
/* Bold in notes reads like the rest of the text: one quiet weight and colour everywhere. */
.note-body b, .note-body strong { font-weight: 400; color: inherit; }
.note-body h1, .note-body h2, .note-body h3 { font-size: 1.22em; font-weight: 500; color: var(--text); line-height: 1.25; margin: .6em 0 .3em; letter-spacing: -.01em; }
.note-body ul, .note-body ol { margin: .3em 0; padding-left: 1.3em; }
.note-body blockquote { margin: .4em 0; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--muted); }
.note-body a { color: var(--accent); }
.card.t-note .tags, .card.t-todo .tags, .card.t-event .tags { padding: 0 20px 16px; margin: 0; }

/* headings */
.card.t-heading { background: transparent; box-shadow: none; border-color: transparent; }
.card.t-heading:hover { box-shadow: none; background: var(--hover); }
.heading-text {
  padding: 4px 6px; font-weight: 750; letter-spacing: -.025em; line-height: 1.1; outline: none; overflow-wrap: anywhere;
  font-size: clamp(16px, calc(var(--w) * .075), 120px);
}
.heading-text[contenteditable=true] { cursor: text; user-select: text; }

/* tasks */
.todo-title { padding: 16px 18px 6px; font-weight: 500; outline: none; }
.todos { padding: 2px 10px 12px; }
.todo-row { position: relative; display: flex; align-items: flex-start; gap: 9px; padding: 4px 8px; border-radius: 7px; }
.todo-row input { margin: 3px 0 0; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
.todo-main { flex: 1; min-width: 0; }
.todo-text { display: block; outline: none; min-height: 1.45em; overflow-wrap: anywhere; }
.todo-meta { display: flex; gap: 5px; margin-top: 4px; }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 500; padding: 1px 6px; border-radius: 5px; background: #234a31; color: #9fdcb2; }
.due .ic { width: 10px; height: 10px; }
.due.late { background: #713430; color: #f6b9b1; }
:root[data-theme="light"] .due { background: #d7f1df; color: #1d6b3b; }
:root[data-theme="light"] .due.late { background: #ffdcd7; color: #a3322a; }
.todo-due { position: absolute; right: 4px; top: 3px; width: 22px; height: 22px; display: none; place-items: center; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.todo-due .ic { width: 13px; height: 13px; }
.todo-row:hover .todo-due { display: grid; }
.todo-due:hover { color: var(--text); }
.todo-row.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-text:empty::before { content: 'A task'; color: var(--faint); }
.card.editing .todo-title, .card.editing .todo-text { cursor: text; user-select: text; }
.todo-progress { margin: 0 18px 14px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.todo-progress i { display: block; height: 100%; background: var(--ok); }

/* boards */
.card.t-board { padding: 8px; }
.b-cover {
  aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--accent-c, var(--a-blue)) 30%, var(--surface-2));
  display: grid; gap: 3px; place-items: center;
}
.b-cover.n2 { grid-template-columns: 1fr 1fr; } .b-cover.n3, .b-cover.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.b-cover.n3 img:first-child { grid-row: span 2; }
.b-cover img { width: 100%; height: 100%; object-fit: cover; }
.b-cover .b-folder { width: 40%; height: 40%; color: var(--accent-c, var(--a-blue)); stroke-width: 1.4; }
.b-cover.has-icon { background: color-mix(in srgb, var(--accent-c, var(--a-blue)) 22%, var(--surface-2)); }
.b-emoji { font-size: calc(var(--w) * .26); line-height: 1; }
.b-info { padding: 8px 4px 2px; }
.b-title { font-weight: 500; outline: none; overflow-wrap: anywhere; }
.b-title[contenteditable=true] { cursor: text; user-select: text; background: var(--surface-2); border-radius: 6px; }
.b-count { font-size: 12px; color: var(--muted); }
.card.t-board.in-wall { padding: 8px; }
.card.t-board.in-wall .clip { display: flex; align-items: center; gap: 12px; }
.card.t-board.in-wall .b-cover { width: 64px; flex: none; aspect-ratio: 4 / 3; }
.card.t-board.in-wall .b-info { padding: 0; }

/* colours */
.card.t-swatch { overflow: hidden; }
.sw { min-height: calc(var(--w) * .42); padding: 14px 16px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; color: #1c1b19; }
.sw.on-dark { color: #f6f2ea; }
.sw b { font-size: 14px; font-weight: 500; }
.sw span { font: 11.5px ui-monospace, Consolas, monospace; opacity: .75; }

/* files */
.file { display: flex; gap: 12px; align-items: center; padding: 14px; }
.file-ic { position: relative; flex: none; width: 40px; height: 48px; border-radius: 8px; display: grid; place-items: center; background: #3a6ae8; color: #fff; }
.file-ic .ic { width: 22px; height: 22px; }
.file-ic span { position: absolute; bottom: 3px; font-size: 8.5px; font-weight: 800; letter-spacing: .04em; }
.file-ic.x-pdf { background: #d9443a; }
.file-name { font-weight: 500; overflow-wrap: anywhere; }
.file-size { font-size: 12px; color: var(--muted); }
.card audio { display: block; width: calc(100% - 20px); margin: 0 10px 12px; height: 34px; }

/* walls: a titled column that holds cards (they're positioned over it) */
.card.t-wall {
  z-index: -1; background: color-mix(in srgb, var(--accent-c) 7%, var(--wall)); border: 1px solid var(--wall-line);
  border-radius: 20px; box-shadow: none; min-height: 150px;
}
.card.t-wall.c-default { background: var(--wall); }
.card.t-wall.c-brown { background: color-mix(in srgb, #7b4a30 70%, var(--wall)); }
.card.t-wall:hover { box-shadow: none; border-color: var(--line-2); }
.card.t-wall.drop-into { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.t-wall.selected { outline-offset: 3px; }
.wall-head { display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 20px; }
.wall-bar { width: 3px; height: 20px; border-radius: 2px; background: var(--accent-c); flex: none; }
.card.t-wall.c-default .wall-bar { background: var(--a-yellow); }
.wall-title { font-weight: 500; font-size: 17px; letter-spacing: -.01em; outline: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-title[contenteditable=true] { cursor: text; user-select: text; white-space: normal; }
.card.in-wall { box-shadow: none; }
.card.in-wall:hover { box-shadow: var(--shadow); }
.card.in-wall > .rz, .card.in-wall > .cn { display: none; }
body.dragging-cards .card.t-wall:not(.drop-into) { transition: none; }

/* tables */
.card.t-table { cursor: default; }
.tb-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 4px; cursor: pointer; }
.tb-head .ic { color: var(--muted); }
.tb-title { font-weight: 500; font-size: 15px; outline: none; }
.tb-sub { padding: 2px 18px 12px 46px; color: var(--muted); font-size: 12px; }
.tb-wrap { overflow-x: auto; padding: 0 0 6px; }
.card.t-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.card.t-table th, .card.t-table td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; outline: none; }
.card.t-table th { background: var(--surface-2); color: var(--muted); font-weight: 500; border-top: 1px solid var(--line); }
.card.t-table td { cursor: cell; }
.card.t-table td[contenteditable=true], .card.t-table th[contenteditable=true] { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface); cursor: text; user-select: text; }
.card.t-table .k-number { text-align: right; font-variant-numeric: tabular-nums; }
.card.t-table .k-check { width: 54px; text-align: center; }
.card.t-table .k-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.card.t-table tfoot td { font-weight: 500; border-bottom: 0; }
.card.t-table tbody tr:hover td { background: var(--hover); }

/* events */
.ev { display: flex; gap: 14px; padding: 16px 18px; }
.ev-date { flex: none; width: 50px; border-radius: 11px; overflow: hidden; text-align: center; background: var(--surface-2); border: 1px solid var(--line); }
.ev-date span { display: block; background: #e5574e; color: #fff; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 0; }
.ev-date b { display: block; font-size: 20px; line-height: 1.5; }
.ev-main { min-width: 0; }
.ev-title { font-weight: 500; outline: none; margin-bottom: 4px; overflow-wrap: anywhere; }
.ev-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ev-meta .ic { width: 13px; height: 13px; }
.ev-note { padding: 0 18px 14px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }

/* the AI's own cards get a faint mark */
.card.by-ai::after { content: ''; position: absolute; top: 10px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .8; pointer-events: none; }
.card.t-wall.by-ai::after, .card.t-heading.by-ai::after { display: none; }

/* resize & connect handles */
.rz, .cn { position: absolute; opacity: 0; transition: opacity .12s; }
.card:hover > .rz, .card.selected > .rz, .card:hover > .cn { opacity: 1; }
.rz { right: -6px; bottom: -6px; width: 14px; height: 14px; cursor: nwse-resize; border-radius: 4px; background: var(--surface); border: 2px solid var(--accent); }
.cn { right: -9px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; cursor: crosshair; background: var(--accent); border: 3px solid var(--surface); box-shadow: var(--shadow); }
.card.editing > .cn, .card.editing > .rz { display: none; }
.card.t-wall > .cn { top: 29px; }
/* a wall's right edge: drag it to make the wall wider or narrower */
.rz-edge { position: absolute; top: 14px; bottom: 14px; right: -6px; width: 12px; cursor: ew-resize; }
.rz-edge::after { content: ''; position: absolute; top: 50%; left: 4px; width: 4px; height: 44px; margin-top: -22px; border-radius: 3px; background: var(--accent); opacity: 0; transition: opacity .12s; }
.card.t-wall:hover > .rz-edge::after, .card.t-wall.selected > .rz-edge::after { opacity: .9; }
.card.editing > .rz-edge { display: none; }

/* group headings from Arrange › By … */
#labels { position: absolute; left: 0; top: 0; pointer-events: none; }
.group-label { position: absolute; white-space: nowrap; font-size: 20px; font-weight: 750; letter-spacing: -.02em; max-width: var(--w); overflow: hidden; text-overflow: ellipsis; }
.group-label span { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
#world.animate .card { transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .15s, opacity .2s; }

.marquee { position: absolute; z-index: 5; pointer-events: none; border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; }

/* drag & drop */
.drop-hint {
  position: absolute; inset: 16px; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 14px; color: var(--accent); font-weight: 700; font-size: 18px;
  background: color-mix(in srgb, var(--accent) 6%, transparent); opacity: 0; transition: opacity .12s;
}
#viewport.dropping .drop-hint { opacity: 1; }

.empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 16px; color: var(--muted); pointer-events: none; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px; }
.empty-icon .ic { width: 26px; height: 26px; color: var(--accent); }
.empty h2 { color: var(--text); margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; }
.empty p { margin: 0; line-height: 1.7; max-width: 460px; }
.empty-links { margin-top: 12px !important; pointer-events: auto; }
.empty-links a { color: var(--accent); font-weight: 500; text-decoration: none; }

/* minimap & zoom (bottom left of the canvas) */
.mapbox { position: absolute; z-index: 12; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#minimap {
  width: 168px; height: 100px; border-radius: 12px; cursor: pointer; display: block;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.zoomrow {
  display: flex; align-items: center; gap: 1px; padding: 3px; border-radius: 11px;
  background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line-2); box-shadow: var(--shadow);
}
.zoomrow button { min-width: 28px; height: 28px; padding: 0 6px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; }
.zoomrow button:hover, .zoomrow button.on { background: var(--hover); color: var(--text); }
.zoomrow .ic { width: 16px; height: 16px; }
.zr-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 3px; }
.canvas-panel { top: auto; bottom: calc(100% + 10px); left: 0; right: auto; width: 290px; padding: 12px; }
.cp-label { font-size: 12px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }
.cp-row + .cp-label { margin-top: 14px; }
.cp-row { display: flex; flex-wrap: wrap; gap: 6px; }
#cpGrid button, .cp-arrange button {
  flex: 1 1 30%; padding: 6px 4px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12.5px; cursor: pointer;
}
#cpGrid button:hover, .cp-arrange button:hover { background: var(--surface-2); }
#cpGrid button.on { border-color: var(--accent); color: var(--accent); }
.cp-swatches > * { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); cursor: pointer; padding: 0; }
.cp-swatches .on { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-swatches .cp-auto { background: linear-gradient(135deg, #f4f2ee 50%, #1b1b1b 50%); }
.cp-swatches label { position: relative; overflow: hidden; display: grid; place-items: center; border-style: dashed; color: var(--muted); font-size: 15px; }
.cp-swatches label.on { border-style: solid; }
.cp-swatches input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* the AI orb (bottom right of the canvas) */
.ai-orb {
  position: absolute; z-index: 12; right: 16px; bottom: 16px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: radial-gradient(circle at 34% 28%, #cfe0ff 0, #7aa3ff 18%, #3a6ae8 48%, #1d3fa8 78%, #13297a 100%);
  box-shadow: 0 6px 18px rgba(40, 90, 230, .45), inset 0 -4px 10px rgba(0, 0, 40, .35);
  transition: transform .15s;
}
.ai-orb span { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 200deg, transparent 0 70%, rgba(255, 255, 255, .35) 80%, transparent 90%); animation: orb 6s linear infinite; }
.ai-orb:hover { transform: scale(1.06); }
@keyframes orb { to { transform: rotate(360deg); } }
body.ai-open .ai-orb { display: none; }

/* ---------- the dock ---------- */
.dock {
  position: fixed; z-index: 24; bottom: 22px;
  left: calc((max(var(--sb-w), var(--gap)) + 100vw - var(--ai-w) - var(--gap)) / 2); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 6px 8px; max-width: calc(100vw - var(--sb-w) - var(--ai-w) - 260px);
  background: color-mix(in srgb, var(--panel) 96%, transparent); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lift);
  backdrop-filter: blur(10px); transition: left .22s cubic-bezier(.2, .8, .2, 1);
}
.dock .tool {
  width: 42px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 11px; background: transparent; cursor: pointer; color: var(--text); text-decoration: none;
}
.dock .tool:hover, .dock .tool.on { background: var(--hover); }
.dock .tool[data-drag] { cursor: grab; touch-action: none; }
.dock-sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 5px; flex: none; }
/* the dock's tiles, macOS style: a coloured rounded square with a soft top light and a white symbol */
.tile {
  position: relative; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, var(--t1), var(--t2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .35);
  transition: transform .15s cubic-bezier(.2, .8, .2, 1);
}
.tile .ic { width: 17px; height: 17px; filter: drop-shadow(0 .5px .5px rgba(0, 0, 0, .25)); }
.dock .tool:hover .tile { transform: translateY(-2px) scale(1.06); }
.tile.t-yellow { --t1: #ffd84f; --t2: #f5b400; } .tile.t-orange { --t1: #ffa34d; --t2: #ff7a00; }
.tile.t-blue { --t1: #5aa8ff; --t2: #1f6ff2; } .tile.t-sky { --t1: #6fd0ff; --t2: #2a9df4; }
.tile.t-teal { --t1: #5fd8cf; --t2: #13a8a0; } .tile.t-green { --t1: #5fd879; --t2: #23b04a; }
.tile.t-indigo { --t1: #8b8cff; --t2: #5856d6; } .tile.t-purple { --t1: #c58cff; --t2: #9b4de0; }
.tile.t-graphite { --t1: #9a9aa0; --t2: #636369; } .tile.t-slate { --t1: #8aa0b8; --t2: #55697f; }
.tile.t-steel { --t1: #b4b6bc; --t2: #808389; }
.tile.t-photos { background: conic-gradient(from 200deg, #ffcc4d, #ff7a59, #e8457a, #8e6cff, #46b4ff, #5fd879, #ffcc4d); }
.tile.t-rainbow { background: conic-gradient(from 0deg, #ff5f57, #ffbd2e, #28c940, #34aadc, #8e6cff, #ff5fa2, #ff5f57); }
.tile.t-photos::after, .tile.t-rainbow::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .25), transparent 60%); }
.tile.t-photos .ic, .tile.t-rainbow .ic { position: relative; z-index: 1; }
.tile.t-calendar { --t1: #fff; --t2: #f2f2f2; color: #1c1c1e; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px; }
.cal-day { font: 600 7px/1 var(--font); color: #ff3b30; letter-spacing: .04em; }
.cal-num { font: 300 15px/1.05 var(--font); color: #1c1c1e; }
#dockTrash.drop-target { background: color-mix(in srgb, var(--danger) 35%, transparent); }
.link-pop {
  position: fixed; z-index: 40; bottom: 84px; left: calc((max(var(--sb-w), var(--gap)) + 100vw - var(--ai-w) - var(--gap)) / 2); transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px)); padding: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.link-pop input { width: 100%; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; outline: none; }
.link-pop input:focus { border-color: var(--accent); }

/* ---------- floating bars ---------- */
.selbar, .fmtbar {
  position: fixed; z-index: 25; top: calc(var(--top-h) + 12px); left: calc((max(var(--sb-w), var(--gap)) + 100vw - var(--ai-w) - var(--gap)) / 2); transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px; padding: 5px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 13px; box-shadow: var(--shadow-lift);
  max-width: calc(100vw - var(--sb-w) - var(--ai-w) - 40px); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
}
.selbar button, .fmtbar button, .selbar select, .selbar input[type=date], .selbar input[type=time] {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; min-width: 30px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--text);
}
.selbar .ic { width: 15px; height: 15px; }
.selbar button:hover, .fmtbar button:hover { background: var(--hover); }
.selbar button.on { background: var(--surface-3); }
.selbar select, .selbar input[type=date], .selbar input[type=time] { background: var(--surface-2); max-width: 180px; }
.selbar .danger { color: var(--danger); }
.selbar .count-pill { padding: 0 8px; font-size: 12px; color: var(--muted); }
.sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 3px; }
.dots { display: flex; gap: 3px; padding: 0 3px; }
.dot-btn { width: 20px !important; min-width: 20px !important; height: 20px !important; padding: 0 !important; border-radius: 50% !important; border: 1px solid var(--line-2) !important; }
.dot-btn.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.selbar input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.selbar .font-btn { font-family: Excalifont, Virgil, cursive; }

.iconpicker {
  position: fixed; z-index: 26; left: calc((max(var(--sb-w), var(--gap)) + 100vw - var(--ai-w) - var(--gap)) / 2); top: calc(var(--top-h) + 62px); transform: translateX(-50%); width: min(400px, calc(100vw - 24px));
  padding: 10px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.ip-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.ip-grid button { aspect-ratio: 1; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 20px; padding: 0; }
.ip-grid button:hover { background: var(--hover); }
.ip-grid button.on { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.ip-row { display: flex; gap: 6px; margin-top: 8px; }
.ip-custom { flex: 1; height: 32px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); outline: none; }
.ip-custom:focus { border-color: var(--accent); }
.ip-remove { height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: transparent; cursor: pointer; }

/* ---------- side panel (a saved link / clip / image / file) ---------- */
.panel {
  position: fixed; z-index: 30; top: calc(var(--top-h) + 12px); right: calc(var(--ai-w) + 22px); bottom: 22px; width: min(370px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lift);
  overflow-y: auto; padding: 14px;
}
.panel .close { position: sticky; top: 0; float: right; z-index: 2; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1; }
.panel .p-media { margin: 0 0 12px; border-radius: 10px; overflow: hidden; background: var(--surface-2); clear: both; }
.panel .p-media img, .panel .p-media video { display: block; width: 100%; max-height: 52vh; object-fit: contain; background: #000; }
.panel .frames { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.panel .frames img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; }
.panel .p-title { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 4px 6px; margin-left: -6px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; resize: none; field-sizing: content; min-height: 1.6em; }
.panel .p-title:hover, .panel .p-title:focus { border-color: var(--line-2); outline: none; }
.panel .p-meta { color: var(--muted); font-size: 12px; margin: 2px 0 12px; word-break: break-all; }
.panel .p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel .open { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 500; text-decoration: none; }
.panel label { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.panel label .ic { width: 13px; height: 13px; }
.panel textarea, .panel input.p-tags { width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); outline: none; }
.panel textarea:focus, .panel input.p-tags:focus { border-color: var(--accent); }
.panel textarea.p-note { min-height: 80px; resize: vertical; }
.panel .ai, .panel .desc { white-space: pre-wrap; font-size: 13px; }
.panel .ai { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.panel .desc { color: var(--muted); }

.toast {
  position: fixed; z-index: 400; left: 50%; bottom: 140px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-radius: 11px; background: var(--text); color: var(--app); box-shadow: var(--shadow-lift);
  max-width: calc(100vw - 32px); font-weight: 500;
}
.toast button { border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; }

/* ---------- notifications & calendar ---------- */
.notify { width: 400px; max-height: min(620px, calc(100vh - 80px)); display: flex; flex-direction: column; padding: 14px; right: -60px; }
.nt-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nt-top b { font-size: 15px; }
.nt-tabs { display: flex; width: 100%; margin-bottom: 10px; }
.nt-tabs button { flex: 1; justify-content: center; height: 32px; font-weight: 500; }
.nt-badge { background: #f05a3a; color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 0 6px; margin-left: 4px; }
.nt-list { overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nt-filters { margin-bottom: 10px; border: 0; background: transparent; padding: 0; }
.nt-filters button.on { background: var(--surface-3); }
.nt-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; color: var(--text); }
.nt-row:hover { background: var(--hover); }
.nt-dot { width: 7px; height: 7px; border-radius: 50%; background: #f05a3a; flex: none; }
.nt-dot.off { background: transparent; }
.nt-av { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); overflow: hidden; }
.nt-av.ai { background: color-mix(in srgb, var(--accent) 25%, var(--surface-2)); color: #9fb8ff; }
.nt-av.extension { background: color-mix(in srgb, #3a86ff 18%, var(--surface-2)); color: #8fc4ff; }
.nt-pic { width: 100%; height: 100%; background: center / cover; }
.nt-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-txt > span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nt-txt small { color: var(--muted); font-size: 12px; }
.nt-time { color: var(--muted); font-size: 12px; flex: none; }
.nt-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 12px 8px 4px; }
.nt-head .ic { width: 15px; height: 15px; }
.nt-chip { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 7px; border-radius: 6px; margin-right: 8px; background: #5c4719; color: #f2cf7a; }
.nt-chip.late { background: #713430; color: #f6b9b1; }
:root[data-theme="light"] .nt-chip { background: #fbefbe; color: #7d6310; }
.nt-feature { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; margin-bottom: 6px; border-radius: 12px; background: var(--surface); border-left: 3px solid var(--a-orange); }
.nt-f-main { display: flex; flex-direction: column; gap: 2px; }
.nt-f-acts { display: flex; gap: 8px; }
.nt-none { color: var(--muted); padding: 16px 8px; margin: 0; }

/* ---------- search ---------- */
.palette-back { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .45); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lift); overflow: hidden; }
.pa-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pa-input .ic { color: var(--muted); }
.pa-input input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; }
.pa-filters { margin: 10px 14px 4px; border: 0; background: transparent; padding: 0; flex-wrap: wrap; }
.pa-filters button.on { background: var(--surface-3); }
.pa-results { overflow-y: auto; padding: 6px 8px 8px; }
.pa-hit { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.pa-hit.on, .pa-hit:hover { background: var(--hover); }
.pa-pic, .pa-ic { width: 38px; height: 38px; flex: none; border-radius: 8px; background: var(--surface-2) center / cover; display: grid; place-items: center; color: var(--muted); }
.pa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pa-txt b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pa-none { color: var(--muted); padding: 20px 12px; margin: 0; }
.pa-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.count { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- the AI panel ---------- */
.ai-panel {
  position: fixed; z-index: 26; top: var(--top-h); right: var(--gap); bottom: var(--gap); width: calc(var(--ai-w) - var(--gap));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.ai-panel.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
.ai-head { position: relative; display: flex; align-items: center; gap: 2px; padding: 10px 10px 6px 12px; }
.ai-chats { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 500; color: var(--text); max-width: 260px; }
.ai-chats:hover { background: var(--hover); }
.ai-chats .ic:first-child { color: var(--muted); }
.ai-chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-history { left: 8px; right: auto; top: 46px; width: 300px; max-height: 420px; overflow-y: auto; }
.ai-history button { justify-content: space-between; }
.ai-history button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 12px; }
.ai-log { display: flex; flex-direction: column; gap: 14px; }
.ai-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18vh 10px 20px; gap: 6px; }
.ai-empty h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; margin: 10px 0 12px; letter-spacing: -.01em; }
.ai-empty p { max-width: 300px; font-size: 13px; color: var(--muted); }
.ai-badge { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.ai-badge .ic { width: 24px; height: 24px; color: var(--accent); fill: color-mix(in srgb, var(--accent) 30%, transparent); }
.ai-starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 310px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 550; }
.chip:hover { background: var(--surface-2); }
.chip .ic { width: 14px; height: 14px; color: var(--muted); }
.ai-msg.user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ai-msg .bubble { max-width: 88%; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-msg .bubble.answer { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.am-att { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.am-board { font-size: 11.5px; color: var(--muted); padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); }
.ai-msg.bot { display: flex; flex-direction: column; gap: 8px; }
.ai-thought { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.ai-thought .ic { color: var(--faint); }
.ai-update { color: var(--muted); font-size: 13px; padding-left: 10px; border-left: 2px solid var(--line-2); white-space: pre-wrap; }
.ai-text { line-height: 1.6; overflow-wrap: anywhere; }
.ai-text p { margin: 0 0 .55em; } .ai-text p:last-child { margin-bottom: 0; }
.ai-text ul, .ai-text ol { margin: .2em 0 .6em; padding-left: 1.3em; }
.ai-text a { color: var(--accent); }
.ai-error { color: var(--danger); font-size: 13px; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, var(--danger) 10%, transparent); }
.ai-steps { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); padding: 10px 12px; }
.as-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.as-head b { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-n { color: var(--muted); font-size: 12px; }
.as-row { display: grid; grid-template-columns: 18px 70px 1fr; align-items: center; gap: 6px; margin-top: 7px; font-size: 12.5px; }
.as-ic { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.as-ic .ic { width: 11px; height: 11px; stroke-width: 2.4; }
.as-row.done .as-ic { background: color-mix(in srgb, var(--ok) 25%, var(--surface-3)); color: var(--ok); }
.as-row.error .as-ic { background: color-mix(in srgb, var(--danger) 25%, var(--surface-3)); color: var(--danger); }
.as-label { color: var(--muted); }
.as-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-made { display: flex; flex-direction: column; gap: 4px; }
.ai-made-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); text-align: left; font-size: 13px; }
.ai-made-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-made-item:hover { border-color: var(--accent); }
.ai-made-item .ic { width: 15px; height: 15px; color: var(--muted); }
.ai-question { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.aq-q { font-weight: 500; margin-bottom: 4px; }
.aq-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; color: var(--text); }
.aq-opt:hover:not(:disabled) { border-color: var(--accent); }
.aq-opt:disabled { cursor: default; opacity: .7; }
.aq-n { width: 22px; height: 22px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 700; color: var(--muted); }
.aq-txt { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.aq-txt small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.aq-tag { font-size: 10.5px; font-weight: 700; color: #9fb8ff; background: color-mix(in srgb, var(--accent) 22%, transparent); padding: 0 6px; border-radius: 5px; }
.aq-other { display: flex; gap: 6px; margin-top: 2px; }
.aq-other input { flex: 1; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); outline: none; }
.aq-other input:focus { border-color: var(--accent); }
.aq-skip { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.ai-qa { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.qa-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.qa-a { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-top: 4px; }
.qa-a .ic { width: 14px; height: 14px; color: var(--ok); }
.ai-composer { position: relative; margin: 0 12px 12px; padding: 10px 10px 8px; border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); }
.ai-composer:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); }
.ai-composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; padding: 2px 4px; font-size: 14px; max-height: 200px; field-sizing: content; min-height: 54px; }
.ai-composer textarea::placeholder { color: var(--faint); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ai-chips:empty { display: none; }
.ai-ctx, .ai-ref, .ai-file { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; max-width: 220px; }
.ai-ctx { color: var(--muted); }
.ai-ctx i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; background: var(--accent-c, var(--a-blue)); }
.ai-ref .ic { width: 13px; height: 13px; color: var(--muted); }
.ai-ref, .ai-file { overflow: hidden; }
.ai-ref button, .ai-file button { width: 16px; height: 16px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ai-ref button .ic, .ai-file button .ic { width: 12px; height: 12px; }
.ai-file { flex-direction: row; height: auto; min-height: 26px; padding: 4px 8px; }
.af-pic { width: 22px; height: 22px; border-radius: 5px; background: center / cover; flex: none; }
.af-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-kind { font-size: 9.5px; font-weight: 800; padding: 1px 4px; border-radius: 4px; background: #555; color: #fff; flex: none; }
.ai-file.k-pdf .af-kind { background: #d9443a; } .ai-file.k-img .af-kind { background: #6d4ee6; } .ai-file.k-txt .af-kind { background: #5d6470; }
.ai-bar { position: relative; display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ai-wf { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.ai-wf:hover, .ai-wf.on { background: var(--hover); color: var(--text); }
.ai-wf .ic { width: 15px; height: 15px; }
.ai-effort { height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0 4px; border-radius: 7px; }
.ai-effort:hover { background: var(--hover); color: var(--text); }
.ai-send { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); cursor: pointer; }
.ai-send.ready, .ai-send.stop { background: var(--accent); color: #fff; }
.ai-send .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.ai-send.stop .ic { fill: #fff; }
.ai-attach, .ai-workflows { top: auto; bottom: calc(100% + 10px); left: 0; right: auto; width: 290px; }
.ai-workflows { max-height: 420px; overflow-y: auto; left: 30px; }
.ai-workflows button span, .ai-attach button { display: flex; flex-direction: column; align-items: flex-start; }
.ai-attach button { flex-direction: row; }
.ai-workflows small { color: var(--muted); font-size: 12px; }
.ai-workflows .ic, .ai-attach .ic { color: var(--muted); }
.ai-suggest { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); max-height: 300px; overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lift); z-index: 5; }
.ai-suggest button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.ai-suggest button.on, .ai-suggest button:hover { background: var(--hover); }
.ai-suggest span { display: flex; flex-direction: column; }
.ai-suggest small { color: var(--muted); font-size: 12px; }
.ai-suggest .ic { color: var(--muted); }

/* ---------- share, help, account ---------- */
.modal { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .5); }
.modal-card {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lift);
}
.modal-card h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.modal-card h3 { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.modal-card section { padding: 16px 0; border-top: 1px solid var(--line); }
.modal-card section:first-of-type { margin-top: 12px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 18px; line-height: 1; }
.share-card { width: min(460px, 100%); }
.sh-what { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; }
.sh-what .ic { width: 16px; height: 16px; }
.sh-block { display: flex; flex-direction: column; gap: 10px; }
.sh-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sh-row p { margin: 4px 0 0; font-size: 13px; }
.sh-link { display: flex; gap: 8px; }
.sh-link input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.sh-open a { color: var(--accent); font-size: 13px; text-decoration: none; }
.sh-mail { display: flex; flex-direction: column; gap: 8px; }
.sh-mail input, .sh-mail textarea { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); outline: none; resize: vertical; }
.sh-mail input:focus, .sh-mail textarea:focus { border-color: var(--accent); }
.sh-mail .btn { align-self: flex-start; }
.sh-nets { display: flex; flex-wrap: wrap; gap: 8px; }
.net { padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; font-weight: 550; }
.net:hover { border-color: var(--accent); }
.sh-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.switch { position: relative; flex: none; width: 40px; height: 23px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .15s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }
.help-card { width: min(760px, 100%); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 8px; }
.help-grid section { border-top: 1px solid var(--line); padding: 14px 0; margin: 0 !important; }
.help-grid p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.help-grid b { color: var(--text); }
.ac-email { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.ac-muted { margin: 0; color: var(--muted); font-size: 13px; }
.ac-meter { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin-bottom: 6px; }
.ac-meter span { display: block; height: 100%; width: 0; background: var(--ok); }
.ac-meter.full span { background: var(--danger); }
.ac-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.ac-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ac-row input { flex: 1 1 200px; height: 36px; padding: 0 10px; color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; outline: none; }
.ac-row input:focus { border-color: var(--accent); }
.ac-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 9px; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; }
.ac-btn:hover { border-color: var(--accent); }
.ac-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.ac-tokens { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ac-tokens li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ac-tokens small { display: block; color: var(--muted); font-size: 12px; }
.ac-danger h3 { color: var(--danger); }
.ac-sub { margin-top: 16px; }
.ac-sub .ac-muted { font-weight: 400; }
#acAiSection > .ac-muted, #acAiKeys { margin-bottom: 8px; }
#acAiSection code { font: 12px ui-monospace, Consolas, monospace; }
.ac-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.ac-check input { flex: none; width: auto; height: auto; padding: 0; }
.ac-newkey { margin-top: 10px; padding: 10px; border: 1px solid var(--accent); border-radius: 10px; }
.ac-newkey input { font: 12px ui-monospace, Consolas, monospace; }
#acMessage { margin-top: 8px; }

/* ---------- sign-in ---------- */
.signin { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle, var(--dot) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--app); }
.signin-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 28px 24px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-lift); }
.signin-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.logo { flex: none; width: 18px; height: 18px; border-radius: 5px; background: conic-gradient(from 45deg, #ff5a36 0 25%, #ffb020 0 50%, #8338ec 0 75%, #3a86ff 0); }
.signin-card h1 { margin: 8px 0 0; font-size: 22px; letter-spacing: -.02em; }
.signin-sub { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.signin-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.signin-card input { height: 40px; padding: 0 12px; font-weight: 400; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; outline: none; color: var(--text); }
.signin-card input:focus { border-color: var(--accent); }
.signin-msg { margin: 0; padding: 8px 10px; border-radius: 9px; font-size: 13px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.signin-msg.good { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--ok); }
.signin-go { height: 42px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; background: var(--accent); color: #fff; }
.signin-go:disabled { opacity: .6; cursor: progress; }
.signin-alt { margin: 0; display: flex; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; }
.signin-secondary { height: 40px; border-radius: 10px; cursor: pointer; font-weight: 500; background: transparent; color: var(--text); border: 1px solid var(--line-2); }
.signin-secondary:hover { border-color: var(--accent); }
.signin-secondary:disabled { opacity: .6; cursor: progress; }
.signin-card [hidden] { display: none !important; }

/* ---------- the read-only viewer ---------- */
.viewer .topbar { left: 0; }
.viewer #viewport { left: var(--gap); right: var(--gap); }
.viewer .card { cursor: default; }
.viewer .card.t-board { cursor: pointer; }

/* ---------- drawing (app/draw/) ---------- */
/* Shapes over the cards; the selection box over the shapes. Dark mode shows colours the way Excalidraw does. */
#shapes, #shapeUi { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
#shapes { z-index: 100000; }
#shapeUi { z-index: 100001; }
#shapes .hidden { display: none; }
#shapes .erasing { opacity: .25; }
#shapeUi .outline { fill: none; stroke: var(--accent); stroke-width: calc(1px / var(--z, 1)); vector-effect: non-scaling-stroke; opacity: .6; }
#shapeUi .frame { fill: none; stroke: var(--accent); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
#shapeUi .h { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
#shapeUi .bind { fill: none; stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; opacity: .6; }
.shape-text-editor { position: absolute; z-index: 100002; margin: 0; padding: 0; border: 0; outline: 1px dashed var(--accent); background: transparent; resize: none; overflow: hidden; white-space: pre; tab-size: 4; }
/* On a dark background drawings are shown inverted (like Excalidraw's dark mode), whatever the theme. */
body[data-canvas-tone="dark"] :is(#shapes, .shape-text-editor, .sp-swatch) { filter: invert(93%) hue-rotate(180deg); }
body[data-tool="rectangle"] #viewport, body[data-tool="diamond"] #viewport, body[data-tool="ellipse"] #viewport,
body[data-tool="arrow"] #viewport, body[data-tool="line"] #viewport, body[data-tool="freedraw"] #viewport { cursor: crosshair; }
body[data-tool="text"] #viewport { cursor: text; }
body[data-tool="eraser"] #viewport { cursor: cell; }
body[data-tool="hand"] #viewport { cursor: grab; }

.toolbar {
  position: fixed; z-index: 24; bottom: 84px; left: calc((max(var(--sb-w), var(--gap)) + 100vw - var(--ai-w) - var(--gap)) / 2); transform: translateX(-50%); width: max-content;
  display: flex; align-items: center; gap: 2px; padding: 4px; max-width: calc(100vw - 24px); overflow-x: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lift);
}
.toolbar button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.toolbar button:hover { background: var(--hover); }
.toolbar button.on { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent); }
.toolbar svg, .style-panel svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toolbar .sep { height: 20px; }

.style-panel {
  position: fixed; z-index: 24; left: calc(max(var(--sb-w), var(--gap)) + 14px); top: calc(var(--top-h) + 14px); width: 214px; max-height: calc(100vh - var(--top-h) - 120px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lift);
}
.style-panel[hidden] { display: none; }
.sp-row { display: flex; flex-direction: column; gap: 5px; }
.sp-label { font-size: 11px; font-weight: 500; color: var(--muted); }
.sp-items { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sp-swatch { width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid var(--line-2); background: var(--c); cursor: pointer; }
.sp-swatch.none { background: repeating-conic-gradient(var(--line-2) 0 25%, transparent 0 50%) 0 0 / 8px 8px; }
.sp-swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-custom { width: 26px; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.sp-opt { min-width: 30px; height: 30px; padding: 0 6px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 14px; }
.sp-opt:hover { border-color: var(--line-2); }
.sp-opt.on { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.sp-opt.danger { color: var(--danger); }
.sp-select { height: 30px; flex: 1; min-width: 0; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); }
.sp-range { width: 100%; accent-color: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  body.ai-open { --ai-w: 360px; }
  .dock { max-width: calc(100vw - var(--sb-w) - var(--ai-w) - 40px); overflow-x: auto; }
  .mapbox #minimap { display: none; }
}
@media (max-width: 760px) {
  :root { --sb-w: 0px; --gap: 6px; }
  body:not(.sb-collapsed) .sidebar { transform: none; box-shadow: var(--shadow-lift); }
  body.sb-collapsed .sidebar { transform: translateX(-100%); }
  .topbar { left: 0; padding-right: 8px; }
  #tbHelp, #modeSeg, .tb-sep, #tbPresent, .viewer-note { display: none; }
  body.ai-open { --ai-w: 0px; }
  .ai-panel { left: 6px; right: 6px; width: auto; z-index: 35; }
  .dock { left: 50%; bottom: 12px; max-width: calc(100vw - 16px); overflow-x: auto; }
  .toolbar, .link-pop { left: 50%; bottom: 74px; }
  .selbar, .fmtbar, .iconpicker { left: 50%; }
  .mapbox { bottom: 74px; }
  .ai-orb { bottom: 74px; }
  .panel { left: 6px; right: 6px; width: auto; top: auto; height: 60vh; }
  .notify { position: fixed; left: 8px; right: 8px; top: 56px; width: auto; }
  .help-grid { grid-template-columns: 1fr; }
}

/* ---------- board marks, covers, the icon & picture picker, adding columns ---------- */
.bmark { width: 20px; height: 20px; border-radius: 6px; flex: none; display: inline-grid; place-items: center; font-size: 13px; line-height: 1; vertical-align: middle; }
.bmark.pic { background: var(--surface-3) center / cover; }
.bmark.bm-sw { background: var(--accent-c, var(--a-blue)); }
.bmark.line { background: color-mix(in srgb, var(--accent-c, var(--a-blue)) 22%, var(--surface-2)); color: var(--accent-c, var(--a-blue)); }
.bmark.line .ic { width: 13px; height: 13px; }
.crumbs .bmark { width: 18px; height: 18px; border-radius: 5px; }
.ai-ctx .bmark { width: 14px; height: 14px; border-radius: 4px; font-size: 11px; }
.ai-ctx .bmark .ic { width: 10px; height: 10px; }
.sel-mark { width: 16px; height: 16px; border-radius: 4px; font-size: 11px; }
.b-cover.has-cover { position: relative; display: block; }
.b-cover.has-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.b-badge { position: absolute; left: 8px; bottom: 8px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: rgba(20, 20, 20, .72); color: #fff; backdrop-filter: blur(6px); }
.b-badge .ic { width: 16px; height: 16px; }
.b-cover .b-line { width: 38%; height: 38%; color: var(--accent-c, var(--a-blue)); stroke-width: 1.5; }
.iconpicker { display: flex; flex-direction: column; gap: 10px; }
.ip-tabs { align-self: flex-start; }
.ip-lines button { color: var(--accent-c, var(--a-blue)); display: grid; place-items: center; }
.ip-lines button .ic { width: 20px; height: 20px; }
.ip-hint { margin: 0; color: var(--muted); font-size: 12px; }
.ip-sub { font-size: 12px; color: var(--muted); }
.ip-pics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ip-pics button { aspect-ratio: 1; border-radius: 8px; border: 2px solid transparent; background: var(--surface-2) center / cover; cursor: pointer; padding: 0; }
.ip-pics button.on { border-color: var(--accent); }
.ip-foot { align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 0; }
.ip-now { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.ip-now span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cols-pop { width: 320px; gap: 10px; padding: 12px; z-index: 70; }
.cols-pop .mh { padding: 0; }
.cols-pop label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.cols-pop input, .cols-pop select { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); outline: none; font-size: 13px; }
.cols-pop input:focus { border-color: var(--accent); }
.cols-row { display: flex; gap: 6px; align-items: center; }
.card.t-table th.tb-add { width: 34px; padding: 0 6px; text-align: center; }
.tb-addcol { width: 22px; height: 22px; border-radius: 6px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; opacity: 0; transition: opacity .12s; }
.card.t-table:hover .tb-addcol, .card.t-table.selected .tb-addcol { opacity: 1; }
.tb-addcol:hover { color: var(--text); border-color: var(--accent); }

/* ---------- icons and pop-up menus, Apple style ---------- */
.ic.f7 { fill: currentColor; stroke: none; }
.apple-select-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden !important; }
.apple-select {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px 0 10px; max-width: 220px;
  border: 1px solid var(--line-2); border-radius: 7px; cursor: pointer; text-align: left; font: inherit; font-size: 13px; color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 70%, var(--surface)), var(--surface-2));
  box-shadow: 0 .5px 1px rgba(0, 0, 0, .3), inset 0 .5px 0 rgba(255, 255, 255, .06);
}
.apple-select:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--line-2)); }
.apple-select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.apple-select.open { border-color: var(--accent); }
.apple-select:disabled { opacity: .5; cursor: default; }
.as-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-chev { width: 11px !important; height: 11px !important; flex: none; color: var(--muted); }
.apple-menu {
  position: fixed; z-index: 1000; padding: 5px; overflow-y: auto; font-size: 13px; color: var(--text);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(28px) saturate(1.8); -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border: .5px solid color-mix(in srgb, var(--text) 16%, transparent); border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(0, 0, 0, .4);
  animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: scale(.98); } }
.am-group { padding: 6px 10px 3px 28px; font-size: 11px; font-weight: 500; color: var(--muted); }
.am-item { display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 12px 0 6px; border-radius: 5px; cursor: default; white-space: nowrap; }
.am-item.hover { background: #0a84ff; color: #fff; }
.am-item.off { opacity: .4; }
.am-check { width: 18px; display: grid; place-items: center; flex: none; }
.am-check .ic { width: 12px; height: 12px; }
/* the board's right-click menu */
.ctx-menu { min-width: 210px; }
.ctx-menu .am-label { flex: 1; }
.ctx-menu kbd { margin-left: 18px; padding: 0; border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted); }
.ctx-menu .am-more { margin-left: 14px; color: var(--muted); }
.ctx-menu .am-item.hover kbd, .ctx-menu .am-item.hover .am-more { color: rgba(255, 255, 255, .8); }
.ctx-menu .am-item.danger { color: #ff453a; }
.ctx-menu .am-item.danger.hover { background: #ff453a; color: #fff; }
.am-sep { height: 1px; margin: 4px 8px; background: color-mix(in srgb, var(--text) 12%, transparent); }
:root[data-theme="light"] .apple-menu { box-shadow: 0 10px 30px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .12); }
:root[data-theme="light"] .am-item.hover { background: #007aff; }
:root[data-theme="light"] .apple-select { background: linear-gradient(180deg, #fff, #f6f6f6); }
/* where a pop-up sits in a bar or a form */
.selbar .apple-select { height: 30px; border-color: transparent; background: var(--surface-2); box-shadow: none; }
.cols-pop .apple-select, .style-panel .apple-select { width: 100%; max-width: none; }
.ai-bar .apple-select.ai-effort { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); padding: 0 4px 0 8px; }
.ai-bar .apple-select.ai-effort:hover { background: var(--hover); color: var(--text); }

/* ---------- the dock, like the macOS Dock (app/dock.js swells the icons) ---------- */
.dock {
  --base: 48px;
  bottom: 10px; gap: 4px; padding: 5px 7px 6px; align-items: flex-end; overflow: visible; max-width: none;
  background: rgba(255, 255, 255, .13);
  border: .5px solid rgba(255, 255, 255, .2); border-radius: 22px;
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45), inset 0 .5px 0 rgba(255, 255, 255, .2);
}
:root[data-theme="light"] .dock { background: rgba(255, 255, 255, .55); border-color: rgba(0, 0, 0, .1); box-shadow: 0 12px 34px rgba(0, 0, 0, .16), inset 0 .5px 0 rgba(255, 255, 255, .8); }
.dock .tool {
  --s: 1;
  /* the slot widens as the icon swells (pushing its neighbours apart); the shelf keeps its height and the icon rises out of it */
  position: relative; width: calc(var(--base, 48px) * var(--s)); height: var(--base, 48px); padding: 0;
  display: flex; align-items: flex-end; justify-content: center; background: none !important; border-radius: 0;
  transition: width .2s cubic-bezier(.2, .8, .2, 1), height .2s cubic-bezier(.2, .8, .2, 1);
}
.dock.magnify .tool, .dock.magnify .tool .tile { transition: width .07s linear, height .07s linear; }
.dock .tool .tile {
  position: absolute; left: 0; bottom: 0; width: 100%; height: calc(var(--base, 48px) * var(--s)); border-radius: 22.5%;
  transition: height .2s cubic-bezier(.2, .8, .2, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), inset 0 -1px 0 rgba(0, 0, 0, .14), 0 2px 5px rgba(0, 0, 0, .38);
}
.dock .tool:hover .tile { transform: none; }
.dock .tool .tile .ic { width: 54%; height: 54%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.dock .tool .tile::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent 48%); pointer-events: none; }
.dock .tile.t-calendar { font-size: calc(var(--base, 48px) * var(--s) * .155); padding-top: .55em; }
.dock .tile.t-calendar::before { display: none; }
.dock .cal-day { font-size: 1em; }
.dock .cal-num { font-size: 2.55em; line-height: 1; }
.dock-sep { width: 1px; height: calc(var(--base, 48px) - 6px); align-self: center; background: rgba(255, 255, 255, .24); margin: 0 5px; }
:root[data-theme="light"] .dock-sep { background: rgba(0, 0, 0, .14); }
/* a "running" dot, as under an open app: drawing is on */
.dock .tool.on::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(255, 255, 255, .8); }
:root[data-theme="light"] .dock .tool.on::after { background: rgba(0, 0, 0, .55); }
#dockTrash.drop-target .tile { filter: brightness(1.25); transform: scale(1.12); }
@keyframes dock-bounce { 0%, 100% { transform: translateY(0); } 28% { transform: translateY(-24px); } 52% { transform: translateY(0); } 72% { transform: translateY(-9px); } 86% { transform: translateY(0); } }
.dock .tile.bounce { animation: dock-bounce .75s cubic-bezier(.3, .7, .4, 1); }
.dock-tip {
  position: fixed; z-index: 60; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  padding: 4px 10px; border-radius: 7px; font-size: 12.5px; color: #fff;
  background: rgba(36, 36, 36, .88); border: .5px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
:root[data-theme="light"] .dock-tip { background: rgba(250, 250, 250, .9); color: #1c1c1e; border-color: rgba(0, 0, 0, .1); }
/* what sits above the dock moves up with it */
.toolbar, .link-pop { bottom: 96px; }
@media (max-width: 1100px) { .dock { --base: 40px; } }
@media (max-width: 760px) { .dock { --base: 36px; max-width: calc(100vw - 16px); overflow-x: auto; overflow-y: visible; } .toolbar, .link-pop { bottom: 70px; } }

/* ==========================================================================================================
   Apple layer — the whole app in the language of macOS: system colours and blue, a unified toolbar, a sidebar
   like Finder's, push buttons and text fields with the blue focus ring, frosted (vibrant) panels, menus and
   sheets, Spotlight-style search, capsule tags. It sits last and only restyles; the layout above stays.
   ========================================================================================================== */
:root {
  --app: #1f1f21;
  --sidebar: #2a2a2d;
  --canvas: #1c1c1e;
  --dot: rgba(255, 255, 255, .055);
  --panel: #2c2c2e;
  --surface: #2c2c2e;
  --surface-2: #3a3a3c;
  --surface-3: #48484a;
  --hover: rgba(255, 255, 255, .07);
  --wall: rgba(255, 255, 255, .035);
  --wall-line: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --muted: #98989d;
  --faint: #6e6e73;
  --accent: #0a84ff;
  --accent-2: #0077ed;
  --vibrant: rgba(44, 44, 46, .72);
  --ring: 0 0 0 3.5px rgba(10, 132, 255, .5);
  --shadow: 0 .5px 1px rgba(0, 0, 0, .3), 0 3px 12px rgba(0, 0, 0, .2);
  --shadow-lift: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(0, 0, 0, .5);
  --danger: #ff453a;
  --ok: #30d158;
  --a-red: #ff453a; --a-orange: #ff9f0a; --a-yellow: #ffd60a; --a-green: #30d158; --a-blue: #0a84ff;
  --a-purple: #bf5af2; --a-pink: #ff375f; --a-brown: #ac8e68; --a-gray: #98989d;
  --c-yellow: #3a3423; --c-orange: #3b2c1c; --c-red: #3b2322; --c-pink: #3a2129; --c-purple: #33263f;
  --c-blue: #1d2c42; --c-green: #1e3425; --c-brown: #372d24; --c-gray: #333335;
  --radius: 12px;
}
:root[data-theme="light"] {
  --app: #ececee;
  --sidebar: #e3e3e6;
  --canvas: #fbfbfd;
  --dot: rgba(0, 0, 0, .08);
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --hover: rgba(0, 0, 0, .05);
  --wall: rgba(0, 0, 0, .025);
  --wall-line: rgba(0, 0, 0, .07);
  --line: rgba(0, 0, 0, .08);
  --line-2: rgba(0, 0, 0, .13);
  --text: #1d1d1f;
  --text-2: #48484a;
  --muted: #6e6e73;
  --faint: #aeaeb2;
  --accent: #007aff;
  --accent-2: #0068da;
  --vibrant: rgba(246, 246, 248, .78);
  --ring: 0 0 0 3.5px rgba(0, 122, 255, .35);
  --shadow: 0 .5px 1px rgba(0, 0, 0, .08), 0 3px 12px rgba(0, 0, 0, .06);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .08);
  --danger: #ff3b30;
  --ok: #34c759;
  --a-red: #ff3b30; --a-orange: #ff9500; --a-yellow: #ffcc00; --a-green: #34c759; --a-blue: #007aff;
  --a-purple: #af52de; --a-pink: #ff2d55; --a-brown: #a2845e; --a-gray: #8e8e93;
  --c-yellow: #fff6d6; --c-orange: #ffecd6; --c-red: #ffe3e1; --c-pink: #ffe1e8; --c-purple: #f3e6fa;
  --c-blue: #e1eeff; --c-green: #e0f6e6; --c-brown: #f1e9df; --c-gray: #f0f0f2;
}

/* text: macOS sizes */
body { font-size: 13.5px; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* thin overlay scrollbars */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 22%, transparent) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- the sidebar, like Finder's ---------- */
.sidebar { background: var(--sidebar); border-right: .5px solid var(--line); padding: 10px 8px 10px; }
.sb-workspace { height: 30px; border-radius: 7px; font-size: 13px; }
.sb-link { height: 28px; border-radius: 6px; font-size: 13px; padding: 0 8px; }
.sb-link .ic, .sb-foot-link .ic { color: var(--accent); }
.sb-link.here { background: var(--hover); }
.sb-search { height: 28px; border-radius: 7px; border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 5%, transparent); font-size: 13px; }
.sb-search kbd { background: transparent; border-color: var(--line-2); }
.sb-section { font-size: 11px; font-weight: 600; color: var(--faint); padding: 12px 10px 4px; }
.sb-row { height: 28px; border-radius: 6px; }
.sb-row.here { background: color-mix(in srgb, var(--text) 12%, transparent); }
.sb-title { font-size: 13px; }
.sb-count { border: 0; background: transparent; color: var(--faint); }
.sb-foot { border-top: .5px solid var(--line); }

/* ---------- the toolbar, unified with the window ---------- */
.topbar { background: var(--app); border-bottom: 0; height: var(--top-h); }
.icon-btn { width: 30px; height: 28px; border-radius: 6px; color: var(--muted); }
.icon-btn .ic { width: 17px; height: 17px; }
.icon-btn:hover, .icon-btn.on { background: var(--hover); color: var(--text); }
.crumbs a { font-size: 13px; font-weight: 500; border-radius: 6px; }
.tb-sep { height: 16px; background: var(--line-2); }

/* push buttons */
.btn {
  height: 28px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500;
  border: .5px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: color-mix(in srgb, var(--text) 9%, transparent);
  box-shadow: 0 .5px 1px rgba(0, 0, 0, .18);
}
.btn:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }
.btn:active { filter: brightness(.92); }
:root[data-theme="light"] .btn { background: #fff; border-color: rgba(0, 0, 0, .12); box-shadow: 0 .5px 1.5px rgba(0, 0, 0, .12); }
:root[data-theme="light"] .btn:hover { background: #f7f7f7; }
.btn.primary, :root[data-theme="light"] .btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); border-color: transparent; color: #fff;
  box-shadow: 0 .5px 1.5px rgba(0, 0, 0, .25), inset 0 .5px 0 rgba(255, 255, 255, .25);
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); }
.btn:focus-visible, .icon-btn:focus-visible, .apple-select:focus-visible { outline: none; box-shadow: var(--ring); }

/* segmented controls */
.seg { padding: 2px; gap: 0; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.seg button { height: 24px; border-radius: 6px; font-size: 12.5px; }
.seg button.on { background: color-mix(in srgb, var(--text) 20%, transparent); box-shadow: 0 .5px 1.5px rgba(0, 0, 0, .3); }
:root[data-theme="light"] .seg button.on { background: #fff; box-shadow: 0 .5px 2px rgba(0, 0, 0, .18); }
.seg.mode button { width: 30px; }

/* text fields */
.sh-link input, .sh-mail input, .sh-mail textarea, .ac-row input, .signin-card input, .cols-pop input,
.panel textarea, .panel input.p-tags, .link-pop input, .aq-other input, .ip-custom, .sb-rename {
  border: .5px solid var(--line-2); border-radius: 7px; background: color-mix(in srgb, var(--text) 5%, transparent);
}
:root[data-theme="light"] :is(.sh-link input, .sh-mail input, .sh-mail textarea, .ac-row input, .signin-card input, .cols-pop input, .panel textarea, .panel input.p-tags, .link-pop input, .aq-other input, .ip-custom) { background: #fff; }
:is(.sh-link input, .sh-mail input, .sh-mail textarea, .ac-row input, .signin-card input, .cols-pop input, .panel textarea, .panel input.p-tags, .link-pop input, .aq-other input, .ip-custom, .sb-rename):focus {
  border-color: var(--accent); box-shadow: var(--ring); outline: none;
}

/* toggles, macOS size */
.switch { width: 38px; height: 22px; }
.switch span { background: color-mix(in srgb, var(--text) 18%, transparent); border: 0; }
.switch span::after { width: 20px; height: 20px; left: 1px; top: 1px; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- frosted panels, menus, sheets ---------- */
.pop, .menu, .selbar, .fmtbar, .iconpicker, .toolbar, .style-panel, .canvas-panel, .link-pop, .panel, .notify, .palette, .modal-card, .apple-menu, #minimap, .zoomrow, .present-bar, .toast, .ai-history, .ai-attach, .ai-workflows, .ai-suggest {
  background: var(--vibrant);
  backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border: .5px solid color-mix(in srgb, var(--text) 14%, transparent);
  box-shadow: var(--shadow-lift);
}
.pop, .menu, .iconpicker, .canvas-panel, .link-pop, .notify, .cols-pop, .ai-history, .ai-attach, .ai-workflows, .ai-suggest { border-radius: 12px; }
.selbar, .fmtbar, .toolbar { border-radius: 11px; }
.menu > button, .menu > a { border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.menu > button:hover, .menu > a:hover { background: var(--accent); color: #fff; }
.menu > button:hover small, .menu > a:hover small, .menu > button:hover .ic, .menu > a:hover .ic { color: rgba(255, 255, 255, .85); }
.menu > button.danger:hover { background: var(--danger); color: #fff; }
.menu .mh { font-size: 12px; color: var(--muted); font-weight: 600; }
.modal { background: rgba(0, 0, 0, .38); }
.modal-card { border-radius: 14px; }
.modal-close { width: 26px; height: 26px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--text) 12%, transparent); font-size: 15px; color: var(--muted); }
.modal-close:hover { background: color-mix(in srgb, var(--text) 20%, transparent); color: var(--text); }
.toast { color: var(--text); border-radius: 12px; padding: 10px 16px; font-size: 13px; }
.toast button { color: var(--accent); }

/* ---------- the canvas and its cards ---------- */
#viewport { border: .5px solid var(--line); border-radius: 12px; }
.card { border: .5px solid color-mix(in srgb, var(--text) 9%, transparent); box-shadow: var(--shadow); }
.card:hover { box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .28); }
:root[data-theme="light"] .card:hover { box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 26px rgba(0, 0, 0, .1); }
.card.selected { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.card.t-wall { border-radius: 18px; border: .5px solid var(--wall-line); }
.card.t-heading, .card.t-heading:hover { border-color: transparent; }
.tag { border-radius: 999px; padding: 2px 9px; font-weight: 500; background: color-mix(in srgb, var(--tc2, var(--a-gray)) 22%, transparent); color: var(--tc2, var(--muted)); }
.tag.t-blue { --tc2: var(--a-blue); } .tag.t-green { --tc2: var(--a-green); } .tag.t-purple { --tc2: var(--a-purple); }
.tag.t-brown { --tc2: var(--a-brown); } .tag.t-red { --tc2: var(--a-red); } .tag.t-yellow { --tc2: var(--a-yellow); }
.tag.t-gray { --tc2: var(--a-gray); } .tag.t-pink { --tc2: var(--a-pink); } .tag.t-orange { --tc2: var(--a-orange); }
:root[data-theme="light"] .tag { color: color-mix(in srgb, var(--tc2, var(--a-gray)) 75%, #000); background: color-mix(in srgb, var(--tc2, var(--a-gray)) 16%, transparent); }
.due { border-radius: 999px; padding: 1px 7px; background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.due.late { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.card.t-table th { background: color-mix(in srgb, var(--text) 5%, transparent); }
.todo-row input, .card.t-table .k-check input { accent-color: var(--accent); }
.zoomrow { border-radius: 10px; }
#minimap { border-radius: 10px; }

/* ---------- Spotlight-style search ---------- */
.palette-back { background: rgba(0, 0, 0, .25); padding-top: 16vh; }
.palette { border-radius: 16px; width: min(680px, 100%); }
.pa-input { padding: 14px 18px; border-bottom: .5px solid var(--line); }
.pa-input .ic { width: 22px; height: 22px; }
.pa-input input { font-size: 22px; font-weight: 300; }
.pa-hit { border-radius: 8px; }
.pa-hit.on { background: var(--accent); color: #fff; }
.pa-hit.on small, .pa-hit.on .pa-ic { color: rgba(255, 255, 255, .8); }
.pa-hit:hover:not(.on) { background: var(--hover); }
.pa-foot { border-top: .5px solid var(--line); }

/* ---------- the AI ---------- */
.ai-panel { background: var(--sidebar); border: .5px solid var(--line); border-radius: 12px; }
.ai-composer { border-radius: 14px; border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 5%, transparent); }
.ai-composer:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.ai-msg .bubble { background: var(--accent); color: #fff; border: 0; border-radius: 18px 18px 5px 18px; }
.ai-msg .bubble.answer { background: color-mix(in srgb, var(--accent) 70%, var(--surface-3)); }
.ai-steps, .ai-question, .ai-made-item, .ai-qa { border: .5px solid var(--line-2); border-radius: 12px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.chip { border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 6%, transparent); }
.ai-send.ready, .ai-send.stop { background: var(--accent); }
/* the orb: an Apple-Intelligence-style glow */
.ai-orb {
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .95) 0 16%, rgba(255, 255, 255, 0) 42%),
              conic-gradient(from 0deg, #2f7bff, #a54dff, #ff4f9a, #ff9f43, #ffd84a, #34c7ff, #2f7bff);
  box-shadow: 0 6px 22px rgba(120, 80, 255, .45), 0 0 0 .5px rgba(255, 255, 255, .25) inset;
}
.ai-orb span { background: conic-gradient(from 90deg, transparent, rgba(255, 255, 255, .45), transparent 40%); filter: blur(2px); }

/* the dock a little higher */
.dock { bottom: 22px; }
.toolbar, .link-pop { bottom: 108px; }
@media (max-width: 760px) { .dock { bottom: 10px; } .toolbar, .link-pop { bottom: 70px; } }

/* the dock's icons, tinted: a flat glyph (app/dock-icons, used as a mask) in a soft colour on a dim tile of the same
   colour — no gloss. --tint is the colour on the dark theme, --tint-d a deeper one that reads on the light theme. */
.tint.yellow { --tint: #f3cd6a; --tint-d: #b8860f; } .tint.orange { --tint: #f19a55; --tint-d: #c9661c; }
.tint.coral { --tint: #f2826f; --tint-d: #cc4c38; }   .tint.rose { --tint: #ef7f93; --tint-d: #c9445f; }
.tint.violet { --tint: #b79af0; --tint-d: #7d55d0; }  .tint.blue { --tint: #7cacf3; --tint-d: #3b72d6; }
.tint.sky { --tint: #74c6e6; --tint-d: #2a8fb8; }     .tint.teal { --tint: #6cc6bd; --tint-d: #23958a; }
.tint.green { --tint: #8acb7a; --tint-d: #45953a; }   .tint.gray { --tint: #b0b0b0; --tint-d: #74716b; }
.dock .tool .tile.tint {
  display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 24%, #1c1c1c);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--tint) 28%, transparent), 0 2px 6px rgba(0, 0, 0, .28);
}
.dock .tool .tile.tint::before { display: none; }
.dock .tool .tile.tint i {
  width: 56%; height: 56%; background: var(--tint);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
:root[data-theme="light"] .dock .tool .tile.tint {
  background: color-mix(in srgb, var(--tint-d) 13%, #fff);
  box-shadow: inset 0 0 0 .5px color-mix(in srgb, var(--tint-d) 22%, transparent), 0 1px 4px rgba(0, 0, 0, .12);
}
:root[data-theme="light"] .dock .tool .tile.tint i { background: var(--tint-d); }

/* ==========================================================================================================
   Calendar & timeline (calendar.js), templates (templates.js), script cards and the teleprompter (script.js)
   ========================================================================================================== */

/* the Board / Calendar / Timeline switch in the toolbar */
.view-seg button { gap: 6px; padding: 0 10px; font-size: 12.5px; }
.view-seg .ic { width: 14px; height: 14px; }
@media (max-width: 1250px) { .view-seg button { font-size: 0; gap: 0; padding: 0 8px; } .view-seg .ic { width: 15px; height: 15px; } }

/* the calendar takes the canvas's place */
.cal-view {
  position: fixed; z-index: 2; top: var(--top-h); bottom: var(--gap);
  left: max(var(--sb-w), var(--gap)); right: calc(var(--ai-w) + var(--gap));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--canvas); border: .5px solid var(--line); border-radius: 12px;
  transition: left .22s cubic-bezier(.2, .8, .2, 1), right .22s cubic-bezier(.2, .8, .2, 1);
}
body.cal-open :is(#viewport, .dock, .selbar, .toolbar, .style-panel, .iconpicker, .link-pop, .panel) { display: none !important; }
.cal-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: .5px solid var(--line); }
.cal-title { font-size: 20px; font-weight: 300; letter-spacing: -.01em; }
.cal-title b { font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 16px; border-top: .5px solid var(--line); font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--accent); }
.lg.task { border-radius: 50%; background: transparent; border: 2px solid var(--a-orange); }
.lg.post { background: var(--a-green); border-radius: 2px; transform: rotate(45deg) scale(.8); }
.cal-none { color: var(--muted); padding: 24px 16px; }

/* an entry: tinted in its project's colour */
.ce {
  --cc: var(--accent-c, var(--accent));
  display: flex; align-items: center; gap: 5px; min-width: 0; height: 20px; padding: 0 6px; border-radius: 5px; cursor: default;
  font-size: 12px; line-height: 1; color: var(--text); user-select: none;
}
.ce:hover { background: color-mix(in srgb, var(--cc) 16%, transparent); }
.ce.all { background: color-mix(in srgb, var(--cc) 24%, transparent); color: color-mix(in srgb, var(--cc) 55%, var(--text)); font-weight: 500; }
.ce.all:hover { background: color-mix(in srgb, var(--cc) 34%, transparent); }
.ce.done .ce-title { text-decoration: line-through; opacity: .6; }
.ce.dragging { opacity: .35; }
.ce-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-time { color: var(--muted); font-size: 11px; flex: none; }
.ce-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cc); flex: none; }
.ce-dot.sq { border-radius: 2px; transform: rotate(45deg) scale(.85); }
.ce-check { width: 10px; height: 10px; border-radius: 50%; border: 1.6px solid var(--cc); flex: none; }
.ce-check.on { background: var(--cc); }
.cal-ghost { position: fixed; z-index: 1200; pointer-events: none; opacity: .92; box-shadow: var(--shadow-lift); background: var(--panel) !important; }
.drop { background: color-mix(in srgb, var(--accent) 10%, transparent) !important; box-shadow: inset 0 0 0 1.5px var(--accent); }

/* month */
.cm { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cm-head { display: grid; grid-template-columns: repeat(7, 1fr); padding: 6px 0 4px; }
.cm-head div { text-align: right; padding-right: 10px; font-size: 12px; color: var(--muted); }
.cm-grid { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr); border-top: .5px solid var(--line); min-height: 0; }
.cm-day { border-right: .5px solid var(--line); border-bottom: .5px solid var(--line); padding: 4px 4px 2px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.cm-day:nth-child(7n) { border-right: 0; }
.cm-day.wknd { background: color-mix(in srgb, var(--text) 2%, transparent); }
.cm-day.other .cm-num { color: var(--faint); }
.cm-num { text-align: right; font-size: 12px; color: var(--muted); padding: 2px 4px 3px; }
.cm-num b { font-weight: 500; color: var(--text); display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; }
.cm-day.other .cm-num b { color: var(--faint); }
.cm-day.today .cm-num b { background: var(--a-red); color: #fff; }
.cm-list { display: flex; flex-direction: column; gap: 1px; min-height: 0; }
.cm-more { font-size: 11px; color: var(--muted); padding: 1px 6px; }

/* week */
.cw { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cw-top, .cw-alld { display: grid; grid-template-columns: 56px repeat(7, 1fr); }
.cw-gut { font-size: 11px; color: var(--muted); display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 8px 4px 0; }
.cw-dh { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 8px 0; font-size: 12px; color: var(--muted); }
.cw-dh b { font-size: 18px; font-weight: 400; color: var(--text); min-width: 28px; height: 28px; border-radius: 14px; display: inline-grid; place-items: center; }
.cw-dh.today b { background: var(--a-red); color: #fff; }
.cw-alld { border-top: .5px solid var(--line); border-bottom: .5px solid var(--line); min-height: 30px; }
.cw-ad { padding: 3px 2px; display: flex; flex-direction: column; gap: 1px; border-left: .5px solid var(--line); }
.cw-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.cw-body { position: relative; display: grid; grid-template-columns: 56px repeat(7, 1fr); }
.cw-hours { grid-column: 1; }
.cw-h { height: 46px; position: relative; }
.cw-h span { position: absolute; right: 8px; top: -7px; font-size: 11px; color: var(--muted); }
.cw-col { position: relative; border-left: .5px solid var(--line); background-image: linear-gradient(var(--line) .5px, transparent .5px); background-size: 100% 46px; }
.cw-col.today { background-color: color-mix(in srgb, var(--a-red) 3%, transparent); }
.cw-col .ce { position: absolute; left: 3px; right: 4px; height: auto; align-items: flex-start; padding: 4px 6px; border-radius: 6px;
  background: color-mix(in srgb, var(--cc) 22%, var(--canvas)); border-left: 3px solid var(--cc); flex-wrap: wrap; overflow: hidden; }
.cw-col .ce .ce-dot { display: none; }
.cw-col .ce .ce-title { flex-basis: 100%; white-space: normal; font-weight: 500; color: color-mix(in srgb, var(--cc) 45%, var(--text)); }
.cw-now { position: absolute; left: -4px; right: 0; height: 2px; background: var(--a-red); z-index: 2; }
.cw-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--a-red); }

/* timeline */
.ct { flex: 1; min-height: 0; display: flex; }
.ct-scroll { flex: 1; overflow: auto; }
.ct-inner { position: relative; min-height: 100%; padding-left: 0; }
.ct-head { position: sticky; top: 0; z-index: 3; background: var(--canvas); border-bottom: .5px solid var(--line); }
.ct-months { position: relative; height: 26px; }
.ct-mo { position: absolute; top: 0; bottom: 0; }
.ct-mo span { position: sticky; left: 0; display: inline-block; padding: 6px 8px 0; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ct-mo + .ct-mo { border-left: .5px solid var(--line); }
.ct-days { display: flex; }
.ct-d { width: 34px; flex: none; display: flex; flex-direction: column; align-items: center; padding: 2px 0 6px; font-size: 10px; color: var(--faint); }
.ct-d b { font-size: 12px; font-weight: 500; color: var(--muted); width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; }
.ct-d.today b { background: var(--a-red); color: #fff; }
.ct-rows { position: relative; }
.ct-we { position: absolute; top: 0; bottom: 0; width: 34px; background: color-mix(in srgb, var(--text) 2.5%, transparent); pointer-events: none; }
.ct-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--a-red); opacity: .7; z-index: 2; pointer-events: none; }
.ct-row { position: relative; border-bottom: .5px solid var(--line); }
.ct-label { position: sticky; left: 0; z-index: 2; display: inline-block; margin: 6px 0 0 6px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--canvas) 85%, transparent); backdrop-filter: blur(6px); }
.ct-item { --cc: var(--accent-c, var(--accent)); position: absolute; height: 24px; display: flex; align-items: center; gap: 6px; cursor: default; white-space: nowrap; font-size: 12px; margin-top: 14px; }
.ct-bar { width: var(--w); height: 22px; border-radius: 6px; background: color-mix(in srgb, var(--cc) 30%, transparent); border: .5px solid color-mix(in srgb, var(--cc) 60%, transparent); flex: none; }
.ct-item .ct-bar + .ct-t { color: color-mix(in srgb, var(--cc) 40%, var(--text)); font-weight: 500; }
.ct-mark { width: 12px; height: 12px; margin-left: 11px; border-radius: 3px; background: var(--cc); transform: rotate(45deg); flex: none; }
.ct-mark.task { border-radius: 50%; transform: none; background: transparent; border: 2px solid var(--cc); }
.ct-item.done { opacity: .55; }
.ct-item:hover .ct-t { text-decoration: underline; }

/* the details of an entry */
.cal-pop { z-index: 80; }
.cp-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cp-sw { width: 10px; height: 10px; border-radius: 3px; background: var(--accent-c, var(--accent)); flex: none; }
.cp-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.cp-line .ic { width: 14px; height: 14px; flex: none; }
.cal-new { z-index: 300; }
.cal-new input { height: 32px; padding: 0 10px; border-radius: 7px; border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); outline: none; }
.cal-new input:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* ---------- starting a project ---------- */
.tpl-card { width: min(860px, 100%); }
.tpl-card > .muted { margin: 4px 0 16px; }
.tpl-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tpl {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 12px; border-radius: 14px; cursor: pointer; text-align: left; color: var(--text);
  border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 4%, transparent); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tpl:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl.on { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 35%, transparent); }
.tpl-pic { aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; color: var(--text); background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 22%, var(--surface-2)), color-mix(in srgb, var(--tc) 6%, var(--surface))); }
.tpl-pic svg { width: 100%; height: 100%; display: block; }
.tpl b { font-size: 13px; font-weight: 600; padding: 0 2px; }
.tpl small { font-size: 11.5px; line-height: 1.4; color: var(--muted); padding: 0 2px; }
.tpl-foot { display: flex; align-items: flex-end; gap: 8px; margin-top: 18px; }
.tpl-foot label { flex: 1; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.tpl-foot input { height: 32px; padding: 0 10px; border-radius: 7px; border: .5px solid var(--line-2); background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); outline: none; font-size: 13.5px; }
.tpl-foot input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.tpl-foot .btn { height: 32px; }
@media (max-width: 860px) { .tpl-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- script cards ---------- */
.card.t-script { cursor: pointer; }
.sc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 2px 16px; }
.sc-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(180deg, #ff7a85, #e0243f); }
.sc-ic .ic { width: 14px; height: 14px; }
.sc-title { flex: 1; min-width: 0; font-weight: 500; font-size: 15px; outline: none; overflow-wrap: anywhere; }
.sc-title[contenteditable=true] { cursor: text; user-select: text; }
.sc-play { width: 30px; height: 30px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; color: #fff; background: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.sc-play .ic { width: 12px; height: 12px; }
.sc-play:hover { filter: brightness(1.1); }
.sc-meta { padding: 2px 16px 10px 52px; font-size: 12px; color: var(--muted); }
.sc-meta b { color: var(--text); font-weight: 500; }
.sc-body { padding: 4px 18px 16px; max-height: 520px; overflow-y: auto; outline: none; font-size: 14px; line-height: 1.6; color: var(--text-2); user-select: text; overflow-wrap: anywhere; }
.sc-body[contenteditable=true] { cursor: text; max-height: none; }
.sc-body h3 { margin: 14px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #ff6b78; }
.sc-body h3:first-child { margin-top: 2px; }
.sc-body p { margin: 0 0 8px; color: var(--text); }
.sc-body p:empty::before { content: 'What is said…'; color: var(--faint); }
.sc-body blockquote { margin: 0 0 8px; padding: 4px 0 4px 10px; border-left: 2.5px solid color-mix(in srgb, var(--accent) 60%, transparent); color: var(--muted); font-size: 13px; font-style: italic; }
.card.t-script .tags { padding: 0 18px 14px; margin: 0; }
.scbar button { min-width: 0; padding: 0 10px; font-size: 13px; }

/* ---------- the teleprompter ---------- */
.prompter { position: fixed; inset: 0; z-index: 600; background: #000; color: #fff; overflow: hidden; }
.pp-stage { position: absolute; inset: 0; overflow: hidden; }
.pp-stage.mirror { transform: scaleX(-1); }
.pp-text { max-width: 980px; margin: 0 auto; padding: 0 48px 60vh; line-height: 1.35; font-weight: 500; will-change: transform; }
.pp-text h3 { margin: 1.1em 0 .3em; font-size: .42em; letter-spacing: .14em; text-transform: uppercase; color: #ff6b78; font-weight: 600; }
.pp-text p { margin: 0 0 .7em; }
.pp-text blockquote { margin: 0 0 .7em; font-size: .5em; color: rgba(255, 255, 255, .45); font-style: italic; border-left: 3px solid rgba(255, 255, 255, .25); padding-left: .6em; }
.pp-end { margin-top: 1.2em; font-size: .4em; color: rgba(255, 255, 255, .35); text-align: center; letter-spacing: .2em; }
.pp-line { position: fixed; left: 0; right: 0; top: 35%; height: var(--lh, 64px); pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .06)); border-top: 1px solid rgba(255, 59, 48, .7); }
.pp-line::before { content: ''; position: absolute; left: 12px; top: -7px; border: 7px solid transparent; border-left: 11px solid #ff3b30; }
.pp-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: rgba(40, 40, 42, .78); backdrop-filter: blur(24px) saturate(1.6); border: .5px solid rgba(255, 255, 255, .16); border-radius: 16px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5); opacity: .25; transition: opacity .2s;
}
.prompter:hover .pp-bar { opacity: 1; }
.pp-bar button { height: 32px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #eee; cursor: pointer; display: grid; place-items: center; font: inherit; font-size: 13px; }
.pp-bar button:hover, .pp-bar button.on { background: rgba(255, 255, 255, .12); }
.pp-bar .ic { width: 15px; height: 15px; }
.pp-main { width: 40px; height: 40px !important; border-radius: 50% !important; background: #0a84ff !important; }
.pp-main .ic { fill: #fff; }
.pp-group { display: flex; align-items: center; gap: 2px; padding: 0 4px; border-left: .5px solid rgba(255, 255, 255, .14); }
.pp-group .big { font-size: 17px; }
.pp-wpm, .pp-time { font-size: 12.5px; color: rgba(255, 255, 255, .7); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.pp-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, .08); }
.pp-progress i { display: block; height: 100%; width: 0; background: #0a84ff; }

/* ---------- a new card being pulled out of the dock (app.js: startPlacing) ---------- */
.card.placing {
  pointer-events: none; box-shadow: var(--shadow-lift); scale: 1.03; rotate: -1.2deg;
  transition: scale .18s cubic-bezier(.2, .8, .2, 1), rotate .18s cubic-bezier(.2, .8, .2, 1), opacity .15s;
  animation: place-in .22s cubic-bezier(.2, .8, .2, 1);
}
.card.placing.cancel { opacity: .45; scale: .96; rotate: 0deg; }
.card.placing.gone { opacity: 0; scale: .7; }
@keyframes place-in { from { scale: .5; opacity: 0; } }
body.placing-card, body.placing-card * { cursor: grabbing !important; user-select: none; }
