: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 h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--brand);
}
.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;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}
.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 { background: linear-gradient(135deg,#f5c744,#efbb3a); color: #6a4d00; }
.role-badge.admin { background: var(--brand-faint); color: var(--brand); }
.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); }

/* 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%; }

/* ----- 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;
}
