:root {
  --brand: #534AB7;
  --brand-hover: #635ac7;
  --brand-faint: rgba(83, 74, 183, 0.12);
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-alt: #fafafb;
  --sidebar-bg: #1a1b23;
  --sidebar-text: #d1d1d6;
  --sidebar-muted: #8a8b94;
  --sidebar-hover: #24252f;
  --border: #e6e6ea;
  --text: #1a1b23;
  --text-muted: #696a73;
  --danger: #d64545;
  --danger-faint: rgba(214, 69, 69, 0.1);
  --success: #639922;
  --warn: #ef9f27;
  --warning: #efbb3a;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.18);
}

html[data-theme="dark"] {
  --bg: #1a1b23;
  --surface: #22232d;
  --surface-alt: #2a2b37;
  --border: #383944;
  --text: #e4e4e8;
  --text-muted: #8a8b94;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --sidebar-bg: #16171f;
  --sidebar-hover: #2a2b37;
  --sidebar-text: #c8c8cc;
  --sidebar-muted: #6a6b73;
  --brand: #534AB7;
  --brand-hover: #635ac7;
  --brand-faint: rgba(83,74,183,0.18);
  --danger: #e85d5d;
  --danger-faint: rgba(232,93,93,0.12);
  --success: #4caf50;
  --warn: #efbb3a;
  --warning: #efbb3a;
}

html[data-theme="dark"] img.thumb, html[data-theme="dark"] .drop-zone { filter: none; }
html[data-theme="dark"] .code-block { background: #0e0f16; }

body.compact .kanban-col .cards { padding: 4px 6px; gap: 4px; }
body.compact .task-card { padding: 8px; }
body.compact .task-list th, body.compact .task-list td { padding: 6px 8px; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-faint);
}

#app { min-height: 100vh; }

/* ----- Login ----- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1b23, #2b2550 70%, #534AB7);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}
.login-card .login-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(83, 74, 183, 0.25);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--brand);
  text-align: center;
}
.login-card p.subtitle { text-align: center; }
.login-card p.subtitle { margin: 0 0 24px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.login-form input { font-size: 15px; padding: 11px 12px; }
.login-form button[type=submit] {
  margin-top: 6px; background: var(--brand); color: #fff; border: none;
  padding: 12px; border-radius: 8px; font-weight: 600; font-size: 15px;
}
.login-form button[type=submit]:hover { background: var(--brand-hover); }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-toggle {
  text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 13px;
}
.login-toggle button { background: none; border: none; color: var(--brand); font-weight: 600; }

/* ----- App shell ----- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; transition: grid-template-columns 0.15s ease; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .sidebar { display: none; }
.floating-sidebar-btn {
  position: fixed; top: 12px; left: 12px; z-index: 150;
  background: var(--surface); border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 8px;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md); cursor: pointer;
}
.floating-sidebar-btn:hover { background: var(--surface-alt); }

/* ----- Sidebar ----- */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid #2a2b36;
  margin-bottom: 14px;
}
.sidebar-brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}
.sidebar-brand .name {
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -0.01em;
}
.sidebar-section { margin-top: 18px; }
.sidebar-section h4 {
  margin: 0 8px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-section h4 button {
  background: none; border: none; color: var(--sidebar-muted);
  font-size: 16px; padding: 0 4px; border-radius: 4px;
}
.sidebar-section h4 button:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}
.sidebar-nav .item:hover { background: var(--sidebar-hover); }
.sidebar-nav .item.active { background: var(--brand); color: #fff; }
.sidebar-nav .item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #2a2b36;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.sidebar-footer .info { flex: 1; min-width: 0; }
.sidebar-footer .info .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-footer .info .email { color: var(--sidebar-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .logout {
  background: none; border: none; color: var(--sidebar-muted); font-size: 18px; padding: 4px 6px; border-radius: 4px;
}
.sidebar-footer .logout:hover { color: #fff; background: var(--sidebar-hover); }

/* ----- Main area ----- */
.main { display: flex; flex-direction: column; min-width: 0; }
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 58px;
}
.header .crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.header .crumbs .sep { color: var(--border); }
.header .crumbs .current { color: var(--text); font-weight: 600; }
.header .crumbs button.toggle { background: none; border: none; font-size: 18px; color: var(--text-muted); padding: 0 4px; }
.header .right { display: flex; gap: 8px; align-items: center; }
.header .btn {
  background: var(--brand); color: #fff; border: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 13px;
}
.header .btn:hover { background: var(--brand-hover); }
.header .btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.header .btn.ghost:hover { background: var(--surface-alt); }

.content { flex: 1; overflow: auto; }

/* ----- Empty state ----- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; text-align: center;
  color: var(--text-muted);
}
.empty-state h2 { margin: 0 0 8px; color: var(--text); font-size: 20px; }
.empty-state p { margin: 0 0 20px; max-width: 380px; }

/* ----- Kanban ----- */
.kanban {
  display: flex;
  gap: 16px;
  padding: 20px;
  min-height: 100%;
  align-items: flex-start;
  overflow-x: auto;
}
.kanban-col {
  flex: 0 0 300px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}
.kanban-col.drag-over { background: var(--brand-faint); border-color: var(--brand); }
.kanban-col header {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.kanban-col header .title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px;
}
.kanban-col header .title .chip {
  width: 10px; height: 10px; border-radius: 50%;
}
.kanban-col header .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.kanban-col .cards {
  flex: 1; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 40px;
}
.kanban-col footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
}
.kanban-col .add-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
}
.kanban-col .add-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-faint); }

