/* ============================================================
   CollabFlow — app.css
   Design tokens + all component styles
   ============================================================ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --color-primary:      #4f46e5;
  --color-primary-hover:#4338ca;
  --color-primary-light:#ede9fe;
  --color-danger:       #ef4444;
  --color-danger-light: #fee2e2;
  --color-success:      #10b981;
  --color-success-light:#d1fae5;
  --color-warning:      #f59e0b;
  --color-warning-light:#fef3c7;
  --color-info:         #3b82f6;

  --bg-page:      #f8fafc;
  --bg-surface:   #ffffff;
  --bg-muted:     #f1f5f9;
  --bg-hover:     #f8fafc;

  --border:       #e2e8f0;
  --border-focus: #4f46e5;

  --text-primary: #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --text-link:    #4f46e5;

  --sidebar-w:    240px;
  --topbar-h:     56px;

  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    12px;
  --radius-xl:    16px;
  --radius-full:  9999px;

  --shadow-sm:    0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 1px 6px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.12);

  --transition:   0.15s ease;

  --font-base:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-base); color: var(--text-primary); background: var(--bg-page); line-height: 1.5; min-height: 100vh; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, textarea, select, button { outline: none; }
ul, ol { list-style: none; }
svg { flex-shrink: 0; }

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 0.9375rem; font-weight: 600; }

/* ── Layout: App ─────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  transition: width var(--transition), transform var(--transition);
  z-index: 50;
  overflow: hidden;
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .workspace-name,
.sidebar.collapsed .user-name,
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .brand span { display: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-muted); color: var(--text-primary); }

.sidebar-section {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.workspace-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
}
.workspace-btn:hover { background: var(--bg-muted); }

.workspace-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.workspace-name {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--color-primary-light); color: var(--color-primary); }
.nav-item svg { flex-shrink: 0; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-btn { position: relative; }
.notif-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--color-danger);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-full);
  min-width: 16px;
  text-align: center;
}

.user-menu-wrap { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}
.user-menu-btn:hover { background: var(--bg-muted); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.user-dropdown {
  position: absolute;
  bottom: 100%;
  left: 8px;
  right: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  padding: 4px;
  margin-bottom: 4px;
}
.user-dropdown a,
.user-dropdown button { display: block; width: 100%; }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
}
.topbar-search form {
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search svg {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}
.topbar-search input {
  width: 100%;
  height: 34px;
  padding: 0 36px;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition);
}
.topbar-search input:focus {
  background: white;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.topbar-search kbd {
  position: absolute;
  right: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.6875rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-toggle { display: none; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg-muted); color: var(--text-primary); }

.notif-badge-top {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ── Page Content ────────────────────────────────────────── */
.page-content { flex: 1; padding: 24px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.9375rem; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(79,70,229,.25); }

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); text-decoration: none; color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-muted); text-decoration: none; }

.btn-danger {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.label-link { font-weight: 400; color: var(--text-link); font-size: 0.8125rem; }
.label-hint { font-weight: 400; color: var(--text-faint); font-size: 0.8125rem; }

.form-input {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-primary);
  background: white;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-input.is-invalid { border-color: var(--color-danger); }
.form-error { font-size: 0.8125rem; color: var(--color-danger); margin-top: 4px; }

textarea.form-input { height: auto; padding: 8px 12px; resize: vertical; }
select.form-input { cursor: pointer; }

.input-with-toggle { position: relative; }
.input-with-toggle .form-input { padding-right: 40px; }
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 2px;
  cursor: pointer;
}
.toggle-password:hover { color: var(--text-muted); }

.form-check { display: flex; align-items: center; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 0;
}
.checkbox-label input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown-menu {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 160px;
  z-index: 200;
}
.dropdown-item, .dropdown-link {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  text-decoration: none;
  transition: background var(--transition);
}
.dropdown-item:hover, .dropdown-link:hover { background: var(--bg-muted); text-decoration: none; }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-light); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-wrap { position: relative; }

