/* Maestro Workspaces — practical, readable, light + dark.
   Tokens: --accent-ink is for accent-colored TEXT (AA in both modes);
   --accent is for fills/borders/decoration only. *-soft = tinted backgrounds. */

/* Feature-package styles (one file per package — parallel-build ownership). */
@import url("./wp-members.css");
@import url("./wp-mywork.css");
@import url("./wp-notify.css");
@import url("./wp-board.css");
@import url("./wp-drawer.css");
@import url("./wp-live.css");
@import url("./wp-connect.css");
@import url("./wp-projects.css");
@import url("./wp-project.css");
@import url("./wp-threads.css");
@import url("./wp-knowledge.css");
@import url("./wp-projsettings.css");
@import url("./wp-skills.css");

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
}

/* Dark is also the pre-JS fallback (theme.js sets data-theme before paint). */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101014;
  --panel: #17171c;
  --panel-2: #1e1e24;
  --border: #2e2e36;
  --border-soft: #242429;
  --text: #eceae6;
  --muted: #a3a1ac;
  --accent: #e8c872;
  --accent-ink: #e8c872;
  --accent-soft: rgba(232, 200, 114, .14);
  --danger: #ff6478;
  --danger-soft: rgba(255, 100, 120, .12);
  --ok: #2ed58a;
  --ok-soft: rgba(46, 213, 138, .12);
  --focus: rgba(232, 200, 114, .55);
  --shadow: rgba(0, 0, 0, .5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f6;
  --panel: #ffffff;
  --panel-2: #f2f0ea;
  --border: #d8d5cc;
  --border-soft: #e7e4dc;
  --text: #26242e;
  --muted: #68656f;
  --accent: #e8c872;
  --accent-ink: #8a6b14;
  --accent-soft: rgba(232, 200, 114, .25);
  --danger: #c1273f;
  --danger-soft: rgba(193, 39, 63, .1);
  --ok: #0c7a4d;
  --ok-soft: rgba(12, 122, 77, .12);
  --focus: rgba(138, 107, 20, .5);
  --shadow: rgba(30, 25, 10, .15);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 4px 0 20px; letter-spacing: .01em; }
h1 .thin { color: var(--muted); }
h2 { font-size: 22px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 17px; font-weight: 500; margin: 0 0 8px; }

.mono { font-family: var(--mono); font-size: .93em; letter-spacing: .01em; }
kbd {
  font-family: var(--mono); font-size: 12px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 3px 6px;
}

/* ---------- avatars (dom.js avatarNode; sized inline) ---------- */
.avatar, .chip-avatar, .chip-initials {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; flex: none; object-fit: cover; overflow: hidden;
}
.avatar.initials, .chip-initials {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-weight: 500; letter-spacing: .04em;
}
.avatar.agent {
  border: 1px solid var(--accent); background: var(--accent-soft);
  color: var(--accent-ink); font-weight: 600; letter-spacing: .02em;
}

/* ---------- topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: baseline; gap: 8px; font-family: var(--serif); font-size: 19px; letter-spacing: .01em; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-family: var(--sans); font-size: 14px;
  background: var(--accent); color: #141414; font-weight: 600;
  transform: translateY(3px);
}
.brand-sub { color: var(--muted); }
#topnav { display: flex; gap: 4px; align-items: center; flex: 1; min-width: 0; overflow: hidden; }
.crumb { color: var(--muted); font-size: 14px; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }
.crumb.here { color: var(--text); background: var(--panel-2); }
.crumb-sep { color: var(--border); }
.top-right { display: flex; align-items: center; gap: 16px; }
.top-link { color: var(--muted); font-size: 14px; }
.top-link:hover { color: var(--text); }
.as-btn { background: none; border: none; padding: 0; }
#notify-bell { display: inline-flex; align-items: center; }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.rt-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.user-chip:hover { color: var(--text); }
.chip-name { max-width: 160px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pop-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-width: 220px; }
.pop-user-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pop-user-name { color: var(--text); }
.pop-user-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.pop-user .role-badge { align-self: flex-start; margin-top: 3px; }

/* ---------- main / generic ---------- */
#main { max-width: 1360px; margin: 0 auto; padding: 32px 28px 96px; }
.sub { color: var(--muted); margin: -14px 0 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 14px; color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #141414; font-weight: 500; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: none; }
.btn.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 13px; }
input.text, textarea.text {
  min-height: 36px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; width: 100%;
}
input.text:focus, textarea.text:focus { border-color: var(--accent); }
.err { color: var(--danger); margin-top: 10px; min-height: 20px; }
.muted { color: var(--muted); }
.spin { color: var(--muted); padding: 48px 0; text-align: center; }

