:root {
  --bg: #10141a; --panel: #1a2029; --panel2: #222a36;
  --text: #e6ebf2; --muted: #8a97a8; --accent: #4f8cff;
  --danger: #e5534b; --ok: #3fb27f; --warn: #d9a520;
  --radius: 8px;
  --topbar-h: 57px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
/* App shell: header stays fixed, everything below it scrolls (never "under"
   the header). The board view fills the remaining height exactly and gives
   each column its own vertical scrollbar. */
body { margin: 0; font: 14px/1.45 system-ui, sans-serif; background: var(--bg); color: var(--text); display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#topbar { flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); padding: 7px 14px; cursor: pointer; }
button:hover { filter: brightness(1.12); }
button.ghost { background: var(--panel2); color: var(--text); }
button.danger { background: var(--danger); }
input, select, textarea { background: var(--panel2); color: var(--text); border: 1px solid #333e4e; border-radius: var(--radius); padding: 7px 9px; font: inherit; width: 100%; }
/* form.row (e.g. the admin "new user" line) and form .row alike */
form.row, form .row { display: flex; align-items: center; gap: 10px; }
form.row label, form .row label { flex: 1; }
form.row label.check, form .row label.check { flex: 0 0 auto; }
label { display: block; margin: 8px 0; }
label input, label select, label textarea { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }

#topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid #2a3342; position: sticky; top: 0; z-index: 60; }
.logo { font-weight: 700; letter-spacing: .06em; color: var(--accent); }
/* board picker in the header: "+ Column" then a dropdown button */
#board-select { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; position: relative; }
#btn-new-column { flex: 0 0 auto; }
#board-select-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 360px;
  background: var(--panel2); border: 1px solid #2a3342; border-radius: var(--radius);
  padding: 7px 12px; font: inherit; cursor: pointer; }
#board-select-btn:disabled { opacity: .5; cursor: default; }
#board-select-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board-select-btn .caret { color: var(--muted); font-size: 12px; }
#board-select-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; max-height: 60dvh;
  overflow-y: auto; background: var(--panel2); border: 1px solid #3a4658; border-radius: 10px; padding: 6px;
  z-index: 70; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
#board-select-menu .dd-label { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .05em; }
#board-select-menu ul { list-style: none; padding: 0; margin: 0; }
#board-select-menu .dd-item { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent;
  color: var(--text); border: 0; border-radius: 8px; padding: 8px 10px; text-align: left; font: inherit; cursor: pointer; }
#board-select-menu .dd-item:hover { background: #2c3644; filter: none; }
#board-select-menu .dd-item.current { outline: 1px solid var(--accent); }
#board-select-menu .dd-sep { border: 0; border-top: 1px solid #3a4658; margin: 4px 6px; }
#user-box { display: flex; gap: 8px; align-items: center; }

/* ---------- presence ring & account menu ---------- */
/* ring around the avatar: green online, amber away, red dnd, grey offline */
.ring { --ring: #8a97a8; }
.ring-online  { --ring: #3fb27f; }
.ring-pause   { --ring: #d9a520; }
.ring-dnd     { --ring: #e5534b; }
.ring-offline { --ring: #5a6572; }
#me-menu { position: relative; }
#me-avatar-btn { background: var(--panel2); border: 0; padding: 0; width: 30px; height: 30px;
  border-radius: 50%; overflow: visible; display: grid; place-items: center; box-shadow: 0 0 0 2.5px var(--ring, #5a6572); }
#me-avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#me-avatar-btn span.letter { font-weight: 700; font-size: 13px; color: var(--muted); }
#me-dropdown { position: absolute; top: 38px; right: 0; min-width: 200px; background: var(--panel2);
  border: 1px solid #3a4658; border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 40;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); }
#me-dropdown .dd-label { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .05em; }
#me-dropdown .dd-item { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent;
  color: var(--text); border: 0; border-radius: 8px; padding: 8px 10px; text-align: left; font: inherit; cursor: pointer; }
#me-dropdown .dd-item:hover { background: #2c3644; filter: none; }
#me-dropdown .dd-item.current { outline: 1px solid var(--accent); }
#me-dropdown .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
#me-dropdown .dot-online { background: #3fb27f; } #me-dropdown .dot-pause { background: #d9a520; } #me-dropdown .dot-dnd { background: #e5534b; }
#me-dropdown .dd-sep { border: 0; border-top: 1px solid #3a4658; margin: 4px 6px; }

/* ---------- presence sidebar (collapsible) ---------- */
#user-sidebar { position: fixed; top: calc(var(--topbar-h, 49px) + 8px); right: 8px; width: 240px;
  max-height: calc(100dvh - var(--topbar-h, 49px) - 20px); overflow-y: auto; background: var(--panel);
  border: 1px solid #2a3342; border-radius: 12px; padding: 12px 14px; z-index: 50; }
#user-sidebar h3 { margin: 0 0 8px; font-size: 14px; }
#sidebar-users { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
#sidebar-users li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#sidebar-users li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar-users li .me { color: var(--muted); font-size: 11px; }
#sidebar-users .ava.ring { box-shadow: 0 0 0 2.5px var(--ring); background: var(--panel2); border: 0; }

/* ---------- card sheet (replaces the card modal) ---------- */
#sheet-card, #sheet-column { position: fixed; top: var(--topbar-h, 49px); right: 0; bottom: 0; width: min(430px, 96vw);
  background: var(--panel); border-left: 1px solid #2a3342; padding: 16px 20px; overflow-y: auto; z-index: 35;
  box-shadow: -12px 0 32px rgba(0,0,0,.4); }
#sheet-card h2, #sheet-column h2 { margin: 0 0 10px 40px; font-size: 18px; }
.sheet-close { position: absolute; top: 10px; left: 10px; z-index: 2; width: 30px; height: 30px;
  padding: 0; border-radius: 50%; background: var(--panel2); color: var(--muted);
  border: 1px solid #3a4658; font-size: 14px; line-height: 1; display: grid; place-items: center; }
.sheet-close:hover { color: var(--text); border-color: var(--accent); }
#sheet-card label, #sheet-column label { display: block; margin: 8px 0; }
#sheet-card .row, #sheet-column .row { display: flex; align-items: center; gap: 10px; }
#sheet-card .row label, #sheet-column .row label { flex: 1; }
#sheet-card menu, #sheet-column menu { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 14px 0 0; padding: 0; }
#sheet-card #card-comments, #sheet-card #card-audit-box { border-top: 1px solid #2a3342; margin-top: 14px; padding-top: 10px; }
/* the board loses room while the sheet is open */
body.sheet-open #app { padding-right: calc(min(430px, 96vw) + 16px); }
@media (max-width: 900px) {
  body.sheet-open #app { padding-right: 16px; }
  #sheet-card { width: 100vw; }
}

/* ---------- presence & avatar stacks ---------- */
/* overlapping avatar chips (used on cards and in the presence bar) */
.ava {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; overflow: hidden;
  background: var(--panel2); color: var(--muted);
  border: 2px solid var(--panel2); font-size: 10px; font-weight: 700;
  flex: 0 0 auto; position: relative;
}
.ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.card .assignees { display: flex; align-items: center; margin-top: 7px; padding-left: 1px; }
.card .assignees .ava { border-color: var(--panel2); }
.card .assignees .ava + .ava { margin-left: -7px; }
#btn-pause.active { border-color: #d9a520; color: #e6c86a; }
/* GitHub-style presence heatmap (profile, private per user) */
.heatmap { display: flex; gap: 3px; overflow-x: auto; padding: 4px 2px; }
.heatmap .hm-col { display: flex; flex-direction: column; gap: 3px; }
.heatmap .hm-cell { width: 11px; height: 11px; border-radius: 2px; background: #222a36; }
.heatmap .hm-cell.l1 { background: #115832; }
.heatmap .hm-cell.l2 { background: #1c7a48; }
.heatmap .hm-cell.l3 { background: #2ea363; }
.heatmap .hm-cell.l4 { background: #4ac27f; }
.heatmap-legend { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; }
.heatmap-legend .hm-side { flex: 1; }
#dlg-call { min-width: 320px; }
#dlg-new-board { min-width: 340px; }
#dlg-new-board label.nb-template-label { display: flex; align-items: center; gap: 8px; }
#dlg-new-board #nb-template { flex: 1; }
.nb-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; min-height: 24px; }
.nb-chip { background: var(--panel2); border: 1px solid #3a4658; border-radius: 99px; padding: 2px 10px; font-size: 12px; }
.nb-chip.done { border-color: #3fb27f; color: #7fd6a4; }
.nb-chip.backlog { border-color: #4f8cff; color: #9cc4ff; }

/* chip picker for board-local labels in the card sheet: click toggles */
.chip-picker { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 4px; }
.chip-picker .chip { background: var(--panel2); border: 1px solid #3a4658; border-radius: 99px; color: var(--muted); font: inherit; font-size: 12px; padding: 2px 10px; cursor: pointer; }
.chip-picker .chip:hover { border-color: #4f8cff; color: #cdd6e4; }
.chip-picker .chip.on { background: #23413d; border-color: #2f6a5c; color: #8fe0d2; }
#call-messages { list-style: none; padding: 0; margin: 8px 0; max-height: 200px; overflow-y: auto; font-size: 13px; }
#call-messages li { padding: 3px 0; border-bottom: 1px solid #232b38; }
#call-messages li.mine { color: #9cc4ff; }
#call-chat { border-top: 1px solid #2a3342; margin-top: 10px; padding-top: 8px; }

#app { padding: 16px; flex: 1; min-height: 0; overflow: auto; }
.panel { max-width: 420px; margin: 60px auto; background: var(--panel); padding: 24px; border-radius: 12px; }
.panel.wide { max-width: 860px; }
.msg { min-height: 18px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
a { color: var(--accent); }

#board-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
#columns { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; }
/* Board view fills the viewport exactly: header never scrolls away, the page
   never scrolls under it — instead every column scrolls on its own over the
   full available height (even when short). */
#view-board { height: 100%; display: flex; flex-direction: column; }
#view-board #columns { flex: 1; min-height: 0; align-items: stretch; padding-bottom: 0; }
.column { background: var(--panel); border-radius: 12px; width: 300px; min-width: 300px; padding: 10px; border: 1px solid #2a3342; display: flex; flex-direction: column; }
.column .cards { flex: 1; min-height: 34px; overflow-y: auto; }
/* .card has overflow:hidden, which zeroes its automatic min-size — inside the
   fixed-height scroll box it would shrink instead of overflowing. Keep cards
   at their natural height so the column scrolls. */
.cards > .card { flex-shrink: 0; }
.column.drag-over { border-color: var(--accent); }
/* WIP limits: amber = at the limit (full), red = over it (only reachable
   by lowering the limit or legacy data; server blocks moves at the cap) */
.column.wip-at-limit { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn), 0 0 14px rgba(217,165,32,.25); }
.column.wip-at-limit .col-meta { color: var(--warn); font-weight: 600; }
.column.wip-exceeded { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger), 0 0 14px rgba(229,83,75,.3); }
.column.wip-exceeded .col-meta { color: var(--danger); font-weight: 600; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; cursor: pointer; }
.col-head h3 { margin: 2px 0; font-size: 15px; }
.col-meta { font-size: 12px; color: var(--muted); }
.state-bar { display: flex; gap: 2px; height: 5px; margin-bottom: 6px; }
.state-bar:empty { display: none; }
.state-seg { height: 100%; border-radius: 3px; min-width: 5px; opacity: .9; }
.state-seg.state-not_started { background: var(--state-c, #8a97a8); }
.state-seg.state-wip { background: var(--state-c, #4f8cff); }
.state-seg.state-blocked { background: var(--state-c, #e5534b); }
.state-seg.state-wont_fix { background: var(--state-c, #d9a520); }
.state-seg.state-done { background: var(--state-c, #3fb27f); }
.col-desc { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 34px; }
.card { background: var(--panel2); border-radius: var(--radius); padding: 9px 11px; cursor: grab; border: 1px solid transparent; position: relative; overflow: hidden; }
/* blocked cards cannot be dragged (moves are refused server-side until
   the block is lifted) — the cursor says so */
.card.blocked { cursor: default; }
.card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--st-c, transparent); }
.card:hover { border-color: #3a4658; }
.card .title { font-weight: 600; }
.card .badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; font-size: 11px; }
.badge { border-radius: 99px; padding: 1px 8px; background: #2c3644; color: var(--muted); }
.badge.state-not_started { background: #2c3644; color: var(--muted); }
.badge.state-wip { background: #27436b; color: #9cc4ff; }
.badge.state-blocked { background: #5a2a26; color: #ff9a90; }
.badge.state-wont_fix { background: #4a3f22; color: #e6c86a; }
.badge.state-done { background: #1e4634; color: #7fdcae; }
.badge.prio-1 { color: #9cc4ff; } .badge.prio-2 { color: #e6c86a; } .badge.prio-3 { color: #ff9a90; }
.badge.deadline { background: #33263b; color: #d7aef0; }
.badge.label { background: #23413d; color: #8fe0d2; }
.badge.assignee { background: #2f3341; color: #bfc6e0; }
.add-card { width: 100%; margin-top: 8px; background: transparent; color: var(--muted); border: 1px dashed #333e4e; }

dialog { background: var(--panel); color: var(--text); border: 0; border-radius: 12px; padding: 20px 24px; width: min(560px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 16px 0 0; }
#card-audit-box { border-top: 1px solid #2a3342; margin-top: 12px; padding-top: 8px; }
#audit-list { max-height: 220px; overflow-y: auto; padding-left: 18px; }
#audit-list li { margin: 4px 0; font-size: 13px; }

#user-list { list-style: none; padding: 0; }
#user-list > li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #2a3342; }
#user-list li > span { flex: 1; }
/* agent MCP token box: a full-width sub-row below the user row */
#user-list > li.mcp-box { flex-wrap: wrap; align-items: stretch; padding: 4px 0 10px 28px; background: rgba(255,255,255,.02); }
#user-list li.mcp-box .row { width: 100%; }
#user-list li.mcp-box .mcp-list { width: 100%; }
#user-list li.mcp-box .mcp-empty { width: 100%; margin: 4px 0 0; }
/* ---------- admin: media file inventory ---------- */
#media-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#media-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid #2a3342; }
#media-table td { padding: 7px 8px; border-bottom: 1px solid #232b38; vertical-align: middle; }
#media-table td.media-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-use { display: inline-block; background: var(--panel2); border: 1px solid #2a3342; border-radius: 6px;
  padding: 1px 6px; margin: 1px 2px; font-size: 11px; white-space: nowrap; }
.badge-unused { background: #3a2f1d; color: var(--warn); border: 1px solid #5a4a28; border-radius: 6px; padding: 1px 6px; font-size: 11px; }
#passkey-list { list-style: none; padding: 0; margin-top: 12px; }
#passkey-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #2a3342; font-size: 13px; }
#passkey-list li > span { flex: 1; word-break: break-all; }
#passkey-list li > input { flex: 1; }
hr.sep { border: 0; border-top: 1px solid #2a3342; margin: 14px 0; }
button.wide { width: 100%; }
#board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.board-card { background: var(--panel2); border: 1px solid #2a3342; border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: border-color .15s; }
.board-card.has-bg { background-image: linear-gradient(rgba(16, 20, 26, 0.82), rgba(16, 20, 26, 0.82)), var(--bgb); background-size: cover; background-position: center; }
.board-card.has-bg-video { position: relative; isolation: isolate; background: rgba(28, 34, 45, 0.9); }
.board-card.has-bg-video > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; border-radius: inherit; }
.board-card.has-bg-video::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(rgba(16, 20, 26, 0.78), rgba(16, 20, 26, 0.78)); z-index: -1; pointer-events: none; }
.board-card:hover, .board-card:focus-visible { border-color: var(--accent); outline: none; }
.board-card h3 { margin: 0 0 4px; font-size: 16px; }
.board-card p { margin: 0; font-size: 13px; min-height: 18px; }
.board-card-add { border-style: dashed; color: var(--muted); display: flex; align-items: center; justify-content: center; min-height: 74px; }
.board-card-add:hover, .board-card-add:focus-visible { color: var(--accent); }
.board-card-add h3 { margin: 0; font-weight: 600; }
#logo-link { text-decoration: none; }
.avatar { border-radius: 50%; vertical-align: middle; margin-right: 6px; background: var(--panel2); object-fit: cover; }
.avatar.xl { margin-right: 14px; }
.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
#form-name { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
#form-name label { flex: 1; }
#who { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.icon-btn:hover { color: var(--accent); background: #2c3644; }
#archived-boards { list-style: none; padding: 0; }
#archived-boards li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #2a3342; }
#archived-boards li > span { flex: 1; }
details#archived-boards-box { margin-top: 18px; }
details#archived-boards-box summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.board-stats { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.stat-chip { background: #2c3644; border-radius: 99px; padding: 1px 8px; }
.stat-chip.overdue { background: #5a2a26; color: #ff9a90; }
.stat-chip.depopen { background: #4b2f2a; color: #ffb08c; }
.stat-chip.time { color: #9cc4ff; }
.stat-pct { color: #7fdcae; font-weight: 600; }
.stat-empty { font-size: 12px; }
.pb { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: #232b38; }
.pb-seg { height: 100%; min-width: 3px; }
.pb-blocked { background: var(--state-c, #e5534b); }
.pb-not_started { background: var(--state-c, #8a97a8); }
.pb-wip { background: var(--state-c, #4f8cff); }
.pb-wont_fix { background: var(--state-c, #d9a520); }
.pb-done { background: var(--state-c, #3fb27f); }
.pb-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.pb-item { display: inline-flex; align-items: center; gap: 4px; }
.pb-item i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pb-item b { color: var(--text); font-weight: 600; }
.pb-line { display: flex; gap: 8px; align-items: center; }
#board-archive-box, #board-time-box, #board-deps-box, #board-intake-box { border-top: 1px solid #2a3342; margin-top: 14px; padding-top: 8px; }
#board-archive-box summary, #board-time-box summary, #board-deps-box summary, #board-intake-box summary { cursor: pointer; color: var(--muted); }
#board-archive-box ul, #board-time-box ul { list-style: none; padding: 0; }
#board-archive-box li, #board-time-box li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #2a3342; }
#board-archive-box li > span, #board-time-box li > span { flex: 1; }

/* card timer (work-time tracking in the card dialog) */
#card-timer { margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid #2a3342; }
#card-timer .upload-row { justify-content: space-between; }
#btn-timer-toggle.running { border-color: var(--state-c, #4f8cff); color: #9cc4ff; }
.timer-sessions { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--muted); max-height: 140px; overflow-y: auto; }
.timer-sessions li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid #222b38; }
.timer-sessions li b { color: var(--text); font-weight: 600; }
.timer-sessions .timer-live { color: #9cc4ff; }
/* card relationships (dependencies) */
#card-deps { margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid #2a3342; }
#card-deps summary { cursor: pointer; color: var(--muted); }
.dep-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; }
.dep-list li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; border-bottom: 1px solid #222b38; }
.dep-list .dep-rel { color: var(--muted); flex: none; font-size: 11px; }
.dep-list .dep-title { color: var(--text); cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-list .dep-title:hover { text-decoration: underline; }
.dep-list .dep-board { color: var(--muted); font-style: italic; flex: none; }
.dep-list .dep-open { color: #ff9a90; flex: none; }
.dep-list .dep-done { color: #3fb27f; flex: none; }
.card .badge.dep-open { background: #5a2a26; color: #ff9a90; }
.card .badge.dep-ok { background: #244b36; color: #7fd6a4; }
.card .badge.dep-hold { background: #4b3d1f; color: #f0c674; }
.dep-list .dep-remove { flex: none; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 2px; }
.dep-list .dep-remove:hover { color: var(--danger); }
.dep-results { list-style: none; padding: 0; margin: 6px 0; max-height: 160px; overflow-y: auto; border: 1px solid #2a3342; border-radius: var(--radius); background: var(--panel2); }
.dep-results li { padding: 6px 9px; cursor: pointer; font-size: 12px; border-bottom: 1px solid #222b38; display: flex; gap: 6px; align-items: baseline; }
.dep-results li:last-child { border-bottom: none; }
.dep-results li:hover { background: #2c3644; }
.dep-results .r-state { flex: none; width: 8px; height: 8px; border-radius: 50%; align-self: center; }
.dep-results .r-board { color: var(--muted); font-style: italic; margin-left: auto; flex: none; }
#dep-search { flex: 1; min-width: 0; }
#dep-kind { flex: none; }
#board-time-box li b { color: var(--text); }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid #3a4658; padding: 10px 18px; border-radius: var(--radius); opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }

/* ---------- file uploads (cards, boards) ---------- */
.card .cover { display: block; width: calc(100% + 22px); margin: -9px -11px 8px; max-height: 120px; object-fit: cover; }
/* video covers keep their aspect ratio and stay small enough to fit the
   board without pushing the title out of view; native controls stay usable */
.card video.cover { max-height: 170px; object-fit: contain; background: #000; }
.badge.files { background: #2f3341; color: #cfd6e8; }
#card-files { border-top: 1px solid #2a3342; margin-top: 12px; padding-top: 8px; }
#card-files h3 { margin: 0 0 6px; font-size: 14px; }
#attachment-list { list-style: none; padding: 0; margin: 0 0 8px; }
#attachment-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #232b38; font-size: 13px; }
#attachment-list li > a { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); text-decoration: none; }
#attachment-list li > a:hover { text-decoration: underline; }
#attachment-list li > .muted { flex: 1; text-align: right; font-size: 11px; }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* board settings form: clearly separated blocks — shared "Board settings"
   vs "Personal overrides" (visible only to you) */
fieldset.form-block { border: 1px solid var(--border, #2a3342); border-radius: 10px; margin: 0 0 14px; padding: 10px 12px 12px; }
fieldset.form-block legend { font-size: 13px; font-weight: 600; padding: 0 6px; color: var(--text, inherit); }
fieldset.form-block h4 { margin: 12px 0 6px; font-size: 14px; }
/* background previews: the box shows the image itself, or a real inline
   <video> with native controls (poster as still) so a black fade-in at
   the start of a clip can be scrubbed through — a plain poster frame
   would hide which video it is */
.bg-preview { margin: 0 0 8px; }
.bg-preview p { margin: 4px 0 0; font-size: 12px; }
.bg-preview-box { position: relative; width: min(320px, 100%); aspect-ratio: 16 / 9; border-radius: 8px; border: 1px solid var(--border, #2a3342); background: var(--panel-2, #1c2230); overflow: hidden; }
.bg-preview-box img, .bg-preview-box video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
button.small { padding: 2px 8px; font-size: 11px; }
/* the background is a fixed full-viewport overlay, so its size never
   depends on board content (short columns, few columns, scrolling) */
body.has-board-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(15,19,26,.35), rgba(15,19,26,.35)), var(--board-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
/* video background: the <video> sits furthest back, the same dimming
   gradient rides on the existing ::before overlay (no --board-bg image) */
#board-bg-video { display: none; }
body.has-board-bg-video #board-bg-video {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
body.has-board-bg-video::before {
  background-image: linear-gradient(rgba(15,19,26,.35), rgba(15,19,26,.35));
}
/* poster + explicit play button (user preference "click"): the button
   floats bottom-right over the board so it never fights the columns;
   the sound toggle (visible while a bg video plays) stacks above it */
#board-bg-play {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 55;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  padding: 0;
  opacity: .85;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
#board-bg-play:hover { opacity: 1; }
/* sound toggle: visible whenever a background video plays (no native
   controls on it, so this is the only audio affordance); sits above the
   play button when both show */
#board-bg-sound {
  position: fixed;
  right: 18px;
  bottom: 70px;
  z-index: 55;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 16px;
  padding: 0;
  opacity: .85;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
#board-bg-sound:hover { opacity: 1; }
body.has-board-bg #topbar { background: rgba(24, 30, 40, 0.72); }
body.has-board-bg .board-card { background: rgba(28, 34, 45, 0.85); }
body.has-board-bg #view-board .column { background: rgba(24, 30, 40, 0.82); }

/* ---------- card media strip & lightbox ---------- */
.card-media { display: flex; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.card-thumb { position: relative; display: block; width: 46px; height: 46px; border-radius: 6px;
  overflow: hidden; border: 1px solid #2a3342; cursor: zoom-in; background: var(--panel2);
  flex: 0 0 auto; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb:hover { border-color: var(--accent); }
.card-thumb .thumb-play { position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 16px; color: #fff; background: rgba(10,14,20,.35); text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.card-thumb.video { cursor: pointer; }
.card-thumb.more { display: grid; place-items: center; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--panel2); }
#dlg-lightbox { border: 0; background: transparent; padding: 0; max-width: none; max-height: none;
  width: 100%; height: 100%; overflow: hidden; }
#dlg-lightbox::backdrop { background: rgba(5, 8, 12, 0.88); }
#lightbox-body { width: 100%; height: 100%; display: grid; place-items: center; }
#lightbox-body img, #lightbox-body video { max-width: min(92vw, 1600px); max-height: 88vh;
  border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.6); background: #000; }
#lightbox-close { position: fixed; top: 14px; right: 18px; z-index: 1; }

/* ---------- card comments ---------- */
#card-comments { border-top: 1px solid #2a3342; margin-top: 12px; padding-top: 8px; }
#card-comments h3 { margin: 0 0 6px; font-size: 14px; }
#comment-list { list-style: none; padding: 0; margin: 0 0 10px; }
#comment-list li { padding: 6px 0; border-bottom: 1px solid #232b38; }
.comment-meta { font-size: 11px; color: var(--muted); }
.comment-body { font-size: 13px; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 2px; }
#form-comment textarea { width: 100%; resize: vertical; }
#form-comment .comment-actions { margin-top: 6px; }
.badge.comments { background: #23413d; color: #8fe0d2; }
.badge.tasks { background: #24344b; color: #9cc4ff; }
/* card checklist */
#card-tasks { margin: 10px 0 4px; padding-top: 8px; border-top: 1px solid #2a3342; }
.task-list { list-style: none; padding: 0; margin: 6px 0; }
.task-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.task-list input[type=checkbox] { width: 16px; height: 16px; accent-color: #4f8cff; cursor: pointer; flex: none; }
.task-list .task-body { flex: 1; min-width: 0; word-break: break-word; font-size: 13px; }
.task-list li.done .task-body { color: var(--muted); text-decoration: line-through; }
.task-list .task-edit { flex: 1; min-width: 0; }
#form-task #task-input { flex: 1; min-width: 0; }