/* ----- Task card ----- */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.task-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.task-card.dragging { opacity: 0.5; }
.task-card .title { font-weight: 500; margin-bottom: 6px; line-height: 1.35; }
.task-card .meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
.task-card .priority {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
}
.priority.urgent { background: #fde5e5; color: #b1332d; }
.priority.high { background: #fdece0; color: #a35a12; }
.priority.medium { background: #eef0ff; color: #3a3f9c; }
.priority.low { background: #eaf3fb; color: #2a658a; }
.priority.none { background: #eeeef0; color: #696a73; }

.avatar-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.due-date {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.due-date.overdue { color: var(--danger); border-color: #f2c7c4; background: #fdf1f0; }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 16, 22, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 20px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal header .title-input {
  flex: 1;
  border: none; padding: 4px 6px;
  font-size: 20px; font-weight: 600;
  background: transparent;
}
.modal header .title-input:focus { background: var(--surface-alt); border-radius: 6px; box-shadow: none; }
.modal header .close {
  background: none; border: none; font-size: 22px; color: var(--text-muted); padding: 4px 8px; border-radius: 4px;
}
.modal header .close:hover { background: var(--surface-alt); color: var(--text); }
.modal-body { padding: 18px 22px; display: grid; grid-template-columns: 1fr 220px; gap: 24px; }
.modal-body .field { margin-bottom: 16px; }
.modal-body .field label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 6px;
}
.modal-body textarea { width: 100%; min-height: 120px; resize: vertical; }
.modal-body .sidebar-info { border-left: 1px solid var(--border); padding-left: 22px; }
.modal-body .sidebar-info .field select { width: 100%; }
.modal-body .sidebar-info .field input { width: 100%; }

.comments {
  margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--border);
}
.comments h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.comment {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.comment .body {
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 8px; flex: 1;
}
.comment .body .head {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted);
  margin-bottom: 4px;
}
.comment .body .head .author { font-weight: 600; color: var(--text); }
.comment-form { display: flex; gap: 10px; margin-top: 10px; }
.comment-form textarea { flex: 1; min-height: 40px; }
.comment-form button { align-self: flex-end; background: var(--brand); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; font-weight: 600; }

/* ----- Toast ----- */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  max-width: 360px;
  animation: slide-in 0.2s ease;
}
.toast.error { background: var(--danger); }
@keyframes slide-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----- Activity panel ----- */
.activity-list { padding: 20px; max-width: 720px; margin: 0 auto; }
.activity-list .item {
  display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-list .item .when { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* ----- Project sub-nav ----- */
.sidebar-nav .project-group { margin-bottom: 2px; }
.sidebar-nav .project-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px;
  color: var(--sidebar-text);
}
.sidebar-nav .project-head:hover { background: var(--sidebar-hover); }
.sidebar-nav .project-head .chev { font-size: 10px; width: 10px; color: var(--sidebar-muted); }
.sidebar-nav .project-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav .sub {
  display: flex; flex-direction: column;
  padding: 2px 0 4px 22px; gap: 2px;
}
.sidebar-nav .sub .item {
  padding: 6px 10px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-nav .sub .item .icon { font-size: 14px; width: 16px; text-align: center; }

/* ----- View toggle ----- */
.view-toggle {
  display: inline-flex; gap: 2px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px;
}
.view-toggle button {
  background: none; border: none; padding: 6px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.view-toggle button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }

/* ----- Filter bar ----- */
.filter-bar {
  display: flex; gap: 10px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  align-items: center; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  padding: 6px 10px; font-size: 13px;
}
.filter-bar .search { flex: 1; min-width: 200px; max-width: 320px; }

/* ----- List view ----- */
.task-list-wrap { padding: 20px; }
.task-list {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.task-list th, .task-list td {
  text-align: left; padding: 10px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.task-list thead th {
  background: var(--surface-alt);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; user-select: none;
}
.task-list tbody tr { cursor: pointer; }
.task-list tbody tr:hover { background: var(--surface-alt); }
.task-list tbody tr:last-child td { border-bottom: none; }
.task-list .status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.task-list .status-chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ----- Discussions ----- */
.discussions-wrap { padding: 20px; max-width: 900px; margin: 0 auto; }
.discussions-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.discussion-row {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.discussion-row:hover { border-color: var(--brand); }
.discussion-row.pinned { border-color: #efbb3a; }
.discussion-row .avatar-sm { align-self: flex-start; margin-top: 2px; }
.discussion-row .title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.discussion-row .meta { font-size: 12px; color: var(--text-muted); }
.discussion-row .stats {
  margin-left: auto; display: flex; flex-direction: column; align-items: flex-end;
  font-size: 12px; color: var(--text-muted); gap: 4px;
}
.discussion-row .pin-icon { color: #efbb3a; margin-right: 4px; }

.discussion-thread { padding: 24px; max-width: 800px; margin: 0 auto; }
.discussion-thread .back { background: none; border: none; color: var(--brand); margin-bottom: 12px; font-weight: 600; }
.discussion-thread .head {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; margin-bottom: 12px;
}
.discussion-thread .head h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.01em; }
.discussion-thread .head .meta { color: var(--text-muted); font-size: 12px; margin-bottom: 14px; }
.discussion-thread .head .body { font-size: 14px; line-height: 1.55; }
.discussion-thread .reply {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 10px;
}
.discussion-thread .reply .head {
  background: none; border: none; padding: 0 0 6px;
  display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-muted);
}
.discussion-thread .reply .head .author { color: var(--text); font-weight: 600; }
.discussion-thread .reply .body { font-size: 14px; line-height: 1.55; }
.discussion-thread .reply-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; margin-top: 14px;
}
.discussion-thread .reply-form textarea { width: 100%; min-height: 80px; resize: vertical; margin-bottom: 8px; }
.discussion-thread .reply-form button {
  background: var(--brand); color: #fff; border: none; padding: 8px 16px;
  border-radius: 6px; font-weight: 600;
}
.mention { color: var(--brand); font-weight: 600; }
.code-block {
  background: #1a1b23; color: #e4e4e8;
  padding: 12px 14px; border-radius: 6px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 12px; overflow-x: auto; margin: 8px 0;
  white-space: pre;
}
code {
  background: var(--surface-alt); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; font-size: 12px;
  border: 1px solid var(--border);
}

.mention-dropdown {
  position: absolute; z-index: 500;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-md); min-width: 240px; padding: 4px;
}
.mention-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.mention-item.active, .mention-item:hover { background: var(--brand-faint); }

/* ----- Files ----- */
.files-wrap { padding: 20px; max-width: 1000px; margin: 0 auto; }
.files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 30px; text-align: center; color: var(--text-muted);
  background: var(--surface); margin-bottom: 18px;
  transition: border-color 0.1s, background 0.1s;
}
.drop-zone.active { border-color: var(--brand); background: var(--brand-faint); color: var(--brand); }
.drop-zone button {
  background: var(--brand); color: #fff; border: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 600; margin-top: 8px;
}
.files-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.files-table th, .files-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.files-table thead th { background: var(--surface-alt); font-size: 11px; text-transform: uppercase; color: var(--text-muted); }
.files-table tbody tr:last-child td { border-bottom: none; }
.files-table .actions { display: flex; gap: 6px; }
.files-table button {
  background: none; border: 1px solid var(--border); padding: 4px 10px;
  border-radius: 4px; font-size: 12px; color: var(--text);
}
.files-table button.danger { color: var(--danger); border-color: #f2c7c4; }

.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 14px; font-size: 12px;
}
.file-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.file-chip button { background: none; border: none; color: var(--text-muted); font-size: 14px; padding: 0 2px; }

/* ----- Notifications bell ----- */
.notif-bell {
  position: relative; background: none; border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 6px; font-size: 16px; color: var(--text);
}
.notif-bell:hover { background: var(--surface-alt); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.notif-panel {
  position: absolute; top: 52px; right: 20px; z-index: 120;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); width: 380px; max-height: 70vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.notif-panel header {
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.notif-panel header button {
  background: none; border: none; color: var(--brand); font-size: 12px; font-weight: 600;
}
.notif-panel .list { overflow-y: auto; }
.notif-panel .item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-panel .item:hover { background: var(--surface-alt); }
.notif-panel .item.unread { background: var(--brand-faint); }
.notif-panel .item .title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-panel .item .body { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.notif-panel .item .time { font-size: 11px; color: var(--text-muted); }
.notif-panel .empty { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ----- Activity panel ----- */
.activity-panel {
  position: absolute; top: 52px; right: 20px; z-index: 110;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); width: 420px; max-height: 70vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.activity-panel header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; display: flex; justify-content: space-between; align-items: center;
}
.activity-panel .list { overflow-y: auto; padding: 8px 0; }
.activity-panel .item {
  padding: 10px 16px; display: flex; gap: 10px; align-items: flex-start;
}
.activity-panel .item .txt { font-size: 13px; line-height: 1.45; flex: 1; }
.activity-panel .item .time { font-size: 11px; color: var(--text-muted); }

.task-card .files-inline { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.task-card .files-inline .tag {
  font-size: 10px; background: var(--surface-alt); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 10px; color: var(--text-muted);
}

/* ----- Sprint cards (also reused for checkins/time panels) ----- */
.sprint-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color 0.1s;
}
.sprint-card:hover { border-color: var(--brand); }
.sprint-card.active { border-color: var(--success); border-left-width: 4px; }

/* ----- Timeline ----- */
.timeline-wrap {
  height: calc(100vh - 180px);
  background: var(--surface);
}
.timeline-wrap .tl-bar:hover { filter: brightness(1.1); }

/* ----- Settings layout ----- */
.settings-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.settings-nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.settings-nav .back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 6px;
  margin-bottom: 18px;
}
.settings-nav .back:hover { background: var(--surface-alt); color: var(--text); }
.settings-nav h5 {
  margin: 14px 10px 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700;
}
.settings-nav a.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 14px; margin-bottom: 2px;
  cursor: pointer;
}
.settings-nav a.item:hover { background: var(--surface-alt); }
.settings-nav a.item.active { background: var(--brand-faint); color: var(--brand); font-weight: 600; }

.settings-main { padding: 30px 40px; max-width: 960px; overflow-x: hidden; }
.settings-main h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.01em; }
.settings-main p.subtitle { margin: 0 0 24px; color: var(--text-muted); }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
}
.settings-card h2 {
  margin: 0 0 4px; font-size: 16px; font-weight: 600;
}
.settings-card p.card-sub { margin: 0 0 18px; color: var(--text-muted); font-size: 13px; }
.settings-card .danger-zone { border-color: var(--danger); }
.settings-card.danger { border-color: var(--danger); }

.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-row label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
}
.form-row input, .form-row textarea, .form-row select {
  padding: 10px 12px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-primary {
  background: var(--brand); color: #fff; border: none;
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-alt); }
.btn-danger {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-danger:hover { background: var(--danger-faint); }

/* Avatar card */
.profile-avatar {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 600;
  position: relative; cursor: pointer;
  overflow: hidden; border: 4px solid var(--surface);
  box-shadow: var(--shadow-md);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; opacity: 0; transition: opacity 0.15s;
  font-weight: 600;
}
.profile-avatar:hover .overlay { opacity: 1; }

/* Toggle switch */
.toggle-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .text { flex: 1; }
.toggle-row .text .title { font-weight: 600; font-size: 14px; }
.toggle-row .text .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle {
  position: relative; width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.toggle .track {
  display: block; width: 100%; height: 100%;
  background: var(--border); border-radius: 12px;
  transition: background 0.15s;
}
.toggle .knob {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked ~ .knob { transform: translateX(18px); }

/* Theme cards */
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.theme-card {
  border: 2px solid var(--border); border-radius: 10px;
  padding: 18px; text-align: center; cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--brand); background: var(--brand-faint); }
.theme-card .glyph { font-size: 28px; margin-bottom: 6px; }
.theme-card .name { font-weight: 600; font-size: 13px; }

/* Color swatch picker */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
}
.swatches button.active { border-color: var(--text); }

/* Members table */
.members-table { width: 100%; border-collapse: collapse; }
.members-table th, .members-table td {
  text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.members-table thead th {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-alt);
}
.role-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.role-badge.owner,
.role-badge.super_admin { background: linear-gradient(135deg,#f5c744,#efbb3a); color: #6a4d00; }
.role-badge.admin { background: var(--brand-faint); color: var(--brand); }
.role-badge.project_manager { background: rgba(55, 138, 221, 0.15); color: #2a658a; }
html[data-theme="dark"] .role-badge.project_manager { color: #7fb9ed; }
.role-badge.member { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.role-badge.viewer { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.perm-info {
  background: rgba(83, 74, 183, 0.08);
  border: 1px solid var(--brand-faint);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.perm-info .icon { font-size: 16px; flex-shrink: 0; }
.perm-info .role-name { font-weight: 700; color: var(--brand); }

/* Invite list */
.invite-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-alt); margin-bottom: 8px; font-size: 12px;
}
.invite-row code {
  flex: 1; background: var(--surface); padding: 4px 8px;
  border-radius: 4px; font-size: 11px;
  word-break: break-all;
}

/* Analytics */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px;
}
.stat-card .label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.stat-card .number { font-size: 28px; font-weight: 700; color: var(--brand); margin-top: 4px; }
.stat-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 120px;
  padding: 10px 0 0;
}
.chart .bar {
  flex: 1; background: var(--brand); border-radius: 2px 2px 0 0;
  min-height: 2px; position: relative;
}
.chart .bar:hover { background: var(--brand-hover); }
.chart .bar .tt {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface);
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  white-space: nowrap; opacity: 0; pointer-events: none;
}
.chart .bar:hover .tt { opacity: 1; }

/* Labels list */
.label-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-alt); margin-bottom: 6px;
}
.label-row .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.label-row .name { flex: 1; }

/* Password strength */
.strength { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.strength .bar { height: 100%; transition: width 0.15s, background 0.15s; }
.strength .bar.weak { background: var(--danger); width: 33%; }
.strength .bar.medium { background: var(--warn); width: 66%; }
.strength .bar.strong { background: var(--success); width: 100%; }

/* ----- Chat ----- */
.chat-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 58px);
  min-height: 0;
  overflow: hidden;
}
.chat-list {
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 8px;
}
.chat-list .chat-search {
  padding: 8px 10px; font-size: 12px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); margin-bottom: 10px;
}
.chat-list h5 {
  margin: 12px 8px 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.chat-list h5 button {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; padding: 0 4px; border-radius: 4px;
}
.chat-list h5 button:hover { background: var(--border); color: var(--text); }
.chat-list .ch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 14px; color: var(--text);
  cursor: pointer; text-decoration: none;
  margin-bottom: 1px;
}
.chat-list .ch-item:hover { background: var(--border); }
.chat-list .ch-item.active {
  background: var(--brand-faint);
  border-left: 3px solid var(--brand);
  padding-left: 7px;
}
.chat-list .ch-item .hash { color: var(--text-muted); font-weight: 700; }
.chat-list .ch-item.unread { font-weight: 700; }
.chat-list .ch-item .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  min-width: 16px; text-align: center;
}
.chat-list .dm-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.chat-list .dm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; text-decoration: none;
  color: var(--text); font-size: 13px;
  flex: 1; min-width: 0;
}
.chat-list .dm-item:hover { background: var(--border); }
.chat-list .dm-item.active { background: var(--brand-faint); }
.chat-list .dm-hide {
  position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 14px; line-height: 1; padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease;
  display: flex; align-items: center; justify-content: center;
}
.chat-list .dm-item-wrap:hover .dm-hide { opacity: 1; }
.chat-list .dm-hide:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--danger-faint);
}