/* ---------- maestro shared badges (components/maestro.js; WP0-owned) ---------- */
.m-pill {
  display: inline-flex; align-items: center;
  padding: 1px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.7; white-space: nowrap;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.m-pill.st-active, .m-pill.st-completed, .m-pill.st-resolved, .m-pill.st-approved {
  background: var(--ok-soft); border-color: var(--ok); color: var(--ok);
}
.m-pill.st-building, .m-pill.st-executing, .m-pill.st-running, .m-pill.st-busy,
.m-pill.st-triaging, .m-pill.st-planning, .m-pill.st-reviewing,
.m-pill.st-cloning, .m-pill.st-parsing, .m-pill.st-indexing {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink);
}
.m-pill.st-failed, .m-pill.st-blocked, .m-pill.st-rejected,
.m-pill.st-degraded, .m-pill.st-timed_out {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
}
.m-kind {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--panel-2); border: 1px solid var(--border-soft); color: var(--muted);
}
.m-kind.k-bug, .m-kind.k-security { border-color: var(--danger); color: var(--danger); }
.m-prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.m-prio.p-critical { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.m-prio.p-high { background: var(--danger); }
.m-prio.p-medium { background: var(--accent); }
.m-event-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  font-size: 12px; background: var(--panel-2); border: 1px solid var(--border-soft);
  color: var(--muted);
}
.m-event-icon.ev-build_failed, .m-event-icon.ev-agent_error, .m-event-icon.ev-callback_failed { color: var(--danger); border-color: var(--danger); }
.m-event-icon.ev-build_completed, .m-event-icon.ev-resolution { color: var(--ok); border-color: var(--ok); }
.m-project-link { color: var(--accent-ink); }
.m-project-link:hover { text-decoration: underline; }

/* ---------- toasts ---------- */
#toast-holder { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 11px 16px; max-width: 400px; font-size: 14px;
  box-shadow: 0 6px 24px var(--shadow);
  animation: slidein .18s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.undo { display: flex; align-items: center; gap: 14px; }
.undo-msg { flex: 1; min-width: 0; }
.undo-btn {
  background: none; border: none; padding: 2px 4px; flex: none;
  color: var(--accent-ink); font-weight: 600;
}
.undo-btn:hover { text-decoration: underline; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login-wrap { max-width: 380px; margin: 12vh auto 0; }
.login-wrap h1 { text-align: center; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 12px; }

/* ---------- workspaces ---------- */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ws-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.ws-card h3 { margin: 0 0 2px; font-weight: 500; font-size: 17px; }
.ws-role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.ws-boards { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.board-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--panel-2);
}
.board-link:hover { border-color: var(--accent); }
.board-count { color: var(--muted); font-size: 13px; }
.ws-new { border-style: dashed; display: flex; flex-direction: column; gap: 10px; justify-content: center; }

/* ---------- board head + filters ---------- */
.board-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.board-head h1 { margin: 0; }
.board-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.board-title .board-more { opacity: 0; transition: opacity .15s; font-size: 13px; padding: 2px 8px; }
.board-title:hover .board-more, .board-title .board-more:focus-visible { opacity: 1; }
.board-rename { font-family: var(--serif); font-size: 26px; max-width: 380px; }
.filterbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filterbar input.text { width: 210px; }
.fsel {
  min-height: 36px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--muted); max-width: 180px;
}
.fsel.active { color: var(--text); border-color: var(--accent); }

/* ---------- sections + table ---------- */
.section { margin-bottom: 32px; }
.section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 2px 10px;
}
.section-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.section-title { font-weight: 500; font-size: 17px; }
.section-count { color: var(--muted); font-size: 13px; }

.tbl { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.trow {
  display: grid; align-items: center;
  border-bottom: 1px solid var(--border-soft);
  min-height: 40px;
}
.trow:last-child { border-bottom: none; }
.trow.head { background: var(--panel-2); color: var(--muted); font-size: 13px; min-height: 34px; }
.trow.item:hover { background: var(--panel-2); }
.trow.dragging { opacity: .35; }
.trow.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.tcell { padding: 10px 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcell.title-cell { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.drag-grip { color: var(--border); cursor: grab; user-select: none; }
.trow.item:hover .drag-grip { color: var(--muted); }
.tcell.sel-cell { display: flex; align-items: center; justify-content: center; padding: 10px 0 10px 10px; }
.tcell.sel-cell input { accent-color: var(--accent); cursor: pointer; margin: 0; }

.title-text { overflow: hidden; text-overflow: ellipsis; }
.title-text:hover { text-decoration: underline dotted var(--muted); }
.note-count { color: var(--muted); font-size: 13px; }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 76px; padding: 3px 12px; border-radius: 20px;
  font-size: 13px; color: #101010; font-weight: 500;
  border: none; background: var(--panel-2);
}
.pill.empty { background: transparent; border: 1px dashed var(--border); color: var(--muted); font-weight: 400; }
.chips { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; overflow: hidden; }
.chip {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; font-size: 13px; white-space: nowrap;
}
.chip.add { color: var(--muted); border-style: dashed; background: none; }
.cellbtn { background: none; border: none; padding: 0; width: 100%; text-align: left; }
input.cell-edit { background: var(--panel-2); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 8px; width: 100%; }
input.cell-date { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; color: var(--text); font-size: 13px; }

.add-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); }
.add-row input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 6px 2px;
}
.add-row input::placeholder { color: var(--muted); opacity: .7; }
.add-plus { color: var(--muted); }

