/* Mechanesmos – design tokens and components. No framework, no build step.
   The design is our own; only the colours come from the EYF palette (black
   #141416, off-white, cream, grey, red). No carousel rules apply here. */
:root {
  color-scheme: light;
  --bg: #F3F1EC; --surface: #ffffff; --surface-2: #F8F7F3; --surface-3: #ECE9E2;
  --border: #E0DCD3; --border-2: #C9C4B8;
  --text: #141416; --text-2: #45454A; --muted: #77776F;
  --accent: #E5484D; --accent-2: #C93A3F; --accent-soft: #FCEBE9; --on-accent: #fff;
  --danger: #c93434; --warn: #d97a00;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 10px 30px rgba(20, 20, 30, .10);
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .07);
  --grid: #E8E4DC; --axis: #C9C4B8; --dotgrid: #D3CDC1; --edge: #5E5E58;
  --c-gray: #8b8a84; --c-blue: #2a78d6; --c-aqua: #0e9fae; --c-green: #0ca30c; --c-amber: #f2a90f;
  --c-orange: #eb6834; --c-red: #d03b3b; --c-pink: #e0669a; --c-violet: #6250d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --mix: #ffffff; --tint: 20%;
  --r: 6px; --r-sm: 5px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141416; --surface: #1E1E22; --surface-2: #19191C; --surface-3: #2A2A2F;
  --border: #34343A; --border-2: #4A4A52;
  --text: #F5F5F0; --text-2: #D4D0C8; --muted: #8F8F89;
  --accent: #FC6262; --accent-2: #FF8585; --accent-soft: #3A2224; --on-accent: #141416;
  --danger: #ee6b6b; --warn: #f2a90f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --grid: #2A2A2F; --axis: #4A4A52; --dotgrid: #2A2A2F; --edge: #9B9B95;
  --c-gray: #7d7b75; --c-blue: #3987e5; --c-aqua: #19a9b8; --c-green: #0ca30c; --c-amber: #f2a90f;
  --c-orange: #d95926; --c-red: #e05656; --c-pink: #d55181; --c-violet: #8478e6;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --mix: #1E1E22; --tint: 30%;
}
[data-c="gray"] { --c: var(--c-gray); } [data-c="blue"] { --c: var(--c-blue); } [data-c="aqua"] { --c: var(--c-aqua); }
[data-c="green"] { --c: var(--c-green); } [data-c="amber"] { --c: var(--c-amber); } [data-c="orange"] { --c: var(--c-orange); }
[data-c="red"] { --c: var(--c-red); } [data-c="pink"] { --c: var(--c-pink); } [data-c="violet"] { --c: var(--c-violet); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
a { color: var(--accent); cursor: pointer; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

.ic { width: 16px; height: 16px; flex: none; }
.ic.sm { width: 12px; height: 12px; opacity: .7; }
.ic.flip { transform: rotate(180deg); }
.gl { font-size: 15px; line-height: 1; flex: none; }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; }
.hint.pad { padding: 10px 12px; }
.hint code, .prose code, p code { font: 12px var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.link { color: var(--accent); font-size: 12.5px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.count { font-size: 12px; color: var(--muted); }
.strong { font-weight: 600; }
kbd { font: 11px var(--font); color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); white-space: nowrap; }
.warn-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); flex: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--c-gray)); flex: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-sm); font-weight: 550; font-size: 13px; border: 1px solid var(--border); background: var(--surface); white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.ghost.on { background: var(--accent-soft); color: var(--accent); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent); }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 5px; }
.icon-btn.xs .ic { width: 14px; height: 14px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.inp, .sel { height: 32px; border: 1px solid var(--border-2); background: var(--surface); border-radius: var(--r-sm); padding: 0 10px; width: 100%; outline: none; }
.inp:focus, .sel:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.inp { height: auto; padding: 8px 10px; resize: vertical; min-height: 110px; line-height: 1.5; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 5px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .ic { width: 14px; height: 14px; }
.search { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); }
.search input { border: 0; outline: 0; background: none; width: 130px; color: var(--text); }
.search:focus-within { border-color: var(--accent); }

.av { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--c, var(--c-gray)); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; flex: none; }
.av[data-c="amber"] { color: #0b0b0b; }
.av.none { background: none; border: 1px dashed var(--border-2); color: var(--muted); }
.av.none .ic { width: 12px; height: 12px; }
.av.sm { width: 20px; height: 20px; font-size: 9px; }
.pill { display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 10px; border-radius: 6px; background: var(--c, var(--c-gray)); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pill[data-c="amber"] { color: #0b0b0b; }
.pill.none { background: var(--surface-3); color: var(--muted); }
.sw { width: 20px; height: 20px; border-radius: 6px; background: var(--c); flex: none; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); }
.sw.big { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; }
.sw.big[data-c="amber"] { color: #0b0b0b; }
.tag { font-size: 11.5px; color: var(--text-2); background: var(--surface-3); border-radius: 5px; padding: 1px 6px; margin-right: 4px; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 500; line-height: 1.5; vertical-align: baseline; max-width: 100%; }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip em { font-style: normal; font-size: 11px; color: var(--muted); padding-left: 6px; border-left: 1px solid var(--border); }
.chip.new { border-style: dashed; color: var(--muted); }
.chip .ic { width: 13px; height: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.col { flex-direction: column; align-items: flex-start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.card.pad { padding: 18px; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 60px 20px; color: var(--muted); grid-column: 1 / -1; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty.sm { padding: 28px 16px; }
.empty .btn { margin-top: 6px; }

/* ---------- overlays ---------- */
.pop { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); min-width: 190px; max-width: 320px; max-height: min(70vh, 460px); overflow: auto; animation: pop .1s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-3px); } }
.menu { padding: 5px; display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; text-align: left; font-size: 13px; min-height: 32px; }
.menu button:hover { background: var(--surface-3); }
.menu button span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button .ic { color: var(--muted); }
.menu button.on { font-weight: 600; }
.menu button .tick { color: var(--accent); }
.menu button.danger, .menu button.danger .ic { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; width: 100%; }
.menu h6 { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 7px 9px 4px; }
.opts-menu .pill { flex: 1; }
.docpick { width: 280px; }
.docpick .inp { margin-bottom: 5px; }
.docpick .list { display: flex; flex-direction: column; max-height: 260px; overflow: auto; }
.datepop { padding: 10px; width: 230px; }
.datepop .quick { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.datepop .quick button { height: 28px; border-radius: 6px; background: var(--surface-3); font-size: 12.5px; }
.datepop .quick button:hover { background: var(--accent-soft); color: var(--accent); }

.modal-wrap, .palette-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(15, 15, 20, .45); display: grid; place-items: start center; padding: 9vh 16px 16px; animation: fade .12s; overflow: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.modal.wide { width: min(720px, 100%); }
.modal > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 4px 20px; }
.modal h3 { font-size: 16px; }
.modal-body { padding: 10px 20px 16px; max-height: 68vh; overflow: auto; }
.modal-body p { color: var(--text-2); margin-bottom: 10px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.opts { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.opt-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.form { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; align-items: center; }
.form label { font-size: 13px; color: var(--text-2); }
.pv-h { margin: 16px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.wd-body.preview { border: 1px solid var(--border); border-radius: var(--r); padding: 12px; min-height: 90px; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: #1f1f23; color: #f4f4f1; padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; max-width: 520px; animation: toast .18s ease-out; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast button { color: #FF9C9C; font-weight: 600; }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }
.oh-tip { position: fixed; z-index: 120; display: none; pointer-events: none; background: #1f1f23; color: #f4f4f1; padding: 6px 9px; border-radius: 5px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; }
.oh-tip b { display: block; font-weight: 600; }
.oh-tip span { opacity: .8; }

.palette { width: min(600px, 100%); background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.pal-in input { flex: 1; border: 0; outline: 0; background: none; font-size: 15px; color: var(--text); }
.pal-list { max-height: 52vh; overflow: auto; padding: 6px; display: flex; flex-direction: column; }
.pal-list button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 5px; text-align: left; }
.pal-list button span:not(.gl) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-list button .ic { color: var(--muted); }
.pal-list button.on, .pal-list button:hover { background: var(--accent-soft); }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100vh; }
#app.no-sidebar { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; background: var(--surface-2); border-right: 1px solid var(--border); min-width: 0; overflow: hidden; }
.sb-top { display: flex; align-items: center; gap: 10px; padding: 14px 10px 10px 14px; }
.logo { width: 30px; height: 30px; border-radius: 5px; background: var(--accent); display: grid; place-items: center; flex: none; }
.logo i { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--on-accent); box-shadow: 0 0 0 3px var(--accent), 0 0 0 4.5px color-mix(in srgb, var(--on-accent) 55%, transparent); }
.ws { flex: 1; min-width: 0; line-height: 1.2; }
.ws b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ws small, .sb-me small { color: var(--muted); font-size: 11.5px; }
.sb-search { display: flex; align-items: center; gap: 8px; margin: 2px 10px 8px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; }
.sb-search span { flex: 1; text-align: left; }
.sb-search:hover { border-color: var(--border-2); }
.sb-nav { flex: 1; overflow: auto; padding: 0 8px 10px; }
.nav-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 8px 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-i { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 4px 0 8px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13.5px; position: relative; }
.nav-i .ic { color: var(--muted); }
.nav-i .nl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-i:hover { background: var(--surface-3); color: var(--text); }
.nav-i.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-i.on .ic { color: var(--accent); }
.nav-i.also::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .55; margin-right: 8px; }
.nav-split { display: none; width: 24px; height: 24px; border-radius: 5px; place-items: center; color: var(--muted); }
.nav-split .ic { width: 14px; height: 14px; }
.nav-i:hover .nav-split { display: grid; }
.nav-i:hover.also::after { display: none; }
.nav-split:hover { background: var(--surface); color: var(--accent); }
.sb-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.sb-alert { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 5px 8px; border-radius: var(--r-sm); }
.sb-alert:hover { background: var(--surface-3); }
.sb-tools { display: flex; align-items: center; gap: 2px; }
.sb-me { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); text-align: left; }
.sb-me:hover { background: var(--surface-3); }
.sb-me span:not(.av) { flex: 1; min-width: 0; line-height: 1.25; }
.sb-me b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-me .av { width: 28px; height: 28px; font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.panes { flex: 1; display: flex; min-height: 0; --ratio: .5; }
.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.panes.split .pane[data-pane="0"] { flex: 0 0 calc(var(--ratio) * 100% - 3px); }
.panes.split .pane.active .pane-head { box-shadow: inset 0 2px 0 var(--accent); }
.divider { display: none; flex: 0 0 6px; cursor: col-resize; background: var(--border); position: relative; transition: background .12s; }
.panes.split .divider { display: block; }
.divider:hover, .panes.resizing .divider { background: var(--accent); }
.panes.resizing { user-select: none; cursor: col-resize; }
.panes.resizing .pane { pointer-events: none; }
.pane-head { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.ph-title { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px; min-width: 0; }
.ph-title span:not(.gl) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-title:hover { background: var(--surface-3); }
.ph-title > .ic:first-child { color: var(--accent); }
.pane-body { flex: 1; min-height: 0; position: relative; container-type: inline-size; container-name: pane; overflow: hidden; }
.view { height: 100%; display: flex; flex-direction: column; min-height: 0; }

.vhead { display: flex; align-items: center; gap: 14px; padding: 16px 20px 12px; flex-wrap: wrap; flex: none; }
.vhead.flat { padding: 0 0 18px; }
.vh-l { display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0; }
.vh-t { min-width: 0; }
.vh-t h1, .jr-head h1 { font-size: 20px; font-weight: 680; letter-spacing: -.01em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vh-t h1[data-act] { cursor: text; border-radius: 5px; }
.vh-t h1[data-act]:hover { background: var(--surface-3); }
.vdesc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vdesc[data-act] { cursor: text; }
.vh-r { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.emo-btn { width: 40px; height: 40px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: 20px; display: grid; place-items: center; flex: none; }
.emo-btn:not(.static):hover { border-color: var(--accent); }
.emo-btn.static { cursor: default; color: var(--accent); }
.emo-btn .ic { width: 20px; height: 20px; }

/* ---------- live cells ---------- */
.cell { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 30px; padding: 3px 8px; border-radius: 6px; text-align: left; font-size: 13px; min-width: 0; }
.cell:hover { background: var(--surface-3); }
.cell > span:not(.pill):not(.av):not(.gl) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell .ph { color: var(--border-2); }
.c-status { padding: 3px 6px; }
.c-status .pill { width: 100%; }
.c-title { font-weight: 500; cursor: text; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 24px; }
.c-title.big { font-size: 20px; font-weight: 680; white-space: normal; line-height: 1.3; padding: 4px 8px; margin-left: -8px; }
.c-num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.c-date.overdue { color: var(--c-red); font-weight: 600; }
.cell.mini { width: auto; min-height: 22px; padding: 0 2px; font-size: 12px; color: var(--text-2); }
.cell.mini.c-status { padding: 0; }
.cell.mini .pill { height: 20px; padding: 0 7px; font-size: 11px; width: auto; }
.cell.mini .av { width: 22px; height: 22px; }
.cell.mini.c-person > span:not(.av) { display: none; }
.cell-input { height: 30px; border: 1px solid var(--accent); border-radius: 6px; padding: 0 8px; background: var(--surface); outline: none; width: 100%; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---------- table ---------- */
.tscroll { flex: 1; overflow: auto; padding: 4px 20px 60px; }
.grp { margin-bottom: 22px; width: max-content; min-width: 100%; }
.grp-h { display: flex; align-items: center; gap: 6px; padding: 4px 0 6px; position: sticky; left: 0; width: max-content; }
.grp-h h3 { font-size: 15px; font-weight: 650; color: var(--c); cursor: text; padding: 0 4px; border-radius: 5px; }
.grp-h h3:hover { background: var(--surface-3); }
.grp-h .tw { color: var(--c); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; }
.grp-h .tw:hover { background: var(--surface-3); }
.grp.drop-on > .grp-h h3 { outline: 2px dashed var(--accent); }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); border-left: 4px solid var(--c); }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 10px; height: 34px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.grid th:hover { color: var(--text); background: var(--surface-2); }
.grid th.t-status, .grid th.t-person, .grid th.t-date { text-align: center; }
.grid th.t-number { text-align: right; }
.grid th.th-add { border-right: 0; text-align: center; padding: 0; }
.grid th .sort { font-style: normal; color: var(--accent); margin-left: 4px; }
.grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 2px 3px; height: 38px; overflow: hidden; }
.grid td:last-child, .grid th:last-child { border-right: 0; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid td.t-person .cell, .grid td.t-date .cell { justify-content: center; }
.td-title { position: relative; }
.grid td.td-title { display: flex; align-items: center; gap: 2px; padding-left: 4px; border-bottom: 1px solid var(--border); }
.td-title .c-title { flex: 1; min-width: 0; }
.grip { color: var(--border-2); cursor: grab; display: grid; place-items: center; width: 16px; opacity: 0; flex: none; }
.grip .ic { width: 14px; height: 14px; }
tr:hover .grip { opacity: 1; }
.row-tools { display: flex; align-items: center; gap: 6px; flex: none; padding-right: 4px; }
.cmt { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); }
.cmt .ic { width: 13px; height: 13px; }
.row-open { display: none; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); }
.row-open .ic { width: 12px; height: 12px; }
.row-open:hover { color: var(--accent); border-color: var(--accent); }
tr:hover .row-open { display: inline-flex; }
tr.drop-on td { box-shadow: inset 0 2px 0 var(--accent); }
.add-row td { border-bottom: 1px solid var(--border); }
.add-in { width: 100%; height: 32px; border: 0; outline: 0; background: none; padding: 0 10px; color: var(--text); border-radius: 6px; }
.add-in::placeholder { color: var(--muted); }
.add-in:focus { background: var(--accent-soft); }
.grid tfoot td { border-bottom: 0; height: 36px; padding: 0 10px; background: var(--surface-2); }
.grid tfoot td:first-child { border-bottom-left-radius: 8px; }
.grid tfoot td.sum { text-align: right; font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sum small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }
.st-bar { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; width: 100%; }
.st-bar i { min-width: 3px; }
.st-bar.big { height: 12px; }
.add-group { margin-top: -6px; }

/* ---------- kanban ---------- */
.kb { flex: 1; display: flex; gap: 12px; overflow: auto; padding: 4px 20px 24px; align-items: flex-start; }
.kb-col { flex: 0 0 272px; background: var(--surface-2); border: 1px solid var(--border); border-top: 3px solid var(--c); border-radius: var(--r); display: flex; flex-direction: column; max-height: 100%; }
.kb-col.drop-on { background: var(--accent-soft); border-color: var(--accent); }
.kb-col > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
.kb-col > header b { font-size: 13px; }
.kb-list { display: flex; flex-direction: column; gap: 8px; padding: 2px 8px 8px; overflow: auto; min-height: 20px; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 10px 10px 8px; box-shadow: var(--shadow-sm); cursor: grab; }
.kb-card:hover { border-color: var(--border-2); }
.kb-card.dragging { opacity: .35; }
.kb-t { font-weight: 550; font-size: 13.5px; line-height: 1.35; cursor: pointer; }
.kb-t:hover { color: var(--accent); }
.kb-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.kb-m { display: flex; align-items: center; gap: 6px; margin-top: 7px; min-height: 22px; }
.kb-col .add-in { margin: 0 8px 8px; width: auto; }

/* ---------- mini tables (embeds, dashboards, drawer, home) ---------- */
table.mini { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini td { padding: 1px 2px; border-top: 1px solid var(--border); height: 36px; overflow: hidden; }
.mini tr:first-child td { border-top: 0; }
.mini td:nth-child(2) { width: 132px; }
.mini td:nth-child(3) { width: 96px; }
.mini td:nth-child(4) { width: 92px; }
.mini td.mt { display: flex; align-items: center; gap: 4px; padding-left: 6px; }
.mini .c-title { flex: 1; min-width: 0; }
@container pane (max-width: 560px) { .mini td:nth-child(3) { width: 34px; } .mini td:nth-child(3) .cell > span:not(.av) { display: none; } .mini td:nth-child(4) { display: none; } .mini td:nth-child(2) { width: 118px; } }

/* ---------- drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); z-index: 60; transform: translateX(105%); transition: transform .2s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.dr-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 18px; }
.crumb { font-size: 12.5px; color: var(--text-2); font-weight: 500; padding: 3px 7px; border-radius: 6px; margin-left: -7px; }
.crumb:hover { background: var(--surface-3); }
.dr-body { flex: 1; overflow: auto; padding: 4px 20px 30px; }
.fields { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; align-items: center; margin: 12px 0 6px; }
.fields label { font-size: 12.5px; color: var(--muted); }
.fields .cell { max-width: 240px; }
.fields .c-status .pill { width: auto; min-width: 110px; }
.fields .c-num { justify-content: flex-start; }
.fields .sel { max-width: 240px; height: 30px; }
.dr-body section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 16px; }
.dr-body h5, .doc-links h5, .jr-extras h5, .ws-in h5.day, .lib-sub { display: flex; align-items: center; gap: 7px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; margin-bottom: 8px; }
.dr-body h5 .link { margin-left: auto; text-transform: none; letter-spacing: 0; }
.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.cm { display: flex; gap: 10px; }
.cm b { font-size: 13px; } .cm time, .hist time, .alist time { color: var(--muted); font-size: 11.5px; margin-left: 6px; white-space: nowrap; }
.cm p { color: var(--text-2); margin-top: 1px; }
.cm-new { display: flex; gap: 10px; align-items: center; }
.hist { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.dr-body .meta { margin-top: 18px; }

/* ---------- canvas ---------- */
.cv-stage { position: relative; flex: 1; overflow: hidden; outline: none; background-color: var(--bg); background-image: radial-gradient(var(--dotgrid) 1.2px, transparent 1.2px); cursor: grab; user-select: none; touch-action: none; }
.cv-stage.panning { cursor: grabbing; }
.cv-stage:not([data-tool="select"]) { cursor: crosshair; }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edge { pointer-events: stroke; cursor: pointer; }
.edge .eh { stroke: transparent; stroke-width: 16; fill: none; pointer-events: stroke; }
.el { stroke: var(--edge); stroke-width: 1.8; fill: none; }
.el.temp { stroke: var(--accent); stroke-dasharray: 5 4; }
.arr { fill: var(--edge); }
.edge.sel .el { stroke: var(--accent); stroke-width: 2.6; }
.edge text { font-size: 12px; font-weight: 600; fill: var(--text-2); paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round; }
.node { position: absolute; cursor: move; border-radius: 6px; }
.node .nt { white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.node.sel { outline: 2px solid var(--accent); outline-offset: 3px; }
.node.target { outline: 2px dashed var(--accent); outline-offset: 4px; }
.node.editing { cursor: text; }
.node.editing .nt { cursor: text; user-select: text; min-width: 20px; }
.node .port, .node .rz { position: absolute; display: none; }
.node .port { right: -9px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 2.5px solid var(--surface); cursor: crosshair; box-shadow: var(--shadow-sm); }
.node .rz { right: -5px; bottom: -5px; width: 12px; height: 12px; border-radius: 3px; background: var(--surface); border: 2px solid var(--accent); cursor: nwse-resize; }
.node.sel .port, .node.sel .rz, .node:hover .port { display: block; }
.node.sticky { background: color-mix(in srgb, var(--c, var(--c-amber)) 26%, #fffdf2); color: #1d1c19; padding: 14px; font-size: 14px; line-height: 1.35; font-weight: 500; border-radius: 3px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 6px 14px -4px rgba(0, 0, 0, .18); overflow: hidden; }
:root[data-theme="dark"] .node.sticky { background: color-mix(in srgb, var(--c, var(--c-amber)) 62%, #f4efdc); }
.node.text { padding: 8px 6px; font-size: 15px; color: var(--text); }
.node.text.xl { font-size: 26px; font-weight: 720; letter-spacing: -.015em; line-height: 1.15; }
.node.rect, .node.ellipse, .node.diamond { display: grid; place-items: center; text-align: center; padding: 12px; font-weight: 600; font-size: 13.5px; line-height: 1.25; color: var(--text); }
.node.rect { background: color-mix(in srgb, var(--c) var(--tint), var(--mix)); border: 2px solid var(--c); }
.node.ellipse { background: color-mix(in srgb, var(--c) var(--tint), var(--mix)); border: 2px solid var(--c); border-radius: 50%; }
.node.diamond { padding: 20px 34px; border-radius: 0; }
.node.diamond::before { content: ''; position: absolute; inset: 0; background: var(--c); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); z-index: -1; }
.node.diamond::after { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--c) var(--tint), var(--mix)); clip-path: polygon(50% 4px, calc(100% - 5px) 50%, 50% calc(100% - 4px), 5px 50%); z-index: -1; }
.node.diamond { isolation: isolate; }
.node.frame { border: 1.5px dashed var(--border-2); background: color-mix(in srgb, var(--surface) 55%, transparent); border-radius: 6px; }
.node.frame .fr-t { position: absolute; left: 4px; top: -26px; font-size: 13px; font-weight: 650; color: var(--text-2); white-space: nowrap; padding: 2px 6px; border-radius: 5px; }
.node.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-sm), 0 6px 16px -8px rgba(0, 0, 0, .2); padding: 9px 11px 8px 14px; display: flex; flex-direction: column; overflow: hidden; }
.node.card.sel, .node.card.target { overflow: visible; }
.node.card.item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); border-radius: 6px 0 0 11px; }
.node.card.doc::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); border-radius: 6px 0 0 11px; }
.node.card.ghost { border-style: dashed; color: var(--muted); justify-content: center; }
.cd-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; }
.cd-b { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-b .ic { width: 12px; height: 12px; }
.cd-open { color: var(--muted); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; opacity: 0; flex: none; }
.cd-open .ic { width: 13px; height: 13px; }
.node:hover .cd-open { opacity: 1; }
.cd-open:hover { background: var(--surface-3); color: var(--accent); }
.cd-t { font-weight: 600; font-size: 13.5px; line-height: 1.3; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cd-x { font-size: 12px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 3px; }
.cd-m { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.cv-top { position: absolute; left: 68px; top: 12px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px 6px 12px; box-shadow: var(--shadow-sm); font-size: 12px; color: var(--muted); max-width: calc(100% - 90px); cursor: default; }
.cv-top h2 { font-size: 14px; color: var(--text); cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-top span { white-space: nowrap; }
.cv-tools { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px; box-shadow: var(--shadow-sm); cursor: default; }
.cv-tools button { width: 34px; height: 34px; border-radius: 5px; display: grid; place-items: center; color: var(--text-2); }
.cv-tools button:hover { background: var(--surface-3); color: var(--text); }
.cv-tools button.on { background: var(--accent); color: var(--on-accent); }
.cv-tools hr { border: 0; border-top: 1px solid var(--border); margin: 3px 4px; }
.cv-tools .ic { width: 18px; height: 18px; }
.cv-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 3px; box-shadow: var(--shadow-sm); cursor: default; }
.cv-zoom button { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font-size: 16px; color: var(--text-2); }
.cv-zoom button:hover { background: var(--surface-3); }
.cv-zoom .zl { font-size: 12px; min-width: 44px; text-align: center; color: var(--text-2); font-variant-numeric: tabular-nums; }
.cv-selbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: none; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px; box-shadow: var(--shadow); cursor: default; max-width: calc(100% - 130px); flex-wrap: wrap; justify-content: center; }
.cv-selbar.show { display: flex; }
.cv-selbar > button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 5px; font-size: 12.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.cv-selbar > button:hover { background: var(--surface-3); color: var(--text); }
.cv-selbar > button.danger:hover { color: var(--danger); }
.cv-selbar .sws { display: flex; gap: 3px; padding: 0 4px; }
.cv-selbar .sep { width: 1px; height: 20px; background: var(--border); }
.cv-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; color: var(--muted); pointer-events: none; }
.cv-empty h3 { color: var(--text); font-size: 17px; } .cv-empty .btn { pointer-events: auto; margin-top: 8px; }

/* ---------- dashboard ---------- */
.dscroll { flex: 1; overflow: auto; padding: 4px 20px 40px; }
.dgrid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.wd { grid-column: span var(--span, 4); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; }
.wd > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wd h4, .card > header h4 { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.wd > header .icon-btn { opacity: 0; }
.wd:hover > header .icon-btn { opacity: 1; }
.wd-body { min-width: 0; flex: 1; }
@container pane (max-width: 980px) { .wd:not(.wd-kpi) { grid-column: span 6; } .wd.wd-list, .wd.wd-stack { grid-column: span 12; } .kpi .kv { font-size: 32px; } }
@container pane (max-width: 700px) { .wd:not(.wd-kpi) { grid-column: span 12; } .wd.wd-kpi { grid-column: span 6; } }
.kpi { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; gap: 2px; border-radius: 5px; }
.kpi .kv { font-size: 38px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi .ks { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi:hover .kv { color: var(--s1); }
svg.ch { display: block; max-width: 100%; }
.ch .grid { stroke: var(--grid); stroke-width: 1; } .ch .axis { stroke: var(--axis); stroke-width: 1; }
.ch text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.ch .tick { font-variant-numeric: tabular-nums; }
.ch .val { fill: var(--text); font-weight: 600; }
.ch .hit { fill: transparent; cursor: pointer; }
.ch .hit:hover { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.ch.donut path, .ch.donut circle { cursor: pointer; }
.ch .dn-total { fill: var(--text); font-size: 24px; font-weight: 700; }
.ch .dn-sub { font-size: 11px; }
.ch-empty { display: grid; place-items: center; min-height: 90px; color: var(--muted); font-size: 12.5px; text-align: center; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.legend { display: flex; flex-direction: column; gap: 5px; flex: 1 1 130px; min-width: 120px; }
.legend.row { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; flex: none; }
.lg-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: default; border-radius: 5px; padding: 1px 4px; }
.donut-wrap .lg-row { cursor: pointer; } .donut-wrap .lg-row:hover { background: var(--surface-3); }
.lg-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lg-l { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-v { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.hbar { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.hb-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; align-items: center; gap: 10px; cursor: pointer; border-radius: 5px; }
.hb-row:hover .hb-l { color: var(--text); }
.hb-l { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-t { height: 14px; display: block; }
.hb-t i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 3px; }
.hb-v { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.stack { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.st-row { display: grid; grid-template-columns: minmax(80px, 32%) 1fr 38px; align-items: center; gap: 10px; }
.st-l { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row .st-bar { height: 10px; } .st-row .st-bar i { cursor: pointer; }
.st-v { font-size: 12.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- knowledge hub ---------- */
.hub-view { flex-direction: row; }
.hub-tree { flex: 0 0 236px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.hub-tree .search { margin: 12px 10px 8px; } .hub-tree .search input { width: 100%; }
.tree-body { flex: 1; overflow: auto; padding: 0 6px; }
.tr-row { display: flex; align-items: center; gap: 6px; height: 30px; padding-right: 8px; border-radius: 6px; color: var(--text-2); font-size: 13px; }
.tr-row:hover { background: var(--surface-3); color: var(--text); }
.tr-row.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tr-row .tw { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; flex: none; color: var(--muted); }
.tr-row .tw .ic { width: 12px; height: 12px; }
.tr-row button.tw:hover { background: var(--surface); }
.tr-row .tl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-foot { display: flex; gap: 4px; padding: 8px; border-top: 1px solid var(--border); }
.hub-main { flex: 1; min-width: 0; overflow: auto; }
.doc-top { display: flex; align-items: center; gap: 8px; padding: 10px 20px; position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); z-index: 2; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; min-width: 0; overflow: hidden; }
.crumbs a { color: var(--text-2); padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { background: var(--surface-3); } .crumbs a.cur { color: var(--text); font-weight: 600; }
.tree-toggle { display: none; }
.docpage { max-width: 820px; margin: 0 auto; padding: 8px 28px 80px; }
.docpage.mode-split { max-width: 1280px; }
.doc-head { display: flex; align-items: center; gap: 12px; }
.doc-title { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 30px; font-weight: 720; letter-spacing: -.02em; padding: 2px 0; }
.doc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin: 8px 0 18px; }
.doc-meta .tags { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; margin-left: 6px; }
.doc-body { display: grid; gap: 22px; }
.docpage.mode-split .doc-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.editor { width: 100%; min-height: 420px; resize: vertical; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: 16px 18px; font: 13.5px/1.65 var(--mono); outline: none; tab-size: 2; }
.editor:focus { border-color: var(--accent); }
.docpage.mode-split .editor { position: sticky; top: 56px; height: calc(100cqh - 250px); min-height: 300px; }
.syntax { margin-top: 12px; line-height: 2; }
.doc-links { margin-top: 34px; display: grid; gap: 22px; }
.doc-links section { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; }
@container pane (max-width: 900px) { .docpage.mode-split .doc-body { grid-template-columns: 1fr; } .docpage.mode-split .editor { position: static; height: 300px; } }
@container pane (max-width: 720px) {
  .hub-tree { display: none; position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; box-shadow: var(--shadow); }
  .hub-view.tree-open .hub-tree { display: flex; }
  .tree-toggle { display: inline-grid; }
  .docpage { padding: 8px 18px 60px; } .doc-title { font-size: 24px; }
}

.prose { font-size: 15px; line-height: 1.68; color: var(--text); overflow-wrap: anywhere; }
.prose.small { font-size: 13.5px; line-height: 1.55; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 26px; letter-spacing: -.02em; margin: 26px 0 10px; line-height: 1.25; }
.prose h2 { font-size: 19px; margin: 28px 0 8px; letter-spacing: -.01em; }
.prose h3 { font-size: 16px; margin: 20px 0 6px; } .prose h4 { font-size: 14px; margin: 16px 0 4px; color: var(--text-2); }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 24px; }
.prose li { margin: 3px 0; } .prose li.l1 { margin-left: 22px; } .prose li.l2 { margin-left: 44px; } .prose li.l3 { margin-left: 66px; }
.prose li.task { list-style: none; margin-left: -22px; display: flex; gap: 9px; align-items: baseline; }
.prose li.task.l1 { margin-left: 0; } .prose li.task.l2 { margin-left: 22px; }
.prose li.task input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; transform: translateY(2px); cursor: pointer; }
.prose li.task.done > span { color: var(--muted); text-decoration: line-through; }
.prose blockquote { margin: 0 0 12px; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-2); }
.prose pre { background: var(--surface-3); border-radius: 5px; padding: 12px 14px; overflow: auto; margin: 0 0 12px; }
.prose pre code { background: none; padding: 0; font: 12.5px/1.55 var(--mono); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
.prose table.mdt { border-collapse: collapse; margin: 0 0 14px; font-size: 13.5px; width: 100%; }
.mdt th, .mdt td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.mdt th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.prose .chip { margin: 1px 1px; }
.embed { margin: 4px 0 16px; }
.embed-box { border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow: hidden; line-height: 1.45; font-size: 14px; }
.embed-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.embed-head a, .embed-head .strong { font-size: 13px; font-weight: 600; color: var(--text); }
.embed-head a:hover { color: var(--accent); }
.embed-box > .st-bar { margin: 14px; width: auto; }
.embed-chart { padding: 14px 16px; }
.embed-miss { border: 1px dashed var(--border-2); border-radius: 6px; padding: 10px 14px; color: var(--muted); font-size: 13px; }

.lib { max-width: 1040px; margin: 0 auto; padding: 8px 28px 60px; }
.lib-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.lib-head .vh-t { flex: 1 1 220px; } .lib-head .vdesc { white-space: normal; }
.lib-sub { margin: 22px 0 10px; }
.recents { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.recent { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px; color: var(--text); min-height: 118px; }
.recent:hover { border-color: var(--accent); }
.recent .gl { font-size: 20px; margin-bottom: 4px; }
.recent b { font-size: 13.5px; } .recent small { color: var(--muted); font-size: 12px; line-height: 1.4; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent time { color: var(--muted); font-size: 11.5px; }
.lib-t { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.lib-t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lib-t td { padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.lib-t tr:last-child td { border-bottom: 0; }
.lib-t tbody tr { cursor: pointer; } .lib-t tbody tr:hover td { background: var(--surface-2); }
.lib-t td.ln { color: var(--text); display: flex; align-items: center; gap: 10px; }
.lib-t td .av { vertical-align: middle; margin-right: 6px; }
@container pane (max-width: 640px) { .lib-t th:nth-child(3), .lib-t td:nth-child(3), .lib-t th:nth-child(5), .lib-t td:nth-child(5) { display: none; } .lib { padding: 8px 16px 50px; } }
.file-img { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 28px; display: grid; place-items: center; }
.file-img img { max-width: 100%; max-height: 420px; }
.file-pre { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; overflow: auto; font: 12.5px/1.5 var(--mono); max-height: 520px; }

/* ---------- journal ---------- */
.journal-view { flex-direction: row; }
.jr-side { flex: 0 0 212px; border-right: 1px solid var(--border); background: var(--surface); overflow: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.jr-side h6 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 8px 4px; }
.jr-i { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 5px; text-align: left; color: var(--text-2); }
.jr-i .ic { color: var(--muted); } .jr-i span { min-width: 0; line-height: 1.25; }
.jr-i b { display: block; font-size: 13px; font-weight: 550; } .jr-i small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-i:hover { background: var(--surface-3); } .jr-i.on { background: var(--accent-soft); } .jr-i.on b, .jr-i.on .ic { color: var(--accent); }
.jr-main { flex: 1; min-width: 0; overflow: auto; padding: 16px 24px 60px; }
.jr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.jr-nav { display: flex; align-items: center; gap: 4px; } .jr-nav h1 { padding: 0 6px; }
.jr-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.jr-cols .editor { min-height: 320px; height: 44cqh; }
.jr-cols .preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px 20px; min-height: 320px; }
.jr-extras { display: grid; gap: 16px; margin-top: 22px; }
.jr-extras section { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; }
@container pane (max-width: 820px) { .jr-cols { grid-template-columns: 1fr; } .jr-cols .editor { height: 240px; min-height: 200px; } }
@container pane (max-width: 600px) { .jr-side { flex-basis: 54px; } .jr-side h6, .jr-i span { display: none; } .jr-i { justify-content: center; } .jr-main { padding: 14px 14px 50px; } }

.alist, .plist { list-style: none; margin: 0; padding: 0; }
.alist li, .plist li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); }
.alist li:first-child, .plist li:first-child { border-top: 0; }
.alist li span:not(.av), .plist li span:not(.gl) { flex: 1; min-width: 0; }
.alist li b { color: var(--text); font-weight: 600; }
.alist li.clk, .plist li.clk { cursor: pointer; } .alist li.clk:hover, .plist li.clk:hover { background: var(--surface-2); }
.plist b { display: block; color: var(--text); font-weight: 550; } .plist small { color: var(--muted); font-size: 11.5px; }
.alist.two { display: grid; grid-template-columns: 1fr 1fr; } .alist.two li:nth-child(2) { border-top: 0; }
@container pane (max-width: 760px) { .alist.two { grid-template-columns: 1fr; } .alist.two li:nth-child(2) { border-top: 1px solid var(--border); } }

/* ---------- calendar ---------- */
.cal { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0 20px 20px; overflow: auto; }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 0 6px; min-width: 620px; }
.cal-dow span { padding-left: 8px; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(104px, 1fr); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--border); gap: 1px; min-width: 620px; }
.cal-day { background: var(--surface); padding: 4px 5px 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.we { background: var(--surface-2); } .cal-day.out { background: var(--bg); } .cal-day.out .dn { color: var(--border-2); }
.cal-day.drop-on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day > header { display: flex; align-items: center; gap: 5px; height: 24px; }
.cal-day .dn { font-size: 12px; font-weight: 600; color: var(--text-2); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-day .dn:hover { background: var(--surface-3); }
.cal-day.today .dn { background: var(--accent); color: var(--on-accent); }
.jdot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .6; }
.cal-day .add { margin-left: auto; opacity: 0; } .cal-day:hover .add { opacity: 1; }
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--text); padding: 2px 6px; border-radius: 5px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.cal-chip:hover { background: color-mix(in srgb, var(--c) 26%, var(--surface)); }
.cal-chip .dot { width: 7px; height: 7px; }
.cal-chip.done { color: var(--muted); text-decoration: line-through; }
.cal-chip.late { box-shadow: inset 0 0 0 1px var(--c-red); }
.cal-day .more { font-size: 11px; text-align: left; padding-left: 6px; }

/* ---------- home ---------- */
.home-view { overflow: auto; display: block; }
.home-in { max-width: 1180px; margin: 0 auto; padding: 30px 28px 60px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-size: 12.5px; color: var(--muted); font-weight: 550; margin-bottom: 4px; }
.hero h1 { font-size: 30px; font-weight: 730; letter-spacing: -.025em; line-height: 1.15; }
.hero .sub { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.quick { display: flex; gap: 6px; align-items: center; flex: 0 1 430px; min-width: 260px; }
.quick .inp { height: 38px; flex: 1; } .quick .btn { height: 38px; background: var(--surface); border-color: var(--border); max-width: 190px; overflow: hidden; }
.tour { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r); padding: 18px 20px 20px; margin-bottom: 18px; }
.tour > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tour h3 { font-size: 16px; letter-spacing: -.01em; } .tour header p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.tour-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.tour-steps button { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; align-items: start; transition: border-color .12s, transform .12s; }
.tour-steps button:hover { border-color: var(--accent); transform: translateY(-1px); }
.tn { grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.tour-steps b { font-size: 13.5px; } .tour-steps small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.home-grid .card { overflow: hidden; }
.home-grid .span2 { grid-column: span 2; } .home-grid .span3 { grid-column: span 3; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 16px 9px; }
.card > header h4 { color: var(--text); font-size: 13.5px; }
.card > header h4 .ic { color: var(--muted); }
.card > .mini { margin-bottom: 4px; } .card > .mini td.mt { padding-left: 12px; }
.card > .mini td { border-top: 1px solid var(--border) !important; }
.home-chart { padding: 6px 16px 16px; }
@container pane (max-width: 900px) { .home-grid { grid-template-columns: 1fr; } .home-grid .span2, .home-grid .span3 { grid-column: auto; } .home-in { padding: 22px 16px 50px; } .hero h1 { font-size: 25px; } }

/* ---------- workspace ---------- */
.ws-view { overflow: auto; display: block; }
.ws-in { max-width: 1000px; margin: 0 auto; padding: 26px 28px 60px; }
.ws-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ws-in h5.day { margin: 20px 0 8px; } .ws-in h5.day small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.lead { font-size: 13.5px; margin-bottom: 14px; max-width: 680px; }
.people { margin-bottom: 12px; }
.pp { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); }
.pp:first-child { border-top: 0; } .pp .inp { flex: 1; min-width: 0; }
.ws-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ws-grid h4 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; margin-bottom: 6px; } .ws-grid h4 .ic { color: var(--accent); }
.ws-grid p { color: var(--text-2); font-size: 13.5px; margin-bottom: 12px; } .ws-grid p.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .meter i { display: block; height: 100%; background: var(--s1); border-radius: 99px; } .meter.warn i { background: var(--c-red); }
.fld { display: block; font-size: 12.5px; color: var(--muted); margin-top: 14px; } .fld .inp { margin-top: 4px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); } .danger-zone h4 .ic { color: var(--danger); }
@container pane (max-width: 760px) { .ws-grid { grid-template-columns: 1fr; } .ws-in { padding: 20px 16px 50px; } .pp { flex-wrap: wrap; } }

@container pane (max-width: 640px) { .vhead { padding: 12px 14px 10px; } .tscroll, .kb, .dscroll { padding-left: 14px; padding-right: 14px; } .search input { width: 90px; } .vdesc { display: none; } }
@media (max-width: 860px) { #app { grid-template-columns: 0 minmax(0, 1fr); } #app:not(.no-sidebar) .sidebar { position: fixed; z-index: 70; width: 250px; height: 100vh; box-shadow: var(--shadow); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- line icons in place of emoji ---------- */
.gl { display: inline-grid; place-items: center; flex: none; color: var(--text-2); }
.gl .ic { width: 16px; height: 16px; }
.nav-i .gl, .tr-row .gl, .menu .gl, .pal-list .gl { color: var(--muted); }
.nav-i.on .gl, .tr-row.on .gl { color: var(--accent); }
.ph-title .gl { color: var(--accent); }
.emo-btn { border-radius: 6px; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.emo-btn .gl { color: inherit; } .emo-btn .gl .ic { width: 20px; height: 20px; }
.recent .gl { justify-self: start; align-self: flex-start; color: var(--accent); margin-bottom: 4px; } .recent .gl .ic { width: 20px; height: 20px; }
.cd-b .gl .ic, .chip .gl .ic, .embed-head .gl .ic { width: 13px; height: 13px; }
.embed-head a, .crumb { display: inline-flex; align-items: center; gap: 6px; }
.cd-t .gl { display: inline-grid; vertical-align: -3px; margin-right: 3px; }
.icon-grid { display: grid; grid-template-columns: repeat(7, 34px); gap: 2px; padding: 8px; }
.icon-grid button { width: 34px; height: 34px; border-radius: 5px; display: grid; place-items: center; color: var(--text-2); }
.icon-grid button:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- sober shell: dark navy rail, restrained accent ---------- */
.sidebar { --text: #F1EFEA; --text-2: #BDBAB3; --muted: #86847E; --surface: #232327; --surface-2: #141416; --surface-3: #26262B; --border: #2E2E33; --border-2: #45454B; --accent: #FC6262; --accent-soft: #3A2224; --on-accent: #141416; background: #141416; color: var(--text); border-right-color: #141416; }
.sidebar .nav-i.on { color: #fff; } .sidebar .nav-i.on .ic, .sidebar .nav-i.on .gl { color: var(--accent); }
.sidebar kbd { background: transparent; }
.logo { border-radius: 6px; background: #E5484D; } .logo i { border-color: #fff; box-shadow: none; width: 13px; height: 13px; border-width: 2.5px; }
.pill { border-radius: 4px; font-weight: 600; letter-spacing: .01em; }
.vh-t h1, .jr-head h1 { font-weight: 650; }
.hero h1 { font-weight: 680; letter-spacing: -.02em; }
.kpi .kv { font-weight: 650; }
.tn { border-radius: 5px; }
.panes.split .pane.active .pane-head { box-shadow: inset 0 2px 0 var(--accent); }

/* ---------- plan, workspaces, backup and sync ---------- */
button.ws { text-align: left; border-radius: 5px; padding: 3px 6px; margin-left: -6px; }
button.ws:hover { background: var(--surface-3); }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.lock { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 6px; padding: 10px 12px; color: var(--muted) !important; font-size: 13px !important; margin: 0 !important; }
.lock .ic { color: var(--muted); }
.wslist { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; }
.wsrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); min-height: 46px; }
.wsrow:first-child { border-top: 0; }
.wsrow > span { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }
.wsrow > span .ic { color: var(--muted); }
.wsrow small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.wsrow.on { background: var(--accent-soft); }
.sel.sm { width: 120px; height: 30px; }
.chk.big { display: flex; font-size: 13.5px; color: var(--text); margin: 14px 0 12px; white-space: normal; }
.kvl { font-size: 13.5px; }
.warn-txt { color: var(--danger); }
.ws-grid h4 .badge { margin-left: auto; }

/* ---------- sign in ---------- */
.auth { grid-column: 1 / -1; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1000px 500px at 80% -10%, #4A2226 0%, transparent 60%), #141416; }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 10px; padding: 30px 30px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); display: grid; gap: 12px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 6px; }
.auth-card h1 { font-size: 22px; letter-spacing: -.02em; }
.auth-card label { display: grid; gap: 5px; font-size: 13px; color: var(--text-2); font-weight: 550; }
.auth-card .inp { height: 40px; }
.auth-card .btn { height: 42px; justify-content: center; font-size: 14.5px; margin-top: 4px; }
.auth-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.auth-card .switch { text-align: center; }

.wm em { font-style: normal; color: var(--accent); }
.auth-card .hint b { color: var(--text); }

/* ---------- data tables and query editor ---------- */
.data-view { flex-direction: row; }
.dv-side { flex: 0 0 220px; border-right: 1px solid var(--border); background: var(--surface); overflow: auto; padding: 10px 6px; }
.dv-new { padding: 2px 4px 10px; } .dv-new .btn { width: 100%; justify-content: center; }
.dv-side .tr-row { padding-left: 8px; gap: 8px; } .dv-side .tr-row .ic { color: var(--muted); width: 15px; height: 15px; }
.dv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.dv-body { flex: 1; display: flex; min-height: 0; border-top: 1px solid var(--border); }
.dv-steps { flex: 0 0 290px; overflow: auto; padding: 12px; border-right: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.dv-steps h6 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 2px; }
.dv-step { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px 2px 2px; }
.dv-step.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dv-step.off { opacity: .5; } .dv-step.bad { border-color: var(--danger); }
.dv-step.bad small { color: var(--danger) !important; }
.dv-step .st-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 6px; text-align: left; border-radius: 5px; }
.dv-step .st-main:hover { background: var(--surface-3); }
.dv-step .st-main > .ic { color: var(--accent); }
.dv-step .st-main span { flex: 1; min-width: 0; line-height: 1.25; }
.dv-step b { display: block; font-size: 12.5px; } .dv-step small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-step em { font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-step .icon-btn { display: none; } .dv-step:hover .icon-btn { display: inline-grid; } .dv-step:hover em { display: none; }
.ic.up { transform: rotate(-90deg); }
.dv-grid { flex: 1; min-width: 0; overflow: auto; background: var(--surface); }
.dv-err { display: flex; align-items: center; gap: 8px; margin: 12px; padding: 10px 12px; border: 1px solid var(--danger); border-radius: 6px; color: var(--danger); font-size: 13px; }
.dv-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.dv-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; font-weight: 600; z-index: 1; }
.dv-table th em { font-style: normal; font-weight: 500; font-size: 10px; color: var(--muted); margin-left: 8px; background: var(--surface-3); padding: 1px 5px; border-radius: 3px; }
.dv-table td { padding: 5px 12px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.dv-table td.n { text-align: right; font-variant-numeric: tabular-nums; } .dv-table td.nil { color: var(--border-2); text-align: center; }
.dv-table .rn { color: var(--muted); text-align: right; width: 44px; background: var(--surface-2); font-size: 11px; }
.dv-table tbody tr:hover td { background: var(--accent-soft); }
.step-form { grid-template-columns: 200px 1fr; align-items: start; } .step-form > label { padding-top: 7px; }
.ticks { display: flex; flex-wrap: wrap; gap: 6px 16px; max-height: 190px; overflow: auto; padding: 4px 2px; }
.ticks .chk { font-size: 13px; color: var(--text); }
.aggs { display: grid; gap: 6px; } .agg-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 6px; }
textarea.formula { font: 13px/1.5 var(--mono); min-height: 80px; }
.step-form .hint { margin-top: 6px; line-height: 1.7; }
@container pane (max-width: 900px) { .dv-side { display: none; } .dv-steps { flex-basis: 230px; } }
@container pane (max-width: 620px) { .dv-body { flex-direction: column; } .dv-steps { flex: 0 0 auto; max-height: 200px; border-right: 0; border-bottom: 1px solid var(--border); } }

/* ---------- analytics charts and dashboard filters ---------- */
.wd-viz .wd-body { flex: none; }
.wd-body.big-chart, .wd-body.preview { flex: none; }
.modal.xwide { width: min(1100px, 100%); }
.vz-table { max-height: 320px; overflow: auto; } .vz-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vz-table th, .vz-table td { border-bottom: 1px solid var(--border); padding: 6px 10px; text-align: left; white-space: nowrap; }
.vz-table th { position: sticky; top: 0; background: var(--surface-2); font-size: 12px; color: var(--text-2); }
.vz-table .n { text-align: right; font-variant-numeric: tabular-nums; } .vz-table tfoot td { font-weight: 650; border-top: 2px solid var(--border-2); border-bottom: 0; }
.slicers { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.slicer { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow: hidden; }
.slicer.on { border-color: var(--accent); background: var(--accent-soft); }
.slicer > button:first-child { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; font-size: 12.5px; }
.slicer > button:first-child .ic { width: 13px; height: 13px; color: var(--muted); } .slicer span { color: var(--text-2); }
.slicer .x { width: 26px; display: grid; place-items: center; border-left: 1px solid var(--border); color: var(--muted); } .slicer .x .ic { width: 12px; height: 12px; }
.slicer .x:hover { color: var(--danger); }
.docpick .ticks { flex-direction: column; flex-wrap: nowrap; gap: 2px; max-height: 240px; padding: 4px 8px; } .docpick .ticks .chk { padding: 4px 0; }

/* ---------- measures, date ranges, movable widgets ---------- */
.ms-list { display: grid; gap: 10px; } .ms-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.ms-parts { grid-column: 1 / 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); } .ms-parts .sel { width: auto; min-width: 150px; }
.ms-row > .icon-btn { grid-row: 1; grid-column: 3; }
.datepop.wide { width: 300px; } .datepop .range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 2px; } .datepop .range label { font-size: 12px; color: var(--muted); display: grid; gap: 3px; }
.wd { position: relative; } .wd > header[draggable] { cursor: grab; }
.wd.drop-on { outline: 2px dashed var(--accent); outline-offset: 2px; }
.wd-rz { position: absolute; top: 12px; bottom: 12px; right: -4px; width: 8px; cursor: ew-resize; border-radius: 4px; }
.wd-rz:hover, .wd.resizing .wd-rz { background: var(--accent); opacity: .5; } .wd.resizing { outline: 2px solid var(--accent); }

.auth-err.ok { color: var(--c-green); }
.badge.warn { background: color-mix(in srgb, var(--c-amber) 22%, var(--surface)); color: var(--text); }
.link.danger { color: var(--danger); }
.auth-card .switch a { cursor: pointer; }

/* ---------- templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 6px; }
.tpl { text-align: left; display: grid; gap: 6px; align-content: start; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.tpl:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpl-ic { width: 36px; height: 36px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 4px; }
.tpl-ic .ic { width: 20px; height: 20px; }
.tpl b { font-size: 15px; } .tpl small { color: var(--text-2); font-size: 13px; line-height: 1.45; } .tpl em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.tn .ic { width: 14px; height: 14px; }

/* ---------- two-step sign-in ---------- */
.qrbox { display: grid; place-items: center; padding: 12px; margin: 10px 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.qrbox .qr { display: block; }
code.key { font-size: 14px; letter-spacing: .06em; user-select: all; }
pre.codes { columns: 2; margin: 10px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 15px; line-height: 1.9; user-select: all; }

/* ---------- phones and small tablets ----------
   Basics only: the sidebar is a slide-over menu, one pane at a time, pages
   stack in one column, wide things scroll sideways inside their own area. */
@media (max-width: 860px) {
  #app:not(.no-sidebar) .sidebar { width: min(290px, 86vw); height: 100dvh; }
  #app:not(.no-sidebar) .panes::after { content: ''; position: fixed; inset: 0; background: rgba(8, 12, 20, .45); z-index: 65; }
  .panes.split .pane[data-pane="1"], .panes.split .divider { display: none; }
  .panes.split .pane[data-pane="0"] { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .home-grid, .ws-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid .span2, .home-grid .span3 { grid-column: auto; }
  .drawer { width: 100vw; border-left: 0; }
  .pane-head { overflow-x: auto; scrollbar-width: none; } .pane-head::-webkit-scrollbar { display: none; } .pane-head > * { flex: none; }
  .form, .fields, .step-form { grid-template-columns: minmax(0, 1fr); gap: 4px; } .form > label, .fields > label, .step-form > label { padding-top: 6px; }
  .modal { width: 100%; max-height: 92dvh; overflow-y: auto; }
  .modal > footer { flex-wrap: wrap; }
  .cal-grid { grid-auto-rows: minmax(64px, 1fr); }
  .ws-grid .row, .ws-grid .btns { flex-wrap: wrap; }
  .wsrow { flex-wrap: wrap; gap: 6px; }
  .auth-card { width: 100%; }
  pre.codes { columns: 1; }
  .inp, .sel, textarea { font-size: 16px; } /* stops phones zooming in when a field is tapped */
}

/* ---------- Business plan: membership and security record ---------- */
.rec { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; margin: 8px 0 4px; }
.rec table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rec th, .rec td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.rec th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; }
.rec-h { font-size: 13.5px; margin-top: 14px; }

/* Red means "bad" in charts and numbers (Stuck, overdue, over budget), so the
   brand red is never a default data colour. Charts start from blue (--s1) and
   red is the last colour in the series; meters and highlighted numbers use
   --s1 too. Red stays for buttons, links, the selected item and real warnings. */

/* ---------- phone polish (checked at 390 x 844 with real phone emulation) ---------- */
@media (max-width: 860px) {
  [data-ph="split"] { display: none; }                      /* one pane at a time on a phone */
  .vh-r { min-width: 0; max-width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; flex: none; }
  .icon-btn { min-width: 36px; min-height: 36px; }          /* comfortable to tap */
  .nav-i { height: 40px; } .btn { height: 38px; } .btn.sm { height: 34px; }
  body { padding-bottom: env(safe-area-inset-bottom); }
}