/* DM picker modal — member list */
.dm-picker-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; text-align: left;
  color: var(--text);
}
.dm-picker-item:hover { background: var(--surface-alt); }
.dm-picker-item .n { font-weight: 600; font-size: 13px; }
.dm-picker-item .e { font-size: 11px; color: var(--text-muted); }
.chat-list .dm-avatar {
  position: relative; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.chat-list .dm-avatar .status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--surface-alt);
}
.status-dot.online { background: #3ec26f; }
.status-dot.away { background: #efbb3a; }
.status-dot.busy { background: #e85d5d; }
.status-dot.offline { background: #8a8b94; }
.chat-list .dm-item .info { flex: 1; min-width: 0; }
.chat-list .dm-item .info .n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .dm-item .info .p {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface);
}
.chat-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
}
.chat-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.chat-header .desc { font-size: 12px; color: var(--text-muted); }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 0;
  display: flex; flex-direction: column;
  gap: 2px;
}
.chat-messages .loading-more {
  text-align: center; padding: 10px; font-size: 12px; color: var(--text-muted);
}
.date-sep {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px 6px;
  color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.date-sep::before, .date-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.msg-row {
  display: flex; gap: 12px; padding: 3px 20px;
  position: relative;
}
.msg-row:hover { background: var(--surface-alt); }
.msg-row .avatar {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
}
.msg-row .avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-row .body { flex: 1; min-width: 0; }
.msg-row .head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px;
}
.msg-row .head .name { font-weight: 600; font-size: 14px; }
.msg-row .head .ts { font-size: 11px; color: var(--text-muted); }
.msg-row .content { font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.msg-row.grouped { padding-top: 1px; padding-bottom: 1px; }
.msg-row.grouped .avatar { visibility: hidden; height: 0; }
.msg-row.grouped .head { display: none; }
.msg-row .ts-inline {
  display: inline-block; width: 48px; margin-left: -60px; padding-right: 12px;
  text-align: right; color: var(--text-muted); font-size: 10px;
  opacity: 0; transition: opacity 0.1s;
}
.msg-row.grouped:hover .ts-inline { opacity: 1; }

.msg-row .deleted { font-style: italic; color: var(--text-muted); }
.msg-row .edited { font-size: 10px; color: var(--text-muted); margin-left: 4px; }
.msg-row .reply-preview {
  font-size: 12px; color: var(--text-muted);
  border-left: 2px solid var(--border); padding: 2px 8px; margin-bottom: 4px;
}
.msg-row .reply-preview strong { color: var(--text); font-weight: 600; }

.msg-row.system { justify-content: center; padding: 8px 20px; }
.msg-row.system .body {
  text-align: center; font-size: 12px; color: var(--text-muted); font-style: italic; flex: none;
}
.msg-row.system .avatar, .msg-row.system .head { display: none; }

.reactions-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reaction-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 12px; font-size: 11px; cursor: pointer;
}
.reaction-pill.mine { background: var(--brand-faint); border-color: var(--brand); color: var(--brand); }
.reaction-pill:hover { background: var(--border); }

.msg-actions {
  position: absolute; top: -10px; right: 20px;
  display: none; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.msg-row:hover .msg-actions { display: flex; }
.msg-actions button {
  background: none; border: none; padding: 4px 6px;
  border-radius: 4px; font-size: 14px; cursor: pointer;
  color: var(--text);
}
.msg-actions button:hover { background: var(--surface-alt); }

.file-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 8px;
  margin-top: 4px; max-width: 420px;
}
.file-msg img.preview { max-width: 360px; max-height: 240px; border-radius: 6px; cursor: pointer; }
.file-msg .file-info { flex: 1; min-width: 0; }
.file-msg .file-info .n { font-weight: 600; font-size: 13px; word-break: break-all; }
.file-msg .file-info .m { font-size: 11px; color: var(--text-muted); }

.chat-typing {
  flex-shrink: 0;
  padding: 4px 20px 0;
  font-size: 12px; color: var(--text-muted); min-height: 20px;
}
.chat-typing .dots::after {
  content: '…';
  animation: typing 1.2s steps(4, end) infinite;
}
@keyframes typing {
  0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } 100% { content: ''; }
}