/* ---------- batch action bar (multi-select) ---------- */
.batchbar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: calc(100vw - 24px);
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 8px 28px var(--shadow);
}
.batchbar .count { font-size: 14px; color: var(--muted); white-space: nowrap; padding-right: 4px; }
.batchbar .batch-set, .batchbar .batch-set-value { display: flex; align-items: center; gap: 6px; }
.batchbar input.text { min-height: 30px; padding: 3px 9px; font-size: 13px; width: 130px; }

/* ---------- popover menu ---------- */
.pop {
  position: fixed; z-index: 90; min-width: 190px; max-width: 300px; max-height: 340px; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px var(--shadow); padding: 6px;
}
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-radius: 8px; padding: 9px 12px; text-align: left;
}
.pop-item:hover { background: var(--panel); }
.pop-item .section-dot { flex: none; }
.pop-item.checked { color: var(--accent-ink); }
.pop-sep { border-top: 1px solid var(--border-soft); margin: 5px 0; }

/* ---------- drawer ---------- */
.drawer-veil { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); z-index: 70;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px var(--shadow);
  display: flex; flex-direction: column;
  animation: drawerin .16s ease-out;
}
@keyframes drawerin { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 20px 12px; }
.drawer-title { font-family: var(--serif); font-size: 22px; flex: 1; margin: 0; cursor: pointer; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; }
.drawer-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.dfield { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; }
.dfield-label { color: var(--muted); font-size: 13px; }
.desc-box {
  background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 20px;
}
.desc-box .md { font-size: 14px; }
.desc-empty { color: var(--muted); font-style: italic; }
.desc-edit textarea { min-height: 220px; font-family: var(--mono); font-size: 13px; line-height: 1.55; }

.md h1, .md h2, .md h3 { font-family: var(--serif); font-weight: 400; margin: 12px 0 6px; }
.md h1 { font-size: 21px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; }
.md p { margin: 8px 0; }
.md code { font-family: var(--mono); font-size: .92em; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; }
.md pre { font-family: var(--mono); background: var(--bg); border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }
.md pre code { border: none; padding: 0; background: none; }
.md ul { margin: 6px 0; padding-left: 22px; }
.md a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* ---------- activity trail + comments ---------- */
.activity h4 { margin: 0 0 10px; color: var(--muted); font-weight: 500; font-size: 13px; }
.note { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.note-kind { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--border); }
.note-kind.comment { background: var(--accent); }
.note-kind.system { background: var(--muted); }
.note-body { flex: 1; min-width: 0; }
.note-meta { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.comment-box { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); align-items: center; }
.comment-box input.text { flex: 1; }

/* ---------- upload progress toast ---------- */
.progress-toast { min-width: 280px; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.progress-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-cancel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.progress-cancel:hover { color: var(--text); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { width: 0; height: 100%; background: var(--accent); transition: width .12s ease-out; }
.progress-pct { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 30px; text-align: right; }
.progress-toast.done .progress-fill { background: var(--ok); }

/* ---------- note attachments + lightbox ---------- */
.note-media { display: inline-block; margin-top: 6px; padding: 0; border: none; background: none; cursor: pointer; }
.note-media img { max-width: 280px; max-height: 190px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.note-media:hover img { border-color: var(--muted); }
.note-media-file { display: inline-block; margin-top: 6px; color: var(--text); font-size: 13px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; }
.note-media-file:hover { border-color: var(--muted); }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: fadein .12s ease-out; }
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 12px 48px rgba(0, 0, 0, .6); cursor: default; }
.lightbox-close { position: fixed; top: 16px; right: 20px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0, 0, 0, .55); border: 1px solid var(--border); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.lightbox-close:hover { background: rgba(0, 0, 0, .85); }
@keyframes fadein { from { opacity: 0; } }

/* ---------- my work ---------- */
.mw-board { margin-bottom: 26px; }
.mw-board h3 { margin: 0 0 10px; font-weight: 500; }
.mw-row {
  display: flex; gap: 12px; align-items: center;
  min-height: 44px; padding: 9px 14px;
  border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--panel); margin-bottom: 8px;
}
.mw-row:hover { border-color: var(--accent); }
.mw-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 24px; }
.lane {
  flex: 0 0 280px; background: var(--panel);
  border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 10px; padding: 12px;
}
.lane-over { border-color: var(--accent); }
.lane .section-head { padding: 2px 4px 10px; }
.lane .section-title { font-size: 15px; }
.lane-cards { display: flex; flex-direction: column; gap: 10px; min-height: 6px; }
.card {
  background: var(--panel-2); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .4; }
