/* WAC Projects — Monday-style board UI. Dark by default, light via [data-theme=light]. */
:root, [data-theme="dark"] {
  --bg: #181b34;
  --bg-2: #1f2241;
  --surface: #292f4c;
  --surface-2: #30324e;
  --row: #30324e;
  --row-hover: #383a5a;
  --border: #4b4e69;
  --border-soft: #3c3f59;
  --text: #d5d8df;
  --text-strong: #ffffff;
  --muted: #9699a6;
  --primary: #0073ea;
  --primary-hover: #0060c2;
  --danger: #e2445c;
  --ok: #00c875;
  --blank: #797e93;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
  --mention-bg: rgba(0,115,234,.25);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --row: #ffffff;
  --row-hover: #f5f7fa;
  --border: #d0d4e4;
  --border-soft: #e6e9ef;
  --text: #323338;
  --text-strong: #1f1f1f;
  --muted: #676879;
  --blank: #c4c4c4;
  --shadow: 0 8px 28px rgba(0,0,0,.15);
  --mention-bg: #cce5ff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Figtree", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}
a { color: #4aa3ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 600; margin: 0; color: var(--text-strong); }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; color: var(--text-strong); }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--text-strong); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 14px; }
.spacer { flex: 1; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
[hidden] { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 4px; background: transparent; color: var(--text);
  font: inherit; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--row-hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 16px; position: relative;
}
.icon-btn:hover { background: var(--row-hover); }
.icon-btn.ghost { opacity: .75; }
.link-btn { background: none; border: 0; color: #4aa3ff; cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 7px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; width: 100%; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12px; border: 1px solid var(--border-soft); }
.pill.tiny { font-size: 10px; padding: 0 6px; margin-left: 6px; vertical-align: middle; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 600;
  border: 0; cursor: default; letter-spacing: .3px;
}
button.avatar { cursor: pointer; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.more { background: var(--surface-2) !important; color: var(--text); }

/* ---------- alerts & toasts ---------- */
.alert { padding: 10px 14px; border-radius: 4px; margin: 10px 0; border: 1px solid; }
.alert.error { background: rgba(226,68,92,.12); border-color: var(--danger); }
.alert.ok { background: rgba(0,200,117,.12); border-color: var(--ok); }
.alert.info { background: rgba(0,115,234,.12); border-color: var(--primary); }
.copy-field { width: 100%; margin-top: 6px; font-family: monospace; font-size: 12px; }
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #323338; color: #fff; padding: 10px 18px; border-radius: 6px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- top bar & shell ---------- */
.topbar {
  height: 52px; display: flex; align-items: center; padding: 0 16px; gap: 12px;
  background: var(--bg); border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text-strong) !important; text-decoration: none !important; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: conic-gradient(from 200deg, #ff3d57, #ffcb00, #00ca72, #0073ea, #ff3d57); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-menu, .bell-wrap { position: relative; }
.dropdown, .bell-panel {
  position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); min-width: 220px; z-index: 60; overflow: hidden;
}
.dropdown a { display: block; padding: 9px 16px; color: var(--text); }
.dropdown a:hover { background: var(--row-hover); text-decoration: none; }
.dropdown-head { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text-strong); }
.bell-count {
  position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.bell-panel { width: 380px; max-height: 70vh; display: flex; flex-direction: column; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.bell-list { overflow-y: auto; }
.bell-item { display: flex; gap: 10px; padding: 10px 16px; color: var(--text); border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.bell-item:hover { background: var(--row-hover); text-decoration: none; }
.bell-item.unread { background: rgba(0,115,234,.12); }
.bell-item.unread .bell-text::before { content: "●"; color: var(--primary); margin-right: 6px; }

.shell { display: flex; min-height: calc(100vh - 52px); }
.sidebar {
  width: 240px; flex: none; background: var(--bg-2); border-right: 1px solid var(--border-soft);
  padding: 12px 10px; position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto;
}
.side-title { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 16px 8px 6px; letter-spacing: .5px; }
.side-search { width: 100%; margin-bottom: 6px; padding: 5px 10px; }
.side-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-link:hover { background: var(--row-hover); text-decoration: none; }
.side-link.active { background: rgba(0,115,234,.25); color: var(--text-strong); }
.side-ico { opacity: .6; }
.main { flex: 1; min-width: 0; }
.page { padding: 24px 32px; }
.page.narrow { max-width: 620px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: 18px; }
.two-col { display: flex; gap: 20px; align-items: flex-start; }
.two-col > .card:first-child { width: 380px; flex: none; }
.grow { flex: 1; min-width: 0; overflow-x: auto; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.field-label { font-size: 13px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.board-checks { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.board-check { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.board-check label { flex-direction: row !important; align-items: center; gap: 6px !important; color: var(--text) !important; }
.board-check select { padding: 3px 6px; font-size: 12px; }
.grid-form { display: grid; grid-template-columns: 1fr 1.3fr 1fr 1.2fr auto; gap: 8px; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 6px 0; width: 100%; }

/* ---------- auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(circle at 30% 20%, #262a55, var(--bg) 60%); }
.auth-card { width: 380px; background: var(--surface); border-radius: 12px; padding: 32px; box-shadow: var(--shadow); }
.auth-brand { margin-bottom: 18px; }
.auth-card h1 { font-size: 20px; margin-bottom: 14px; }

/* ---------- boards page ---------- */
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.board-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: 18px; color: var(--text); display: flex; flex-direction: column; gap: 4px; min-height: 120px; border-top: 4px solid var(--primary); }
.board-card:hover { text-decoration: none; border-color: var(--primary); }
.board-card.is-template { border-top-color: var(--muted); border-style: dashed; border-top-style: solid; }
.board-card-title { font-weight: 600; color: var(--text-strong); font-size: 16px; }
.board-card-foot { margin-top: auto; }
.admin-box { margin-top: 30px; }
.admin-box summary { cursor: pointer; color: var(--muted); }

.list-table { width: 100%; border-collapse: collapse; }
.list-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); }
.list-table td { padding: 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.list-table tr.inactive { opacity: .5; }
.role-pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; font-weight: 600; }
.role-admin { background: rgba(162,93,220,.25); color: #c99cf0; }
.role-staff { background: rgba(0,115,234,.25); color: #7dbbff; }
.role-guest { background: rgba(253,171,61,.25); color: #fdbc64; }

/* ---------- modal ---------- */
dialog.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 24px; width: 480px; max-width: 94vw; box-shadow: var(--shadow); }
dialog.modal.wide { width: 860px; }
dialog::backdrop { background: rgba(0,0,0,.55); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- board page ---------- */
.board-page .main { padding: 0; }
.board-loading { padding: 40px; }
.board-head { padding: 18px 28px 0; position: sticky; left: 0; }
.board-title-row { display: flex; align-items: center; gap: 12px; }
.board-title[data-act] { cursor: pointer; border-radius: 4px; padding: 0 4px; margin-left: -4px; }
.board-title[data-act]:hover { outline: 1px dashed var(--border); }
.board-desc { margin-top: 4px; max-width: 900px; }
.people-stack { display: flex; }
.people-stack .avatar { margin-left: -6px; border: 2px solid var(--bg); }
.board-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-soft); margin-top: 12px; }
.board-tabs .tab, .panel-tabs .tab { background: none; border: 0; color: var(--text); padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.board-tabs .tab.active, .panel-tabs .tab.active { border-bottom-color: var(--primary); color: var(--text-strong); }
.toolbar { display: flex; align-items: center; gap: 6px; padding: 12px 0; flex-wrap: wrap; }
.tool { background: none; border: 0; color: var(--text); font: inherit; padding: 6px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.tool:hover { background: var(--row-hover); }
.tool.on { background: rgba(0,115,234,.25); color: var(--text-strong); }
.tool-search { display: flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 4px; border: 1px solid transparent; }
.tool-search:focus-within { border-color: var(--primary); }
.tool-search input { border: 0; background: transparent; width: 150px; padding: 6px 2px; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

.board-scroll { overflow-x: auto; padding: 4px 28px 120px 0; }
.board-scroll > .group, .board-scroll > .empty-state { margin-left: 28px; }
.group { margin-top: 26px; width: max-content; min-width: calc(100% - 28px); }
.group-title { display: flex; align-items: center; gap: 8px; height: 36px; position: sticky; left: 0; width: fit-content; padding-right: 12px; }
.group-title .caret { background: none; border: 0; color: var(--gc); font-size: 16px; cursor: pointer; width: 24px; }
.group-name { color: var(--gc); font-size: 18px; font-weight: 600; padding: 0 4px; border-radius: 4px; }
.group-name[data-act]:hover { outline: 1px solid var(--border); cursor: text; }
.group-title .icon-btn { opacity: 0; }
.group-title:hover .icon-btn { opacity: 1; }
.group.collapsed .group-title { border-left: 6px solid var(--gc); padding-left: 6px; background: var(--row); border-radius: 4px; height: 44px; max-width: 700px; }

table.gtable { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; }
.gtable th, .gtable td { border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); height: 36px; padding: 0; }
.gtable th { font-weight: 500; font-size: 13px; color: var(--text); background: var(--row); text-align: center; position: relative; border-top: 1px solid var(--border-soft); }
.gtable td { background: var(--row); }
.gtable .c-name { position: sticky; left: 0; z-index: 2; text-align: left; box-shadow: inset 6px 0 0 var(--gc); padding-left: 10px; }
.gtable thead .c-name { padding-left: 16px; border-top-left-radius: 6px; z-index: 3; }
.gtable thead .c-name, .gtable tfoot .c-name { text-align: center; }
.gtable tbody tr.row:hover td { background: var(--row-hover); }
.gtable .nm { display: flex; align-items: center; gap: 4px; height: 35px; }
.grip, .grip-space { width: 16px; flex: none; color: var(--muted); cursor: grab; opacity: 0; font-size: 11px; letter-spacing: -2px; }
tr.row:hover .grip { opacity: 1; }
.item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; color: var(--text); padding: 2px 4px; border-radius: 3px; }
.item-name:hover { color: var(--text-strong); }
.row-menu { opacity: 0; height: 26px; min-width: 26px; font-size: 14px; }
tr.row:hover .row-menu { opacity: 1; }
.c-upd { text-align: center; }
.upd-btn { background: none; border: 0; cursor: pointer; position: relative; padding: 4px 6px; opacity: .5; filter: grayscale(1); font-size: 15px; }
.upd-btn.has { opacity: 1; filter: none; }
.upd-btn:hover { opacity: 1; }
.upd-n { position: absolute; bottom: 0; right: -2px; background: var(--muted); color: #fff; font-size: 9px; border-radius: 8px; min-width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; padding: 0 3px; font-weight: 700; }
.upd-btn.unread .upd-n { background: var(--primary); }
.gtable th.c-col .th-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 22px; }
.th-menu { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--text); cursor: pointer; opacity: 0; border-radius: 3px; }
th:hover .th-menu { opacity: 1; }
.th-menu:hover { background: var(--row-hover); }
.sort-ind { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); color: var(--primary); }
.col-resize { position: absolute; right: -3px; top: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 4; }
.col-resize:hover { background: var(--primary); }
th.dragging, tr.dragging { opacity: .4; }
th.drop-left { box-shadow: inset 3px 0 0 var(--primary); }
th.drop-right { box-shadow: inset -3px 0 0 var(--primary); }
tr.drop-above td { box-shadow: inset 0 3px 0 var(--primary); }
tr.drop-below td { box-shadow: inset 0 -3px 0 var(--primary); }
tr.drop-above td.c-name, tr.drop-below td.c-name { box-shadow: inset 6px 0 0 var(--gc), inset 0 3px 0 var(--primary); }
.c-add { background: transparent !important; border-right: 0 !important; border-top: 0 !important; border-bottom: 0 !important; }
.gtable td:last-child { background: transparent !important; border-right: 0; border-bottom: 0; }

.cell { text-align: center; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 6px !important; }
.cell.editable { cursor: pointer; }
.cell.editable:hover { outline: 1px solid var(--border); outline-offset: -1px; }
.cell.status { background: var(--lc) !important; color: #fff; font-weight: 500; text-shadow: 0 0 2px rgba(0,0,0,.25); border-right-color: var(--bg) !important; border-bottom-color: var(--bg) !important; }
.cell.status:hover { filter: brightness(1.08); }
.cell.status span { display: block; overflow: hidden; text-overflow: ellipsis; }
.cell .placeholder { opacity: 0; color: var(--muted); }
.cell:hover .placeholder { opacity: 1; }
.cell.person .avatars { display: inline-flex; vertical-align: middle; }
.cell.person .avatar + .avatar { margin-left: -6px; }
.cell.link a { color: #4aa3ff; }
.cell.number { text-align: right; padding-right: 12px !important; }
.cell-input, .inline-edit { width: 100%; height: 28px; padding: 3px 6px; text-align: inherit; }
.cell.date .cell-input { text-align: center; }

.add-row td { background: var(--row); }
.add-row .c-name { padding-left: 26px !important; }
.add-input { border: 1px solid transparent; background: transparent; width: 100%; height: 28px; padding: 3px 8px; }
.add-input:hover { border-color: var(--border); }
.add-input:focus { border-color: var(--primary); background: var(--bg-2); }
.gtable tfoot td { background: transparent; border-right: 0; border-bottom: 0; height: 40px; }
.gtable tfoot td.c-name { box-shadow: none; background: var(--bg); }
.gtable tfoot td.c-sum { background: var(--row); border: 1px solid var(--border-soft); border-top: 0; border-left: 0; padding: 0 8px; text-align: center; }
.gtable tfoot tr td.c-sum:first-of-type { border-bottom-left-radius: 6px; }
.sum-bar { display: flex; height: 22px; border-radius: 2px; overflow: hidden; }
.sum-bar span { min-width: 3px; }
.sum-range, .sum-num { font-size: 12px; color: var(--text); }
.sum-num small { color: var(--muted); margin-left: 3px; }

/* ---------- popovers ---------- */
.popover { position: fixed; z-index: 200; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 8px; max-height: 70vh; overflow-y: auto; }
.menu { display: flex; flex-direction: column; }
.menu button { background: none; border: 0; color: var(--text); font: inherit; text-align: left; padding: 7px 10px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.menu button:hover, .menu button.on { background: var(--row-hover); }
.menu button.danger { color: var(--danger); }
.menu-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px 4px; border-top: 1px solid var(--border-soft); margin-top: 4px; }
.menu-sep:first-child { border-top: 0; margin-top: 0; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 4px; }
.label-opt { border: 0; color: #fff; font: inherit; font-weight: 500; font-size: 13px; padding: 7px 8px; border-radius: 2px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 2px rgba(0,0,0,.3); }
.label-opt:hover { filter: brightness(1.1); }
.pop-foot { border-top: 1px solid var(--border-soft); margin-top: 8px; padding: 8px 4px 0; text-align: center; }
.pop-search { width: 100%; margin-bottom: 6px; }
.person-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.person-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer; }
.person-opt:hover { background: var(--row-hover); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
.swatches.wide { padding: 4px; }
.swatch { width: 22px; height: 22px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text-strong); }
.swatch.big { width: 30px; height: 30px; flex: none; }
.filter-pop { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-col { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.chip { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.chip:hover { background: var(--row-hover); }
.chip.on { background: rgba(0,115,234,.25); }
.chip input { margin: 0 4px 0 0; }
.filter-pop .pop-foot { width: 100%; }
.sort-row { display: flex; align-items: center; gap: 4px; padding: 2px 10px; }
.sort-row span { flex: 1; }
.sort-row button { padding: 3px 9px !important; border: 1px solid var(--border-soft) !important; }
.check-row { display: flex; gap: 8px; padding: 5px 10px; align-items: center; cursor: pointer; }

/* labels dialog */
.label-rows { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-row .label-text { flex: 1; }
.drag-h { cursor: grab; color: var(--muted); letter-spacing: -2px; }

/* ---------- side panel ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); z-index: 100;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slidein .18s ease-out;
}
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.panel-backdrop { position: fixed; inset: 0; z-index: 99; background: rgba(0,0,0,.25); }
.panel-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px 4px; }
.panel-title-wrap { flex: 1; min-width: 0; }
.panel-title { font-size: 22px; margin: 2px 0 0; cursor: text; border-radius: 4px; }
.panel-title:hover { outline: 1px dashed var(--border); }
.panel-group { color: var(--muted); }
.panel-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border-soft); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }

.composer { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); position: relative; }
.composer:focus-within { border-color: var(--primary); }
.composer.drop { border-style: dashed; border-color: var(--primary); }
.composer textarea { border: 0; background: transparent; padding: 12px; resize: vertical; min-height: 60px; }
.composer-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--border-soft); }
.composer-bar .hint { margin-right: 8px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px; }
.attach-list:not(:empty) { padding-bottom: 8px; }
.attach-chip { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 14px; padding: 3px 6px 3px 10px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.attach-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; }
.mention-box { position: absolute; left: 10px; bottom: calc(100% - 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; z-index: 5; min-width: 260px; }
.composer-wrap .mention-box { top: 70px; bottom: auto; }
.mopt { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text); padding: 6px 8px; border-radius: 4px; cursor: pointer; font: inherit; text-align: left; }
.mopt.on, .mopt:hover { background: var(--row-hover); }

.updates { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.update { border: 1px solid var(--border-soft); border-radius: 8px; padding: 14px 16px; background: var(--surface); }
.update header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.update .who { flex: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.update .who strong { color: var(--text-strong); }
.update-body { word-wrap: break-word; line-height: 1.55; }
.update-body .edit-ta { margin-bottom: 4px; }
.mention { background: var(--mention-bg); color: #4aa3ff; border-radius: 3px; padding: 0 3px; font-weight: 500; }
.replies { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.replies:empty { display: none; }
.update.reply { background: var(--surface-2); border: 0; padding: 10px 12px; }
.update.reply header .avatar { width: 26px; height: 26px; font-size: 10px; }
.reply-slot { margin-top: 10px; }
.empty-updates { text-align: center; padding: 30px; }
.empty-updates .big { font-size: 40px; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.file-grid.big { margin-top: 16px; }
.file-card { border: 1px solid var(--border-soft); border-radius: 6px; overflow: hidden; background: var(--bg-2); position: relative; display: flex; flex-direction: column; }
.file-thumb { height: 130px; display: flex; align-items: center; justify-content: center; background: #fff; position: relative; overflow: hidden; }
[data-theme="dark"] .file-thumb { background: #e9eaee; }
.file-thumb img, .file-thumb canvas.ready { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.file-thumb canvas:not(.ready) { display: none; }
.file-thumb .ext { font-weight: 700; color: #fff; background: #676879; border-radius: 4px; padding: 6px 10px; font-size: 13px; }
.file-thumb .ext.pdf { background: #e2445c; }
.file-thumb canvas.ready + .ext { position: absolute; bottom: 6px; left: 6px; padding: 2px 6px; font-size: 10px; }
.file-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.file-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.5) !important; color: #fff; height: 26px; min-width: 26px; font-size: 12px; opacity: 0; }
.file-card:hover .file-del { opacity: 1; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed var(--border); border-radius: 8px; padding: 26px; cursor: pointer; text-align: center; }
.dropzone.over, .dropzone:hover { border-color: var(--primary); background: rgba(0,115,234,.06); }
.dropzone.busy { opacity: .6; pointer-events: none; }

.activity { display: flex; flex-direction: column; }
.act-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.act-time { width: 44px; flex: none; padding-top: 3px; }
.act-detail { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .page { padding: 16px; }
  .two-col { flex-direction: column; }
  .two-col > .card:first-child { width: 100%; }
  .board-head { padding: 14px 14px 0; }
  .board-scroll { padding: 4px 14px 100px 0; }
  .board-scroll > .group { margin-left: 14px; }
  .gtable col:first-child { width: 230px !important; }
  .grid-form { grid-template-columns: 1fr; }
  .bell-panel { position: fixed; left: 8px; right: 8px; width: auto; top: 56px; }
  .composer-bar .hint { display: none; }
}