.chat-input-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--border); padding: 12px 20px 16px;
  background: var(--surface);
}
.chat-reply-bar {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface-alt); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  padding: 6px 10px; border-radius: 6px; margin-bottom: 8px;
  font-size: 12px;
}
.chat-reply-bar .close {
  background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer;
}
.chat-input {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px;
}
.chat-input textarea {
  flex: 1; border: none; background: transparent; resize: none;
  outline: none; font-family: inherit; font-size: 14px; color: var(--text);
  line-height: 1.5; padding: 4px 6px; max-height: 140px;
}
.chat-input textarea:focus { box-shadow: none; }
.chat-input button {
  background: none; border: none; color: var(--text-muted);
  padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 16px;
}
.chat-input button:hover { background: var(--border); color: var(--text); }
.chat-input button.send {
  background: var(--brand); color: #fff; padding: 6px 14px; font-weight: 600;
}
.chat-input button.send:hover { background: var(--brand-hover); }
.chat-input button.send:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

.emoji-picker {
  position: absolute; z-index: 500;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 8px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
}
.emoji-picker button {
  font-size: 20px; background: none; border: none; padding: 6px;
  border-radius: 4px; cursor: pointer;
}
.emoji-picker button:hover { background: var(--surface-alt); }

.new-msg-bar {
  position: sticky; bottom: 8px; align-self: center;
  background: var(--brand); color: #fff;
  padding: 6px 14px; border-radius: 16px; font-size: 12px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-md);
}

/* Main sidebar chat icon */
.sidebar .chat-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 600;
  background: var(--sidebar-hover);
  margin-bottom: 10px; cursor: pointer;
}
.sidebar .chat-link:hover { background: var(--brand); color: #fff; }
.sidebar .chat-link .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  min-width: 16px; text-align: center;
}

/* Avatar status dot (for message avatars) */
.avatar-status {
  position: relative;
}
.avatar-status .status-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ----- Channel member panel (right side drawer) ----- */
.chat-member-panel {
  position: absolute; top: 58px; right: 0; bottom: 0;
  width: 280px; z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.chat-member-panel .mp-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.chat-member-panel .mp-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 0 4px;
}
.chat-member-panel .mp-add {
  margin: 10px 16px; padding: 8px 12px; font-size: 13px;
}
.chat-member-panel .mp-list { padding: 6px 8px; }
.chat-member-panel .mp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
}
.chat-member-panel .mp-row:hover { background: var(--surface-alt); }
.chat-member-panel .mp-remove {
  background: none; border: none;
  color: var(--text-muted); font-size: 18px;
  cursor: pointer; padding: 0 4px;
  margin-left: auto;
}
.chat-member-panel .mp-remove:hover { color: var(--danger); }
.chat-main { position: relative; }

