/* Tree3 Mission Control — dark, visual, monday-inspired */
:root {
  --bg: #111421;
  --bg2: #191d2e;
  --bg3: #21263b;
  --bg4: #2a3049;
  --border: #2e3450;
  --text: #e8eaf6;
  --text-dim: #9aa1c0;
  --text-faint: #646b8c;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --green: #00b894;
  --orange: #fdcb6e;
  --red: #d63031;
  --blue: #0984e3;
  --pink: #fd79a8;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,.45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
::placeholder { color: var(--text-faint); }
a { color: var(--accent2); }

/* ---------- auth screens ---------- */
.auth-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #2a2352 0%, var(--bg) 55%);
}
.auth-card {
  width: 400px; max-width: 92vw; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 34px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-dim); margin-bottom: 22px; font-size: 13px; }
.auth-card label { display: block; font-size: 12px; color: var(--text-dim); margin: 12px 0 5px; }
.auth-error { color: #ff7675; font-size: 13px; margin-top: 12px; min-height: 18px; }
.auth-switch { margin-top: 18px; font-size: 13px; color: var(--text-dim); text-align: center; }
.logo-badge {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--pink)); font-size: 24px; margin-bottom: 18px;
}

/* ---------- app shell ---------- */
#app { display: flex; height: 100vh; }
.sidebar {
  width: 244px; min-width: 244px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 12px 12px; overflow: hidden;
  transition: width .22s ease, min-width .22s ease;
}
#app.sidebar-collapsed .sidebar { width: 74px; min-width: 74px; padding: 12px 9px; }

