/* TESSERA: a friendly, dense work OS. One stylesheet, tokens on :root. */
:root {
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #f1f3f9;
  --ink: #1d2233;
  --ink-2: #4b5266;
  --ink-3: #6b7285;
  --line: #e3e6ef;
  --line-2: #d0d5e1;
  --primary: #4a55e8;
  --primary-hover: #3942d0;
  --primary-soft: #eaecfd;
  --primary-ink: #ffffff;
  --danger: #d6383e;
  --danger-soft: #fdecec;
  --warn: #9a6400;
  --ok: #1d8f5c;
  --hover: #f1f3f9;
  --row-hover: #f6f7fc;
  --tile-1: #4a55e8;
  --tile-2: #ff6b4a;
  --tile-3: #1fbf8f;
  --tile-4: #ffc233;
  --weekend: rgba(29, 34, 51, 0.035);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(20, 24, 40, 0.06), 0 1px 1px rgba(20, 24, 40, 0.04);
  --shadow-pop: 0 12px 32px rgba(20, 24, 40, 0.16), 0 2px 6px rgba(20, 24, 40, 0.08);
  --row-h: 38px;
  --top-h: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.tnum, .stat-num, .cell-num, .foot-num b, .count, .bell-count { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot-splash { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.ic { flex: none; }
.ic.flip { transform: rotate(180deg); }

/* ---- utilities ------------------------------------------------------------ */
.muted { color: var(--ink-3); }
.muted-ink { color: var(--ink-2); }
.small { font-size: 12.5px; }
.err { color: var(--danger); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.warn { color: var(--warn); background: #fff6e0; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.pad { padding: 10px 12px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 700; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 600; margin-left: 8px; vertical-align: middle; }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: none; }
.empty-state { display: grid; place-items: center; gap: 12px; padding: 56px 16px; text-align: center; color: var(--ink-3); }
.empty-state.small { padding: 24px 12px; }
.empty-state h1 { color: var(--ink); font-size: 22px; }

/* ---- buttons and inputs ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 40px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #bd2d33; }
.btn-danger-ghost { color: var(--danger); border-color: #f1c4c6; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.split-btn .btn.split { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
  position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 26px; height: 26px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0; color: var(--primary); font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.sm { height: 30px; font-size: 13px; padding: 0 8px; }
.input.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }
select.input { padding-right: 24px; }
.num-input { width: 90px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span, .field-label, .field legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.inline-field select, .inline-field input { width: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.color-grid { display: grid; grid-template-columns: repeat(6, 26px); gap: 6px; }
.color-dot { width: 26px; height: 26px; border-radius: 6px; border: 2px solid transparent; transition: transform 0.12s var(--ease); }
.color-dot:hover { transform: scale(1.08); }
.color-dot.on { border-color: var(--ink); }
.color-input { width: 40px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: none; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; border-radius: 10px; background: var(--line-2); transition: background-color 0.18s var(--ease); }
.switch .slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform 0.18s var(--ease); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-row { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 2px; }
.seg-btn { border: 0; background: none; padding: 4px 12px; border-radius: 4px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
kbd { font-family: var(--font); font-size: 11.5px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--ink-3); background: var(--surface); }

/* ---- avatars and chips ------------------------------------------------------ */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; letter-spacing: 0.02em; box-shadow: 0 0 0 2px var(--surface); }
.avatar.empty { background: var(--surface-3); color: var(--ink-3); box-shadow: none; }
.avatar.more { background: var(--ink-3); font-size: 11px; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }
.chips { display: flex; gap: 4px; overflow: hidden; min-width: 0; }
.chips.wrap { flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 12px; font-size: 12.5px; white-space: nowrap; background: #eef0f6; color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.chip.removable button { border: 0; background: none; padding: 0; display: grid; place-items: center; color: var(--ink-2); }
.chip.suggest { border: 1px dashed var(--line-2); background: var(--surface); color: var(--ink-2); }
.chip.suggest:hover { border-color: var(--primary); color: var(--primary); }

/* ---- shell ---------------------------------------------------------------------- */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 14px 0 12px; flex: none; }
.menu-btn { display: none; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; width: 236px; }
.brand:hover { text-decoration: none; }
.wordmark { font-weight: 800; letter-spacing: 0.14em; font-size: 15px; }
.search-trigger { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface); color: var(--ink-3); min-width: 280px; transition: border-color 0.15s var(--ease); }
.search-trigger:hover { border-color: var(--primary); }
.search-trigger kbd { margin-left: auto; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.avatar-btn { border: 0; background: none; padding: 2px; border-radius: 50%; }
.frame { flex: 1; min-height: 0; display: flex; }
.sidebar { width: 260px; flex: none; overflow-y: auto; padding: 4px 10px 24px; }
.content { flex: 1; min-width: 0; background: var(--surface); border-radius: var(--radius-lg) 0 0 0; overflow: auto; box-shadow: var(--shadow-1); position: relative; }
.scrim { display: none; }
.side-nav { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.side-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; text-decoration: none; min-width: 0; transition: background-color 0.12s var(--ease); }
.side-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link:hover { background: rgba(255, 255, 255, 0.7); text-decoration: none; color: var(--ink); }
.side-link.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-link.locked { color: var(--ink-3); font-size: 13px; }
.side-sec { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; display: flex; flex-direction: column; gap: 1px; }
.side-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 2px 10px 6px; letter-spacing: 0.02em; }
.ws { display: flex; flex-direction: column; gap: 1px; margin-bottom: 4px; }
.ws-row { display: flex; align-items: center; gap: 2px; border-radius: var(--radius-sm); }
.ws-row:hover, .ws-row.on { background: rgba(255, 255, 255, 0.7); }
.ws-caret { color: var(--ink-3); }
.ws-link { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 34px; color: var(--ink); font-weight: 600; text-decoration: none; }
.ws-link:hover { text-decoration: none; }
.ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-badge { width: 22px; height: 22px; border-radius: 6px; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; flex: none; }
.ws-lock { color: var(--ink-3); margin-right: 4px; }
.ws-body { padding-left: 14px; display: flex; flex-direction: column; gap: 1px; }
.folder summary { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 600; list-style: none; cursor: pointer; }
.folder summary::-webkit-details-marker { display: none; }
.folder summary:hover { background: rgba(255, 255, 255, 0.7); }
.folder > .side-link { margin-left: 14px; }

/* ---- popover, menu, modal, toast ------------------------------------------------ */
#layer { position: relative; z-index: 50; }
.pop { position: fixed; z-index: 80; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-pop); border: 1px solid var(--line); max-height: min(70vh, 560px); overflow: auto; opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top; transition: opacity 0.14s var(--ease), transform 0.14s var(--ease); max-width: calc(100vw - 16px); }
.pop.in { opacity: 1; transform: none; }
.pop-pad { padding: 10px; }
.pop-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.menu { padding: 6px; min-width: 210px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; background: none; border-radius: var(--radius-sm); text-align: left; color: var(--ink); font-size: 13.5px; }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { opacity: 0.45; }
.menu-item.danger { color: var(--danger); }
.menu-item.on { font-weight: 600; }
.menu-item .ic { color: var(--ink-3); }
.menu-item.danger .ic { color: var(--danger); }
.menu-ic { width: 16px; flex: none; }
.menu-label { flex: 1; }
.menu-hint { color: var(--ink-3); font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-head { font-size: 11.5px; font-weight: 700; color: var(--ink-3); padding: 6px 10px 4px; letter-spacing: 0.02em; }
.modal-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(20, 24, 40, 0.38); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity 0.16s var(--ease); }
.modal-wrap.in { opacity: 1; }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); transform: translateY(8px) scale(0.98); transition: transform 0.18s var(--ease); }
.modal-wrap.in .modal { transform: none; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 20px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 4px 20px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--radius); background: #1f2433; color: #fff; box-shadow: var(--shadow-pop); font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity 0.18s var(--ease), transform 0.18s var(--ease); max-width: 100%; }
.toast.in { opacity: 1; transform: none; }
.toast.error { background: #8f1f24; }
.toast-undo { border: 0; background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-sm); }
.toast-undo:hover { background: rgba(255, 255, 255, 0.24); }
.toast-x { border: 0; background: none; color: rgba(255, 255, 255, 0.7); display: grid; place-items: center; padding: 4px; border-radius: 4px; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 95; pointer-events: none; opacity: 0.92; box-shadow: var(--shadow-pop); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.drag-src { opacity: 0.35; }

/* options inside popovers */
.opt-list { display: flex; flex-direction: column; gap: 1px; max-height: 320px; overflow: auto; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 5px 8px; border: 0; background: none; border-radius: var(--radius-sm); text-align: left; font-size: 13.5px; cursor: pointer; }
.opt:hover { background: var(--hover); }
.opt.on { background: var(--primary-soft); }
.opt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check { width: 16px; height: 16px; border: 1.5px solid var(--line-2); border-radius: 4px; display: grid; place-items: center; flex: none; color: #fff; }
.check.on { background: var(--primary); border-color: var(--primary); }
.status-pop { display: flex; flex-direction: column; gap: 8px; }
.label-grid { display: grid; grid-template-columns: 1fr; gap: 5px; }
.label-opt { height: 32px; border: 0; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: 13px; transition: filter 0.12s var(--ease), transform 0.1s var(--ease); }
.label-opt:hover { filter: brightness(0.94); }
.label-opt:active { transform: scale(0.98); }
.label-opt.blank { background: var(--surface-3); color: var(--ink-2); }

/* ---- pages ----------------------------------------------------------------------- */
.page { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1200px; }
.page.narrow { max-width: 760px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-title.danger { color: var(--danger); }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.home-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color 0.15s var(--ease); }
.home-stat:hover { border-color: var(--primary); text-decoration: none; }
.home-stat .stat-num { font-size: 28px; font-weight: 800; }
.home-stat.danger .stat-num { color: var(--danger); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; text-align: left; transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.tile:hover { border-color: var(--primary); box-shadow: var(--shadow-1); text-decoration: none; }
.tile.add { border-style: dashed; color: var(--ink-2); }
.tile-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.tile-name { font-weight: 700; }
.tile .muted { display: inline-flex; align-items: center; gap: 4px; }
.tile .ws-badge { width: 34px; height: 34px; border-radius: 8px; font-size: 15px; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 2px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
a.list-row:hover { background: var(--hover); text-decoration: none; }
.list-row .ic { color: var(--ink-3); }

/* gate */
.gate-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.gate-screen.inline { min-height: 100%; background: transparent; padding: 48px 16px; }
.gate-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-1); }
.gate-card h1 { font-size: 22px; }
.gate-brand { display: flex; align-items: center; gap: 10px; }
.gate-brand.small .wordmark { font-size: 13px; }
.gate-lock { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.gate-lock.ok { background: #e3f6ee; color: var(--ok); }
.gate-card .link-btn { align-self: center; }

/* ---- board ---------------------------------------------------------------------- */
.board-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.board-head { padding: 18px 24px 0; display: flex; flex-direction: column; gap: 6px; flex: none; }
.bh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bh-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.board-title { font-size: 24px; font-weight: 700; padding: 2px 6px; margin-left: -6px; border-radius: var(--radius-sm); cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-title:hover { background: var(--hover); }
.star { color: var(--ink-3); }
.star.on { color: #e5a019; }
.bh-actions { display: flex; align-items: center; gap: 4px; }
.members { display: inline-flex; border: 0; background: none; padding: 4px 8px 4px 12px; border-radius: 20px; }
.members:hover { background: var(--hover); }
.members .avatar + .avatar { margin-left: -8px; }
.bh-actions .count { margin-left: 2px; }
.bh-desc { color: var(--ink-3); font-size: 13.5px; }
.view-tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-top: 6px; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 0; background: none; color: var(--ink-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: color 0.12s var(--ease), background-color 0.12s var(--ease); }
.view-tab:hover { background: var(--hover); color: var(--ink); }
.view-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
.view-tab.add { color: var(--ink-3); }
.tab-more { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--ink-3); }
.tab-more:hover { background: var(--line); }
.board-toolbar { display: flex; align-items: center; gap: 4px; padding: 12px 24px; flex: none; overflow-x: auto; scrollbar-width: thin; }
.tb-search { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--ink-3); margin-left: 8px; border: 1px solid transparent; transition: border-color 0.15s var(--ease); }
.tb-search:focus-within { border-color: var(--primary); }
.tb-search input { border: 0; outline: 0; width: 140px; background: transparent; color: var(--ink); }
.tb-search:hover { background: var(--hover); }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--ink-2); white-space: nowrap; font-weight: 500; transition: background-color 0.12s var(--ease); }
.tb-btn:hover { background: var(--hover); color: var(--ink); }
.tb-btn.on { background: var(--primary-soft); color: var(--primary); }
.view-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-bar { display: flex; align-items: center; gap: 12px; padding: 0 24px 12px; flex-wrap: wrap; }
.filter-row { display: grid; grid-template-columns: 1.2fr 1fr 1.2fr auto; gap: 6px; align-items: center; }

/* ---- table ---------------------------------------------------------------------- */
.table-wrap { flex: 1; min-height: 0; overflow: auto; padding: 4px 24px 40px; overscroll-behavior: contain; }
.tgroup { margin-bottom: 28px; width: max-content; min-width: 100%; position: relative; }
.tgroup.drop-into { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: 6px; }
.tgroup.drop-before::before, .tgroup.drop-after::after { content: ''; display: block; height: 3px; background: var(--primary); border-radius: 2px; margin: 4px 0; }
.tg-head { position: sticky; left: 0; z-index: 6; width: max-content; }
.tg-head-in { display: flex; align-items: center; gap: 4px; height: 38px; position: sticky; left: 0; }
.tg-name { color: var(--gc); font-weight: 700; font-size: 16px; padding: 2px 6px; border-radius: var(--radius-sm); cursor: text; white-space: nowrap; }
.tg-name:hover { background: var(--hover); }
.tg-toggle { color: var(--gc); }
.tg-menu { opacity: 0; transition: opacity 0.12s var(--ease); }
.tgroup:hover .tg-menu, .tg-menu:focus-visible { opacity: 1; }
.tg-count { color: var(--ink-3); font-size: 13px; margin-left: 4px; }
.tgroup.collapsed .tg-head-in { border-left: 6px solid var(--gc); border-radius: 6px; padding: 0 8px; background: var(--surface-2); height: 44px; }
.trow { display: grid; grid-template-columns: var(--tpl); min-height: var(--row-h); width: max-content; min-width: 100%; }
.subwrap .trow, .trow.sub { grid-template-columns: var(--tpl-sub); }
.tcell { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); background: var(--surface); font-size: 13.5px; }
.trow.item:hover .tcell { background: var(--row-hover); }
.trow.item:hover .tcell.editable:hover { background: #eef0fa; }
.tcell.editable { cursor: pointer; }
.tcell.editable:focus-visible, .iname:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 0; }
.tcell.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--primary); z-index: 2; }
.tname { position: sticky; left: 0; z-index: 3; justify-content: flex-start; gap: 4px; padding: 0 6px 0 12px; box-shadow: -24px 0 0 0 var(--surface); }
.tname .edge { position: absolute; left: 0; top: -1px; bottom: -1px; width: 6px; background: var(--gc); }
.trow.thead .tname .edge { border-radius: 6px 0 0 0; }
.tfoot .tname .edge.fade { display: none; }
.trow.thead { position: sticky; top: 0; z-index: 5; }
.trow.thead .tcell { background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; border-top: 1px solid var(--line); }
.trow.thead .tname { z-index: 6; }
.trow.thead .tcell:first-child { border-top-left-radius: 6px; }
.th { padding: 0 4px; }
.tname.th { padding-left: 18px; }
.th-btn { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; border: 0; background: none; color: inherit; font-weight: 500; min-width: 0; padding: 0 4px; border-radius: 4px; }
.th-btn:hover { background: var(--hover); }
.th-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-caret { opacity: 0; transition: opacity 0.12s var(--ease); }
.th-btn:hover .th-caret { opacity: 1; }
.resizer { position: absolute; right: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 4; }
.resizer::after { content: ''; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: transparent; transition: background-color 0.12s var(--ease); }
.resizer:hover::after { background: var(--primary); }
.tfill { border-right: 0; }
.trow.thead .tfill { justify-content: flex-start; }
.grip { display: grid; place-items: center; width: 16px; height: 24px; color: var(--ink-3); cursor: grab; opacity: 0; flex: none; touch-action: none; transition: opacity 0.12s var(--ease); }
.grip-space { width: 16px; flex: none; }
.trow.item:hover .grip, .tg-head:hover .g-grip { opacity: 1; }
.row-menu { opacity: 0; flex: none; }
.trow.item:hover .row-menu, .row-menu:focus-visible { opacity: 1; }
.sub-toggle { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 4px; border: 0; background: none; color: var(--ink-3); border-radius: 4px; font-size: 12px; flex: none; opacity: 0; transition: opacity 0.12s var(--ease); }
.sub-toggle .ic { transition: transform 0.15s var(--ease); }
.sub-toggle.open .ic { transform: rotate(90deg); }
.sub-toggle:not(.has):not(.open) { width: 0; padding: 0; overflow: hidden; }
.trow.item:hover .sub-toggle:not(.has):not(.open) { width: auto; padding: 0 4px; }
.sub-toggle.has, .sub-toggle.open, .trow.item:hover .sub-toggle { opacity: 1; }
.sub-toggle:hover { background: var(--hover); color: var(--ink); }
.iname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; border-radius: 4px; cursor: text; }
.iname:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.open-btn { display: grid; place-items: center; width: 30px; height: 28px; border: 0; background: none; color: var(--ink-3); border-radius: 4px; flex: none; }
.open-btn:hover { color: var(--primary); background: var(--primary-soft); }
.trow.drop-before .tcell { box-shadow: inset 0 3px 0 var(--primary); }
.trow.drop-after .tcell { box-shadow: inset 0 -3px 0 var(--primary); }
.trow.tadd .tcell { border-right: 0; }
.trow.tadd .tname { border-right: 1px solid var(--line); }
.trow.tadd input { width: 100%; border: 0; background: transparent; outline: 0; height: 34px; padding: 0 6px; color: var(--ink); }
.trow.tadd input::placeholder { color: var(--ink-3); }
.trow.tadd input:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--primary); border-radius: 4px; }
.trow.tfoot .tcell { border-bottom: 0; border-right: 0; background: transparent; height: 38px; }
.trow.tfoot .tname { background: var(--surface); }
.trow.tfoot .tcell.t-numbers, .trow.tfoot .tcell.t-formula, .trow.tfoot .tcell.t-status, .trow.tfoot .tcell.t-progress, .trow.tfoot .tcell.t-rating, .trow.tfoot .tcell.t-checkbox, .trow.tfoot .tcell.t-time_tracking { border: 1px solid var(--line); border-top: 0; background: var(--surface); }
.foot-num { display: flex; flex-direction: column; align-items: center; line-height: 1.1; border: 0; background: none; padding: 2px 6px; border-radius: 4px; }
button.foot-num:hover:not(:disabled) { background: var(--hover); }
.foot-num b { font-weight: 700; font-size: 13px; }
.foot-num span { font-size: 10.5px; color: var(--ink-3); }
.battery { display: flex; width: 100%; height: 22px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.battery span { height: 100%; }
.battery.big { height: 26px; border-radius: 6px; }
.subwrap { margin-left: 40px; border-left: 2px solid var(--line); }
.subwrap .tname .edge { background: color-mix(in srgb, var(--gc) 45%, transparent); }
.subwrap .trow.thead { position: static; }
.subwrap .trow.thead .tcell { background: var(--surface-2); }
.add-group { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-weight: 600; position: sticky; left: 0; }
.add-group:hover { border-color: var(--primary); color: var(--primary); }
.inline-input { width: 100%; height: 30px; border: 1px solid var(--primary); border-radius: 4px; padding: 0 6px; outline: 0; background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.inline-input.big { font-size: 20px; font-weight: 700; height: 40px; }
.cell-input { width: 100%; height: 100%; border: 0; outline: 0; padding: 0 10px; background: var(--surface); text-align: center; }

/* cells */
.cell-fill { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 6px; }
.status-cell { color: #fff; font-weight: 600; font-size: 13px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: filter 0.12s var(--ease); }
.status-cell.empty { background: #c9cfdb; }
.tcell.editable:hover .status-cell { filter: brightness(0.95); }
.status-cell::after { content: ''; position: absolute; right: 0; top: 0; border: 6px solid transparent; border-top-color: rgba(255, 255, 255, 0.5); border-right-color: rgba(255, 255, 255, 0.5); opacity: 0; transition: opacity 0.12s var(--ease); }
.tcell.editable:hover .status-cell::after { opacity: 1; }
.cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; display: inline-flex; align-items: center; gap: 2px; }
.cell-num { font-weight: 500; }
.cell-empty { color: var(--line-2); display: inline-grid; place-items: center; }
.tcell:hover .cell-empty { color: var(--ink-3); }
.cell-date { display: inline-flex; align-items: center; gap: 5px; }
.cell-date.overdue { color: var(--danger); font-weight: 600; }
.cell-date.done { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.cell-date.done .ic { color: var(--ok); }
.dot-red { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.timeline-pill { display: inline-block; width: 100%; max-width: 170px; padding: 3px 8px; border-radius: 12px; color: #fff; font-size: 12.5px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.checkbox { width: 20px; height: 20px; border: 1.5px solid var(--line-2); border-radius: 5px; display: grid; place-items: center; color: #fff; background: var(--surface); transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease); }
.checkbox.on { background: var(--ok); border-color: var(--ok); }
.cell-link { display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.stars { display: inline-flex; gap: 1px; }
.stars .star { border: 0; background: none; padding: 2px; color: var(--line-2); display: grid; place-items: center; transition: transform 0.1s var(--ease), color 0.1s var(--ease); }
.stars .star.on { color: #eda100; }
.stars .star:hover:not(:disabled) { transform: scale(1.15); }
.file-count { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12.5px; }
.file-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: var(--radius-sm); color: var(--ink); font-size: 13px; }
.file-row:hover { background: var(--hover); text-decoration: none; }
.cell-err { color: var(--danger); font-size: 12px; font-weight: 600; }
.progress { display: flex; align-items: center; gap: 8px; width: 100%; }
.progress-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ok); border-radius: 4px; transform-origin: left center; transition: transform 0.3s var(--ease); }
.progress-num { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; width: 34px; text-align: right; }
.log-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.timer { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.timer-btn { width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); transition: transform 0.1s var(--ease); }
.timer-btn:active { transform: scale(0.92); }
.timer.running .timer-btn { background: var(--danger); color: #fff; }
.timer.running .tnum { color: var(--danger); font-weight: 600; }
.clock-cell { display: inline-flex; align-items: baseline; gap: 2px; white-space: nowrap; overflow: hidden; }
.flag { font-size: 15px; }
.vote { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border: 1px solid var(--line-2); border-radius: 13px; background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 12.5px; transition: background-color 0.12s var(--ease), color 0.12s var(--ease); }
.vote.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.color-cell { display: inline-flex; align-items: center; gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.color-cell .swatch { width: 16px; height: 16px; border-radius: 4px; }
.cell-button { height: 26px; padding: 0 12px; border: 0; border-radius: 13px; color: #fff; font-weight: 600; font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: filter 0.12s var(--ease), transform 0.1s var(--ease); }
.cell-button:hover { filter: brightness(0.93); }
.cell-button:active { transform: scale(0.96); }
.t-text, .t-long_text, .t-location, .t-email, .t-link, .t-dependency, .t-connect, .t-mirror, .t-tags, .t-dropdown, .t-creation_log, .t-last_updated, .t-country, .t-week { justify-content: flex-start; }

/* ---- kanban ---------------------------------------------------------------------- */
.kanban-wrap, .cal-wrap, .gantt-wrap, .chart-view, .cards-wrap, .wl-wrap, .form-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.kanban { flex: 1; min-height: 0; display: flex; gap: 12px; overflow: auto; padding: 0 24px 24px; align-items: flex-start; }
.klane { flex: 0 0 272px; background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; border: 1px solid var(--line); transition: box-shadow 0.12s var(--ease); }
.klane.drop { box-shadow: 0 0 0 2px var(--lc); }
.klane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--lc); color: #fff; border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; }
.klane-count { background: rgba(255, 255, 255, 0.25); border-radius: 10px; padding: 0 8px; font-size: 12px; }
.klane-body { display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: auto; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; box-shadow: var(--shadow-1); touch-action: none; transition: box-shadow 0.12s var(--ease), border-color 0.12s var(--ease); }
.kcard:hover { border-color: var(--line-2); box-shadow: 0 4px 12px rgba(20, 24, 40, 0.08); }
.kcard-name { font-weight: 600; }
.kcard-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.kcard-meta .avatar-stack { margin-left: auto; }
.kcard-group { display: inline-flex; align-items: center; gap: 5px; }
.kcard-group::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--gc); }
.kcard-date { display: inline-flex; align-items: center; gap: 3px; }
.kcard-date.overdue { color: var(--danger); font-weight: 600; }
.klane-add { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink-3); padding: 6px 4px; border-radius: var(--radius-sm); font-weight: 500; }
.klane-add:hover { background: var(--hover); color: var(--ink); }

/* ---- calendar ------------------------------------------------------------------- */
.cal-wrap { overflow: auto; padding-bottom: 24px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { font-size: 17px; min-width: 150px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0 24px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--radius-sm); }
.cal-dow { padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-day { min-height: 112px; padding: 4px 6px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background-color 0.12s var(--ease); }
.cal-day.out { background: var(--surface-2); color: var(--ink-3); }
.cal-day.drop { background: var(--primary-soft); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-add { opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-chip { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--cc); background: color-mix(in srgb, var(--cc) 12%, var(--surface)); color: var(--ink); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: grab; touch-action: none; }
.cal-chip:hover { background: color-mix(in srgb, var(--cc) 22%, var(--surface)); }
.cal-more { font-size: 11.5px; color: var(--ink-3); padding-left: 4px; }

/* ---- gantt ---------------------------------------------------------------------- */
.gantt { flex: 1; min-height: 0; overflow: auto; margin: 0 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); overscroll-behavior: contain; }
.g-inner { position: relative; }
.g-head { display: grid; position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.g-corner { position: sticky; left: 0; z-index: 6; background: var(--surface); border-right: 1px solid var(--line); display: flex; align-items: flex-end; padding: 0 12px 8px; font-weight: 600; color: var(--ink-2); font-size: 13px; }
.g-scale { display: flex; flex-direction: column; }
.g-months { position: relative; height: 24px; border-bottom: 1px solid var(--line); }
.g-month { position: absolute; top: 0; height: 24px; line-height: 24px; padding-left: 8px; font-size: 12px; font-weight: 700; color: var(--ink-2); border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.g-days { display: flex; height: 26px; }
.g-day { flex: none; display: grid; place-items: center; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.g-day.weekend { background: var(--weekend); }
.g-day.today { color: #fff; background: var(--danger); border-radius: 6px 6px 0 0; font-weight: 700; }
.g-body { position: relative; }
.g-group, .g-row { display: grid; }
.g-gname { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; padding: 0 12px; font-weight: 700; color: var(--gc); background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--gc); }
.g-gtrack { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.g-name { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; gap: 4px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); padding: 0 12px 0 16px; box-shadow: inset 4px 0 0 color-mix(in srgb, var(--gc) 40%, transparent); }
.g-name-btn { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.g-name-btn:hover { color: var(--primary); }
.g-chev { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 4px; border: 0; background: none; border-radius: 4px; color: var(--ink-3); font-size: 11.5px; flex: none; }
.g-chev:hover { background: var(--hover); color: var(--ink); }
.g-chev .ic { transition: transform 0.15s var(--ease); }
.g-chev.open .ic { transform: rotate(90deg); }
.g-row.sub .g-name { padding-left: 34px; font-size: 13px; background: var(--surface-2); }
.g-bar.sub { height: 20px; top: 10px; opacity: 0.85; }
.g-due { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; transform: rotate(45deg); background: var(--danger); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); z-index: 2; }
.g-due.overdue { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--danger) 35%, transparent); }
.g-due.done { background: var(--line-2); }
.g-track { position: relative; border-bottom: 1px solid var(--line); }
.g-row:hover .g-track, .g-row:hover .g-name { background-color: var(--row-hover); }
.g-bar { position: absolute; top: 7px; height: 26px; border-radius: 13px; background: var(--gc); color: #fff; display: flex; align-items: center; font-size: 12px; font-weight: 600; cursor: grab; touch-action: none; box-shadow: 0 1px 2px rgba(20, 24, 40, 0.18); transition: box-shadow 0.12s var(--ease); z-index: 2; }
.g-bar:hover { box-shadow: 0 3px 10px rgba(20, 24, 40, 0.22); }
.g-bar.moving { opacity: 0.85; cursor: grabbing; }
.g-bar-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 10px; pointer-events: none; }
.g-handle { width: 9px; align-self: stretch; cursor: ew-resize; flex: none; border-radius: 13px; }
.g-handle:hover { background: rgba(255, 255, 255, 0.35); }
.g-set { position: absolute; top: 8px; height: 24px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink-3); font-size: 12px; opacity: 0; transition: opacity 0.12s var(--ease); }
.g-row:hover .g-set, .g-set:focus-visible { opacity: 1; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: 0.6; z-index: 1; pointer-events: none; }
.g-deps { position: absolute; top: 0; pointer-events: none; z-index: 1; overflow: visible; }
.g-dep { fill: none; stroke: var(--ink-3); stroke-width: 1.5; }
.g-dep.late { stroke: var(--danger); stroke-dasharray: 4 3; }

/* ---- charts --------------------------------------------------------------------- */
.chart-view { overflow: auto; padding: 0 0 24px; }
.chart-card { margin: 0 24px; display: flex; flex-direction: column; gap: 12px; }
.chart { display: block; width: 100%; height: auto; }
.chart-scroll { overflow-x: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .val { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .bar { transition: opacity 0.12s var(--ease); }
.chart .hit:hover + .val, .chart:hover .bar { opacity: 0.9; }
.pie-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.pie { flex: none; }
.pie-total { fill: var(--ink); font-size: 22px; font-weight: 800; font-family: var(--font); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.pie-wrap .legend { flex-direction: column; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend-val { color: var(--ink); font-weight: 600; }
.data-table summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); }
.data-table table { border-collapse: collapse; margin-top: 8px; font-size: 13px; min-width: 240px; }
.data-table th, .data-table td { text-align: left; padding: 4px 12px 4px 0; border-bottom: 1px solid var(--line); }
.data-table td.tnum { text-align: right; }
.chart-tip { position: fixed; z-index: 99; pointer-events: none; background: #1f2433; color: #fff; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; opacity: 0; transition: opacity 0.1s var(--ease); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-tip.in { opacity: 1; }

/* ---- cards ---------------------------------------------------------------------- */
.cards-wrap { overflow: auto; padding: 0 24px 24px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.icard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: box-shadow 0.15s var(--ease), border-color 0.15s var(--ease); box-shadow: inset 0 4px 0 var(--gc); }
.icard:hover { box-shadow: inset 0 4px 0 var(--gc), 0 6px 18px rgba(20, 24, 40, 0.08); border-color: var(--line-2); }
.icard-head { padding: 12px 14px 8px; }
.icard-group { font-size: 12px; color: var(--gc); font-weight: 700; }
.icard-name { font-size: 15px; margin-top: 2px; }
.icard-fields { margin: 0; padding: 4px 14px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-items: center; font-size: 13px; }
.icard-fields dt { color: var(--ink-3); font-size: 12px; }
.icard-fields dd { margin: 0; position: relative; min-height: 26px; display: flex; align-items: center; min-width: 0; }
.icard-fields dd .cell-fill { position: static; border-radius: 4px; height: 24px; display: inline-grid; padding: 0 10px; }

/* ---- workload ------------------------------------------------------------------- */
.wl-wrap { overflow: auto; padding: 0 0 24px; }
.wl-wrap > .card { margin: 0 24px; display: flex; flex-direction: column; gap: 12px; overflow-x: auto; }
.wl-table, .wl-mini { display: grid; gap: 4px; align-items: stretch; min-width: 560px; }
.wl-mini { min-width: 0; font-size: 12px; }
.wl-h { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 4px 6px; }
.wl-person { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 6px; min-width: 0; }
.wl-person span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-cell { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 52px; border: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; padding: 0; }
.wl-mini .wl-cell { height: 36px; }
button.wl-cell:not(:disabled):hover { box-shadow: inset 0 0 0 2px var(--line-2); }
.wl-bar { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.wl-bar span { display: block; width: 100%; height: 100%; transform-origin: bottom; transition: transform 0.3s var(--ease); }
.wl-cell.ok .wl-bar span { background: color-mix(in srgb, var(--primary) 30%, transparent); }
.wl-cell.near .wl-bar span { background: #f5c26b; }
.wl-cell.over .wl-bar span { background: #ef8c8f; }
.wl-num { position: relative; z-index: 1; font-weight: 700; font-size: 13px; padding-bottom: 6px; font-variant-numeric: tabular-nums; }
.wl-key { display: flex; gap: 16px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.wl-key .k::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.wl-key .ok::before { background: color-mix(in srgb, var(--primary) 30%, transparent); }
.wl-key .near::before { background: #f5c26b; }
.wl-key .over::before { background: #ef8c8f; }

/* ---- form view ------------------------------------------------------------------ */
.form-view { overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 0 24px 24px; align-items: start; }
.form-builder { display: flex; flex-direction: column; gap: 14px; }
.form-preview { background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.fp-head h3 { font-size: 20px; }
.fp-q { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.fp-input { height: 36px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.fp-submit { align-self: flex-start; background: var(--primary); color: #fff; padding: 8px 18px; border-radius: var(--radius-sm); font-weight: 600; }
.form-page { overflow: auto; }
.public-form { min-height: 100vh; display: grid; place-items: start center; padding: 40px 16px; }
.pf-card { width: min(560px, 100%); background: var(--surface); border-radius: 18px; border: 1px solid var(--line); padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-1); }
.pf-card h1 { font-size: 24px; }
.pf-card.done { align-items: center; text-align: center; }
.req { color: var(--danger); }

/* ---- column settings, extras ---------------------------------------------------- */
.label-row { display: flex; align-items: center; gap: 8px; }
.label-row .input { flex: 1; }
.swatch-btn { width: 30px; height: 30px; border-radius: var(--radius-sm); border: 0; flex: none; }
.done-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.act-list { display: flex; flex-direction: column; }
.act { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.act-body { min-width: 0; overflow-wrap: anywhere; }
.old { color: var(--ink-3); text-decoration: line-through; }
.new { color: var(--ink); font-weight: 600; }
.trash-list, .perm-list { display: flex; flex-direction: column; }
.trash-row, .perm-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.perm-row select { width: 130px; }

/* ---- drawer (item card) --------------------------------------------------------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 40, 0.18); opacity: 0; transition: opacity 0.2s var(--ease); }
.drawer-wrap.in { opacity: 1; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateX(24px); transition: transform 0.22s var(--ease); }
.drawer-wrap.in .drawer { transform: none; }
.drawer-head { padding: 14px 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; }
.crumb { font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.crumb::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--gc); }
.drawer-title { font-size: 21px; font-weight: 700; padding: 2px 6px; margin-left: -6px; border-radius: var(--radius-sm); cursor: text; overflow-wrap: anywhere; }
.drawer-title:hover { background: var(--hover); }
.drawer-tabs { display: flex; gap: 2px; overflow-x: auto; }
.dtab { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border: 0; background: none; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dtab:hover { color: var(--ink); }
.dtab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
.drawer-content { flex: 1; overflow: auto; padding: 18px 20px 32px; display: flex; flex-direction: column; gap: 16px; }
.composer-box { position: relative; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px; transition: border-color 0.15s var(--ease); }
.composer-box:focus-within { border-color: var(--primary); }
.composer { border: 0; box-shadow: none !important; padding: 4px; min-height: 70px; }
.mention-list { position: absolute; left: 8px; top: 100%; margin-top: 4px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 4px; min-width: 220px; }
.mention-list[hidden] { display: none; }
.mention-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: var(--radius-sm); text-align: left; }
.mention-opt:hover { background: var(--hover); }
.updates { display: flex; flex-direction: column; gap: 12px; }
.update { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.update-head { display: flex; align-items: center; gap: 10px; }
.update-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--primary); background: var(--primary-soft); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.update-foot { border-top: 1px solid var(--line); padding-top: 6px; }
.like { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--ink-3); padding: 4px 8px; border-radius: var(--radius-sm); font-weight: 500; }
.like:hover { background: var(--hover); color: var(--ink); }
.like.on { color: #d14f8f; }
.info-grid { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.info-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--line); min-height: 40px; }
.info-row:last-child { border-bottom: 0; }
.info-label { display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); font-size: 13px; background: var(--surface-2); }
.info-val { position: relative; display: flex; align-items: center; padding: 0 10px; min-width: 0; }
.info-val.editable { cursor: pointer; }
.info-val.editable:hover { background: var(--row-hover); }
.info-val.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--primary); }
.sub-list { display: flex; flex-direction: column; gap: 2px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); cursor: pointer; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease); }
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }
.thumb.icon { display: grid; place-items: center; background: var(--surface-3); color: var(--ink-3); outline: 0; }

/* ---- automations ---------------------------------------------------------------- */
.auto-center { display: flex; flex-direction: column; gap: 16px; }
.auto-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auto-list { display: flex; flex-direction: column; gap: 8px; }
.auto-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.auto-row.off { opacity: 0.6; }
.auto-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: #fff3dc; color: #b77800; flex: none; }
.auto-sentence { font-weight: 600; }
.recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.recipe { display: flex; align-items: flex-start; gap: 8px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; line-height: 1.4; transition: border-color 0.15s var(--ease); }
.recipe:hover { border-color: var(--primary); }
.recipe .ic { color: #b77800; margin-top: 2px; }
.builder { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); }
.sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 18px; line-height: 1.6; }
.word { color: var(--ink); }
.token { border: 0; border-bottom: 2px solid var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 700; padding: 2px 8px; border-radius: 6px 6px 2px 2px; font-size: 17px; transition: background-color 0.12s var(--ease); }
.token:hover { background: #dde0fb; }
.token.lead { background: none; border-bottom-color: transparent; color: var(--ink); padding-left: 0; }
.token.lead:hover { color: var(--primary); }
.token.empty { color: var(--danger); border-bottom-color: var(--danger); background: var(--danger-soft); }
.token.ghost { background: none; border-bottom: 1px dashed var(--line-2); color: var(--ink-3); font-size: 13px; font-weight: 500; }
.token-input { border: 0; border-bottom: 2px solid var(--primary); background: var(--surface); padding: 2px 8px; font-size: 16px; border-radius: 6px 6px 2px 2px; min-width: 120px; max-width: 100%; outline: 0; }

/* ---- dashboard ------------------------------------------------------------------ */
.dash-page { padding-bottom: 40px; }
.live { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px #d9f2e6; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px 24px 0; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-width: 0; transition: box-shadow 0.15s var(--ease); }
.widget:hover { box-shadow: 0 4px 14px rgba(20, 24, 40, 0.06); }
.widget.drop-before { box-shadow: -4px 0 0 var(--primary); }
.widget.drop-after { box-shadow: 4px 0 0 var(--primary); }
.widget-head { display: flex; align-items: center; gap: 6px; padding: 12px 10px 4px 12px; }
.widget-head .grip { opacity: 0.5; }
.widget:hover .widget-head .grip { opacity: 1; }
.widget-title { flex: 1; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-body { padding: 8px 16px 16px; min-width: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-cap { color: var(--ink-3); font-size: 13px; }
.stat-list { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.stat-list li { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.battery-w { display: flex; flex-direction: column; gap: 8px; }
.mini-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-bottom: 10px; }
.mini-dow { text-align: center; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.mini-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; border-radius: 6px; background: var(--surface-2); font-size: 12px; min-height: 38px; }
.mini-day.out { color: var(--ink-3); background: transparent; }
.mini-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.mini-day:not(:disabled):hover { background: var(--primary-soft); }
.mini-dots { display: flex; gap: 2px; }
.mini-dots i { width: 5px; height: 5px; border-radius: 50%; }
.tl-w { display: flex; flex-direction: column; gap: 8px; }
.tl-scale { position: relative; height: 18px; margin-left: 34%; font-size: 11px; color: var(--ink-3); }
.tl-scale span { position: absolute; white-space: nowrap; }
.tl-rows { position: relative; display: flex; flex-direction: column; gap: 4px; }
.tl-row { display: grid; grid-template-columns: 34% 1fr; align-items: center; gap: 0; }
.tl-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.tl-track { position: relative; height: 18px; background: var(--surface-2); border-radius: 4px; }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 6px; }
.tl-bar.done { opacity: 0.45; }
.tl-today { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--danger); opacity: 0.6; z-index: 1; }
.boards-pick { max-height: 200px; }

/* ---- my work, inbox, search ------------------------------------------------------ */
.mw-bucket { display: flex; flex-direction: column; gap: 8px; }
.mw-title { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mw-bucket.overdue .mw-title { color: var(--danger); }
.mw-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mw-list li + li { border-top: 1px solid var(--line); }
.mw-row { display: grid; grid-template-columns: 6px minmax(0, 2fr) minmax(0, 1.4fr) 130px 72px; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px 0 0; border: 0; background: var(--surface); text-align: left; transition: background-color 0.12s var(--ease); }
.mw-row:hover { background: var(--row-hover); }
.mw-edge { align-self: stretch; }
.mw-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mw-board { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mw-status { color: #fff; font-weight: 600; font-size: 12.5px; text-align: center; padding: 4px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mw-status.empty { background: #c9cfdb; }
.mw-date { font-size: 13px; text-align: right; }
.mw-date.overdue { color: var(--danger); font-weight: 700; }
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; text-align: left; border-radius: var(--radius-sm); transition: background-color 0.12s var(--ease); }
.notif:hover { background: var(--hover); }
.notif.unread { background: #f4f5fe; }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.inbox-pop { display: flex; flex-direction: column; max-height: 70vh; }
.inbox-pop .notif-list { padding: 0 6px 6px; overflow: auto; }
.search-modal { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.search-modal .modal-head { display: none; }
.search-modal .modal-body { padding: 0; }
.search-bar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.search-input { flex: 1; border: 0; outline: 0; font-size: 17px; background: transparent; }
.search-results { max-height: 60vh; overflow: auto; padding: 6px; }
.search-head { font-size: 11.5px; font-weight: 700; color: var(--ink-3); padding: 8px 10px 4px; }
.search-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm); text-align: left; }
.search-row.active { background: var(--primary-soft); }
.search-row .ic { color: var(--ink-3); }
.search-row .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- phone and small tablet ------------------------------------------------------ */
@media (max-width: 760px) {
  :root { --top-h: 52px; }
  .menu-btn { display: inline-grid; }
  .brand { width: auto; }
  .hide-sm { display: none !important; }
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; border-radius: 50%; margin-left: auto; }
  .top-right { margin-left: 0; }
  .topbar { gap: 6px; padding: 0 8px; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(300px, 86vw); background: var(--bg); padding-top: 16px; transform: translateX(-100%); transition: transform 0.22s var(--ease); box-shadow: var(--shadow-pop); }
  body.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(20, 24, 40, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease); }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .content { border-radius: 0; }
  .page { padding: 18px 16px 40px; gap: 18px; }
  .page-head h1 { font-size: 22px; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-grid { grid-template-columns: minmax(0, 1fr); }
  .board-head { padding: 12px 16px 0; }
  .board-title { font-size: 20px; }
  .bh-top { flex-wrap: nowrap; }
  .bh-actions .members { display: none; }
  .board-toolbar { padding: 10px 16px; }
  .grip, .grip-space { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn.sm { width: 32px; height: 32px; }
  .tab-more { width: 28px; height: 28px; }
  .row-menu { opacity: 1; width: 22px; }
  .tname { padding-left: 10px; }
  .dash-page .bh-top { flex-wrap: wrap; }
  .live { display: none; }
  .tb-search input { width: 90px; }
  .view-bar { padding: 0 16px 10px; }
  .table-wrap { padding: 4px 12px 32px; }
  .kanban { padding: 0 16px 16px; }
  .klane { flex-basis: 250px; }
  .cal-grid { margin: 0 8px; }
  .cal-day { min-height: 72px; padding: 2px; }
  .cal-chip { font-size: 10.5px; padding: 1px 3px; }
  .cal-dow { padding: 4px; font-size: 11px; }
  .cal-add { display: none; }
  .gantt { margin: 0 12px 16px; }
  .chart-card, .wl-wrap > .card { margin: 0 12px; }
  .cards-wrap { padding: 0 12px 16px; }
  .form-view { grid-template-columns: minmax(0, 1fr); padding: 0 12px 16px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 0; }
  .widget { grid-column: auto !important; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .search-modal { margin-top: 0; }
  .drawer { width: 100%; }
  .info-row { grid-template-columns: 110px minmax(0, 1fr); }
  .mw-row { grid-template-columns: 6px minmax(0, 1fr) 96px; grid-template-rows: auto auto; row-gap: 2px; padding: 8px 12px 8px 0; }
  .mw-edge { grid-row: span 2; }
  .mw-board { grid-column: 2; grid-row: 2; }
  .mw-status { grid-column: 3; grid-row: 1; }
  .mw-date { grid-column: 3; grid-row: 2; }
  .sentence { font-size: 16px; }
  .token { font-size: 15px; }
  .gate-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- v2: products, CRM, rollups, invites ------------------------------------------ */
.product-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 2px 0 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); border-radius: var(--radius); }
.product-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; background: none; border-radius: 7px; color: var(--ink-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
.product-tab:hover { color: var(--ink); }
.product-tab.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }
.rollup-cell { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--surface-2); cursor: default; }
.rollup-track { flex: 1; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.rollup-bar { display: block; height: 100%; background: var(--ok); border-radius: 5px; transform-origin: left center; transition: transform 0.3s var(--ease); }
.rollup-num { font-size: 12.5px; font-weight: 700; color: var(--ink); min-width: 36px; text-align: right; }
.link-chip { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); color: var(--ink-2); font-size: 11.5px; font-weight: 600; flex: none; transition: border-color 0.12s var(--ease), color 0.12s var(--ease); }
.link-chip:hover { border-color: var(--primary); color: var(--primary); }
.forecast { display: flex; flex-direction: column; gap: 10px; margin: 12px 24px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); flex: none; }
.fc-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fc-tile { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fc-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.fc-num { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-sub { font-size: 12px; color: var(--ink-3); }
.fc-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface); }
.fc-bar span { height: 100%; }
.klane-sum { margin-left: auto; font-size: 12.5px; font-weight: 700; opacity: 0.95; }
.klane-head { gap: 8px; }
.kind-badge { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 700; vertical-align: 1px; background: var(--surface-3); color: var(--ink-2); }
.kind-badge.call { background: #e6f1f8; color: #125f8a; }
.kind-badge.email { background: #f1e8fd; color: #6a3aa8; }
.kind-select { width: auto; margin-right: auto; }
.prob-input { width: 64px; }
.sp-people { max-height: 200px; }
.sp-tick { border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.invite-list { display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: grid; grid-template-columns: auto minmax(0, 0.8fr) minmax(0, 1.4fr) auto; align-items: center; gap: 8px; }
.invite-row .badge { margin-left: 6px; }
.project-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--primary-soft); color: var(--ink); font-size: 13.5px; }
@media (max-width: 760px) {
  .forecast { margin: 10px 12px 0; padding: 12px; }
  .fc-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fc-num { font-size: 18px; }
  .invite-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .invite-row input { grid-column: 1 / -1; grid-row: 2; }
  .link-chip { display: none; }
  .product-tab { height: 40px; }
}

/* ---- v3: linked projects, frozen progress, column reorder ------------------------------ */
.rollup-cell.frozen .rollup-bar { background: var(--ink-3); }
.rollup-cell.frozen { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px); }
.link-chip.off { border-style: dashed; color: var(--warn); }
.project-link.off { background: #fff6e0; }
.trow.thead .th.drop-before { box-shadow: inset 3px 0 0 var(--primary); }
.trow.thead .th.drop-after { box-shadow: inset -3px 0 0 var(--primary); }
.th-btn { touch-action: pan-y; }
.ws-project { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* ---- v3 round 2: sidebar order ------------------------------------------------------------ */
.side-item { position: relative; display: flex; align-items: center; }
.side-item > .side-link { flex: 1; min-width: 0; }
.side-more { position: absolute; right: 2px; opacity: 0; transition: opacity 0.12s var(--ease); }
.side-item:hover .side-more, .folder summary:hover .side-more, .side-more:focus-visible { opacity: 1; }
.folder summary { position: relative; }
.sidebar [data-scope] { touch-action: pan-y; }
.sidebar .drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.sidebar .drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.sidebar .drop-into { background: var(--primary-soft); outline: 1px dashed var(--primary); }
@media (max-width: 760px) {
  .side-more { opacity: 1; }
}

/* ---- v3 round 2: Home cards (caption top right on the title line) ---------------------------- */
.tile { gap: 6px; padding: 10px 14px; }
.tile-top { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; }
.tile-top .tile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-cap { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.tile-top .tile-ic { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.tile-top .ws-badge { width: 28px; height: 28px; font-size: 13px; }
.tile-grid.thin { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tile-stats { display: flex; gap: 12px; width: 100%; font-size: 12.5px; color: var(--ink-2); }
.tile-stats b { color: var(--ink); font-weight: 700; }
.tile-stats .over, .tile-stats .over b { color: var(--danger); }
.tile-battery { height: 8px; border-radius: 4px; width: 100%; }
.tile-dash { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.home-ws { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile-stats { gap: 10px; }
.tile-stats > span { flex: none; white-space: nowrap; }
.tile-stats > .tile-dash { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---- v4: accounts, access panel ------------------------------------------------------------ */
.access-panel { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.acc-list, .acc-pending-list { display: flex; flex-direction: column; }
/* one line per person: avatar, who, then the controls; the remove button always ends the line */
.acc-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) repeat(3, auto); align-items: center; column-gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acc-row > .acc-remove { grid-column: -2; }
.acc-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.acc-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acc-name .badge { margin-left: 0; }
.badge.warnb { background: #fff3dc; color: var(--warn); }
.acc-boards { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; background: none; padding: 2px 4px; margin-left: -4px; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--ink-2); text-align: left; }
.acc-boards:hover { background: var(--hover); }
.acc-boards b { color: var(--ink); font-weight: 600; }
.acc-role { width: auto; }
.acc-role-fixed { font-size: 12.5px; color: var(--ink-3); }
.acc-pending { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.acc-board-row select { width: auto; }
.role-note { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; }
.guest-door { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.invite-row.no-link { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr); }
@media (max-width: 760px) {
  /* phone: who on the first line, the controls on a second line under the name */
  .acc-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .acc-main { flex: 1 1 calc(100% - 40px); }
  .acc-row > .acc-role, .acc-row > .acc-role-fixed { margin-left: 38px; }
  .acc-row > .acc-remove { margin-left: auto; }
}

/* ---- v4 amendment: photos, profile, email login, the nudge ---------------------------------- */
.avatar { position: relative; overflow: hidden; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }
.acc-email { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.acc-email-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locked-field { position: relative; display: flex; align-items: center; }
.locked-field .input { padding-right: 30px; background: var(--surface-3); color: var(--ink-2); }
.locked-field svg { position: absolute; right: 10px; color: var(--ink-3); pointer-events: none; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.profile-page { max-width: 560px; }
.profile-card { padding: 20px; }
.pf-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nudge { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(340px, calc(100vw - 32px)); display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 14px 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(8px); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); }
.nudge.in { opacity: 1; transform: none; }
.nudge-body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1; }
.nudge-body p { margin: 0 0 6px; text-wrap: pretty; }
/* small controls keep a 40px hit area without growing visually (radius: 14 padding + 6 button = 20) */
.nudge #nudge-close, .acc-email-edit { position: relative; }
.nudge #nudge-close::after, .acc-email-edit::after { content: ''; position: absolute; inset: -8px; }
@media (max-width: 600px) { .nudge { right: 16px; bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .nudge { transition: none; } }

/* ---- v5: notes, pages and the block editor ------------------------------------------------ */
:root { --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; --doc-w: 720px; }
.side-sub { display: flex; flex-direction: column; gap: 1px; padding-left: 14px; }
.side-sub .side-link { height: 30px; font-size: 13px; }
.notes-folder > summary .ic { color: var(--primary); }
.folder .folder { margin-left: 14px; }
.folder > .side-item, .folder > .side-sub { margin-left: 14px; }

/* the document page */
.note-page { max-width: calc(var(--doc-w) + 64px); margin: 0 auto; gap: 14px; padding-top: 20px; }
.note-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.note-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-size: 13px; color: var(--ink-3); }
.note-crumbs a { color: var(--ink-2); }
.crumb-sep { color: var(--line-2); }
.crumb-here { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.note-item-row { display: flex; align-items: center; gap: 8px; }
.item-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-2); font-size: 13px; color: var(--ink); }
.item-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-link:hover { border-color: var(--line-2); background: var(--hover); }
.note-subpages { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }

/* the editor */
.ed { position: relative; display: flex; flex-direction: column; gap: 4px; }
.ed-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; margin-bottom: 6px; background: linear-gradient(var(--surface) 78%, transparent); }
.tb-group { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-1); }
.tb-group .tb-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 34px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); transition: background-color 0.12s var(--ease), color 0.12s var(--ease), transform 0.1s var(--ease); }
.tb-group .tb-btn:hover { background: var(--hover); color: var(--ink); }
.tb-group .tb-btn:active { transform: scale(0.96); }
.tb-aa-glyph { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.ed-status { white-space: nowrap; }
.ed-title { width: 100%; border: 0; outline: 0; background: none; padding: 4px 0 10px; font-size: 32px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.ed-title::placeholder { color: var(--line-2); }
.ed-blocks { display: flex; flex-direction: column; }
.ed-tail { min-height: 56px; cursor: text; }
.ed.ro .ed-tail { cursor: default; }

.nb { position: relative; display: flex; align-items: flex-start; gap: 2px; margin-left: -30px; border-radius: var(--radius-sm); }
.nb-gutter { flex: none; width: 28px; display: flex; justify-content: center; padding-top: 3px; }
.nb-grip { display: grid; place-items: center; width: 22px; height: 24px; border: 0; border-radius: 5px; background: none; color: var(--ink-3); opacity: 0; cursor: grab; touch-action: none; transition: opacity 0.12s var(--ease), background-color 0.12s var(--ease); }
.nb:hover .nb-grip, .nb:focus-within .nb-grip, .nb-grip:focus-visible { opacity: 1; }
.nb-grip:hover { background: var(--hover); }
/* small visible controls keep a 40px hit area (dense desktop floor) without growing */
.nb-grip, .nb-caret { position: relative; }
.nb-grip::after { content: ''; position: absolute; inset: -8px -9px; }
.nb-caret::after { content: ''; position: absolute; inset: -6px -8px; }
.nb.drag-src { opacity: 0.4; }
.nb.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.nb.drop-after { box-shadow: inset 0 -2px 0 var(--primary); }
.nb-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.nb-main > .nb-text { flex: 1; min-width: 0; }
.nb-text { outline: 0; padding: 3px 2px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; font-size: 15px; min-height: 1.6em; }
.nb-text.empty::before { content: attr(data-placeholder); float: left; height: 0; color: var(--ink-3); opacity: 0; pointer-events: none; }
.nb-text.empty:focus::before, .nb-title .nb-text.empty::before, .nb-h1 .nb-text.empty::before, .nb-h2 .nb-text.empty::before { opacity: 0.6; }
.ed.ro .nb-text.empty::before { opacity: 0 !important; }
.nb-text strong { font-weight: 700; }
.nb-text mark { border-radius: 3px; padding: 0 1px; color: inherit; }
.nb-text mark[data-hl="yellow"] { background: #fff1a8; }
.nb-text mark[data-hl="green"] { background: #d3f2c4; }
.nb-text mark[data-hl="pink"] { background: #ffd9e6; }
.nb-text mark[data-hl="blue"] { background: #d6e8ff; }
.nb-title .nb-text { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; padding-top: 14px; }
.nb-h1 .nb-text { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; padding-top: 12px; }
.nb-h2 .nb-text { font-size: 18px; font-weight: 700; line-height: 1.35; padding-top: 8px; }
.nb-h3 .nb-text { font-size: 15.5px; font-weight: 700; padding-top: 6px; }
.nb-marker { flex: none; min-width: 18px; padding-top: 3px; line-height: 1.6; font-size: 15px; color: var(--ink-2); text-align: right; }
.nb-number .nb-marker { min-width: 22px; }
.nb-check { display: grid; place-items: center; width: 22px; height: 24px; padding-top: 4px; }
.nb-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--ok); cursor: pointer; }
.nb-todo.done .nb-text { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.nb-toggle-head { display: flex; align-items: flex-start; gap: 4px; flex: 1 1 100%; min-width: 0; }
.nb-toggle-head .nb-text { flex: 1; }
.nb-caret { flex: none; display: grid; place-items: center; width: 24px; height: 28px; border: 0; background: none; color: var(--ink-3); border-radius: 5px; }
.nb-caret .ic { transition: transform 0.16s var(--ease); }
.nb-caret.open .ic { transform: rotate(90deg); }
.nb-caret:hover { background: var(--hover); }
.nb-body { flex: 1 1 100%; margin-left: 28px; color: var(--ink-2); border-left: 2px solid var(--line); padding-left: 10px; }
.nb-quote .nb-text { border-left: 3px solid var(--ink); padding-left: 14px; color: var(--ink-2); font-size: 16px; }
.nb-callout-box { flex: 1; display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-3); }
.nb-callout-ic { color: var(--primary); padding-top: 4px; }
.nb-hr { flex: 1; border: 0; height: 1px; background: var(--line-2); margin: 14px 0; outline-offset: 6px; }
.nb-codebox { flex: 1; min-width: 0; margin: 4px 0; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-3); font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; outline: 0; min-height: 2.6em; }
.nb-codebox:focus { box-shadow: inset 0 0 0 1px var(--line-2); }
.nb-table-box { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.nb-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.nb-grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.nb-grid td, .nb-grid th { border: 1px solid var(--line); padding: 7px 10px; min-width: 90px; text-align: left; vertical-align: top; white-space: pre-wrap; outline: 0; font-weight: 400; }
.nb-grid tr:first-child > * { border-top: 0; }
.nb-grid tr > :first-child { border-left: 0; }
.nb-grid tr > :last-child { border-right: 0; }
.nb-grid tr:last-child > * { border-bottom: 0; }
.nb-grid th { background: var(--surface-2); font-weight: 700; }
.nb-grid td:focus, .nb-grid th:focus { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.nb-table-tools { display: flex; gap: 14px; opacity: 0; transition: opacity 0.12s var(--ease); }
.nb:hover .nb-table-tools, .nb:focus-within .nb-table-tools { opacity: 1; }
.nb-image { margin: 6px 0; flex: 1; min-width: 0; }
.nb-image img { display: block; max-width: 100%; max-height: 520px; border-radius: var(--radius); outline: 1px solid oklch(0 0 0 / 0.1); outline-offset: -1px; }
.nb-image figcaption { margin-top: 4px; }
.nb-filelink { flex: 1; display: flex; align-items: center; gap: 10px; margin: 4px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.nb-filelink:hover { background: var(--hover); text-decoration: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-height: 30px; margin: 3px 0; padding: 3px 5px 3px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13.5px; text-align: left; transition: border-color 0.12s var(--ease), background-color 0.12s var(--ease); }
.chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.chip .ic { color: var(--primary); }
.chip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-where { font-size: 12px; white-space: nowrap; }
.chip-status { padding: 2px 8px; border-radius: 5px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.off { color: var(--ink-3); border-style: dashed; cursor: default; }
.chip.off .ic { color: var(--ink-3); }

/* slash menu and the Aa popover (Rani's layout: marks, styles, then lists) */
.slash-menu { padding: 4px; }
.slash-item .menu-label { display: flex; flex-direction: column; line-height: 1.25; }
.slash-hint { font-weight: 400; }
.slash-item.on { background: var(--primary-soft); }
.aa-popover { padding: 0; }
.aa-pop { display: flex; flex-direction: column; }
.aa-row { display: flex; align-items: center; gap: 4px; padding: 10px; }
.aa-marks { border-bottom: 1px solid var(--line); }
.aa-mark { display: inline-grid; place-items: center; min-width: 40px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); font-size: 16px; transition: background-color 0.12s var(--ease), transform 0.1s var(--ease); }
.aa-mark:hover { background: var(--hover); }
.aa-mark:active { transform: scale(0.96); }
.aa-mark b { font-weight: 800; }
.aa-mark i { font-family: Georgia, serif; }
.aa-hl { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.aa-marks { flex-wrap: wrap; row-gap: 10px; }
.aa-hl-btn { position: relative; }
.hl-swatch { position: absolute; left: 9px; right: 9px; bottom: 5px; height: 3px; border-radius: 2px; }
.hl-dots { display: flex; gap: 6px; }
.hl-dot { width: 16px; height: 16px; padding: 0; border: 1px solid oklch(0 0 0 / 0.12); border-radius: 50%; position: relative; }
.hl-dot::after { content: ''; position: absolute; inset: -3px; }
.hl-dot.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink-2); }
.aa-styles { display: flex; flex-direction: column; padding: 6px; border-bottom: 1px solid var(--line); }
.aa-style { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 4px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; color: var(--ink); }
.aa-style:hover { background: var(--hover); }
.aa-style.on { background: var(--primary-soft); color: var(--primary); }
.aa-style-title span { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.aa-style-h1 span { font-size: 16.5px; font-weight: 700; }
.aa-style-h2 span { font-size: 14.5px; font-weight: 700; }
.aa-style-p span { font-size: 14px; }
.aa-style-code span { font-family: var(--mono); font-size: 13px; }
.aa-lists { justify-content: space-between; align-items: stretch; }
.aa-list { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.aa-list:hover { background: var(--hover); color: var(--ink); }
.aa-list.on { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.aa-list-label { font-size: 10.5px; line-height: 1.15; text-align: center; }

/* notes in the item panel */
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.notes-head .row { gap: 12px; }
.card-note { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px 4px; }
.ed.compact .nb { margin-left: 0; }
.ed.compact .ed-title { padding-left: 30px; }
.card-note .ed-bar { background: var(--surface); }
.ed.compact .ed-title { font-size: 20px; padding-bottom: 4px; }
.ed.compact .nb-text { font-size: 14px; }
.ed.compact .ed-tail { min-height: 28px; }
.note-picks { display: flex; flex-direction: column; gap: 2px; }
.note-pick { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 4px 10px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; color: var(--ink); }
.note-pick:hover { background: var(--hover); }
.note-pick.on { background: var(--primary-soft); }
.note-pick .np-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-badge { font-size: 11px; font-weight: 700; color: var(--primary); }
.convo { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Home: notes across workspaces */
.note-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.note-list li + li { border-top: 1px solid var(--line); }
.note-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; color: var(--ink); text-decoration: none; transition: background-color 0.12s var(--ease); }
.note-row:hover { background: var(--row-hover); text-decoration: none; }
.note-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); }
.note-main { display: flex; flex-direction: column; min-width: 0; }
.note-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.note-ws { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; }

/* import wizard */
.imp-modal .modal-body { max-height: min(70vh, 720px); overflow: auto; }
.imp-drop { padding: 28px 20px; gap: 6px; text-align: center; }
.imp-or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; }
.imp-or::before, .imp-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.imp-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: start; }
.imp-counts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.imp-count { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); }
.imp-count b { font-size: 20px; font-weight: 800; }
.imp-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.label-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 6px; color: #fff; font-size: 12.5px; font-weight: 600; }
.person-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; background: var(--surface-3); font-size: 12.5px; font-weight: 600; }
.person-chip.new { background: #fff6e0; }
.imp-map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 8px; }
.imp-table-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: var(--radius); }
.imp-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.imp-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 700; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.imp-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.imp-table tr.imp-g td { background: var(--surface-3); font-weight: 700; }
.imp-notes { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.imp-notes legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.imp-note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; }
.imp-note-grid .check-row { font-size: 13.5px; }
.imp-done { align-items: center; text-align: center; padding: 20px 0; }
.imp-done-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #e3f5ec; color: var(--ok); }
.imp-foot { gap: 8px; }

@media (max-width: 760px) {
  .note-page { padding: 14px 16px 40px 30px; }
  .ed-title { font-size: 26px; }
  .nb { margin-left: -24px; }
  .nb-gutter { width: 22px; }
  .nb-grip { opacity: 0.55; }
  .card-note { padding: 0 8px 4px; }
  .ed.compact .nb { margin-left: 0; }
  .ed.compact .ed-title { padding-left: 24px; }
  .imp-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .note-row { grid-template-columns: 28px minmax(0, 1fr); }
  .note-meta { grid-column: 2; flex-direction: row; gap: 8px; align-items: center; justify-content: flex-start; }
  .nb-table-tools { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .nb-caret .ic, .tb-btn, .aa-mark { transition: none; }
}
/* the wizard fits a phone: grid and flex children may shrink below their content, wide tables scroll inside */
.imp-modal { max-width: calc(100vw - 16px); }
.imp-modal .modal-body > *, .imp-preview > *, .imp-controls > * { min-width: 0; }
.imp-controls { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.imp-controls .input { width: 100%; max-width: 100%; }
.person-chip { gap: 4px; }
.modal-wrap:has(.imp-modal) { grid-template-columns: minmax(0, 1fr); }
.folder summary > .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.product-tab span { overflow: hidden; text-overflow: ellipsis; }
.side-btn { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.cell-input { width: 100%; height: 100%; border: 0; padding: 0 7px; font: inherit; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; outline: none; background: var(--surface); }
/* the language choice on the profile */
.lang-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-choice label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer; transition: border-color 0.12s var(--ease), background-color 0.12s var(--ease); }
.lang-choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }

}

/* ---- v7: the Local marker (the copy on the Mac mini; the website has none) ------------------- */

/* ---- v7: Owners and admins (instance roles above workspaces) ----------------------------------- */
.inst-badge[data-role='owner'] { background: var(--primary-soft); color: var(--primary); }
.inst-badge[data-role='admin'] { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.inst-invite { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 10px; align-items: end; }
.inst-invite .field { min-width: 0; }
@media (max-width: 760px) {
  .inst-invite { grid-template-columns: minmax(0, 1fr); }
}