/* ----- Utility ----- */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Profile panel ---------- */
forge-profile-panel { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
forge-profile-panel .pp-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; transition: opacity 200ms ease; pointer-events: auto;
}
forge-profile-panel.open .pp-overlay { opacity: 1; }
forge-profile-panel .pp-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 350px;
  background: var(--surface); box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  transform: translateX(100%); transition: transform 220ms ease;
  pointer-events: auto; display: flex; flex-direction: column;
  overflow-y: auto;
}
forge-profile-panel.open .pp-panel { transform: translateX(0); }
.pp-body { display: flex; flex-direction: column; min-height: 100%; }
.pp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e5ea);
}
.pp-title { font-weight: 700; font-size: 16px; }
.pp-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text-muted); line-height: 1; padding: 0 4px;
}
.pp-main { padding: 18px; display: flex; flex-direction: column; align-items: center; }
.pp-avatar { margin: 8px 0 12px; }
.pp-name { margin: 4px 0 2px; font-size: 20px; font-weight: 700; text-align: center; }
.pp-title-job { color: var(--text-muted); font-size: 13px; text-align: center; }
.pp-status { margin-top: 6px; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9ba0a6; }
.pp-dot.online { background: #3ba55c; }
.pp-dot.away { background: #faa61a; }
.pp-dot.busy { background: #ed4245; }
.pp-dot.offline { background: #9ba0a6; }
.pp-time { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.pp-actions { display: flex; gap: 8px; width: 100%; margin-top: 16px; }
.pp-btn {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border, #e5e5ea);
  background: var(--surface-alt); color: inherit; border-radius: 6px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.pp-btn:hover { background: var(--brand-faint); border-color: var(--brand); }
.pp-sect {
  width: 100%; margin-top: 20px; border-top: 1px solid var(--border, #e5e5ea);
  padding-top: 14px;
}
.pp-sect h5 {
  margin: 0 0 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700;
}
.pp-row { display: flex; gap: 10px; padding: 6px 0; font-size: 13px; }
.pp-ico { font-size: 15px; width: 18px; text-align: center; }
.pp-row-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.pp-row a { color: var(--brand); text-decoration: none; }
.pp-role-badge {
  display: inline-block; padding: 4px 10px; background: var(--brand-faint);
  color: var(--brand); border-radius: 12px; font-size: 12px; font-weight: 600;
}
.pp-projects, .pp-activity { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.pp-projects li { padding: 4px 0; }
.pp-activity li { padding: 6px 0; border-bottom: 1px solid var(--border, #eee); }
.pp-activity li:last-child { border-bottom: none; }
.pp-activity .pp-ts { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pp-loading, .pp-error { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.pp-error { color: #ed4245; }

/* ---------- Vibe floating bar ---------- */
forge-vibe-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; pointer-events: none; }
forge-vibe-bar .vibe-bar {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px;
  margin: 0 auto; max-width: 720px;
  padding: 10px 18px; border-radius: 12px 12px 0 0;
  background: linear-gradient(135deg, #534AB7, #7c5bdf);
  color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.vibe-bar .vb-icon { font-size: 18px; animation: vb-pulse 1.6s ease-in-out infinite; }
@keyframes vb-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.vibe-bar .vb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vibe-bar .vb-count { font-size: 12px; opacity: 0.9; }
.vibe-bar .vb-peers { display: flex; gap: 2px; }
.vibe-bar .vb-av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.25); color: #fff; font-size: 10px; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.4);
}
.vibe-bar .vb-btn {
  border: 1px solid rgba(255,255,255,0.4); background: rgba(255,255,255,0.12);
  color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 12px;
  font-weight: 600; cursor: pointer;
}
.vibe-bar .vb-btn:hover { background: rgba(255,255,255,0.22); }
.vibe-bar .vb-mute.on { background: #ed4245; border-color: #ed4245; }
.vibe-bar .vb-end { background: #ed4245; border-color: #ed4245; }
.vibe-bar .vb-end:hover { background: #f65457; }

/* ---------- Incoming / outgoing call overlay ---------- */
forge-incoming-call {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0; transition: opacity 200ms ease;
}
forge-incoming-call.open { opacity: 1; }
forge-incoming-call .ic-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 12, 20, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}
forge-incoming-call .ic-card {
  position: relative; pointer-events: auto;
  background: linear-gradient(160deg, #2a2b37, #16171f);
  color: #fff; border-radius: 20px;
  padding: 36px 32px; width: 360px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
forge-incoming-call .ic-avatar-wrap {
  position: relative; width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
forge-incoming-call .ic-pulse {
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 3px solid #3ba55c;
  animation: ic-pulse 1.6s ease-out infinite;
}
forge-incoming-call .ic-pulse::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid #3ba55c;
  animation: ic-pulse 1.6s ease-out infinite;
  animation-delay: 0.8s;
}
@keyframes ic-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.45); opacity: 0; }
}
forge-incoming-call .ic-name {
  margin: 4px 0 6px; font-size: 22px; font-weight: 700;
}
forge-incoming-call .ic-sub {
  color: #b8b9c3; font-size: 14px; margin-bottom: 26px;
}
forge-incoming-call .ic-dots::after {
  content: ''; display: inline-block; width: 0;
  animation: ic-dots 1.4s steps(4, end) infinite;
  overflow: hidden; vertical-align: bottom;
}
@keyframes ic-dots {
  0% { width: 0; } 25% { width: 3px; } 50% { width: 6px; } 75% { width: 9px; } 100% { width: 0; }
}
forge-incoming-call .ic-actions {
  display: flex; gap: 12px; width: 100%;
}
forge-incoming-call .ic-btn {
  flex: 1; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: none; color: #fff;
}
forge-incoming-call .ic-decline,
forge-incoming-call .ic-cancel {
  background: #ed4245;
}
forge-incoming-call .ic-decline:hover,
forge-incoming-call .ic-cancel:hover { background: #f65457; }
forge-incoming-call .ic-accept {
  background: #3ba55c;
}
forge-incoming-call .ic-accept:hover { background: #46b869; }

/* Channel vibe invite banner */
.vibe-invite-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 900; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #534AB7, #7c5bdf); color: #fff;
  padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  font-size: 13px; font-weight: 600;
}
.vibe-invite-banner .vib-join {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
  color: #fff; padding: 6px 12px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
.vibe-invite-banner .vib-join:hover { background: rgba(255,255,255,0.3); }
.vibe-invite-banner .vib-dismiss {
  background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1;
}

/* Chat header vibe + back buttons */
.chat-vibe-btn {
  background: var(--brand-faint); color: var(--brand);
  border: 1px solid var(--brand); border-radius: 8px;
  padding: 6px 12px; font-size: 16px; cursor: pointer;
  margin-left: auto;
}
.chat-vibe-btn:hover { background: var(--brand); color: #fff; }
.chat-back-btn {
  background: none; border: 1px solid var(--border, #e5e5ea);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
  font-size: 13px; color: var(--text-muted);
}

/* ===== MOBILE RESPONSIVE ===== */

/* Bottom navigation bar — mobile only */
forge-bottom-nav { display: none; }

@media (max-width: 768px) {
  /* --- Shell --- */
  .shell { display: block !important; }
  .main { display: flex; flex-direction: column; }

  /* --- Bottom nav --- */
  forge-bottom-nav { display: block; }
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px;
    background: #16171f;
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .tab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; color: #8a8b94;
    text-decoration: none; font-size: 10px;
    position: relative; cursor: pointer;
  }
  .bottom-nav .tab.active { color: var(--brand); }
  .bottom-nav .tab .icon { font-size: 20px; }

  /* --- Sidebar: off-canvas drawer --- */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 260px; height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }

  /* --- Main content --- */
  .content { padding-bottom: 64px; }
  .floating-sidebar-btn { bottom: 72px !important; }

  /* --- Header --- */
  .header { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .header .right { gap: 6px; }
  .header .view-toggle { display: none; }
  .header .btn { padding: 6px 10px; font-size: 12px; }

  /* --- Kanban: horizontal swipe --- */
  .kanban {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 12px; gap: 12px;
  }
  .kanban-col {
    min-width: 80vw;
    max-width: 85vw;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* --- Modals go bottom-sheet --- */
  .modal-backdrop { align-items: flex-end; }
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92vh;
    margin: 0;
    border-radius: 16px 16px 0 0 !important;
    overflow-y: auto;
  }
  .modal-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 14px !important;
    padding: 16px !important;
  }

  /* --- Task list — card view --- */
  .task-list-table { display: block; border: none; }
  .task-list-table thead { display: none; }
  .task-list-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .task-list-table tbody tr {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface);
    align-items: center;
  }
  .task-list-table td { border: none !important; padding: 0 !important; font-size: 13px; }
  .task-list-table td:first-child { width: 100%; font-weight: 600; }

  /* --- Chat layout --- */
  .chat-shell {
    display: flex !important;
    flex-direction: column;
    height: 100%;
  }
  .chat-list {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .chat-main { width: 100%; }
  /* When viewing messages, hide the channel list */
  .chat-shell.viewing-messages .chat-list { display: none; }
  .chat-shell.viewing-messages .chat-main { display: flex; }
  .chat-shell.viewing-channels .chat-main { display: none; }
  .chat-shell.viewing-channels .chat-list { display: block; }
  .chat-shell.viewing-messages .chat-back-btn { display: inline-block !important; }

  .chat-messages { padding: 8px 12px; }
  .chat-input-wrap { padding: 8px 12px; }
  .chat-input-wrap textarea { font-size: 16px !important; }

  /* --- Files --- */
  .files-table { display: block; }
  .files-table thead { display: none; }
  .files-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .files-table tbody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface);
  }
  .files-table td { border: none; padding: 0; }

  /* --- Timeline horizontal scroll --- */
  .timeline-wrap, forge-timeline { overflow-x: auto; }

  /* --- Settings --- */
  .settings-layout, forge-settings .layout {
    flex-direction: column !important;
  }
  .settings-sidebar, forge-settings .settings-side {
    width: 100% !important;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* --- Profile panel — full screen --- */
  forge-profile-panel .pp-panel {
    width: 100vw !important;
  }

  /* --- Notifications / activity panels --- */
  forge-notifications-panel, .notif-panel,
  forge-activity-panel, .activity-panel {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    bottom: 56px !important;
    width: 100% !important; max-width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
  }

  /* --- Incoming call overlay --- */
  forge-incoming-call .ic-card { width: 92vw; padding: 28px 20px; }
  forge-incoming-call .ic-actions { flex-direction: row; gap: 12px; }
  forge-incoming-call .ic-btn { flex: 1; min-height: 52px; font-size: 16px; }

  /* --- Vibe bar: above bottom nav --- */
  forge-vibe-bar .vibe-bar {
    max-width: 100%;
    border-radius: 0;
    margin-bottom: calc(56px + env(safe-area-inset-bottom));
    padding: 8px 12px;
    gap: 8px;
  }
  .vibe-bar .vb-label { font-size: 12px; }
  .vibe-bar .vb-peers { display: none; }

  /* --- Touch targets --- */
  button, a.btn, select, [role="button"] { min-height: 44px; }
  input, textarea, select { font-size: 16px !important; }
  body { overscroll-behavior-y: contain; }

  /* --- Login --- */
  .login-card { width: 92vw !important; max-width: 400px; padding: 22px; }

  /* --- Discussions --- */
  .discussions-wrap, forge-discussions { padding: 12px; }
}

@media (max-width: 768px) and (hover: none) {
  .task-card:hover,
  .discussion-row:hover,
  .sidebar-nav .item:hover,
  .files-table tbody tr:hover,
  .notif-panel .item:hover { background: inherit; }
}

/* Loading screen — mobile */
@media (max-width: 768px) {
  #loading-screen .logo { width: 60px; height: 60px; }
  #loading-screen .name { font-size: 22px; }
}

/* ===== Lucide icon baseline ===== */
[data-lucide] {
  width: 18px; height: 18px;
  stroke-width: 1.75;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}
.sidebar-nav [data-lucide] { width: 16px; height: 16px; }
.bottom-nav [data-lucide] { width: 22px; height: 22px; }
.header [data-lucide] { width: 20px; height: 20px; }
.header .view-toggle [data-lucide] { width: 16px; height: 16px; }
button [data-lucide] + * { margin-left: 4px; }

/* ===== Mobile — modern refresh ===== */
@media (max-width: 768px) {
  body { font-size: 15px; line-height: 1.5; }

  h1, .page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
  h3 { font-size: 15px; font-weight: 600; }

  .content { padding: 16px; }

  /* Elevated cards */
  .task-card,
  .discussion-row,
  .sprint-card,
  .file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.1s;
  }
  .task-card:active,
  .discussion-row:active { transform: scale(0.98); }

  /* Bottom nav — frosted */
  .bottom-nav {
    background: rgba(255,255,255,0.85) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border);
    padding: 4px 0;
  }
  [data-theme="dark"] .bottom-nav {
    background: rgba(22,23,31,0.85) !important;
    border-top: 0.5px solid rgba(255,255,255,0.08);
  }
  .bottom-nav .tab {
    font-size: 10px; font-weight: 500; gap: 3px;
    transition: color 0.15s;
  }
  .bottom-nav .tab.active { color: var(--brand); }
  .bottom-nav .tab [data-lucide] { width: 24px; height: 24px; }

  /* Header — sticky + frosted */
  .header {
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border);
    position: sticky; top: 0; z-index: 50;
  }
  [data-theme="dark"] .header {
    background: rgba(26,27,35,0.85);
    border-bottom: 0.5px solid rgba(255,255,255,0.08);
  }
  .header .crumbs { font-size: 15px; font-weight: 600; }
  .header .crumbs .ws-name { display: none; }
  .header .crumbs .sep { display: none; }
  .header .view-toggle button span { display: none; }
  .header .btn { padding: 8px 10px; }

  /* Kanban — spaced cards */
  .kanban { padding: 12px 8px; gap: 8px; }
  .kanban-col {
    min-width: 82vw; max-width: 82vw;
    background: var(--surface-alt);
    border-radius: 14px;
    padding: 12px;
  }
  .kanban-col header .title {
    font-size: 13px; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }
  .kanban-col .task-card {
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* Chat mobile — modern */
  .chat-list .dm-item {
    padding: 10px 14px;
    border-radius: 10px;
    margin: 2px 6px;
  }
  .chat-list .ch-item {
    padding: 10px 14px;
    border-radius: 10px;
    margin: 2px 6px;
  }
  .chat-messages { padding: 8px 12px; }
  .chat-input-wrap {
    padding: 8px 12px;
    gap: 8px;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
  }
  .chat-input-wrap textarea {
    background: var(--surface-alt);
    border: 1px solid var(--border) !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    font-size: 15px !important;
    resize: none;
  }
  .chat-main .msg-row .body .content { font-size: 15px; line-height: 1.45; }

  /* Task modal — sheet style with drag handle */
  .modal {
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    position: relative;
  }
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 4px;
  }
  .modal header { padding: 12px 20px 16px; border-bottom: 0.5px solid var(--border); }
  .modal header .title-input { font-size: 18px; font-weight: 600; }

  /* Login polish */
  .login-card { border-radius: 18px; }

  /* FAB */
  .fab {
    display: flex;
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 16px;
    width: 52px; height: 52px;
    border-radius: 16px;
    background: var(--brand);
    color: #fff;
    border: none;
    box-shadow: 0 6px 18px rgba(83,74,183,0.4);
    align-items: center;
    justify-content: center;
    z-index: 90;
    cursor: pointer;
  }
  .fab:hover { background: var(--brand-hover); }
  .fab [data-lucide] { width: 22px; height: 22px; stroke-width: 2; }
}
@media (min-width: 769px) {
  .fab { display: none !important; }
}

/* Incoming call — modern pulse */
forge-incoming-call.open .ic-backdrop {
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  background: rgba(10,12,20,0.6);
}
forge-incoming-call .ic-card {
  background: var(--surface);
  color: var(--text);
  border-radius: 24px;
  padding: 40px 32px 28px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
}
forge-incoming-call .ic-name { color: var(--text); }
forge-incoming-call .ic-sub { color: var(--text-muted); }
forge-incoming-call .decline-btn {
  background: #ed4245 !important;
  border-radius: 14px;
  padding: 14px !important;
  min-height: 52px;
  font-size: 15px; font-weight: 600;
}
forge-incoming-call .accept-btn {
  background: #1D9E75 !important;
  border-radius: 14px;
  padding: 14px !important;
  min-height: 52px;
  font-size: 15px; font-weight: 600;
}
forge-incoming-call .accept-btn:hover { background: #22b483 !important; }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(83,74,183,0.45); }
  70% { box-shadow: 0 0 0 20px rgba(83,74,183,0); }
  100% { box-shadow: 0 0 0 0 rgba(83,74,183,0); }
}
forge-incoming-call .ic-avatar-wrap .avatar-wrap {
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-in-out infinite;
}

/* Loading screen polish */
#loading-screen .logo {
  border-radius: 20px;
  box-shadow: 0 0 60px rgba(83,74,183,0.35);
}

/* ===== Mobile fixes (pass 2) ===== */
@media (max-width: 768px) {
  /* --- Settings mobile --- */
  .settings-shell {
    display: block !important;
    min-height: 100vh;
  }
  .settings-shell .settings-nav {
    width: 100% !important;
    max-width: 100% !important;
    border-right: none !important;
    padding: 16px;
    box-sizing: border-box;
  }
  .settings-shell .settings-main {
    width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box;
  }
  .settings-shell.viewing-content .settings-nav { display: none; }
  .settings-shell.viewing-menu .settings-main { display: none; }
  .settings-back {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: none;
    color: var(--brand); font-size: 14px; font-weight: 600;
    padding: 4px 0 12px;
    cursor: pointer;
  }
  .settings-back [data-lucide] { width: 18px; height: 18px; }

  .settings-shell .settings-main h1 { font-size: 22px; margin-top: 4px; }
  .settings-shell .settings-main .profile-avatar,
  .settings-shell .settings-main .profile-avatar img {
    max-width: 120px !important;
    max-height: 120px !important;
  }
  .settings-shell .settings-main .profile-avatar {
    margin: 0 auto 16px;
  }
  .settings-shell .settings-main > div > div[style*="display:flex"],
  .settings-shell .settings-main .settings-card > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  .settings-shell .settings-main input,
  .settings-shell .settings-main select,
  .settings-shell .settings-main textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  .settings-shell .settings-main table { display: block; }
  .settings-shell .settings-main thead { display: none; }
  .settings-shell .settings-main tbody { display: flex; flex-direction: column; gap: 8px; }
  .settings-shell .settings-main tbody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--surface);
  }
  .settings-shell .settings-main tbody td { border: none; padding: 0; }

  /* --- Header polish --- */
  .header #new-task-hdr { display: none !important; }
  .header .right { gap: 4px; }
  .header .right .btn.ghost,
  .header .right .btn { padding: 6px 8px; min-height: 36px; }

  /* --- Timeline --- */
  .tl-row-label { min-width: 120px !important; max-width: 40vw !important; }
  .timeline-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* --- Chat input spacing --- */
  .chat-input-wrap {
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  }
  .chat-main { padding-bottom: 0; }
  /* Allow the chat shell to fill the viewport minus bottom nav */
  .chat-shell { min-height: calc(100vh - 56px); }

  /* --- Kanban indicator --- */
  .kanban-wrap { padding-bottom: 64px; }
}

/* --- Kanban indicator (all viewports — hidden on desktop) --- */
.kanban-indicator { display: none; }
@media (max-width: 768px) {
  .kanban-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px 14px;
  }
  .kanban-indicator .ki-label {
    font-size: 13px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .kanban-indicator .ki-dots {
    display: flex; gap: 8px;
  }
  .kanban-indicator .ki-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border);
    transition: background 0.15s, transform 0.15s;
  }
  .kanban-indicator .ki-dot.active {
    background: var(--brand);
    transform: scale(1.25);
  }
}

/* ===== Full-page notifications view ===== */
forge-notifications-view { display: block; min-height: 100vh; background: var(--surface); }
.notif-view {
  display: flex; flex-direction: column;
  min-height: 100vh;
  padding-bottom: 72px;
  background: var(--surface);
}
.notif-view-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid var(--border);
}
[data-theme="dark"] .notif-view-head {
  background: rgba(26,27,35,0.9);
}
.notif-view-head h1 { flex: 1; font-size: 18px; margin: 0; font-weight: 700; }
.notif-view-head .nv-back {
  background: none; border: none; padding: 6px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.notif-view-head .nv-back:hover { background: var(--surface-alt); }
.notif-view-head .nv-read-all {
  background: none; border: none; color: var(--brand);
  font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.notif-view-head .nv-read-all:hover { background: var(--brand-faint); }

.notif-view-list { padding: 8px; flex: 1; }
.notif-view-list .nv-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: transform 0.1s;
}
.notif-view-list .nv-item:active { transform: scale(0.98); }
.notif-view-list .nv-item.unread {
  border-color: var(--brand);
  background: var(--brand-faint);
}
.notif-view-list .nv-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-faint); color: var(--brand);
  flex-shrink: 0;
}
.notif-view-list .nv-body { flex: 1; min-width: 0; }
.notif-view-list .nv-title { font-weight: 600; font-size: 14px; }
.notif-view-list .nv-sub {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-view-list .nv-time {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}
.notif-view-list .nv-dot {
  position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.notif-view-list .nv-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Desktop shows notifications full-page too — capped width, centered */
@media (min-width: 769px) {
  .notif-view { max-width: 720px; margin: 0 auto; }
}

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
  position: fixed;
  bottom: -120px;
  left: 0; right: 0;
  z-index: 9000;
  transition: bottom 0.3s ease;
  padding: 0 12px 12px;
  pointer-events: none;
}
.pwa-install-banner.visible { bottom: 0; }
.pwa-install-banner .pwa-banner-content { pointer-events: auto; }

@media (max-width: 768px) {
  .pwa-install-banner.visible {
    bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25), 0 -4px 20px rgba(0,0,0,0.08);
  max-width: 480px;
  margin: 0 auto;
}
.pwa-banner-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 22px rgba(83,74,183,0.35);
}
.pwa-banner-text {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-banner-text strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.pwa-banner-text span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}
.pwa-banner-text .ios-share {
  display: inline-block; font-size: 16px; vertical-align: -1px;
  color: #0a84ff;
}
.pwa-install-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.pwa-install-btn:hover { background: var(--brand-hover); }
.pwa-install-btn:active { transform: scale(0.96); }
.pwa-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
}
.pwa-dismiss-btn:hover { background: var(--surface-alt); color: var(--text); }

/* ===== Standalone mode tweaks ===== */
@media (display-mode: standalone) {
  .open-in-browser { display: none !important; }

  .header {
    padding-top: max(10px, env(safe-area-inset-top));
  }
  #loading-screen {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== Mobile chat fixes (pass 3) ===== */
@media (max-width: 768px) {
  /* Full-height chat column that leaves room for bottom nav */
  .chat-shell { height: calc(100vh - 56px - env(safe-area-inset-bottom)); }
  .chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chat-input-wrap {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--border);
    background: var(--surface);
  }

  /* Compact chat header */
  .chat-header {
    padding: 10px 12px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 0.5px solid var(--border);
    flex-shrink: 0;
  }
  .chat-header h2 { font-size: 16px !important; margin: 0 !important; font-weight: 600; }
  .chat-header .desc { font-size: 12px !important; color: var(--text-muted); }
  .chat-header .member-count-btn { font-size: 12px !important; }
  .chat-header .channel-desc { display: none; }

  /* Tighter message spacing */
  .msg-row { padding: 4px 12px !important; }
  .msg-row .content { font-size: 15px !important; line-height: 1.4 !important; }
  .msg-row .head { margin-bottom: 2px !important; }
  .msg-row .head .name { font-size: 14px !important; }
  .msg-row .head .ts { font-size: 11px !important; }
  .msg-row.system { padding: 2px 12px !important; font-size: 12px !important; }
  .msg-row.system .body { font-size: 12px; }

  /* Send button: prominent round brand button */
  .chat-input-wrap .send-btn,
  .chat-input-wrap button[type="submit"],
  .chat-input-wrap > form > button:last-child,
  .chat-input-wrap .chat-send {
    background: var(--brand) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }
}

/* ===== Mobile chat: full-screen when inside a channel ===== */
@media (max-width: 768px) {
  /* Hide bottom nav + FAB + PWA banner while inside a chat channel */
  body.in-chat forge-bottom-nav,
  body.in-chat .fab,
  body.in-chat .pwa-install-banner { display: none !important; }

  /* Chat column pinned to the visible viewport */
  body.in-chat .chat-shell {
    height: 100dvh;
    height: 100vh; /* fallback */
    min-height: 0;
  }
  body.in-chat .chat-main {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* fallback — JS overrides to visualViewport.height */
    min-height: 0;
    overflow: hidden;
  }
  body.in-chat .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.in-chat .chat-input-wrap {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--surface);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--border);
  }

  /* Input bar contents */
  body.in-chat .chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
  }
  body.in-chat .chat-input-wrap textarea {
    flex: 1;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 16px !important; /* prevent iOS zoom */
    max-height: 120px;
    resize: none;
    border: 1px solid var(--border);
    background: var(--surface-alt);
  }
  body.in-chat .chat-input-wrap .send-btn,
  body.in-chat .chat-input-wrap button[type="submit"] {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: none;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  body.in-chat .chat-input-wrap .action-btn {
    width: 36px; height: 36px;
    flex-shrink: 0;
  }

  /* When NOT in-chat (channel list mode), let the bottom nav coexist */
  body:not(.in-chat) .chat-shell { min-height: calc(100vh - 56px); }
}

/* ===================================================================
 * Mobile Slack-style redesign
 * =================================================================== */
@media (max-width: 768px) {
  /* Hide the desktop project sidebar entirely on mobile */
  .shell > forge-sidebar,
  forge-sidebar { display: none !important; }
  .shell { display: block !important; }
  .main { display: flex; flex-direction: column; min-height: 100vh; }

  /* Also hide the desktop header when on the mobile Home — mobile-home
     renders its own header. The header stays for project views. */
  forge-mobile-home ~ forge-header,
  body:has(forge-mobile-home) forge-header { display: none; }
}

/* ---------- Mobile Home ---------- */
forge-mobile-home {
  display: block;
  background: var(--bg, var(--surface-alt));
  min-height: 100vh;
  padding-bottom: 80px;
}
forge-mobile-home .mh { max-width: 720px; margin: 0 auto; }

@media (max-width: 768px) {
  .mobile-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: var(--surface);
    position: sticky; top: 0; z-index: 50;
    border-bottom: 0.5px solid var(--border);
  }
  .mobile-home-header .logo-section {
    display: flex; align-items: center; gap: 10px;
  }
  .mobile-home-header .logo-section img {
    width: 32px; height: 32px; border-radius: 8px;
  }
  .mobile-home-header .workspace-name {
    font-size: 20px; font-weight: 700; color: var(--text);
    letter-spacing: -0.3px;
  }
  .mobile-home-header .user-avatar {
    width: 36px; height: 36px;
  }

  /* Quick action cards */
  .quick-actions {
    display: flex; gap: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .quick-actions::-webkit-scrollbar { display: none; }
  .action-card {
    flex-shrink: 0;
    width: 130px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-snap-align: start;
    text-decoration: none;
    color: var(--text);
  }
  .action-card [data-lucide] { color: var(--brand); }
  .action-card strong { font-size: 14px; font-weight: 700; }
  .action-card span { font-size: 12px; color: var(--text-muted); }
  .action-card:active { transform: scale(0.98); }

  /* Sections */
  .mobile-section { padding: 0 16px; }
  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-top: 0.5px solid var(--border);
    cursor: pointer;
  }
  .mobile-section:first-of-type .mobile-section-header { border-top: none; }
  .mobile-section-header .section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
  }
  .mobile-section-header [data-lucide] {
    width: 18px; height: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
  }
  .mobile-section-header.collapsed [data-lucide] { transform: rotate(-90deg); }
  .mobile-section .section-content.collapsed { display: none; }

  /* Channel rows */
  .mobile-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: var(--text);
    font-size: 15px;
    text-decoration: none;
  }
  .mobile-channel-item .hash {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 500;
    width: 22px;
    text-align: center;
  }
  .mobile-channel-item .name { flex: 1; }
  .mobile-channel-item.unread .name { font-weight: 700; color: var(--text); }
  .mobile-channel-item .unread-badge,
  .mobile-dm-item .unread-badge {
    margin-left: auto;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 6px;
  }

  .mobile-dm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    text-decoration: none;
    color: var(--text);
    font-size: 15px;
  }
  .mobile-dm-item .dm-avatar-wrap .dm-dot {
    position: absolute;
    bottom: -1px; right: -1px;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: #9ba0a6;
  }
  .mobile-dm-item .dm-dot.online { background: #1D9E75; }
  .mobile-dm-item .dm-dot.away { background: #faa61a; }
  .mobile-dm-item .dm-dot.busy { background: #ed4245; }
  .mobile-dm-item .you-label { color: var(--text-muted); font-size: 13px; font-weight: 400; }

  .mobile-add-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
  }
  .mh-empty {
    padding: 14px 0;
    color: var(--text-muted);
    font-size: 13px;
  }
}

/* ---------- Bottom nav: Slack 5-tab style ---------- */
@media (max-width: 768px) {
  forge-bottom-nav { display: block; }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--surface) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .bottom-nav .tab.active { color: var(--text); }
  .bottom-nav .tab.active .icon {
    background: var(--brand-faint);
    border-radius: 14px;
    padding: 3px 14px;
  }
  .bottom-nav .tab .icon {
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }
  .bottom-nav .tab [data-lucide] {
    width: 22px; height: 22px;
  }
}