.card.drop-above { box-shadow: 0 -2px 0 var(--accent); }
.card-title { margin-bottom: 8px; overflow-wrap: break-word; }
.card-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.card .pill { min-width: 0; padding: 2px 9px; font-size: 12px; }
.lane .add-row { background: none; padding: 8px 2px 0; }

@media (max-width: 760px) {
  .tcell.optional { display: none; }
  .dfield { grid-template-columns: 100px 1fr; }
}

/* ---------- shell + sidebar ---------- */
#shell { display: flex; align-items: stretch; min-height: 100vh; }
#content { flex: 1; min-width: 0; }
#sidebar {
  width: 260px; flex-shrink: 0;
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh; overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--border-soft);
  padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 4px;
}
.sb-brand {
  font-family: var(--serif); font-size: 21px; color: var(--text);
  padding: 4px 10px 14px; letter-spacing: .01em;
}
.sb-loading, .sb-err { color: var(--muted); padding: 8px 10px; }
.sb-err { color: var(--danger); }
.sb-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sb-ws { padding: 2px 0; }
.sb-ws-head { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 10px; border-radius: 7px; }
.sb-ws-head:hover { background: var(--panel-2); }
.sb-ws-name { flex: 1; min-width: 0; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-ws-tools { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.sb-ws-head:hover .sb-ws-tools, .sb-ws.open .sb-ws-tools, .sb-ws-tools:focus-within { opacity: 1; }
.sb-tool {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  color: var(--muted); font-size: 11px; padding: 2px 7px; line-height: 1.5;
}
.sb-tool:hover { color: var(--text); border-color: var(--muted); }
.sb-boards { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 6px 12px; }
.sb-board-row {
  display: flex; align-items: center; min-height: 34px; border-radius: 7px;
  border-left: 2px solid transparent;
}
.sb-board-row:hover { background: var(--panel-2); }
.sb-board-row.active { background: var(--panel-2); border-left-color: var(--accent); }
.sb-board {
  flex: 1; min-width: 0; color: var(--muted); font-size: 14px; padding: 5px 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-board-row:hover .sb-board, .sb-board-row.active .sb-board { color: var(--text); }
.sb-board-more { opacity: 0; margin-right: 4px; }
.sb-board-row:hover .sb-board-more, .sb-board-more:focus-visible { opacity: 1; }
.sb-rename {
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 7px;
  color: var(--text); padding: 4px 10px; font-size: 14px; width: 100%; margin: 1px 0;
}
.sb-empty { color: var(--muted); font-size: 13px; padding: 4px 10px; }
.sb-newboard, .sb-newws { display: flex; gap: 4px; padding: 4px 0; align-items: center; }
.sb-newboard { flex-wrap: wrap; }
.sb-input {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--text); padding: 5px 10px; font-size: 14px; min-width: 0; flex: 1;
}
.sb-input:focus { border-color: var(--muted); }
.sb-go {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); padding: 5px 10px; font-size: 14px;
}
.sb-go:hover { color: var(--text); border-color: var(--muted); }
.sb-footer { border-top: 1px solid var(--border-soft); padding-top: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.sb-link { color: var(--muted); font-size: 14px; padding: 7px 10px; border-radius: 7px; }
.sb-link:hover { color: var(--text); background: var(--panel-2); }
.sb-toggle { display: none; font-size: 18px; color: var(--muted); margin-right: 2px; }
#sb-scrim { display: none; }

@media (max-width: 860px) {
  #sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: 2px 0 18px var(--shadow);
  }
  #shell.sb-open #sidebar { transform: translateX(0); }
  #sb-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .sb-toggle { display: inline-flex; }
}

/* ---------- members view ---------- */
.members-view { max-width: 720px; }
.member-list { display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin-bottom: 28px; }
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: 8px;
}
.member-name { color: var(--text); }
.role-badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 9px; border-radius: 20px; color: var(--muted); border: 1px solid var(--border);
}
.role-badge.role-admin { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.invite-form { max-width: 640px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 20px; }
.invite-label { display: block; color: var(--text); margin-bottom: 10px; font-weight: 500; }
.invite-row { display: flex; gap: 8px; }
.invite-row .text { flex: 1; }
.invite-hint { font-size: 13px; margin-top: 10px; }
.invite-note { max-width: 640px; padding: 16px; border: 1px dashed var(--border); border-radius: 10px; }