/* ── Modals ──────────────────────────────────────────────── */
dialog.modal {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 90vw;
  width: 500px;
}
dialog.modal::backdrop { background: rgba(0,0,0,.4); backdrop-filter: blur(2px); }
.modal-content { padding: 24px; }
.modal-content.modal-sm { width: 380px; }
.modal-title { font-size: 1.0625rem; font-weight: 600; margin-bottom: 16px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── Flash Messages ──────────────────────────────────────── */
.flash-container {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flash {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
}
.flash-success { background: var(--color-success-light); color: #065f46; }
.flash-error   { background: var(--color-danger-light);  color: #991b1b; }
.flash-info    { background: #dbeafe; color: #1e40af; }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  color: inherit;
  padding: 0 2px;
}
.flash-close:hover { opacity: 1; }

/* ── Cards / Surfaces ────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ── Dashboard ───────────────────────────────────────────── */
.dashboard-alert {
  background: var(--color-warning-light);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  flex-wrap: wrap;
  color: #92400e;
}
.overdue-link { color: var(--color-danger); font-weight: 600; }
.overdue-date { color: var(--text-muted); font-size: 0.8125rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dashboard-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.dashboard-card.full-width { grid-column: 1 / -1; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 0.9375rem; }
.card-link { font-size: 0.8125rem; color: var(--text-link); }

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
}
.workspace-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.workspace-card:hover { border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-light); text-decoration: none; }
.workspace-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workspace-card-info strong { display: block; font-size: 0.875rem; }
.workspace-card-info span { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.workspace-card-new .workspace-new-icon { background: var(--bg-muted); color: var(--text-muted); font-size: 1.25rem; }

.role-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--bg-muted);
  color: var(--text-muted);
}
.role-owner  { background: var(--color-primary-light); color: var(--color-primary); }
.role-admin  { background: #fef3c7; color: #d97706; }
.role-editor { background: #d1fae5; color: #065f46; }

.task-list { overflow-y: auto; }
.task-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: none; }
.task-title { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.task-title:hover { text-decoration: underline; }
.task-meta { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; }
.task-due.text-danger { color: var(--color-danger); font-weight: 600; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.priority-dot.priority-critical { background: #7c3aed; }
.priority-dot.priority-high { background: var(--color-danger); }
.priority-dot.priority-medium { background: var(--color-warning); }
.priority-dot.priority-low { background: var(--color-success); }

.activity-feed { overflow-y: auto; max-height: 360px; }
.activity-item { display: flex; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-avatar { flex-shrink: 0; }
.activity-avatar img, .avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-fallback {
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-content { font-size: 0.8125rem; }
.activity-time { display: block; color: var(--text-faint); font-size: 0.75rem; margin-top: 2px; }

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Kanban Board ────────────────────────────────────────── */
.board-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

.board-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.board-topbar-left, .board-topbar-right { display: flex; align-items: center; gap: 8px; }

.back-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}
.back-link:hover { color: var(--text-primary); }
.board-title {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.board-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.board-search {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-family: inherit;
  width: 180px;
  background: var(--bg-muted);
}
.board-search:focus { outline: none; border-color: var(--border-focus); background: white; }
.board-filter-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
}
.filter-check { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; }

.board-columns-wrap {
  flex: 1;
  overflow-x: auto;
  padding: 16px;
}
.board-columns {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-height: 100%;
}

.board-column {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  max-height: calc(100vh - 180px);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.column-header-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.column-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.column-name { font-size: 0.875rem; font-weight: 600; truncate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.column-actions { display: flex; gap: 2px; }

.column-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.column-cards.drag-over { background: var(--color-primary-light); border-radius: var(--radius); }

.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
  position: relative;
}
.kanban-card:hover { box-shadow: var(--shadow); border-color: #c7d2fe; }
.kanban-card.dragging { opacity: 0.4; box-shadow: var(--shadow-lg); }
.kanban-card.overdue { border-left: 3px solid var(--color-danger); }

.card-ghost {
  background: var(--color-primary-light);
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius);
  margin: 4px 0;
}

.card-cover { height: 6px; border-radius: 4px 4px 0 0; margin: -10px -12px 8px; }

.card-labels { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.card-label { height: 6px; width: 32px; border-radius: 3px; }

.card-title-link { text-decoration: none; display: block; }
.card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.card-due {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.card-due.overdue { color: var(--color-danger); }
.card-priority {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.priority-critical { background: #ede9fe; color: #7c3aed; }
.priority-high { background: var(--color-danger-light); color: var(--color-danger); }
.priority-medium { background: var(--color-warning-light); color: #d97706; }
.priority-low { background: var(--color-success-light); color: var(--color-success); }
.priority-none { display: none; }

.card-badges { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.card-badge {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.card-badge.done { color: var(--color-success); }

.card-assignees { display: flex; gap: 3px; margin-top: 6px; }
.assignee-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 2px solid white; }
.assignee-fallback {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}
.assignee-more { font-size: 0.6875rem; color: var(--text-muted); align-self: center; }

.add-card-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), color var(--transition);
}
.add-card-inline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.add-column-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,255,255,.7);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all var(--transition);
}
.add-column-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: white; }
.column-add-wrap { flex-shrink: 0; }
.column-context-menu { position: fixed; z-index: 300; }

/* ── Workspace Views ─────────────────────────────────────── */
.ws-boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.board-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.board-card:hover { box-shadow: var(--shadow); border-color: var(--color-primary); text-decoration: none; }
.board-card-name { font-weight: 600; font-size: 0.9375rem; }
.board-card-meta { font-size: 0.8125rem; color: var(--text-muted); }

/* ── File Manager ────────────────────────────────────────── */
.file-layout { display: flex; gap: 0; height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.file-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: white;
  padding: 16px 12px;
  overflow-y: auto;
}
.file-main { flex: 1; overflow-y: auto; padding: 20px; }

.folder-tree { list-style: none; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
}
.folder-item:hover { background: var(--bg-muted); text-decoration: none; }
.folder-item.active { background: var(--color-primary-light); color: var(--color-primary); }

.file-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.file-toolbar-right { margin-left: auto; display: flex; gap: 8px; }

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.file-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.file-card:hover { box-shadow: var(--shadow); border-color: var(--color-primary); }
.file-card-thumb {
  height: 100px;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-card-info { padding: 8px; }
.file-card-name {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-card-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 20px;
}
.upload-zone.drag-over { border-color: var(--color-primary); background: var(--color-primary-light); color: var(--color-primary); }
.upload-zone:hover { border-color: var(--color-primary); }

/* ── Whiteboard Index ────────────────────────────────────── */
.wb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.wb-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: white;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.wb-card:hover { box-shadow: var(--shadow); border-color: var(--color-primary); text-decoration: none; }
.wb-card-preview {
  height: 120px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.wb-card-info { padding: 12px; }
.wb-card-title { font-weight: 600; font-size: 0.9375rem; }
.wb-card-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Search ──────────────────────────────────────────────── */
.search-results { display: flex; flex-direction: column; gap: 4px; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.search-result-item:hover { border-color: var(--color-primary); text-decoration: none; }
.search-result-icon { width: 32px; height: 32px; border-radius: var(--radius); background: var(--bg-muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.search-result-name { font-weight: 500; font-size: 0.875rem; }
.search-result-meta { font-size: 0.8125rem; color: var(--text-muted); }
.search-type-tag {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  color: var(--text-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Settings ────────────────────────────────────────────── */
.settings-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.settings-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.settings-section-body { padding: 20px; }

.members-list { display: flex; flex-direction: column; gap: 2px; }
.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
}
.member-item:hover { background: var(--bg-muted); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 500; font-size: 0.875rem; }
.member-email { font-size: 0.8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role select { font-size: 0.8125rem; font-family: inherit; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 6px; cursor: pointer; }

/* ── Notifications ───────────────────────────────────────── */
.notifications-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-muted); }
.notif-item.unread { background: #f8f9ff; border-left: 3px solid var(--color-primary); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--color-primary-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-body { flex: 1; }
.notif-title { font-size: 0.875rem; font-weight: 500; }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Profile ─────────────────────────────────────────────── */
.profile-layout { max-width: 640px; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-page);
}
.auth-container { width: 100%; max-width: 400px; }
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}
.auth-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-title { font-size: 1.5rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 0.9375rem; }
.auth-footer { text-align: center; font-size: 0.875rem; color: var(--text-muted); margin-top: 20px; }

/* ── Error Page ──────────────────────────────────────────── */
.error-layout { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.error-container { text-align: center; max-width: 480px; }
.error-code { font-size: 6rem; font-weight: 800; color: var(--border); line-height: 1; }
.error-title { font-size: 1.5rem; margin-bottom: 12px; }
.error-message { color: var(--text-muted); margin-bottom: 24px; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Whiteboard Layout ───────────────────────────────────── */
.whiteboard-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f8fafc;
}
.wb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  overflow: hidden;
}
.wb-toolbar-left, .wb-toolbar-right { display: flex; align-items: center; gap: 6px; }
.wb-title { font-size: 0.9375rem; font-weight: 600; }
.wb-back-btn {
  display: flex;
  align-items: center;
  padding: 5px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
}
.wb-back-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.wb-save-status { font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }

.wb-tools { display: flex; align-items: center; gap: 2px; background: var(--bg-muted); border-radius: var(--radius); padding: 3px; }
.wb-tool {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.wb-tool:hover { background: white; color: var(--text-primary); }
.wb-tool.active { background: white; color: var(--color-primary); box-shadow: var(--shadow-sm); }
.tool-sep { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); }

.wb-style-panel { display: flex; align-items: center; gap: 10px; padding: 0 6px; flex-wrap: wrap; }
.style-group { display: flex; align-items: center; gap: 6px; }
.style-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.color-swatches { display: flex; gap: 3px; }
.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition);
}
.color-swatch:hover, .color-swatch.active { border-color: var(--color-primary); transform: scale(1.15); }
.style-select {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: inherit;
  background: white;
  cursor: pointer;
}
.zoom-display { font-size: 0.8125rem; color: var(--text-muted); min-width: 42px; text-align: center; }
.toggle-label { display: flex; align-items: center; gap: 5px; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; }

.wb-canvas-wrap { flex: 1; position: relative; overflow: hidden; cursor: crosshair; }
#wbCanvas { display: block; width: 100%; height: 100%; }

.wb-text-input {
  position: absolute;
  background: transparent;
  border: 1.5px dashed var(--color-primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: inherit;
  resize: none;
  min-width: 120px;
  min-height: 30px;
  color: var(--text-primary);
  z-index: 10;
}

.wb-properties {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
.properties-row { display: flex; gap: 8px; align-items: center; }
.prop-input {
  width: 60px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  text-align: right;
}

.versions-list { max-height: 400px; overflow-y: auto; }
.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.version-item:last-child { border-bottom: none; }
.version-info { font-size: 0.875rem; }
.version-info strong { display: block; }
.version-label { color: var(--text-muted); font-size: 0.8125rem; }
.version-meta { color: var(--text-faint); font-size: 0.75rem; display: block; margin-top: 2px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 100;
  }
  .sidebar.mobile-open { transform: none; }

  .topbar-toggle { display: flex; }
  .main-content { margin-left: 0 !important; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-card.full-width { grid-column: 1; }
  .board-filter-bar { display: none; }
  .wb-style-panel { display: none; }
}

/* ── Utils ───────────────────────────────────────────────── */
.text-danger { color: var(--color-danger) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--color-success) !important; }
.hidden { display: none !important; }
.loading { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
