/* Waters Boards — light / dark / night themes, desktop + phone layouts. */
:root {
  --font: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f5f6f8; --surface-3: #ecedf5;
  --text: #323338; --muted: #676879; --faint: #c3c6d4; --border: #d0d4e4; --border-soft: #e6e9ef;
  --primary: #0073ea; --primary-hover: #0060b9; --primary-soft: #cce5ff; --primary-text: #fff;
  --rail: #f6f7fb; --nav: #ffffff; --hover: #dcdfec66; --selected: #cce5ff;
  --row-hover: #f5f6f8; --row-selected: #e5f4ff;
  --status-empty: #c4c4c4; --tl-rest: #333333; --red: #e2445c; --green: #00c875; --orange: #fdab3d;
  --shadow: 0 6px 20px rgba(0,0,0,.12); --shadow-lg: 0 15px 50px rgba(0,0,0,.18);
  --radius: 8px; --radius-sm: 4px;
  --rail-w: 56px; --nav-w: 256px; --row-h: 36px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #181b34; --surface: #30324e; --surface-2: #292f4c; --surface-3: #3a3d5c;
  --text: #d5d8df; --muted: #9699a6; --faint: #4b4e69; --border: #4b4e69; --border-soft: #3b3e5a;
  --primary: #0073ea; --primary-hover: #1f87f5; --primary-soft: #133774;
  --rail: #181b34; --nav: #292f4c; --hover: #ffffff14; --selected: #133774;
  --row-hover: #3a3d5c; --row-selected: #233a6b;
  --status-empty: #797e93; --tl-rest: #5b5e77;
  --shadow: 0 6px 20px rgba(0,0,0,.4); --shadow-lg: 0 15px 50px rgba(0,0,0,.5);
  color-scheme: dark;
}
:root[data-theme="night"] {
  --bg: #111111; --surface: #1a1a1a; --surface-2: #222222; --surface-3: #2c2c2c;
  --text: #e1e1e1; --muted: #a0a0a0; --faint: #3c3c3c; --border: #3c3c3c; --border-soft: #2c2c2c;
  --primary: #0073ea; --primary-hover: #1f87f5; --primary-soft: #133774;
  --rail: #111111; --nav: #1a1a1a; --hover: #ffffff12; --selected: #133774;
  --row-hover: #262626; --row-selected: #1d2c47;
  --status-empty: #6b6b6b; --tl-rest: #4d4d4d;
  --shadow: 0 6px 20px rgba(0,0,0,.6); --shadow-lg: 0 15px 50px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
.icon { flex-shrink: 0; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.pad { padding: 16px; }
.pad-x { padding: 4px 12px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scroll-y { overflow-y: auto; max-height: 60vh; }
.link { color: var(--primary); cursor: pointer; text-align: left; }
.link:hover { text-decoration: underline; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }

/* ─── Buttons & inputs ─── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-weight: 500; white-space: nowrap; transition: background .12s; border: 1px solid var(--border); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--red); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--muted); flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--primary); }
.icon-btn:disabled { opacity: .35; }
.input { height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); width: 100%; outline: none; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.input.sm { height: 32px; padding: 0 8px; font-size: 14px; }
textarea.input { height: auto; padding: 8px 12px; resize: vertical; line-height: 1.5; }
select.input[multiple] { height: auto; padding: 4px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--border); }
.chip-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.warn-note { background: #fdab3d26; border-left: 3px solid var(--orange); padding: 8px 12px; border-radius: 4px; font-size: 13px; }
.error-note { color: var(--red); font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { padding: 5px 12px; font-size: 13px; }
.seg button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--faint); border-radius: 10px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ─── Avatars ─── */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600;
  flex-shrink: 0; overflow: visible; letter-spacing: .3px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.empty { background: transparent; color: var(--faint); border: 1px dashed var(--faint); }
.avatar.more { background: var(--surface-3); color: var(--text); font-weight: 600; }
.avatar .online-dot { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; background: var(--green); border: 2px solid var(--surface); border-radius: 50%; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }

/* ─── Logo / splash / sign-in ─── */
.logo-mark { display: inline-flex; gap: 3px; align-items: flex-start; height: 22px; }
.logo-mark i { width: 6px; border-radius: 3px; display: block; }
.logo-mark i:nth-child(1) { height: 22px; background: #579bfc; }
.logo-mark i:nth-child(2) { height: 16px; background: #00c875; }
.logo-mark i:nth-child(3) { height: 11px; background: #fdab3d; }
.logo-mark.big { height: 56px; gap: 8px; }
.logo-mark.big i { width: 16px; border-radius: 8px; }
.logo-mark.big i:nth-child(1) { height: 56px; } .logo-mark.big i:nth-child(2) { height: 41px; } .logo-mark.big i:nth-child(3) { height: 28px; }
.splash { height: 100vh; display: grid; place-items: center; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; overflow: auto; background: radial-gradient(circle at 20% 10%, #579bfc22, transparent 50%), radial-gradient(circle at 80% 90%, #00c87522, transparent 50%), var(--bg); }
.signin-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 40px 32px; text-align: center; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.signin-card h1 { font-size: 28px; }
.gbtn { min-height: 44px; }
.signin-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* ─── Shell ─── */
.app { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); margin: 8px 8px 0 0; border-radius: 12px 12px 0 0; overflow: hidden; position: relative; }
.sidebar { display: flex; flex-shrink: 0; position: relative; }
.rail { width: var(--rail-w); background: var(--rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.logo { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 8px; }
.logo:hover { background: var(--hover); }
.rail-btn { position: relative; width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--selected); color: var(--primary); }
.rail-label { display: none; }
.rail-badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; border: 2px solid var(--rail); }
.rail-me { margin-top: 8px; border-radius: 50%; }
.nav-panel { width: var(--nav-w); background: var(--nav); margin: 8px 8px 0 0; border-radius: 12px 12px 0 0; display: flex; flex-direction: column; min-height: 0; }
.nav-collapsed .nav-panel { display: none; }
.expand-btn { position: absolute; left: calc(var(--rail-w) - 12px); top: 70px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 5; }
.nav-head { display: flex; align-items: center; gap: 2px; padding: 12px 8px 8px 12px; }
.ws-picker { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-weight: 600; }
.ws-picker:hover { background: var(--hover); }
.ws-icon { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.nav-search { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 0 10px; height: 32px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.nav-search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; color: var(--text); }
.nav-scroll { overflow-y: auto; flex: 1; padding: 0 8px 24px; }
.nav-section { margin-top: 8px; }
.nav-section-title { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.nav-board, .nav-folder-row { display: flex; align-items: center; gap: 8px; height: 34px; padding-right: 4px; border-radius: 6px; cursor: pointer; color: var(--text); }
.nav-board:hover, .nav-folder-row:hover { background: var(--hover); }
.nav-board.active { background: var(--selected); }
.nav-board .icon, .nav-folder-row .icon { color: var(--muted); }
.nav-more { opacity: 0; width: 24px; height: 24px; }
.nav-board:hover .nav-more, .nav-folder-row:hover .nav-more { opacity: 1; }
.nav-empty { display: flex; align-items: center; gap: 6px; padding: 8px; color: var(--primary); }

/* ─── Popovers / menus / modals / toasts ─── */
.popover { position: fixed; z-index: 1000; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border-soft); max-height: min(560px, 80vh); overflow: auto; }
.popover.sheet { left: 0; right: 0; bottom: 0; top: auto; border-radius: 16px 16px 0 0; max-height: 80vh; padding-bottom: env(safe-area-inset-bottom); }
.sheet-backdrop { position: fixed; inset: 0; background: #0006; z-index: 999; }
.menu { padding: 8px; min-width: 210px; }
.menu-title { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 4px; text-align: left; white-space: nowrap; }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item.danger { color: var(--red); }
.menu-item.active { color: var(--primary); font-weight: 600; }
.menu-item:disabled { color: var(--muted); cursor: default; font-size: 12px; }
.menu-item .icon { color: var(--muted); }
.menu-item.danger .icon { color: var(--red); }
.menu-spacer { width: 16px; }
.menu-hint { margin-left: auto; padding-left: 16px; color: var(--muted); font-size: 12px; }
.menu-divider { height: 1px; background: var(--border-soft); margin: 6px 0; }
.col-type-menu .menu { display: grid; grid-template-columns: 1fr 1fr; min-width: 360px; }
.modal-backdrop { position: fixed; inset: 0; background: #0009; z-index: 900; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; animation: pop .15s; }
.modal.small { max-width: 420px; }
.modal.wide { max-width: 760px; }
.dialog { padding: 24px; }
.dialog-body { color: var(--muted); line-height: 1.5; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { font-size: 22px; }
.modal-head p { margin: 4px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #323338; color: #fff; padding: 10px 18px; border-radius: 6px; box-shadow: var(--shadow); pointer-events: auto; display: flex; gap: 12px; animation: pop .15s; }
.toast.error { background: var(--red); }
.toast .link { color: #9fd0ff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(4px); } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 24px auto; }
.row .spinner { width: 16px; height: 16px; border-width: 2px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { flex: 1; display: grid; place-items: center; }
.empty-state { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.pop-pad { padding: 16px; min-width: 260px; max-width: 640px; }
.pop-title { font-weight: 600; margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }

/* ─── Inline edit ─── */
.inline-edit { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; border: 1px solid transparent; border-radius: 3px; cursor: text; vertical-align: middle; }
.inline-edit:hover { border-color: var(--border); }
.inline-edit.placeholder { color: var(--muted); }
.inline-input { width: 100%; padding: 2px 4px; border: 1px solid var(--primary); border-radius: 3px; outline: none; background: var(--surface); min-width: 60px; }

/* ─── Board header / tabs / toolbar ─── */
.board-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.board-header { padding: 18px 28px 0; }
.board-title-row { display: flex; align-items: center; gap: 8px; }
.board-title { font-size: 24px; font-weight: 600; min-width: 0; }
.board-title .inline-edit { padding: 2px 6px; }
.icon-btn.star.on { color: #ffcb00; }
.board-desc { color: var(--muted); margin: 4px 6px 0; }
.header-people { margin: 0 6px; }
.view-tabs { display: flex; gap: 2px; margin-top: 12px; border-bottom: 1px solid var(--border-soft); overflow-x: auto; scrollbar-width: none; }
.view-tab { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px 6px 0 0; position: relative; color: var(--text); white-space: nowrap; }
.view-tab:hover { background: var(--hover); }
.view-tab.active::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; background: var(--primary); }
.view-tab .icon { color: var(--muted); }
.tab-dots { display: inline-flex; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 12px 28px; flex-wrap: wrap; }
.split-btn { display: inline-flex; margin-right: 8px; }
.split-btn .btn:first-child { border-radius: 4px 0 0 4px; }
.split-btn .caret { border-radius: 0 4px 4px 0; padding: 0 8px; border-left: 1px solid #ffffff40; }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 4px; color: var(--text); }
.tb-btn:hover { background: var(--hover); }
.tb-btn.on { background: var(--primary-soft); }
.tb-btn.subtle { color: var(--muted); font-size: 13px; }
.tb-search { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid var(--primary); border-radius: 4px; color: var(--muted); }
.tb-search input { border: 0; outline: none; background: none; width: 180px; color: var(--text); }
.tb-search.wide { border-color: var(--border); width: 100%; max-width: 420px; margin-bottom: 16px; }
.tb-search.wide input { width: 100%; }
.board-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view-options { display: flex; align-items: center; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.view-options .input { width: auto; }

/* filter / person / sort / hide popovers */
.avatar-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.avatar-toggle { border-radius: 50%; padding: 2px; border: 2px solid transparent; }
.avatar-toggle.on { border-color: var(--primary); }
.filter-rule { display: grid; grid-template-columns: 44px 1fr 1fr 1fr 30px; gap: 6px; align-items: center; margin-bottom: 8px; min-width: 560px; }
.quick-filters { display: flex; gap: 24px; margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.qf-col { min-width: 160px; }
.qf-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.qf-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border-radius: 4px; text-align: left; }
.qf-opt:hover { background: var(--hover); }
.qf-opt i { width: 14px; height: 14px; border-radius: 3px; }
.qf-opt .muted { margin-left: auto; }
.hide-cols .check-row { padding: 5px 0; }
.type-dot { width: 20px; height: 20px; border-radius: 4px; display: inline-grid; place-items: center; color: #fff; flex-shrink: 0; }

/* ─── Table ─── */
.table-scroll { flex: 1; overflow: auto; padding: 0 28px 120px; position: relative; }
.table { display: flex; flex-direction: column; gap: 28px; padding-top: 4px; }
.group { --g: #579bfc; }
.group-head { display: flex; align-items: center; gap: 2px; height: 40px; position: sticky; left: 0; width: max-content; }
.group-menu-btn { opacity: 0; margin-left: -34px; }
.group-head:hover .group-menu-btn, .gc-name:hover .group-menu-btn { opacity: 1; }
.group-title { font-size: 18px; font-weight: 500; }
.group-title .inline-edit { padding: 2px 6px; }
.group-count { margin-left: 8px; opacity: 0; }
.group-head:hover .group-count { opacity: 1; }
.group-table.drop { outline: 2px dashed var(--primary); outline-offset: 2px; border-radius: 6px; }
.trow { display: flex; min-height: var(--row-h); }
.tcell { flex-shrink: 0; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: center; position: relative; min-width: 0; background: var(--surface); }
.thead .tcell { border-top: 1px solid var(--border-soft); height: 38px; }
.th { padding: 0 24px; font-size: 14px; color: var(--muted); }
.th-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-menu { position: absolute; right: 2px; opacity: 0; width: 22px; height: 22px; }
.th:hover .th-menu { opacity: 1; }
.th:hover { background: var(--row-hover); }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.col-resize:hover { background: var(--primary); }
.add-col { width: 60px; border-right: 0; justify-content: flex-start; padding-left: 8px; }
.thead .add-col { border-top: 1px solid var(--border-soft); }
.name-cell { justify-content: flex-start; gap: 4px; padding-right: 6px; border-left: 0; }
.sticky { position: sticky; left: 0; z-index: 3; }
.thead .name-cell { padding-left: 0; }
.thead .name-cell .th-title { color: var(--muted); flex: 1; text-align: center; }
.row-bar { width: 6px; align-self: stretch; background: var(--g); flex-shrink: 0; }
.row-bar.first { border-radius: 6px 0 0 0; }
.row-bar.last { border-radius: 0 0 0 6px; }
.row-bar.faded { opacity: .5; }
.row-check, .row-check-spacer { width: 36px; display: grid; place-items: center; align-self: stretch; border-right: 1px solid var(--border-soft); flex-shrink: 0; }
.row-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.row-menu { position: absolute; left: -32px; opacity: 0; }
.item-row:hover .row-menu { opacity: 1; }
.item-row:hover .tcell { background: var(--row-hover); }
.item-row.selected .tcell, .item-row.active .tcell { background: var(--row-selected); }
.item-row.drop-above { box-shadow: inset 0 2px 0 var(--primary); }
.item-row.drop-below { box-shadow: inset 0 -2px 0 var(--primary); }
.item-name { flex: 1; min-width: 0; padding-left: 6px; display: flex; }
.item-name .inline-edit { padding: 3px 6px; }
.open-item { opacity: 0; width: 24px; height: 24px; }
.item-row:hover .open-item { opacity: 1; }
.updates-btn { position: relative; color: var(--faint); }
.updates-btn.has { color: var(--primary); }
.updates-btn .badge { position: absolute; bottom: 1px; right: 0; background: var(--primary); color: #fff; font-size: 10px; min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; font-weight: 600; }
.sub-toggle { width: 34px; height: 26px; gap: 1px; color: var(--faint); }
.sub-toggle.has { color: var(--muted); }
.sub-toggle.open { color: var(--primary); }
.sub-count { font-size: 11px; }
.item-row:not(:hover) .sub-toggle:not(.has):not(.open) { opacity: 0; }
.subitems { margin-left: 46px; border-left: 2px solid var(--g); }
.item-row.sub .name-cell, .add-row.sub .name-cell { width: calc(340px - 46px) !important; }
.sub-indent { width: 12px; }
.add-row .tcell { background: var(--surface); }
.add-row .filler { border-right: 0; }
.add-input { border: 1px solid transparent; outline: none; background: none; padding: 4px 6px; flex: 1; border-radius: 3px; height: 28px; margin-left: 8px; color: var(--text); }
.add-input:hover { border-color: var(--border); }
.add-input:focus { border-color: var(--primary); }
.tfoot .tcell { border-bottom: 0; border-right: 0; background: transparent; height: 38px; }
.tfoot .tcell:not(.name-cell) { border: 1px solid var(--border-soft); border-top: 0; border-left: 0; }
.tfoot .name-cell { background: var(--surface); }
.add-group-btn { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 4px; width: max-content; position: sticky; left: 0; }
.add-group-btn:hover { background: var(--hover); }
.group-collapsed-row { display: flex; border: 1px solid var(--border-soft); border-left: 6px solid var(--g); border-radius: 6px; min-height: 60px; }
.group-collapsed-row.drop { outline: 2px dashed var(--primary); }
.gc-name { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 40px; position: sticky; left: 0; background: var(--surface); z-index: 2; border-right: 1px solid var(--border-soft); }
.gc-name .group-menu-btn { margin-left: auto; }
.gc-cell { border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0; }

/* cells */
.cell-status { width: 100%; height: 100%; min-height: var(--row-h); color: #fff; font-weight: 500; position: relative; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: filter .1s; }
.cell-status:hover { filter: brightness(1.08); }
.cell-status .fold { position: absolute; right: 0; top: 0; border-style: solid; border-width: 0 10px 10px 0; border-color: transparent var(--surface) transparent transparent; opacity: 0; transition: opacity .1s; }
.cell-status:hover .fold { opacity: 1; }
.cell-people, .cell-date, .cell-timeline, .cell-files, .cell-text.long, .cell-chips { width: 100%; height: 100%; min-height: var(--row-h); display: flex; align-items: center; justify-content: center; padding: 0 6px; gap: 4px; }
.cell-date { gap: 6px; }
.cell-date.overdue { color: var(--red); }
.cell-date .warn { width: 16px; height: 16px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.today-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.ghost-icon { color: var(--faint); opacity: 0; }
.tcell:hover .ghost-icon { opacity: 1; }
.tl-bar { display: flex; align-items: center; justify-content: center; height: 24px; width: calc(100% - 12px); border-radius: 12px; color: #fff; font-size: 13px; overflow: hidden; white-space: nowrap; }
.tl-bar.empty { background: var(--status-empty); }
.tl-bar.summary-range { background: var(--tl-rest); font-size: 12px; height: 22px; }
.cell-number { width: 100%; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; }
.cell-number .inline-edit, .cell-number .inline-input { text-align: center; min-width: 40px; }
.cell-number .inline-edit { width: 100%; min-height: 26px; }
.unit { color: var(--muted); font-size: 12px; }
.cell-text { width: 100%; padding: 0 6px; display: flex; align-items: center; }
.cell-text .inline-edit { width: 100%; min-height: 26px; text-align: center; }
.cell-text.long { justify-content: flex-start; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; line-height: var(--row-h); text-align: left; padding: 0 10px; }
.cell-check { display: grid; place-items: center; width: 100%; height: 100%; cursor: pointer; }
.cell-check input { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.cell-check span { display: none; }
.cell-rating { display: flex; gap: 1px; }
.cell-rating button { color: var(--faint); padding: 2px; }
.cell-rating button.on { color: #ffcb00; }
.cell-rating:hover button { color: #ffcb0080; }
.cell-rating button:hover ~ button { color: var(--faint); }
.cell-chips { overflow: hidden; flex-wrap: nowrap; justify-content: flex-start; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: var(--surface-3); font-size: 13px; white-space: nowrap; }
.chip.tag { color: var(--primary); background: var(--primary-soft); }
.chip button { color: var(--muted); display: inline-flex; }
.chip.person { padding-left: 2px; }
.cell-link { width: 100%; display: flex; align-items: center; padding: 0 8px; gap: 4px; overflow: hidden; }
.cell-link a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-edit-btn { color: var(--faint); opacity: 0; margin-left: auto; padding: 4px; }
.tcell:hover .cell-edit-btn, .info-value:hover .cell-edit-btn { opacity: 1; }
.cell-files img { width: 26px; height: 26px; object-fit: cover; border-radius: 3px; }
.file-ext { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 3px; border-radius: 3px; background: var(--primary-soft); color: var(--primary); font-size: 9px; font-weight: 700; }
.file-ext.big { width: 100%; height: 100%; font-size: 20px; border-radius: 0; }
.file-more { font-size: 12px; color: var(--muted); }
.cell-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.summary { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; }
.battery { display: flex; width: 100%; height: 22px; overflow: hidden; border-radius: 2px; }
.battery span { display: block; height: 100%; }

/* bulk bar */
.bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface); box-shadow: var(--shadow-lg); border-radius: 8px; display: flex; align-items: center; z-index: 50; border: 1px solid var(--border-soft); overflow: hidden; animation: pop .15s; }
.bulk-count { background: var(--primary); color: #fff; font-size: 24px; font-weight: 300; width: 64px; align-self: stretch; display: grid; place-items: center; }
.bulk-label { padding: 0 20px; font-size: 16px; white-space: nowrap; }
.bulk-act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 14px; font-size: 12px; color: var(--muted); }
.bulk-act:hover { color: var(--primary); }
.bulk-act.danger:hover { color: var(--red); }
.bulk-close { margin: 0 12px; border-left: 1px solid var(--border-soft); border-radius: 0; height: 64px; width: 48px; }

/* pickers */
.status-picker { padding: 12px; width: 240px; }
.status-grid { display: flex; flex-direction: column; gap: 6px; }
.status-opt { height: 32px; border-radius: 2px; font-weight: 500; padding: 0 8px; }
.status-opt:hover { filter: brightness(1.08); }
.status-opt.blank { border: 1px dashed var(--border); color: var(--muted); }
.label-editor { padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 280px; }
.label-row { display: flex; align-items: center; gap: 6px; }
.label-row .input { flex: 1; }
.swatch { width: 24px; height: 24px; border-radius: 4px; flex-shrink: 0; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); }
.swatch-input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; flex-shrink: 0; }
.done-toggle { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.label-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.label-preview span { padding: 4px 10px; border-radius: 3px; font-size: 13px; }
.color-grid { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; padding: 12px; }
.color-grid .swatch { width: 28px; height: 28px; }
.picker { padding: 10px; width: 300px; display: flex; flex-direction: column; gap: 8px; }
.picker-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.picker-section { font-size: 12px; color: var(--muted); padding: 4px 6px; }
.picker-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 4px; text-align: left; }
.picker-row:hover { background: var(--hover); }
.picker-row .small { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.check-box { width: 18px; height: 18px; border: 1px solid var(--border); border-radius: 3px; display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.check-box.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.datepicker { padding: 12px; width: 280px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.dp-day { height: 34px; border-radius: 50%; font-size: 13px; }
.dp-day:hover { background: var(--hover); }
.dp-day.out { color: var(--faint); }
.dp-day.today { color: var(--primary); font-weight: 700; }
.dp-day.inrange { background: var(--primary-soft); border-radius: 0; }
.dp-day.sel { background: var(--primary); color: #fff; border-radius: 50%; }
.dp-foot { display: flex; gap: 4px; margin-top: 8px; border-top: 1px solid var(--border-soft); padding-top: 8px; }
.dp-time { display: flex; gap: 6px; margin-top: 8px; }
.longtext-editor, .form-pop { padding: 12px; width: 340px; }
.longtext-editor textarea { width: 100%; }
.files-pop { padding: 12px; width: 340px; display: flex; flex-direction: column; gap: 10px; }
.files-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.file-row { display: flex; align-items: center; gap: 8px; }
.file-row img { width: 32px; height: 32px; object-fit: cover; border-radius: 3px; }
.file-row > a:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Item panel ─── */
.panel-backdrop { position: fixed; inset: 0; z-index: 80; background: #0003; animation: fade .15s; }
.item-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 92vw); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 90; display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.crumbs { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; white-space: nowrap; }
.panel-title { font-size: 22px; padding: 6px 22px 8px; }
.panel-title .inline-edit { white-space: normal; padding: 2px 4px; }
.panel-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border-soft); overflow-x: auto; scrollbar-width: none; }
.panel-tabs button { padding: 10px 12px; position: relative; white-space: nowrap; }
.panel-tabs button.active { font-weight: 600; }
.panel-tabs button.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--primary); }
.panel-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; background: var(--surface-2); }
.updates { display: flex; flex-direction: column; gap: 16px; }
.composer { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.composer:focus-within { border-color: var(--primary); }
.composer textarea { width: 100%; border: 0; outline: none; background: none; resize: vertical; padding: 12px 14px; min-height: 60px; line-height: 1.5; }
.composer.compact textarea { min-height: 40px; }
.composer-actions { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--border-soft); }
.composer-files { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 8px; }
.mention-pop { position: absolute; left: 12px; top: 100%; z-index: 5; background: var(--surface); border-radius: 6px; box-shadow: var(--shadow); padding: 4px; min-width: 220px; }
.mention-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 4px; text-align: left; }
.mention-pop button:hover, .mention-pop button:first-child { background: var(--hover); }
.update { background: var(--surface); border-radius: 8px; border: 1px solid var(--border-soft); padding: 14px 16px 0; }
.update.reply { border: 0; padding: 10px 0 0; background: none; }
.update-head { display: flex; align-items: center; gap: 10px; }
.update-meta { flex: 1; display: flex; flex-direction: column; }
.update-body { padding: 10px 0; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.mention { color: var(--primary); background: var(--primary-soft); padding: 0 3px; border-radius: 3px; }
.update-files { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.update-files img { max-width: 220px; max-height: 160px; border-radius: 6px; display: block; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.update-actions { display: flex; border-top: 1px solid var(--border-soft); margin: 0 -16px; }
.update-actions button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px; color: var(--muted); }
.update-actions button:hover { background: var(--hover); }
.update-actions button.on { color: var(--primary); }
.update.reply .update-actions { margin: 0; border: 0; justify-content: flex-start; }
.update.reply .update-actions button { flex: 0; padding: 4px 8px; }
.replies { margin: 0 -16px; padding: 0 16px 12px 56px; background: var(--surface-2); border-radius: 0 0 8px 8px; }
.reply-open { width: 100%; text-align: left; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); background: var(--surface); margin-top: 10px; }
.empty-updates { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-updates h3 { color: var(--text); margin: 10px 0 4px; }
.info-grid { background: var(--surface); border-radius: 8px; border: 1px solid var(--border-soft); }
.info-row { display: grid; grid-template-columns: 180px 1fr; border-bottom: 1px solid var(--border-soft); min-height: 44px; }
.info-row:last-child { border-bottom: 0; }
.info-label { display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--muted); border-right: 1px solid var(--border-soft); }
.info-value { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
.info-value > * { min-height: 44px; }
.info-value .cell-text .inline-edit, .info-value .cell-number .inline-edit { text-align: left; }
.info-value.tc-status .cell-status { min-height: 44px; }
.info-subitems { background: var(--surface); border-radius: 8px; border: 1px solid var(--border-soft); padding: 14px; margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.sub-line { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.sub-line .link { flex: 1; }
.sub-status { width: 130px; height: 32px; }
.sub-status .cell-status { min-height: 32px; border-radius: 3px; }
.info-foot { margin-top: 14px; }
.files-tab { display: flex; flex-direction: column; gap: 16px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px; border: 2px dashed var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; background: var(--surface); width: 100%; }
.dropzone:hover { border-color: var(--primary); color: var(--primary); }
.file-grid, .file-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-gallery { padding: 0 28px 40px; overflow: auto; }
.file-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.file-thumb { height: 120px; display: grid; place-items: center; background: var(--surface-3); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-info { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; justify-content: flex-end; padding: 0 4px 4px; }
.activity { display: flex; flex-direction: column; }
.act-row { display: grid; grid-template-columns: 50px 28px minmax(90px, 160px) 1fr; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.act-who, .act-item { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-col { color: var(--muted); }
.act-from { text-decoration: line-through; color: var(--muted); }
.act-to { font-weight: 500; }

/* ─── Kanban ─── */
.kanban-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 28px; }
.kanban { flex: 1; display: flex; gap: 12px; overflow-x: auto; padding-bottom: 20px; align-items: flex-start; }
.lane { width: 270px; flex-shrink: 0; background: var(--surface-2); border-radius: 8px; max-height: 100%; display: flex; flex-direction: column; }
.lane.over { outline: 2px dashed var(--primary); }
.lane-head { padding: 10px 14px; border-radius: 8px 8px 0 0; font-weight: 600; display: flex; justify-content: space-between; }
.lane-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.kcard { background: var(--surface); border-radius: 6px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.1); cursor: pointer; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border-soft); }
.kcard:hover { box-shadow: var(--shadow); }
.kcard-name { font-weight: 500; }
.kcard-field { display: flex; flex-direction: column; gap: 2px; }
.kcard-field .tcell, .kcard-field > div { justify-content: flex-start; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; }
.lane-add { display: flex; align-items: center; gap: 6px; padding: 8px; color: var(--muted); border-radius: 4px; }
.lane-add:hover { background: var(--hover); }

/* ─── Calendar ─── */
.calendar { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 28px 16px; overflow: auto; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-head .input { width: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border-soft); border-top: 1px solid var(--border-soft); flex: 1; grid-template-rows: 30px; grid-auto-rows: minmax(110px, 1fr); }
.cal-dow { padding: 6px 8px; font-size: 12px; color: var(--muted); border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); grid-row: 1; height: 30px; }
.cal-grid > .cal-dow { min-height: 0; }
.cal-day { border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { color: var(--faint); }
.cal-num { font-size: 12px; padding: 2px 4px; align-self: flex-end; border-radius: 10px; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-item { display: block; text-align: left; font-size: 12px; padding: 3px 6px; border-radius: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.agenda-day { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.agenda-date { width: 90px; flex-shrink: 0; font-weight: 600; font-size: 13px; }
.agenda-date.today { color: var(--primary); }
.agenda-items { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agenda-items .cal-item { font-size: 14px; padding: 8px 10px; border-radius: 6px; }

/* ─── Timeline ─── */
.timeline { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 28px 16px; }
.tl-body { flex: 1; min-height: 0; display: flex; border: 1px solid var(--border-soft); border-radius: 8px; overflow: auto; }
.tl-names { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border-soft); position: sticky; left: 0; background: var(--surface); z-index: 2; }
.tl-corner { height: 36px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--surface); }
.tl-group, .tl-group-row { height: 34px; display: flex; align-items: center; padding: 0 12px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border-soft); }
.tl-name { height: 38px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--border-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tl-name:hover { background: var(--row-hover); }
.tl-scroll { flex: 1; }
.tl-canvas { position: relative; }
.tl-ticks { height: 36px; position: sticky; top: 0; background: var(--surface); z-index: 1; border-bottom: 1px solid var(--border-soft); }
.tl-ticks span { position: absolute; top: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; border-left: 1px solid var(--border-soft); padding-left: 4px; height: 26px; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--primary); z-index: 1; opacity: .7; }
.tl-row { height: 38px; position: relative; border-bottom: 1px solid var(--border-soft); }
.tl-item { position: absolute; top: 7px; height: 24px; border-radius: 12px; color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 4px 0 10px; font-size: 12px; cursor: grab; overflow: hidden; touch-action: none; user-select: none; }
.tl-item:active { cursor: grabbing; }
.tl-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-resize { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.tl-set { position: absolute; top: 9px; }

/* ─── Chart ─── */
.chart-view { padding: 0 28px 40px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi, .chart-card, .card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: 18px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-n { font-size: 32px; font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 180px) 1fr 80px; align-items: center; gap: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 26px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.pie-wrap { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }

/* ─── Pages ─── */
.page { flex: 1; overflow-y: auto; padding: 0 32px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; padding: 24px 0 18px; position: sticky; top: 0; background: var(--surface); z-index: 5; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; }
.page-head .input { width: auto; }
.home-grid { display: flex; flex-direction: column; gap: 28px; max-width: 1100px; }
.home-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; padding: 12px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: 8px; text-align: left; }
.stat:hover { background: var(--hover); }
.stat-n { font-size: 30px; font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 6px; font-size: 16px; margin: 18px 0 10px; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.board-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; text-align: left; transition: box-shadow .15s; }
.board-card:hover { box-shadow: var(--shadow); }
.board-card.new { align-items: center; justify-content: center; color: var(--muted); min-height: 150px; border-style: dashed; }
.bc-preview { height: 84px; background: var(--surface-2); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.bc-preview i { display: block; height: 10px; border-radius: 2px; background: linear-gradient(90deg, #579bfc 0 6px, var(--surface-3) 6px 60%, #00c875 60% 75%, #fdab3d 75%); }
.bc-preview i:nth-child(2) { background: linear-gradient(90deg, #579bfc 0 6px, var(--surface-3) 6px 60%, #fdab3d 60% 75%, #e2445c 75%); }
.bc-name { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.mw-group { margin-bottom: 24px; }
.mw-group h3 { font-size: 17px; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.mw-row { display: grid; grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1.4fr) 130px 100px; gap: 10px; align-items: center; min-height: 42px; border-bottom: 1px solid var(--border-soft); }
.mw-row.done .mw-name { text-decoration: line-through; color: var(--muted); }
.mw-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); color: transparent; display: grid; place-items: center; }
.mw-check:hover { border-color: var(--green); color: var(--green); }
.mw-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.mw-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mw-name:hover { color: var(--primary); }
.mw-board { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; }
.mw-status { height: 30px; display: grid; place-items: center; font-size: 13px; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.mw-status.empty { background: var(--status-empty); opacity: .5; }
.mw-date { font-size: 13px; text-align: center; }
.mw-date.overdue { color: var(--red); font-weight: 600; }
.notif-list { display: flex; flex-direction: column; margin-top: 16px; max-width: 900px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 14px 12px; border-bottom: 1px solid var(--border-soft); cursor: pointer; border-radius: 6px; }
.notif:hover { background: var(--row-hover); }
.notif.unread { background: var(--row-selected); }
.notif-av { position: relative; }
.notif-kind { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; border: 2px solid var(--surface); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; line-height: 1.4; }
.read-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--faint); }
.read-dot.on { background: var(--primary); border-color: var(--primary); }
.big-search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 8px; padding: 0 16px; height: 52px; max-width: 760px; color: var(--muted); }
.big-search:focus-within { border-color: var(--primary); }
.big-search input { border: 0; outline: none; background: none; flex: 1; font-size: 17px; color: var(--text); }
.search-page .section-title { margin-top: 28px; }
.result { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 900px; padding: 10px 12px; border-radius: 6px; text-align: left; }
.result:hover { background: var(--hover); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.person-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 20px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.person-card.inactive { opacity: .45; }
.person-card a { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.admin .panel-tabs { padding: 0; margin-bottom: 20px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px; border-bottom: 1px solid var(--border-soft); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border-soft); }
.admin-table .input { width: 120px; }
.admin-table tr.inactive td { opacity: .5; }
.import-card { max-width: 820px; display: flex; flex-direction: column; gap: 12px; }
.steps { margin: 0; padding-left: 20px; line-height: 1.7; color: var(--muted); }
.steps b { color: var(--text); }
.import-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border-soft); border-radius: 6px; padding: 6px 12px; }
.import-log pre { background: var(--surface-2); padding: 12px; border-radius: 6px; max-height: 320px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.user-menu { min-width: 260px; }
.um-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; text-align: left; }
.tpl .icon { color: var(--primary); }
.tpl.on { border-color: var(--primary); background: var(--primary-soft); }
.automations .auto-row { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 8px; }
.auto-row .icon { color: var(--orange); }
.auto-row.off { opacity: .55; }
.auto-text { flex: 1; line-height: 1.5; }
.auto-builder { border: 1px solid var(--primary); border-radius: 8px; padding: 16px; margin-top: 8px; }
.auto-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 16px; }
.auto-sentence .input { width: auto; }
.auto-sentence .grow { min-width: 200px; }

/* ─── Mobile ─── */
.mobile-tabs { display: none; }
@media (max-width: 768px) {
  body { font-size: 15px; }
  .app { flex-direction: column; }
  .main { margin: 0; border-radius: 0; padding-bottom: calc(60px + env(safe-area-inset-bottom)); padding-top: env(safe-area-inset-top); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 200; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); padding-top: env(safe-area-inset-top); background: var(--rail); }
  .sidebar.open { transform: none; }
  .sidebar.collapsed .nav-panel { display: flex; }
  .nav-collapsed .nav-panel { display: flex; }
  .expand-btn, .collapse-btn { display: none; }
  .nav-panel { width: min(290px, 78vw); margin: 0; border-radius: 0; }
  .drawer-backdrop { position: fixed; inset: 0; background: #0007; z-index: 150; }
  .nav-board, .nav-folder-row { height: 42px; }
  .nav-more { opacity: 1; }
  .mobile-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: var(--surface); border-top: 1px solid var(--border-soft); padding-bottom: env(safe-area-inset-bottom); }
  .mtab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); position: relative; }
  .mtab.active { color: var(--primary); }
  .mtab .rail-badge { top: 2px; right: calc(50% - 22px); border-color: var(--surface); }
  .board-header { padding: 10px 12px 0; }
  .board-title { font-size: 20px; }
  .toolbar { padding: 10px 12px; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tb-search input { width: 120px; }
  .page { padding: 0 16px 40px; }
  .page-head { padding: 14px 0 12px; }
  .page-head h1 { font-size: 22px; }
  .mw-row { grid-template-columns: 28px 1fr auto; grid-template-areas: "c n d" "c b s"; padding: 8px 0; row-gap: 4px; }
  .mw-check { grid-area: c; } .mw-name { grid-area: n; } .mw-board { grid-area: b; } .mw-status { grid-area: s; height: 24px; border-radius: 12px; font-size: 12px; min-width: 90px; } .mw-date { grid-area: d; }
  .item-panel { width: 100vw; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .panel-body { padding: 14px 12px 40px; }
  .panel-title { padding: 6px 14px 8px; font-size: 20px; }
  .panel-tabs { padding: 0 10px; }
  .info-row { grid-template-columns: 120px 1fr; }
  .info-label { padding: 0 10px; font-size: 13px; }
  .replies { padding-left: 16px; }
  .kanban-wrap, .calendar, .timeline, .chart-view { padding-left: 12px; padding-right: 12px; }
  .file-gallery { padding: 0 12px 40px; grid-template-columns: repeat(2, 1fr); }
  .lane { width: 82vw; }
  .tl-names { width: 130px; }
  .bulk-label { display: none; }
  .filter-rule { min-width: 0; grid-template-columns: 1fr 1fr; }
  .filter-rule > .muted { display: none; }
  .quick-filters { flex-direction: column; }
  .popover.sheet .picker, .popover.sheet .datepicker, .popover.sheet .status-picker, .popover.sheet .longtext-editor, .popover.sheet .form-pop, .popover.sheet .files-pop, .popover.sheet .pop-pad, .popover.sheet .label-editor { width: 100%; max-width: none; min-width: 0; }
  .popover.sheet .menu-item { padding: 12px 10px; }
  .popover.sheet .dp-day { height: 42px; }
  .col-type-menu .menu { min-width: 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .dialog { padding: 20px 16px; }
  .act-row { grid-template-columns: 40px 24px 1fr; }
  .act-row .act-what { grid-column: 2 / -1; }
  .bar-row { grid-template-columns: 90px 1fr 60px; }
  .board-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bc-preview { height: 60px; }
  .admin-table th:nth-child(2), .admin-table td:nth-child(2), .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
}

/* phone board list */
.mobile-list { flex: 1; overflow-y: auto; padding: 0 12px 30px; display: flex; flex-direction: column; gap: 14px; }
.m-group { --g: #579bfc; }
.m-group-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 2px; font-weight: 600; font-size: 16px; }
.m-card { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border-soft); border-left: 4px solid var(--g); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.m-card:active { background: var(--row-hover); }
.m-card-top { display: flex; align-items: flex-start; gap: 8px; }
.m-name { flex: 1; font-weight: 500; line-height: 1.35; }
.m-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.m-status { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.m-date { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.m-card-meta .muted { display: inline-flex; align-items: center; gap: 3px; }
.m-add { display: flex; align-items: center; gap: 6px; padding: 10px; color: var(--muted); width: 100%; }
.m-add-input { margin-bottom: 8px; }
.m-add-group { align-self: flex-start; }

@media (hover: none) {
  .row-menu, .open-item, .th-menu, .group-menu-btn, .nav-more { opacity: 1; }
}
@media print {
  .sidebar, .toolbar, .mobile-tabs, .view-tabs { display: none !important; }
  body { overflow: visible; }
}
.empty-updates .icon { margin: 0 auto; }
