:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e6e9f1;
  --border: #e1e4ec;
  --border-strong: #cfd4df;
  --text: #1d2130;
  --muted: #687085;
  --faint: #9aa1b2;
  --accent: #5b5bd6;
  --accent-hover: #4b4bc4;
  --accent-soft: #ecebff;
  --accent-text: #ffffff;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --ok: #12a26b;
  --row-hover: #f6f7fb;
  --row-selected: #eef0ff;
  --shadow: 0 8px 28px rgba(22, 26, 46, .14), 0 1px 3px rgba(22, 26, 46, .08);
  --shadow-sm: 0 1px 2px rgba(22, 26, 46, .06);
  --radius: 8px;
  --sidebar-w: 260px;
  --name-w: 340px;
  --sub-name-w: 300px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151b; --surface: #1c1e26; --surface-2: #242632; --surface-3: #2d303d;
    --border: #2f3240; --border-strong: #3d4152; --text: #e7e8ef; --muted: #9aa0b4; --faint: #6d7386;
    --accent: #7d7df2; --accent-hover: #8f8ff5; --accent-soft: #2a2a4d; --danger-soft: #3a1f24;
    --row-hover: #222430; --row-selected: #272a45;
    --shadow: 0 10px 32px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14151b; --surface: #1c1e26; --surface-2: #242632; --surface-3: #2d303d;
  --border: #2f3240; --border-strong: #3d4152; --text: #e7e8ef; --muted: #9aa0b4; --faint: #6d7386;
  --accent: #7d7df2; --accent-hover: #8f8ff5; --accent-soft: #2a2a4d; --danger-soft: #3a1f24;
  --row-hover: #222430; --row-selected: #272a45;
  --shadow: 0 10px 32px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; white-space: nowrap; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.input, select.input, textarea.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); outline: none; }