/* ---------- More menu ---------- */
forge-more-menu { display: block; min-height: 100vh; background: var(--bg, var(--surface)); }
.more-menu {
  padding: 16px 16px 80px;
  padding-top: max(16px, env(safe-area-inset-top));
  max-width: 720px;
  margin: 0 auto;
}
.more-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 6px 18px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 14px;
}
.more-header img { width: 48px; height: 48px; border-radius: 12px; }
.more-header strong { font-size: 18px; display: block; font-weight: 700; }
.more-header span { font-size: 13px; color: var(--text-muted); }
.more-section {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-bottom: 0.5px solid var(--border);
}
.more-section .more-item:last-child { border-bottom: none; }
.more-item:active { background: var(--surface-alt); }
.more-item [data-lucide] { color: var(--text-muted); }
.more-item.logout { color: #ed4245; }
.more-item.logout [data-lucide] { color: #ed4245; }

/* ---------- Search view ---------- */
forge-search-view { display: block; min-height: 100vh; background: var(--surface); }
.search-view { padding-bottom: 80px; max-width: 720px; margin: 0 auto; }
.sv-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid var(--border);
}
[data-theme="dark"] .sv-head { background: rgba(26,27,35,0.9); }
.sv-back {
  background: none; border: none; padding: 6px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.sv-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}
.sv-input-wrap [data-lucide] { color: var(--text-muted); flex-shrink: 0; }
.sv-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.sv-clear { background: none; border: none; color: var(--text-muted); cursor: pointer; }
.sv-body { padding: 12px 16px; }
.sv-body h5 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin: 14px 0 6px;
  font-weight: 700;
}
.sv-body .sv-row,
.sv-body .sv-recent {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 8px;
  color: var(--text);
  background: none; border: none;
  text-decoration: none;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.sv-body .sv-row:active,
.sv-body .sv-recent:active { background: var(--surface-alt); }
.sv-body .sv-sub {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
}
.sv-body .sv-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; color: var(--text-muted); font-weight: 600;
}
.sv-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- In-chat WhatsApp-style input ---------- */
@media (max-width: 768px) {
  body.in-chat .chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 0.5px solid var(--border);
  }
  body.in-chat .chat-input-wrap textarea {
    flex: 1;
    background: var(--surface-alt) !important;
    border: 1px solid var(--border) !important;
    border-radius: 22px !important;
    padding: 10px 16px !important;
    font-size: 16px !important;
    color: var(--text);
    resize: none;
    max-height: 120px;
    min-height: 40px;
    outline: none;
  }
}

/* ---------- Desktop: hide all mobile-only elements ---------- */
@media (min-width: 769px) {
  forge-mobile-home,
  forge-bottom-nav,
  .fab,
  .sidebar-backdrop,
  forge-more-menu,
  forge-search-view { display: none !important; }
}

/* Mobile: hide header icon cluster (use bottom nav / More menu instead) */
@media (max-width: 768px) {
  .header .desktop-only-btns { display: none !important; }
  .header .right { gap: 0; }
}