.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.side-brand .logo-badge { width: 36px; height: 36px; font-size: 19px; margin: 0; border-radius: 10px; flex-shrink: 0; }
.brand-text b { font-size: 15px; display: block; line-height: 1.15; }
.brand-text span { display: block; font-size: 11px; color: var(--text-faint); }
.side-collapse {
  margin-left: auto; background: var(--bg3); border: 1px solid var(--border); color: var(--text-dim);
  width: 26px; height: 26px; border-radius: 8px; font-size: 17px; line-height: 1; flex-shrink: 0;
  transition: background .15s, color .15s, transform .12s;
}
.side-collapse:hover { background: var(--bg4); color: var(--text); }
.side-collapse:active { transform: scale(.9); }
.side-primary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px;
  color: var(--text-dim); cursor: pointer; margin-bottom: 3px; border: 1px solid transparent; background: none;
  width: 100%; text-align: left; font-size: 14px; min-width: 0;
  transition: background .15s, color .15s, transform .12s, border-color .15s, box-shadow .15s;
}
.nav-item:hover { background: var(--bg3); color: var(--text); transform: translateX(2px); }
.nav-item:active { transform: scale(.98); }
.nav-item.active { background: rgba(108,92,231,.18); color: var(--text); border-color: rgba(108,92,231,.42); }
.nav-item.primary { padding: 11px 13px; font-size: 14.5px; font-weight: 500; background: var(--bg3); border-color: var(--border); }
.nav-item.primary:hover { background: var(--bg4); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(0,0,0,.32); }
.nav-item.primary.active { background: linear-gradient(135deg, rgba(108,92,231,.4), var(--bg3)); border-color: var(--accent); color: #fff; }
.ni-icon { width: 22px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.nav-item.primary .ni-icon { font-size: 18px; }
.ni-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ni-badge { margin-left: auto; font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.ni-avatar { margin-left: auto; flex-shrink: 0; }
.b-icon { border-radius: 5px; object-fit: cover; vertical-align: middle; }

.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 16px 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.sec-add { background: var(--bg3); border: 1px solid var(--border); color: var(--text-dim); width: 22px; height: 22px; border-radius: 7px; font-size: 14px; line-height: 1; transition: background .15s, color .15s, transform .12s; }
.sec-add:hover { background: var(--accent); color: #fff; }
.sec-add:active { transform: scale(.9); }
.board-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.nav-item.child { padding-left: 22px; font-size: 13.2px; }
.caret { width: 16px; text-align: center; color: var(--text-faint); flex-shrink: 0; border-radius: 5px; cursor: pointer; }
.caret:hover { color: var(--text); background: var(--bg4); }
.caret-spacer { width: 16px; flex-shrink: 0; }

/* collapsed rail */
#app.sidebar-collapsed .brand-text,
#app.sidebar-collapsed .logo-badge,
#app.sidebar-collapsed .ni-label,
#app.sidebar-collapsed .ni-badge,
#app.sidebar-collapsed .ni-avatar,
#app.sidebar-collapsed .nav-section > span,
#app.sidebar-collapsed .sec-add,
#app.sidebar-collapsed .caret,
#app.sidebar-collapsed .caret-spacer { display: none; }
#app.sidebar-collapsed .side-brand { justify-content: center; padding-bottom: 12px; }
#app.sidebar-collapsed .side-collapse { margin: 0; }
#app.sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
#app.sidebar-collapsed .nav-section { justify-content: center; padding: 12px 0 4px; }
#app.sidebar-collapsed .plat-head { justify-content: center; padding: 8px 0 2px; }
#app.sidebar-collapsed .nav-item:hover { transform: none; }
.sub-boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sub-board-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; font-size: 13.5px;
}
.sub-board-card:hover { border-color: var(--accent); }

/* info panel: sections of fields */
.info-section { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--bg3); }
.info-section.dragging { opacity: .45; }
.sec-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.sec-drag, .f-drag { cursor: grab; color: var(--text-faint); user-select: none; }
.sec-drag:active, .f-drag:active { cursor: grabbing; }
.sec-caret { cursor: pointer; color: var(--text-faint); width: 14px; text-align: center; }
.sec-caret:hover { color: var(--text); }
.sec-title { background: transparent; border: none; font-weight: 600; font-size: 13.5px; flex: 1; padding: 4px 2px; }
.sec-title:focus { border-bottom: 1px solid var(--accent); }
.sec-body { padding: 4px 10px 10px; }
.info-section .kv-row { border-bottom: none; padding: 4px 0; gap: 7px; }
.info-section .kv-row.dragging { opacity: .4; }
.info-section .f-kind { font-size: 12px; }
.nf-row { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.notes-block .sec-head { cursor: pointer; }
.notes-block textarea { margin-top: 2px; }
.side-footer { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.side-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; }
.plat-head {
  display: flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); padding: 9px 8px 3px; cursor: pointer; user-select: none;
}
.plat-head:hover { color: var(--text); }
.plat-head .caret { width: 14px; }
.ph-icon { flex-shrink: 0; }
.ph-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ph-count { color: var(--text-faint); flex-shrink: 0; }
#app.sidebar-collapsed .ph-label, #app.sidebar-collapsed .ph-count { display: none; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 56px; min-height: 56px; border-bottom: 1px solid var(--border); background: var(--bg2);
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
}
.topbar h2 { font-size: 17px; font-weight: 600; flex-shrink: 0; }
.topbar .spacer { flex: 1; }
.search-hint {
  display: flex; align-items: center; gap: 8px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 12px; color: var(--text-faint); font-size: 13px; cursor: pointer; min-width: 220px;
}
kbd { background: var(--bg4); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-family: inherit; }
.icon-btn { background: var(--bg3); border: 1px solid var(--border); color: var(--text-dim); border-radius: 8px; padding: 8px 11px; font-size: 15px; position: relative; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.badge-dot { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 5px; min-width: 16px; text-align:center; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

.btn {
  background: var(--accent); border: 1px solid transparent; color: #fff; border-radius: 8px; padding: 8px 15px;
  font-size: 13.5px; font-weight: 600; line-height: 1.35; height: 34px; display: inline-flex; align-items: center;
  gap: 6px; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: #7d6ef0; box-shadow: 0 3px 12px rgba(108,92,231,.3); }
.btn:active { transform: scale(.96); }
.btn.secondary { background: var(--bg3); border-color: var(--border); color: var(--text); font-weight: 500; }
.btn.secondary:hover { background: var(--bg4); border-color: var(--accent); box-shadow: none; }
.btn.danger { background: transparent; border-color: var(--red); color: #ff7675; }
.btn.danger:hover { background: rgba(214,48,49,.12); box-shadow: none; }
.btn.small { padding: 4px 11px; font-size: 12.5px; height: 30px; border-radius: 7px; }
.btn.bmo { background: linear-gradient(135deg, var(--accent), var(--pink)); }
.btn.bmo:hover { filter: brightness(1.08); box-shadow: 0 3px 14px rgba(253,121,168,.35); }
.icon-btn { transition: background .15s, border-color .15s, color .15s, transform .1s; }
.icon-btn:active { transform: scale(.92); }

/* ---------- status / priority pills ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: #fff;
  cursor: pointer; border: none; min-width: 104px; user-select: none;
}
.pill.readonly { cursor: default; }
.prio { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 5px; background: var(--bg4); }
.prio.Critical { color: #ff7675; } .prio.High { color: var(--orange); }
.prio.Medium { color: var(--accent2); } .prio.Low { color: var(--text-dim); }

/* ---------- board table view (monday style) ---------- */
.group-block { margin-bottom: 26px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.group-head h3 { font-size: 15px; }
.group-head .count { color: var(--text-faint); font-size: 12px; }
.group-bar { width: 4px; height: 20px; border-radius: 3px; }
.task-table { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: var(--radius); overflow: hidden; }
.task-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.task-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.task-table tr.task-row:hover { background: var(--bg3); }
.task-row { cursor: pointer; }
.task-row.dragging { opacity: .4; }
/* .t-title is now an inner div (NOT the td) so the row stays a real table cell and
   the divider borders align across columns; long titles truncate instead of wrapping */
.t-title { font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; }
.tt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tt-extra { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tt-thumb { width: 26px; height: 26px; border-radius: 5px; overflow: hidden; flex-shrink: 0; display: inline-flex; border: 1px solid var(--border); }
.tt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.t-meta { color: var(--text-faint); font-size: 11px; display: inline-flex; gap: 8px; }
.progress-wrap { background: var(--bg4); height: 8px; border-radius: 5px; width: 90px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 5px; background: var(--green); transition: width .2s; }
.due { font-size: 12.5px; color: var(--text-dim); }
.due.overdue { color: #ff7675; font-weight: 600; }
.verified { font-size: 11px; color: var(--green); }
.add-task-row td { padding: 4px 12px; }
.add-task-input { background: transparent; border: none; padding: 8px 2px; font-size: 13.5px; }
.group-progress { height: 5px; border-radius: 3px; background: var(--bg4); overflow: hidden; flex: 0 0 120px; margin-left: auto; }
.group-progress div { height: 100%; background: var(--green); }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.kb-col { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); min-width: 265px; width: 265px; }
.kb-col-head { padding: 10px 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.kb-col-head .count { color: var(--text-faint); font-size: 12px; }
.kb-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kb-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; font-size: 13.5px;
}
.kb-card:hover { border-color: var(--accent); }
.kb-card .kb-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.kb-col.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }

.view-tabs { display: inline-flex; flex: 0 0 auto; gap: 4px; background: var(--bg3); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.view-tabs button { background: none; border: none; color: var(--text-dim); padding: 6px 14px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.view-tabs button:hover { color: var(--text); }
.view-tabs button.active { background: var(--accent); color: #fff; }

/* board header: progress bar row, then [view toggle | actions] toolbar, then description */
.board-head { margin-bottom: 18px; }
.board-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; max-width: 460px; }
.bp-label, .bp-pct { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.bp-pct { width: 40px; text-align: right; }
.bp-track { flex: 1; height: 7px; background: var(--bg4); border-radius: 5px; overflow: hidden; }
.bp-fill { height: 100%; background: var(--green); border-radius: 5px; transition: width .2s; }
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; row-gap: 10px; }
.board-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-desc { color: var(--text-faint); font-size: 12.5px; margin-top: 14px; }
.board-head .sub-boards { margin-top: 16px; margin-bottom: 0; }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card h3 { font-size: 14px; margin-bottom: 14px; color: var(--text-dim); font-weight: 600; }
.stat-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 130px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar .name { width: 110px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { flex: 1; background: var(--bg4); border-radius: 5px; height: 14px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 5px; }
.hbar .val { width: 60px; text-align: right; font-size: 12px; color: var(--text-dim); }
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { color: var(--accent2); }
.activity-line { font-size: 12.5px; color: var(--text-dim); padding: 6px 0; border-bottom: 1px solid var(--border); }
.activity-line b { color: var(--text); }
.activity-line time { color: var(--text-faint); font-size: 11px; margin-left: 6px; }

.suggestion {
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--bg3);
}
.suggestion .s-title { font-weight: 600; margin-bottom: 4px; }
.suggestion .s-reason { color: var(--text-dim); font-size: 12.5px; margin-bottom: 10px; }
.suggestion .s-actions { display: flex; gap: 8px; align-items: center; }
.suggestion .src { font-size: 10px; text-transform: uppercase; letter-spacing:.05em; color: var(--text-faint); margin-left: auto; }

/* ---------- drawer (task detail) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6,8,16,.55); z-index: 200; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 96vw; background: var(--bg2);
  border-left: 1px solid var(--border); z-index: 201; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-title { font-size: 18px; font-weight: 700; background: transparent; border: none; padding: 4px 0; width: 100%; }
.drawer-title:focus { border-bottom: 1px solid var(--accent); }
.field-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; align-items: center; margin: 14px 0; }
.field-grid label { color: var(--text-dim); font-size: 12.5px; }
.board-icon-preview { width: 40px; height: 40px; border-radius: 9px; background: var(--bg4); display: flex; align-items: center; justify-content: center; font-size: 22px; overflow: hidden; flex-shrink: 0; }
.board-icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.status-select { font-weight: 600; }
.drawer h4 { font-size: 13px; color: var(--text-dim); margin: 18px 0 8px; }
.subtask { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.subtask input[type=checkbox] { width: auto; }
.subtask .st-title { flex: 1; font-size: 13.5px; }
.subtask .st-title.done { text-decoration: line-through; color: var(--text-faint); }
.subtask .del { background: none; border: none; color: var(--text-faint); font-size: 13px; }
.subtask .del:hover { color: var(--red); }
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment .c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12.5px; }
.comment .c-body { font-size: 13.5px; white-space: pre-wrap; }
.comment.bmo { background: rgba(108,92,231,.08); border-radius: 8px; padding: 10px 12px; border-bottom: none; margin-bottom: 6px; }
.checkin-box {
  border: 1px solid var(--accent); background: rgba(108,92,231,.1); border-radius: 8px; padding: 12px; margin-bottom: 12px;
}
.checkin-box .q { font-weight: 600; margin-bottom: 8px; }

/* ---------- modal + command palette ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,8,16,.6); z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; width: 520px; max-width: 94vw; box-shadow: var(--shadow); max-height: 72vh; display:flex; flex-direction: column; }
.modal .modal-body { padding: 20px; overflow-y: auto; }
.modal h3 { margin-bottom: 14px; }
.palette-input { border: none; background: transparent; font-size: 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); border-radius: 0; }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.palette-item:hover, .palette-item.sel { background: var(--bg4); }
.palette-item .hint { margin-left: auto; color: var(--text-faint); font-size: 11.5px; }

/* ---------- notifications panel ---------- */
.notif-panel {
  position: fixed; top: 60px; right: 18px; width: 380px; max-height: 65vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; z-index: 55; box-shadow: var(--shadow);
}
.notif { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.notif:hover { background: var(--bg3); }
.notif.unread { border-left: 3px solid var(--accent); background: rgba(108,92,231,.06); }
.notif .n-body { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.notif time { color: var(--text-faint); font-size: 11px; }

/* ---------- BMO chat ---------- */
.bmo-panel {
  position: fixed; bottom: 20px; right: 20px; width: 400px; height: 520px; max-height: 80vh;
  background: var(--bg2); border: 1px solid var(--accent); border-radius: 14px; z-index: 56;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.bmo-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.bmo-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bmo-msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; }
.bmo-msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.bmo-msg.bot { align-self: flex-start; background: var(--bg3); border: 1px solid var(--border); }
.bmo-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.bmo-fab {
  position: fixed; bottom: 20px; right: 20px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--pink)); border: none; font-size: 24px; z-index: 56;
  box-shadow: var(--shadow);
}

/* ---------- settings ---------- */
.settings-section { max-width: 720px; margin-bottom: 28px; }
.settings-section .card { margin-bottom: 14px; }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .grow { flex: 1; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; background: var(--bg4); padding: 3px 8px; border-radius: 5px; }
.help { color: var(--text-faint); font-size: 12px; margin-top: 6px; line-height: 1.5; }

/* ---------- AI Hub ---------- */
.hub-wrap { display: flex; gap: 16px; height: calc(100vh - 96px); }
.hub-side { width: 300px; min-width: 300px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.hub-agents { display: flex; flex-direction: column; gap: 6px; }
.hub-agent-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--border); color: var(--text); text-align: left; font-size: 13.5px;
}
.hub-agent-btn:hover { border-color: var(--accent); }
.hub-agent-btn .a-emoji { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.hub-agent-btn .a-sub { font-size: 11.5px; color: var(--text-faint); }
.hub-agent-btn.notready { opacity: .55; }
.hub-chats { flex: 1; }
.hub-chat-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  display: flex; flex-direction: column; gap: 2px;
}
.hub-chat-item:hover { background: var(--bg3); }
.hub-chat-item.active { background: var(--bg4); border-color: var(--border); }
.hub-chat-item .hc-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-chat-item .hc-meta { font-size: 11.5px; color: var(--text-faint); }
.hub-group-head {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim);
  padding: 12px 6px 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.hub-topic-head { font-size: 11.5px; color: var(--accent2); padding: 6px 6px 2px 8px; }
.hub-topic-block { margin-left: 12px; border-left: 2px solid var(--border); padding-left: 4px; }

.hub-chat {
  flex: 1; display: flex; flex-direction: column; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.hub-chat-head { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.hub-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.hub-msg { max-width: 78%; }
.hub-msg .m-head { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.hub-msg .m-body {
  padding: 10px 14px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap;
  background: var(--bg3); border: 1px solid var(--border); line-height: 1.5;
}
.hub-msg.user { align-self: flex-end; }
.hub-msg.user .m-head { justify-content: flex-end; }
.hub-msg.user .m-body { background: var(--accent); border-color: var(--accent); color: #fff; }
.hub-msg.error .m-body { border-color: var(--red); color: #ff9a9a; }
.hub-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.hub-input textarea { resize: none; height: 46px; }
.hub-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-faint); }
.hub-empty .big { font-size: 44px; }
.typing { color: var(--text-faint); font-size: 12.5px; padding: 0 18px 10px; }

/* ---------- files (board Files tab + task attachments) ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center;
  color: var(--text-dim); cursor: pointer; margin-bottom: 12px; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag-over { border-color: var(--accent); background: rgba(108,92,231,.08); }
.dropzone b { display: block; margin-bottom: 4px; color: var(--text); }
.file-folder { margin-bottom: 18px; }
.ff-head { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; }
.file-grid, .attach-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  border-radius: 10px; padding: 4px; min-height: 40px;
}
.attach-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.file-grid.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.file-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  position: relative; cursor: default;
}
.file-card.dragging { opacity: .4; }
.file-card .file-thumb {
  height: 110px; background: var(--bg4); display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; position: relative;
}
.file-card.sm .file-thumb { height: 84px; }
.file-thumb img, .file-thumb video { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .file-emoji { font-size: 40px; }
.play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none;
}
.file-name { padding: 7px 9px 2px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.file-meta { padding: 0 9px 6px; font-size: 11px; color: var(--text-faint); }
.file-note { padding: 0 9px 8px; font-size: 11.5px; color: var(--accent2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions {
  position: absolute; top: 5px; right: 5px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s;
  background: rgba(17,20,33,.7); border-radius: 7px; padding: 2px;
}
.file-card:hover .file-actions { opacity: 1; }
.file-actions .icon-btn { padding: 4px 7px; font-size: 13px; }

.lightbox {
  position: fixed; inset: 4vh 4vw; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; z-index: 70; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.lb-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.lb-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lb-body img, .lb-body video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-foot { padding: 10px 16px; border-top: 1px solid var(--border); }
.lb-foot input { width: 100%; }

/* ---------- canvas / moodboard ---------- */
.cv-stage { position: relative; }
/* vertical Milanote-style tool rail floating over the canvas */
.cv-tools {
  position: absolute; top: 14px; left: 14px; z-index: 25;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.cv-tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 58px; padding: 8px 4px; background: none; border: 1px solid transparent; border-radius: 12px;
  color: var(--text-dim); cursor: pointer; transition: transform .12s ease, background .12s ease, color .12s ease;
}
.cv-tool span { font-size: 20px; line-height: 1; }
.cv-tool label { font-size: 10.5px; cursor: pointer; }
.cv-tool:hover { background: var(--bg3); color: var(--text); transform: translateY(-1px); }
.cv-tool:active { transform: scale(.95); }
.cv-tool.active { background: rgba(108,92,231,.28); border-color: var(--accent); color: #fff; }
.cv-scroll {
  overflow: auto; height: calc(100vh - 210px); border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
  position: relative; z-index: 0; /* contain the draw layer's high z-index so the tool rail + draw bar stay clickable */
}
.cv-area {
  position: relative; width: 2600px; height: 1700px;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 26px 26px;
}
/* freehand drawing layer sits above the grid but below cards until draw mode is on */
.cv-draw-layer { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.cv-draw-layer polyline { pointer-events: none; }
.cv-area.drawing .cv-draw-layer { z-index: 9998; pointer-events: auto; cursor: crosshair; touch-action: none; }
.cv-area.erasing .cv-draw-layer { cursor: cell; }
.cv-area.erasing .cv-draw-layer polyline { pointer-events: stroke; cursor: pointer; }
.cv-card {
  position: absolute; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); z-index: 2;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; min-width: 120px; min-height: 80px; cursor: grab;
}
.cv-card:active { cursor: grabbing; }
.cv-card.cv-moving { box-shadow: 0 10px 28px rgba(0,0,0,.55); cursor: grabbing; }
.cv-head { display: flex; align-items: center; gap: 4px; padding: 3px 5px; height: 24px; flex-shrink: 0; }
.cv-drag { color: var(--text-faint); font-size: 12px; }
.cv-spacer { flex: 1; }
.cv-head .cv-note-color { width: 22px; height: 18px; padding: 0; border: none; background: none; }
.cv-del { padding: 2px 6px; font-size: 12px; opacity: 0; cursor: pointer; }
.cv-card:hover .cv-del { opacity: 1; }
.cv-body { flex: 1; overflow: hidden; display: flex; }
.cv-note-color { cursor: pointer; }
textarea.cv-note { flex: 1; border: none; background: transparent; color: var(--text); resize: none; padding: 4px 10px 10px; font-size: 13.5px; line-height: 1.4; cursor: text; }
.cv-img { width: 100%; height: 100%; }
.cv-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.cv-link { display: flex; gap: 8px; padding: 8px 10px; align-items: center; width: 100%; }
.cv-fav { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.cv-link-title { border: none; background: transparent; color: var(--text); font-weight: 600; font-size: 13px; width: 100%; padding: 0; }
.cv-link-url { font-size: 11.5px; color: var(--accent2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
/* colour card: the whole card is the colour; a header swatch recolours it, body stays drag-grabbable */
.cv-card.cv-color .cv-head { position: absolute; top: 0; right: 0; left: 0; z-index: 2; }
.cv-card.cv-color .cv-color-input { width: 22px; height: 18px; padding: 0; border: none; background: none; cursor: pointer; }
.cv-swatch { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 10px; box-sizing: border-box; }
.cv-swatch span { background: rgba(0,0,0,.45); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 5px; font-family: ui-monospace, monospace; }
.cv-resize {
  position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 3;
  background: linear-gradient(135deg, transparent 50%, var(--text-faint) 50%, var(--text-faint) 60%, transparent 60%);
}
/* floating pen/eraser controls shown while in draw mode */
.cv-draw-bar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--accent); border-radius: 14px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.cv-draw-bar input[type=color] { width: 38px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
.cv-draw-bar input[type=range] { width: 110px; }
/* right-click add-card menu */
.cv-menu {
  position: fixed; z-index: 90; min-width: 156px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 2px;
}
.cv-menu button { text-align: left; background: none; border: none; color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.cv-menu button:hover { background: var(--bg4); }

.toast {

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg4); border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 11px 20px; z-index: 400; font-size: 13.5px; box-shadow: var(--shadow);
}
.empty { color: var(--text-faint); font-size: 13px; padding: 16px 0; text-align: center; }
.tag { font-size: 11px; background: var(--bg4); color: var(--accent2); border-radius: 5px; padding: 2px 7px; }
.row { display: flex; gap: 10px; align-items: center; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