textarea.input { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.kbd { font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--muted); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 16px 0 4px; font-size: 22px; }
.auth-card p { margin: 0 0 20px; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 38px; justify-content: center; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: flex; justify-content: center; align-items: flex-start; padding-top: 7px; flex: none; }
.logo-mark i { display: block; width: 4px; border-radius: 2px; background: #fff; margin: 0 1.5px; }

/* ---------- layout ---------- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar-top { padding: 14px 14px 8px; display: flex; align-items: center; gap: 8px; }
.sidebar-nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .badge { margin-left: auto; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; }
.sidebar-section { padding: 14px 18px 6px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.ws { margin-bottom: 2px; }
.ws-head { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 8px; border-radius: 6px; cursor: pointer; }
.ws-head:hover { background: var(--surface-2); }
.ws-head .chev { color: var(--faint); transition: transform .15s; }
.ws.collapsed .chev { transform: rotate(-90deg); }
.ws.collapsed .ws-boards { display: none; }
.ws-icon { width: 20px; height: 20px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ws-head .icon-btn { width: 22px; height: 22px; opacity: 0; }
.ws-head:hover .icon-btn, .ws-head .icon-btn:focus { opacity: 1; }
.ws-boards { padding-left: 18px; }
.board-link { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 6px; color: var(--text); font-size: 13.5px; }
.board-link:hover { background: var(--surface-2); text-decoration: none; }
.board-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.board-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.board-link svg { color: var(--faint); }
.board-link.active svg { color: var(--accent); }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.conn.off { background: var(--danger); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; }
.mobile-bar { display: none; }
.page { flex: 1; overflow: auto; padding: 28px 32px 48px; }
.page h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.page-sub { color: var(--muted); margin: 0 0 24px; }

/* ---------- avatar ---------- */
.av { width: 26px; height: 26px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; border: 2px solid var(--surface); text-transform: uppercase; }
.av.sm { width: 22px; height: 22px; font-size: 10px; }
.av.lg { width: 34px; height: 34px; font-size: 13px; }
.av-stack { display: flex; align-items: center; }
.av-stack .av + .av { margin-left: -7px; }
.av.more { background: var(--surface-3); color: var(--muted); }

/* ---------- board ---------- */
.board-head { padding: 18px 28px 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.board-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; padding: 2px 6px; margin-left: -6px; border-radius: 6px; border: 1px solid transparent; outline: none; min-width: 60px; }
.board-title[contenteditable="true"]:hover { border-color: var(--border-strong); }
.board-title[contenteditable="true"]:focus { border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.private { background: #fff3e0; color: #a35a00; }
:root[data-theme="dark"] .pill.private { background: #3a2a12; color: #ffb259; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.private { background: #3a2a12; color: #ffb259; } }
.pill.guest { background: #e6f6ff; color: #0b6aa2; }
:root[data-theme="dark"] .pill.guest { background: #10314a; color: #6cc4ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.guest { background: #10314a; color: #6cc4ff; } }
.board-desc { color: var(--muted); margin: 4px 0 0; font-size: 13px; max-width: 800px; }
.board-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 2px; margin-top: 14px; }
.tab { height: 36px; padding: 0 12px; border: 0; background: none; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); display: flex; align-items: center; gap: 6px; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 28px; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 9px; top: 9px; color: var(--faint); }
.search .input { padding-left: 30px; width: 220px; height: 32px; }
.filter-on { border-color: var(--accent) !important; color: var(--accent); background: var(--accent-soft) !important; }
.board-body { flex: 1; overflow: auto; padding: 0 28px 80px; }

.group { margin-bottom: 28px; --gc: #579bfc; }
.group-head { display: flex; align-items: center; gap: 6px; height: 36px; position: sticky; left: 0; }
.group-head .chev { color: var(--gc); cursor: pointer; transition: transform .15s; }
.group.collapsed .group-head .chev { transform: rotate(-90deg); }
.group-title { color: var(--gc); font-weight: 650; font-size: 16px; padding: 2px 6px; border-radius: 5px; border: 1px solid transparent; outline: none; cursor: text; }
.group-title:hover { border-color: var(--border-strong); }
.group-title:focus { border-color: var(--accent); color: var(--text); }
.group-count { color: var(--faint); font-size: 13px; }
.group-head .icon-btn { opacity: 0; }
.group-head:hover .icon-btn { opacity: 1; }
.group.drop-target .grid { outline: 2px dashed var(--accent); outline-offset: 2px; }

.grid { display: inline-block; min-width: 100%; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.row { display: grid; grid-template-columns: var(--cols); min-height: 38px; border-bottom: 1px solid var(--border); position: relative; }
.row:last-child { border-bottom: 0; }
.cell { border-right: 1px solid var(--border); display: flex; align-items: center; justify-content: center; min-width: 0; position: relative; font-size: 13.5px; }
.cell:last-child { border-right: 0; }
.row.hd .cell { font-size: 12.5px; color: var(--muted); font-weight: 500; height: 36px; cursor: pointer; user-select: none; padding: 0 8px; gap: 4px; }
.row.hd .cell:hover { background: var(--surface-2); }
.row.hd .cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.hd .cell.namecol { cursor: default; justify-content: flex-start; padding-left: 40px; }
.row.hd .cell.namecol:hover { background: var(--surface); }
.resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 3; }
.resize:hover, .resize.on { background: var(--accent); opacity: .6; }
.cell.namecol { position: sticky; left: 0; z-index: 2; background: var(--surface); justify-content: flex-start; padding: 0 6px 0 0; box-shadow: inset 5px 0 0 var(--gc); }
.row.item:hover .cell, .row.item:hover .cell.namecol { background-color: var(--row-hover); }
.row.item.active-row .cell.namecol, .row.item.active-row .cell { background-color: var(--row-selected); }
.row.item .cell.namecol { padding-left: 8px; }
.drag { color: var(--faint); cursor: grab; opacity: 0; display: grid; place-items: center; width: 20px; height: 28px; flex: none; margin-left: 2px; }
.row.item:hover .drag { opacity: 1; }
.namecol .name { flex: 1; min-width: 0; padding: 4px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; border: 1px solid transparent; }
.namecol .name:hover { border-color: var(--border-strong); }
.namecol input.name-input { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; outline: none; background: var(--surface); }
.open-btn { display: none; align-items: center; gap: 4px; height: 24px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 5px; font-size: 12px; background: var(--surface); cursor: pointer; color: var(--muted); }
.row.item:hover .open-btn { display: inline-flex; }
.open-btn:hover { color: var(--accent); border-color: var(--accent); }
.upd { position: relative; display: grid; place-items: center; width: 32px; height: 28px; border: 0; background: none; color: var(--faint); cursor: pointer; flex: none; border-radius: 5px; }
.upd:hover { color: var(--accent); background: var(--surface-2); }
.upd.has { color: var(--accent); }
.upd .n { position: absolute; right: 1px; bottom: 1px; min-width: 14px; height: 14px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 9.5px; display: grid; place-items: center; padding: 0 3px; font-weight: 600; }
.row-menu { position: absolute; left: -30px; top: 5px; opacity: 0; }
.row.item:hover .row-menu { opacity: 1; }
.row.drop-before::before, .row.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); z-index: 5; }
.row.drop-before::before { top: -1px; }
.row.drop-after::after { bottom: -1px; }
.row.dragging { opacity: .4; }
.row.add .cell.namecol { box-shadow: inset 5px 0 0 color-mix(in srgb, var(--gc) 45%, transparent); }
.row.add input { flex: 1; height: 28px; border: 1px solid transparent; background: transparent; outline: none; padding: 0 6px; margin-left: 30px; border-radius: 4px; }
.row.add input:hover { border-color: var(--border-strong); }
.row.add input:focus { border-color: var(--accent); background: var(--surface); }
.row.sum { min-height: 34px; background: transparent; }
.row.sum .cell { border-right-color: transparent; padding: 0 8px; font-size: 12px; color: var(--muted); }
.row.sum .cell.namecol { background: transparent; box-shadow: none; }

/* cell types */
.c-status { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: 13px; cursor: pointer; padding: 0 6px; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: relative; }
.c-status.empty { background: var(--surface-3); }
.c-status:hover::after { content: ""; position: absolute; right: 0; top: 0; border-style: solid; border-width: 0 10px 10px 0; border-color: transparent rgba(0,0,0,.18) transparent transparent; }
.c-click { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 8px; gap: 6px; overflow: hidden; }
.c-click:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.readonly .c-click, .readonly .c-status { cursor: default; }
.readonly .c-click:hover { box-shadow: none; }
.c-text { justify-content: flex-start; white-space: nowrap; text-overflow: ellipsis; }
.c-text span { overflow: hidden; text-overflow: ellipsis; }
.c-num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.cell input.inline { width: 100%; height: 100%; border: 1px solid var(--accent); outline: none; padding: 0 8px; background: var(--surface); }
.c-date.overdue { color: var(--danger); font-weight: 500; }
.c-date.overdue svg { color: var(--danger); }
.placeholder { color: var(--faint); opacity: 0; }
.row.item:hover .placeholder { opacity: 1; }
.tl { width: 100%; height: 22px; border-radius: 11px; background: var(--surface-3); position: relative; overflow: hidden; display: grid; place-items: center; font-size: 12px; font-weight: 500; }
.tl .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gc); }
.tl span { position: relative; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.35); }
.tl.empty span { color: var(--faint); text-shadow: none; }
.chk { width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: #fff; }
.chk.on { background: var(--ok); border-color: var(--ok); }
.dist { display: flex; width: 100%; height: 20px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.dist i { display: block; height: 100%; }

.add-col { display: grid; place-items: center; color: var(--muted); }
.add-group { margin: 6px 0 20px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h3 { color: var(--text); margin: 12px 0 4px; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; min-height: 100%; }
.lane { width: 280px; flex: none; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.lane-head { padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; border-radius: 10px 10px 0 0; }
.lane-head .n { margin-left: auto; font-weight: 500; opacity: .85; font-size: 12px; }
.lane-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.lane.over .lane-body { background: var(--accent-soft); border-radius: 0 0 10px 10px; }
.card { background: var(--surface); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 500; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card .gdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lane-add { margin: 0 8px 8px; }
.lane-add input { width: 100%; height: 32px; border-radius: 6px; border: 1px dashed var(--border-strong); background: transparent; padding: 0 10px; outline: none; }
.lane-add input:focus { border-style: solid; border-color: var(--accent); background: var(--surface); }

/* ---------- activity ---------- */
.feed { max-width: 820px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.feed-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed-row:last-child { border-bottom: 0; }
.feed-row .what { flex: 1; min-width: 0; }
.feed-row .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.chg { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; font-size: 13px; }
.chg s { color: var(--muted); }

/* ---------- panel (item drawer) ---------- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.panel-head { padding: 16px 20px 0; border-bottom: 1px solid var(--border); }
.panel-head .top { display: flex; align-items: flex-start; gap: 8px; }
.panel-title { flex: 1; font-size: 20px; font-weight: 650; margin: 0; padding: 2px 6px; margin-left: -6px; border-radius: 6px; border: 1px solid transparent; outline: none; word-break: break-word; }
.panel-title[contenteditable="true"]:hover { border-color: var(--border-strong); }
.panel-title:focus { border-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px 30px; }
.fields { display: grid; grid-template-columns: 140px 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.fields > div { min-height: 40px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.fields > div:nth-last-child(-n+2) { border-bottom: 0; }
.fields .fl { padding: 0 12px; color: var(--muted); font-size: 13px; gap: 6px; background: var(--surface-2); }
.fields .fv { position: relative; }
.composer { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; margin-bottom: 18px; background: var(--surface); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { width: 100%; border: 0; outline: none; padding: 12px; min-height: 70px; resize: vertical; background: transparent; }
.composer .bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px 12px; }
.post { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.post .who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.post .who b { font-weight: 600; }
.post .body { white-space: pre-wrap; word-break: break-word; }
.post .body .mention { color: var(--accent); font-weight: 500; }

/* ---------- popover / modal / toast ---------- */
.popover { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; min-width: 200px; max-width: min(360px, calc(100vw - 16px)); max-height: min(440px, calc(100vh - 16px)); overflow-y: auto; animation: pop .12s ease-out; }
@keyframes pop { from { transform: translateY(-4px); opacity: 0; } }
.menu { display: flex; flex-direction: column; min-width: 190px; }
.menu button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.menu .lbl { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.labels { display: flex; flex-direction: column; gap: 5px; width: 200px; }
.labels button.lab { height: 32px; border: 0; border-radius: 5px; color: #fff; font-weight: 500; cursor: pointer; }
.labels button.lab:hover { filter: brightness(1.07); }
.labels button.lab.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.labels button.lab.none { background: var(--surface-3); color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(6, 26px); gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 6px; border: 0; cursor: pointer; }
.swatch.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.plist { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.plist button { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.plist button:hover { background: var(--surface-2); }
.plist button .ck { margin-left: auto; color: var(--accent); }
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 28, .45); z-index: 60; display: grid; place-items: start center; padding: 9vh 16px 16px; overflow-y: auto; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.modal.wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice b { display: block; font-weight: 600; }
.choice span { color: var(--muted); font-size: 13px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.members { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; max-height: 320px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.member:last-child { border-bottom: 0; }
.member .info { flex: 1; min-width: 0; }
.member .info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member select { width: auto; height: 30px; }
.linkbox { display: flex; gap: 6px; padding: 10px; border-radius: 8px; background: var(--accent-soft); flex-direction: column; }
.linkbox input { font-size: 12px; }
.suggest { position: relative; flex: 1; }
.suggest-list { position: absolute; left: 0; right: 0; top: 38px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.suggest-list button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.suggest-list button:hover, .suggest-list button.hl { background: var(--surface-2); }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2233; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13.5px; animation: pop .15s; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ---------- palette ---------- */
.palette { width: 100%; max-width: 600px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 16px 18px; font-size: 16px; outline: none; background: transparent; }
.palette .res { max-height: 400px; overflow-y: auto; padding: 6px; }
.palette .res .lbl { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.palette .res button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; }
.palette .res button.hl { background: var(--accent-soft); color: var(--accent); }
.palette .res button .sub { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- pages ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.bcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; gap: 8px; min-height: 100px; box-shadow: var(--shadow-sm); }
.bcard:hover { border-color: var(--accent); text-decoration: none; }
.bcard .t { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.bcard.new { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; background: transparent; box-shadow: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.warn .v { color: var(--danger); }
.section-h { font-size: 16px; margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border-radius: 10px; }
.wk { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.wk-h { padding: 10px 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.wk-row { display: grid; grid-template-columns: 1fr 200px 140px 110px; align-items: center; border-bottom: 1px solid var(--border); min-height: 42px; }
.wk-row:last-child { border-bottom: 0; }
.wk-row > * { padding: 0 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-row .st { padding: 0; height: 42px; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; background: var(--surface); }
.notif:hover { background: var(--row-hover); }
.notif.unread { background: var(--accent-soft); }
.notif:last-child { border-bottom: 0; }
.noaccess { max-width: 420px; margin: 12vh auto; text-align: center; }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.nav-open .sidebar { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .page { padding: 20px 16px 40px; }
  .board-head { padding: 12px 16px 0; }
  .toolbar { padding: 10px 16px; }
  .board-body { padding: 0 16px 60px; }
  .search .input { width: 160px; }
  :root { --name-w: 220px; }
  .wk-row { grid-template-columns: 1fr 110px; }
  .wk-row .bn, .wk-row .dt { display: none; }
}

/* ---------- attachments & email ---------- */
.upd.files { width: 28px; }
.composer .att { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.composer .att:empty { display: none; }
.fchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; }
a.fchip:hover { border-color: var(--accent); text-decoration: none; }
.fchip .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.fchip.busy { opacity: .7; }
.fchip .x { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--muted); display: grid; place-items: center; border-radius: 4px; }
.fchip .x:hover { color: var(--danger); background: var(--danger-soft); }
.post-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pimg { display: block; width: 120px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dropzone { width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 18px; margin-bottom: 14px; border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; text-align: left; }
.dropzone:hover { border-color: var(--accent); color: var(--accent); }
.dropzone b { color: var(--text); }
.panel.dropping::after { content: 'Largue para anexar'; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: grid; place-items: center; font-weight: 600; color: var(--accent); pointer-events: none; z-index: 5; }
.flist { display: flex; flex-direction: column; gap: 8px; }
.ftile { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ftile:hover { border-color: var(--border-strong); }
.ftile .thumb { width: 52px; height: 52px; flex: none; border-radius: 7px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); position: relative; }
.ftile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ftile .thumb.ico { flex-direction: column; gap: 0; }
.ftile .thumb .ext { font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.ftile .meta { flex: 1; min-width: 0; }
.ftile .fn { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.ftile .fn:hover { color: var(--accent); }
.uploads { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.uploads:empty { display: none; }
.upl { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.upl .fn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl .bar { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.upl .bar i { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.check-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--accent); }
.mailcard { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 8px; max-width: 900px; color: var(--muted); }
.mailcard.on { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.mailcard.on > .i, .mailcard.on > span:first-child { color: var(--ok); }
.mailcard b { color: var(--text); }
@media (max-width: 860px) { .hide-sm { display: none; } .mailcard { flex-wrap: wrap; } }

/* ---------- subitems ---------- */
.subtoggle { display: grid; place-items: center; width: 20px; height: 22px; border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: 4px; flex: none; opacity: 0; transition: transform .12s; }
.subtoggle.has, .subtoggle.open, .row.item:hover .subtoggle { opacity: 1; }
.subtoggle:hover { background: var(--surface-2); color: var(--text); }
.subtoggle.open { transform: rotate(90deg); color: var(--accent); }
.subcount { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center; cursor: pointer; margin-right: 2px; }
.subcount:hover { background: var(--accent-soft); color: var(--accent); }
.subwrap { position: sticky; left: 0; padding: 6px 0 12px 46px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--gc) 5%, var(--surface)); box-shadow: inset 5px 0 0 color-mix(in srgb, var(--gc) 45%, transparent); width: max-content; min-width: 100%; }
.subgrid { display: inline-block; min-width: 420px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.subgrid .row { min-height: 34px; }
.subgrid .row.hd .cell.namecol { padding-left: 14px; }
.subgrid .row.item .cell.namecol { padding-left: 8px; box-shadow: inset 3px 0 0 var(--gc); }
.subgrid .row.add input { margin-left: 4px; }
.subgrid .row.add .cell.namecol { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--gc) 45%, transparent); }
.subgrid .row-menu { left: -28px; }
.sublist { display: flex; flex-direction: column; gap: 2px; }
.sublist a { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--text); }
.sublist a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------- import ---------- */
.modal.wide:has(.imp-summary) { max-width: 760px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.imp-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.imp-summary > div { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; }
.imp-summary b { font-size: 20px; }
.imp-summary span { font-size: 12px; color: var(--muted); }
.imp-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.imp-group { padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 13px; color: var(--gc); background: color-mix(in srgb, var(--gc) 12%, transparent); }
.imp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.imp-h { margin: 8px 0 0; font-size: 14px; }
.table.imp td, .table.imp th { padding: 8px 10px; vertical-align: middle; }
.table.imp select.input { height: 30px; }
.imp-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.imp-labels .lbl { padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 500; }
@media (max-width: 640px) { .imp-summary { grid-template-columns: repeat(2, 1fr); } .imp-grid { grid-template-columns: 1fr; } }
