/* Phorge Redesign — MoltPod-branded, Notion-inspired polish */
/* MoltPod coral/orange palette + Proxima Nova */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surface — PRESERVED */
  --bg-page: #FFFFFF;
  --bg-secondary: #EDF2F7;
  --bg-tertiary: #D7E0EA;
  --bg-smoke: #F4F7FA;

  /* Text — PRESERVED */
  --text-primary: #111319;
  --text-secondary: #394351;
  --text-tertiary: #66778F;

  /* Accent — MoltPod coral/orange */
  --accent: #e8552e;
  --accent-hover: #c4421f;

  /* Border */
  --border: #DAE1E9;
  --border-focus: #e8552e;

  /* Sidebar — dark with MoltPod orange active */
  --sidebar-bg: #111319;
  --sidebar-text: #9AACBE;
  --sidebar-hover-bg: #1F232E;
  --sidebar-active-bg: #e8552e;
  --sidebar-active-text: #FFFFFF;
  --sidebar-border: #1F232E;
  --sidebar-label-color: #66778F;
  --sidebar-logo-color: #E6E6E6;

  /* Status — PRESERVED */
  --status-success: #3AD984;
  --status-running: #2BC2FF;
  --status-warning: #F5BE31;
  --status-danger: #ED2651;
  --status-review: #9E5CF7;
  --status-open: #e8552e;
  --status-closed: #66778F;

  /* Priority — PRESERVED */
  --priority-crit: #ED2651;
  --priority-high: #F08A24;
  --priority-norm: #e8552e;
  --priority-low: #66778F;
  --priority-wish: #DAE1E9;

  /* Spacing — expanded scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radii — rounder, friendlier */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 100px;

  /* Shadows — layered, softer */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.05), 0 20px 40px rgba(0,0,0,0.06);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 54px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

/* Dark mode — PRESERVED colors */
[data-theme="dark"] {
  --bg-page: #111319;
  --bg-secondary: #1F232E;
  --bg-tertiary: #2A2F3E;
  --bg-smoke: #1A1D27;
  --text-primary: #E6E6E6;
  --text-secondary: #A3B1C2;
  --text-tertiary: #7A8BA0;
  --accent: #ff6b4a;
  --accent-hover: #ff8a70;
  --border: #2A2F3E;
  --border-focus: #ff6b4a;
  --sidebar-bg: #08090C;
  --sidebar-text: #9AACBE;
  --sidebar-bg: #08090C;
  --sidebar-hover-bg: #151820;
  --sidebar-border: #1A1D27;
  --sidebar-label-color: #5A6A7E;
  --sidebar-logo-color: #E6E6E6;
  --sidebar-active-bg: #c4421f;
  --sidebar-active-text: #FFFFFF;
  --status-success: #2EAE6A;
  --status-running: #4DD4FF;
  --status-danger: #FF4D6D;
  --status-review: #B47EFF;
  --status-open: #ff6b4a;
  --status-closed: #8A9BB0;
  --priority-crit: #FF4D6D;
  --priority-high: #FFB060;
  --priority-norm: #4DA3FF;
  --priority-low: #8A9BB0;
  --priority-wish: #394351;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,0.3), 0 30px 40px rgba(0,0,0,0.3);
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pageReveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes staggerFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Skeleton Loaders ─── */

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skel {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 37%, var(--bg-secondary) 63%);
  background-size: 800px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skel-text {
  height: 14px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.skel-text-lg {
  height: 24px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skel-text-sm {
  height: 10px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.skel-circle {
  border-radius: 50%;
  flex-shrink: 0;
}

.skel-rect {
  border-radius: var(--radius-md);
}

.skel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--bg-page);
}

.skel-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
}

.skel-wrap {
  max-width: 1100px;
}

[data-theme="dark"] .skel {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 37%, var(--bg-secondary) 63%);
  background-size: 800px 100%;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Smooth scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ─── Layout ─── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scroll-behavior: smooth;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  animation: sidebarFadeIn 0.4s ease both;
}

/* Staggered fade-in for sidebar items */
@keyframes sidebarFadeIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.sidebar-section .sidebar-item {
  animation: sidebarFadeIn 0.4s ease both;
}

.sidebar-section .sidebar-item:nth-child(1) { animation-delay: 0.04s; }
.sidebar-section .sidebar-item:nth-child(2) { animation-delay: 0.08s; }
.sidebar-section .sidebar-item:nth-child(3) { animation-delay: 0.12s; }
.sidebar-section .sidebar-item:nth-child(4) { animation-delay: 0.16s; }
.sidebar-section .sidebar-item:nth-child(5) { animation-delay: 0.20s; }
.sidebar-section .sidebar-item:nth-child(6) { animation-delay: 0.24s; }
.sidebar-section .sidebar-item:nth-child(7) { animation-delay: 0.28s; }
.sidebar-section .sidebar-item:nth-child(8) { animation-delay: 0.32s; }
.sidebar-section .sidebar-item:nth-child(9) { animation-delay: 0.36s; }
.sidebar-section .sidebar-item:nth-child(10) { animation-delay: 0.40s; }

.sidebar-divider {
  animation: sidebarFadeIn 0.4s ease 0.10s both;
}

.sidebar-tabs {
  animation: sidebarFadeIn 0.4s ease 0.14s both;
}

.sidebar-tab-content {
  animation: sidebarFadeIn 0.5s ease 0.18s both;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--sidebar-logo-color);
  letter-spacing: -0.01em;
}

.sidebar-byline {
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-label-color);
  padding-left: 26px;
}

.sidebar-section {
  padding: var(--space-2) var(--space-3);
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-label-color);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, transform 120ms ease;
  text-decoration: none;
  line-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item:hover {
  background: var(--sidebar-hover-bg);
  text-decoration: none;
  color: #E6E6E6;
}

.sidebar-item:active {
  transform: scale(0.98);
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-item .icon,
.sidebar-item [class^="icon-"],
.sidebar-item [class*=" icon-"] {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.sidebar-item .badge {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-label-color);
  background: var(--sidebar-hover-bg);
  border-radius: var(--radius-pill);
  padding: 0 7px;
  min-width: 22px;
  transition: background 200ms ease, color 200ms ease;
  text-align: center;
  line-height: 20px;
}

.sidebar-item.active .badge {
  background: rgba(255,255,255,0.2);
  color: var(--sidebar-active-text);
}

/* Sidebar doc folders */
.sidebar-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
  line-height: 32px;
}

.sidebar-folder-header:hover {
  background: var(--sidebar-hover-bg);
  color: #E6E6E6;
}

.sidebar-folder-chevron {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-folder.open .sidebar-folder-chevron {
  transform: rotate(90deg);
}

.sidebar-folder-items {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding-left: 12px;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease;
}

.sidebar-folder.open .sidebar-folder-items {
  max-height: 500px;
  opacity: 1;
}

.sidebar-folder {
  animation: sidebarFadeIn 0.4s ease both;
}

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: var(--space-3) var(--space-4);
}

/* ─── Main content area ─── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─── */
.header {
  height: var(--header-height);
  min-height: 72px;
  border-bottom: none;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  background: var(--bg-page);
  z-index: 10;
  transition: box-shadow 0.25s ease;
}

.header.scrolled {
  box-shadow: 0 1px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-center { flex: 1; display: flex; justify-content: center; }

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  min-width: 380px;
  max-width: 480px;
  width: 100%;
  transition: all 200ms ease;
}

.search-box:hover {
  border-color: var(--border);
  background: var(--bg-page);
  box-shadow: var(--shadow-md);
}

.search-box kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  margin-left: auto;
  color: var(--text-tertiary);
}

/* ─── Page content ─── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-7) 200px;
  animation: pageReveal 0.3s ease both;
}

/* ─── View tabs ─── */
.view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-6);
  background: var(--bg-page);
}

.view-tab {
  padding: var(--space-3) var(--space-5);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 100ms, border-color 100ms;
}

.view-tab:hover { color: var(--text-primary); }
.view-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}

.toolbar-btn:hover {
  border-color: var(--text-tertiary);
  background: var(--bg-smoke);
}

.toolbar-spacer { flex: 1; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 150ms ease;
  line-height: 20px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-secondary); }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

/* ─── Kanban Board ─── */
.board {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  flex: 1;
  align-items: flex-start;
}

.board-column {
  min-width: 300px;
  max-width: 340px;
  flex-shrink: 0;
}

.column-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-1);
  margin-bottom: var(--space-3);
}

.column-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.column-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  min-width: 22px;
  text-align: center;
}

.column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 40px;
}

/* ─── Task Card ─── */
.task-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 0px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 200ms ease;
  position: relative;
  border-left: 3px solid transparent;
  animation: fadeInUp 0.35s ease both;
}

.task-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Stagger animation for board cards */
.column-cards > :nth-child(1) { animation-delay: 0.03s; }
.column-cards > :nth-child(2) { animation-delay: 0.06s; }
.column-cards > :nth-child(3) { animation-delay: 0.09s; }
.column-cards > :nth-child(4) { animation-delay: 0.12s; }
.column-cards > :nth-child(5) { animation-delay: 0.15s; }
.column-cards > :nth-child(6) { animation-delay: 0.18s; }

.task-card[data-priority="unbreak_now"] { border-left-color: var(--priority-crit); }
.task-card[data-priority="high"] { border-left-color: var(--priority-high); }
.task-card[data-priority="normal"] { border-left-color: var(--priority-norm); }
.task-card[data-priority="low"] { border-left-color: var(--priority-low); }
.task-card[data-priority="wishlist"] { border-left-color: var(--priority-wish); }
/* Numeric fallbacks for API responses */
.task-card[data-priority="100"] { border-left-color: var(--priority-crit); }
.task-card[data-priority="80"]  { border-left-color: var(--priority-high); }
.task-card[data-priority="50"]  { border-left-color: var(--priority-norm); }
.task-card[data-priority="25"]  { border-left-color: var(--priority-low); }
.task-card[data-priority="0"]   { border-left-color: var(--priority-wish); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.card-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.card-priority {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.card-date {
  font-size: 13px;
  color: var(--text-tertiary);
}

.card-date.overdue { color: var(--status-danger); font-weight: 600; }

.card-labels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.label-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bg-secondary);
}

.card-indicator {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-indicator.muted { opacity: 0.3; }

.card-assignee {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* ─── Avatar ─── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #FFFFFF;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.avatar.human { border-radius: 50%; }
.avatar.agent { border-radius: 6px; }

.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.md { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

.avatar-stack {
  display: flex;
}
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--bg-page); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ─── Presence dot ─── */
.presence {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
  position: absolute;
  bottom: -1px;
  right: -1px;
}

.presence.online { background: var(--status-success); }
.presence.away { background: var(--status-warning); }
.presence.dnd { background: var(--status-danger); }
.presence.offline { background: var(--status-closed); }

/* ─── Status badge ─── */
.status-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.3;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Support both underscore (data values) and hyphen (CSS-clean) class names */
.status-badge.open { color: var(--status-open); background: color-mix(in srgb, var(--status-open) 10%, transparent); }
.status-badge.open::before { background: var(--status-open); }

.status-badge.in-progress,
.status-badge.in_progress { color: var(--status-running); background: color-mix(in srgb, var(--status-running) 10%, transparent); }
.status-badge.in-progress::before,
.status-badge.in_progress::before { background: var(--status-running); animation: pulse 2s ease-in-out infinite; }

.status-badge.blocked { color: var(--status-danger); background: color-mix(in srgb, var(--status-danger) 10%, transparent); }
.status-badge.blocked::before { background: var(--status-danger); }

.status-badge.review { color: var(--status-review); background: color-mix(in srgb, var(--status-review) 10%, transparent); }
.status-badge.review::before { background: var(--status-review); }

.status-badge.closed { color: var(--status-closed); background: color-mix(in srgb, var(--status-closed) 10%, transparent); }
.status-badge.closed::before { background: var(--status-closed); }

/* ─── Section headers ─── */
.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.section-header {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* ─── Task detail page ─── */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
  max-width: 1200px;
}

.detail-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.detail-key {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.detail-controls {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ─── Metadata grid ─── */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-6);
  padding: 20px;
  background: var(--bg-smoke);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.meta-item label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.meta-item .value {
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.meta-item .value.overdue { color: var(--status-danger); }

/* ─── Description ─── */
.description {
  padding: var(--space-5) 0;
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 15px;
}

/* ─── Activity stream ─── */
.activity-tabs {
  display: flex;
  gap: var(--space-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.activity-tab {
  padding: var(--space-2) 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 100ms;
}

.activity-tab.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.activity-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

/* ─── Post / Comment ─── */
.post {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.post-body { flex: 1; }

.post-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.post-time {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-left: var(--space-2);
}

.post-content {
  color: var(--text-primary);
  line-height: 1.65;
  margin-top: 6px;
  font-size: 14px;
}

.post-reactions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  transition: background 100ms;
}

.reaction-chip:hover { background: var(--bg-secondary); }

/* ─── Audit entry ─── */
.audit-entry {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.audit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

/* ─── Sidebar panels (detail page right column) ─── */
.sidebar-panel {
  margin-bottom: var(--space-5);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-action {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

/* ─── Mini card (link targets, subtasks) ─── */
.mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 120ms ease;
}

.mini-card:hover {
  background: var(--bg-smoke);
  box-shadow: var(--shadow-sm);
}

.mini-card .mini-key {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.mini-card .mini-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── File item ─── */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 100ms;
}

.file-item:hover { background: var(--bg-smoke); }
.file-item .file-size { color: var(--text-tertiary); margin-left: auto; font-size: 13px; }

/* ─── Project card (grid) ─── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.project-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 200ms ease;
  animation: fadeInUp 0.35s ease both;
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Stagger project cards */
.project-grid > :nth-child(1) { animation-delay: 0.03s; }
.project-grid > :nth-child(2) { animation-delay: 0.06s; }
.project-grid > :nth-child(3) { animation-delay: 0.09s; }
.project-grid > :nth-child(4) { animation-delay: 0.12s; }
.project-grid > :nth-child(5) { animation-delay: 0.15s; }

.project-icon {
  font-size: 26px;
  margin-bottom: var(--space-2);
}

.project-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: var(--space-2);
}

.project-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}

.project-stats {
  display: flex;
  gap: var(--space-5);
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

/* ─── Comment box ─── */
.comment-box {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
}

.comment-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px var(--space-4);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  resize: vertical;
  min-height: 44px;
  line-height: 1.5;
  transition: border-color 150ms, box-shadow 150ms;
}

.comment-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 15%, transparent);
}

/* ─── My Work page ─── */
.my-work-section {
  margin-bottom: var(--space-7);
}

.my-work-section .section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.task-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 10px var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 100ms;
  animation: fadeInUp 0.3s ease both;
}

/* Stagger list items */
.my-work-section > .task-list-item:nth-child(2) { animation-delay: 0.02s; }
.my-work-section > .task-list-item:nth-child(3) { animation-delay: 0.04s; }
.my-work-section > .task-list-item:nth-child(4) { animation-delay: 0.06s; }
.my-work-section > .task-list-item:nth-child(5) { animation-delay: 0.08s; }
.my-work-section > .task-list-item:nth-child(6) { animation-delay: 0.10s; }

.task-list-item:hover { background: var(--bg-smoke); }

.task-list-key {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  min-width: 85px;
}

.task-list-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list-project {
  font-size: 13px;
  color: var(--text-tertiary);
}

.task-list-date {
  font-size: 13px;
  color: var(--text-tertiary);
  min-width: 70px;
  text-align: right;
}

.task-list-date.overdue { color: var(--status-danger); font-weight: 600; }

/* ─── Document view ─── */
.doc-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-7);
  max-width: 1000px;
}

.doc-body {
  line-height: 1.75;
  color: var(--text-primary);
  font-size: 15px;
}

.doc-body h2 {
  font-size: 22px;
  font-weight: 700;
  margin: var(--space-6) 0 var(--space-3);
  letter-spacing: -0.01em;
}

.doc-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: var(--space-5) 0 var(--space-2);
}

.doc-body p { margin-bottom: var(--space-4); }
.doc-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-secondary);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--status-danger);
}

.doc-toc {
  position: sticky;
  top: var(--space-6);
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.toc-item {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px 0;
  cursor: pointer;
  transition: color 100ms;
}

.toc-item:hover { color: var(--accent); text-decoration: none; }
.toc-item.indent { padding-left: var(--space-5); }

/* ─── Theme toggle ─── */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  transition: background 100ms;
}

.theme-toggle:hover { background: var(--bg-secondary); }

/* ─── Chat link ─── */
.chat-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 120ms ease;
}

.chat-link:hover {
  background: var(--bg-secondary);
  color: var(--accent);
  text-decoration: none;
}

/* ─── User profile ─── */
.profile-header {
  display: flex;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  align-items: center;
}

.profile-info { flex: 1; }

.profile-name {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.profile-handle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.profile-bio {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: var(--space-2);
  line-height: 1.5;
}

.profile-contact {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: var(--space-3);
}

/* ─── Breadcrumb ─── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 14px;
  color: var(--text-tertiary);
}

.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.breadcrumb .sep { margin: 0 4px; }

/* ─── Document Breadcrumbs ─── */

.doc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.doc-crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  text-decoration: none;
  transition: all 120ms ease;
  white-space: nowrap;
}

.doc-crumb i {
  font-size: 14px;
  flex-shrink: 0;
}

.doc-crumb-root {
  color: var(--text-tertiary);
  background: var(--bg-secondary);
}

.doc-crumb-root:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
  text-decoration: none;
}

.doc-crumb-root i {
  font-size: 13px;
}

.doc-crumb-folder {
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.doc-crumb-folder:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
  text-decoration: none;
}

.doc-crumb-current {
  color: var(--text-primary);
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  font-weight: 600;
}

.doc-crumb-current i {
  color: var(--accent);
}

.doc-crumb-sep {
  font-size: 12px;
  color: var(--text-tertiary);
  opacity: 0.5;
  flex-shrink: 0;
  margin: 0 2px;
}

.doc-crumb-project {
  margin-left: auto;
}

.doc-crumb-project a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 120ms ease;
}

.doc-crumb-project a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ─── Empty / zero states ─── */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--text-tertiary);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  grid-column: 1 / -1;
  width: 100%;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-desc {
  font-size: 14px;
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: 1.5;
}

.empty-state-action {
  margin-top: var(--space-2);
}

/* ─── Modal Backdrop ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 0;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  overflow-y: auto;
}

/* When backdrop contains a side panel, it's just an overlay */
.modal-backdrop:has(.form-modal) {
  padding: 0;
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-page);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Search Modal ─── */
.search-modal {
  width: 600px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.search-modal-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.search-modal-icon {
  font-size: 18px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 17px;
  color: var(--text-primary);
  background: transparent;
}

.search-modal-input::placeholder { color: var(--text-tertiary); }

.search-modal-kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--text-tertiary);
}

.search-modal-results {
  overflow-y: auto;
  max-height: calc(70vh - 60px);
  padding: var(--space-2) 0;
}

.search-modal-empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 15px;
}

.search-group-label {
  padding: var(--space-3) 20px var(--space-1);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.search-result-item {
  padding: 10px 20px;
  cursor: pointer;
  transition: background 80ms;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-secondary);
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.search-result-snippet {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Form Modal ─── */
/* ─── Slide-in Side Panel (form modals) ─── */

.form-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  box-shadow: -8px 0 30px rgba(0,0,0,0.12), -2px 0 8px rgba(0,0,0,0.06);
  border-radius: 0;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  z-index: 1001;
  overflow: hidden;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-backdrop.closing {
  animation: fadeOut 0.25s ease both;
  pointer-events: none;
}

.modal-backdrop.closing .form-modal {
  animation: slideOutRight 0.25s cubic-bezier(0.4, 0, 1, 1) both;
}

.form-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 0 28px 20px;
}

.form-modal .modal-header {
  flex-shrink: 0;
}

.form-modal .modal-footer {
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 100ms;
}

.modal-close:hover { background: var(--bg-secondary); }

.modal-body {
  padding: 0 28px 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
}

/* ─── Form Elements ─── */
.form-group {
  margin-bottom: var(--space-4);
  flex: 1;
}

.form-row {
  display: flex;
  gap: var(--space-4);
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  transition: border-color 150ms, box-shadow 150ms;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 15%, transparent);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-select {
  appearance: auto;
}

/* ─── Drag-and-Drop ─── */
.draggable-card {
  cursor: grab;
}

.draggable-card:active {
  cursor: grabbing;
}

.draggable-card.dragging {
  opacity: 0.4;
}

.draggable-card.dragging .task-card {
  pointer-events: none;
}

.board-column.drag-over {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: var(--radius-lg);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* ─── Table View ─── */
.hub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hub-th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 100ms;
}

.hub-th:hover {
  color: var(--text-primary);
}

.sort-arrow {
  font-size: 10px;
  margin-left: 4px;
  color: var(--accent);
}

.hub-tr {
  transition: background 80ms;
}

.hub-tr:hover {
  background: var(--bg-smoke);
}

.hub-tr:nth-child(even) {
  background: var(--bg-secondary);
}

.hub-tr:nth-child(even):hover {
  background: var(--bg-tertiary);
}

.hub-td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-primary);
}

.hub-td-key code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.hub-td-title {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.td-assignee-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.hub-th[data-sort-dir="asc"],
.hub-th[data-sort-dir="desc"] {
  color: var(--text-primary);
  background: var(--bg-smoke);
}

.hub-td.overdue {
  color: var(--status-danger);
  font-weight: 600;
}

.table-filter-row {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: center;
}

.table-filter-input {
  max-width: 280px;
}

.table-filter-select {
  max-width: 160px;
}

/* ─── Inline-editable fields ─── */
.inline-editable-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 100ms;
}

.inline-editable-wrap:hover {
  background: var(--bg-secondary);
}

.inline-display {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.inline-caret {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-left: 2px;
  transition: transform 100ms;
}

.inline-editable-wrap:hover .inline-caret {
  color: var(--text-secondary);
}

/* Hidden native controls (still needed for tests + screen readers) */
.inline-overlay-select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  font-size: 14px;
}

/* Date input: keep clickable so native picker opens */
.inline-overlay-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  font-size: 14px;
}

/* ─── Custom dropdown menu ─── */
.hub-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  padding: 4px 0;
  animation: slideUp 0.12s ease;
}

.hub-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 80ms;
  white-space: nowrap;
}

.hub-dropdown-item:hover,
.hub-dropdown-item.selected {
  background: var(--bg-secondary);
}

.hub-dropdown-item .check-mark {
  width: 16px;
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
}

.hub-dropdown-item .dd-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Status pill in dropdown */
.hub-dropdown-item .dd-label {
  flex: 1;
}

/* ─── Bulk action bar ─── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-page));
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.bulk-bar-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.bulk-bar-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: var(--space-2);
  flex: 1;
}

.bulk-action-wrap {
  position: relative;
}

.bulk-action-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bulk-action-wrap .hub-dropdown {
  min-width: 160px;
  top: 100%;
  left: 0;
  margin-top: 4px;
}

.bulk-bar > .btn-ghost:last-child {
  margin-left: auto;
  color: var(--text-tertiary);
}

.bulk-bar > .btn-ghost:last-child:hover {
  color: var(--text-primary);
}

/* ─── Table checkbox column ─── */
.hub-th-check,
.hub-td-check {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  padding: 10px 8px;
}

.hub-td-check input[type="checkbox"],
.hub-th-check input[type="checkbox"] {
  cursor: pointer;
  width: 15px;
  height: 15px;
}

/* ─── User Switcher ─── */
.user-switcher-wrap {
  position: relative;
  cursor: pointer;
}

.user-switcher-wrap .hub-dropdown {
  right: 0;
  left: auto;
  min-width: 240px;
}

.user-switch-item {
  gap: 10px;
}

.user-switch-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-switch-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.user-switch-title {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-switch-item.current {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.user-switcher-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-switcher-profile {
  font-size: 13px;
  color: var(--text-secondary);
  justify-content: center;
}

/* ─── People ─── */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

.person-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 200ms ease;
  animation: fadeInUp 0.35s ease both;
}

.person-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.person-avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: var(--space-3);
}

.person-avatar-circle.sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.person-avatar-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: var(--space-3);
}

.person-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.person-card-title {
  font-size: 13px;
  color: var(--text-secondary);
}

.person-card-company {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* Label filter pills */
.label-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.label-filter-pill {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 120ms ease;
  border: 1px solid transparent;
}

.label-filter-pill:hover {
  border-color: var(--border);
  background: var(--bg-page);
}

.label-filter-pill.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

/* Colored label chips */
.label-chip.colored {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

/* Inline tag management */
.tag-manager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: var(--space-5);
}

.tag-manager .label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.tag-manager .label-chip .tag-remove {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.6;
  line-height: 1;
  margin-left: 2px;
}

.tag-manager .label-chip .tag-remove:hover {
  opacity: 1;
}

.tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px dashed var(--border);
  background: none;
  cursor: pointer;
  transition: all 120ms ease;
}

.tag-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.tag-input-inline {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
  min-width: 100px;
  font-family: var(--font-sans);
}

.tag-input-inline:focus {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Detail page tabs (Notes / Messages) */
.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.detail-tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 120ms ease;
  font-family: var(--font-sans);
}

.detail-tab:hover {
  color: var(--text-primary);
}

.detail-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.detail-tab .tab-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: 4px;
}

.detail-tab.active .tab-count {
  color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Person detail */
/* ─── Person Detail (redesigned) ─── */

.pd { max-width: 940px; }

.pd-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.pd-back:hover { color: var(--accent); text-decoration: none; }
.pd-back i { font-size: 14px; }

.pd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.pd-identity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.pd-avatar, .pd-avatar-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.pd-avatar-img { object-fit: cover; }

.pd-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.pd-role {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pd-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: var(--space-4);
}

.pd-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.pd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 150ms ease;
}

.pd-chip:hover {
  background: var(--bg-tertiary);
  color: var(--accent);
  text-decoration: none;
}

.pd-chip i { font-size: 14px; color: var(--text-tertiary); }

.pd-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-6);
}

/* Note input */
.pd-note-box {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin-bottom: var(--space-5);
}

.pd-note-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  resize: none;
  transition: border-color 150ms, box-shadow 150ms;
}

.pd-note-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 15%, transparent);
}

.pd-timeline-head {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}

.pd-timeline-count {
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 4px;
}

/* Vertical timeline */
.pd-timeline {
  position: relative;
  padding-left: 24px;
}

.pd-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.pd-tl-item {
  position: relative;
  display: flex;
  gap: var(--space-3);
  padding-bottom: var(--space-5);
}

.pd-tl-item:last-child { padding-bottom: 0; }

.pd-tl-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
  flex-shrink: 0;
  z-index: 1;
}

.pd-tl-dot.inbound { background: var(--status-running); }
.pd-tl-dot.outbound { background: var(--accent); }
.pd-tl-dot.note { background: var(--status-review); }

.pd-tl-content {
  flex: 1;
  min-width: 0;
}

.pd-tl-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pd-tl-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.pd-tl-type i { font-size: 13px; }

.pd-tl-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.pd-tl-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pd-tl-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Sidebar cards */
.pd-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pd-card {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.pd-card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.pd-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.pd-detail-row:last-child { border-bottom: none; }

.pd-detail-label { color: var(--text-tertiary); }
.pd-detail-val { color: var(--text-primary); font-weight: 500; }

.pd-card-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: opacity 150ms;
}

.pd-card-row:hover { opacity: 0.7; text-decoration: none; color: inherit; }
.pd-card-row:last-child { border-bottom: none; }

.pd-card-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-card-count {
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 4px;
  font-size: 11px;
}

/* ── Communication History ── */

.pd-comm-header {
  margin-bottom: var(--space-5);
}

.pd-comm-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-3);
}

.pd-comm-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pd-comm-title i {
  font-size: 18px;
  color: var(--text-tertiary);
}

.pd-comm-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.pd-comm-channels {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pd-comm-channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-page);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 150ms ease;
}

.pd-comm-channel:hover {
  background: var(--bg-secondary);
  border-color: var(--border-focus);
}

.pd-comm-channel.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pd-comm-channel i { font-size: 14px; }

.pd-comm-channel-count {
  font-size: 11px;
  opacity: 0.7;
}

/* Communication Timeline */

.pd-comm-timeline {
  position: relative;
  padding-left: 28px;
}

.pd-comm-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}

.pd-comm-item {
  position: relative;
  padding-bottom: var(--space-4);
}

.pd-comm-item:last-child { padding-bottom: 0; }

.pd-comm-dot {
  position: absolute;
  left: -22px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-page);
  z-index: 1;
}

.pd-comm-dot.outbound { background: var(--accent); }
.pd-comm-dot.inbound { background: var(--status-running); }

.pd-comm-card {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  transition: box-shadow 150ms ease;
}

.pd-comm-card:hover {
  box-shadow: var(--shadow-sm);
}

.pd-comm-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pd-comm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.pd-comm-badge i { font-size: 12px; }

.pd-comm-dir {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pd-comm-dir.outbound { color: var(--accent); }
.pd-comm-dir.inbound { color: var(--status-running); }
.pd-comm-dir i { font-size: 12px; }

.pd-comm-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.pd-comm-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.pd-comm-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty state */
.pd-comm-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}

.pd-comm-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.pd-comm-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.pd-comm-empty-desc {
  font-size: 13px;
}

/* ── Sidebar Notes ── */

.pd-sidebar-note-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.pd-sidebar-note-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-page);
  resize: none;
  transition: border-color 150ms, box-shadow 150ms;
}

.pd-sidebar-note-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 15%, transparent);
}

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

.pd-sidebar-note:last-child { border-bottom: none; }

.pd-sidebar-note-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.pd-sidebar-note-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Legacy compat (keep for other pages using these) */
.person-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-5); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border); }
.person-detail-avatar { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; font-size: 26px; font-weight: 700; color: #FFFFFF; flex-shrink: 0; }
.person-detail-avatar-img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.person-detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-6); }

@media (max-width: 767px) {
  .pd-body { grid-template-columns: 1fr; }
  .pd-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .pd-contact { gap: 6px; }
  .pd-chip { font-size: 12px; padding: 5px 10px; }
  .pd-note-box { flex-direction: column; }
}

/* Section blocks */
.section-block {
  margin-bottom: var(--space-5);
}

/* Timeline */
.timeline-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--bg-secondary);
}

.timeline-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}

.timeline-body {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Relationship badges */
.relationship-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--status-review) 12%, transparent);
  color: var(--status-review);
  text-transform: capitalize;
}

.related-person-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-secondary);
}

.related-person-item:last-child {
  border-bottom: none;
}

/* ─── Events ─── */
/* Legacy events grid (kept for compat) */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

/* ─── Luma-style Events Timeline ─── */

.luma-events {
  max-width: 800px;
}

.luma-events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.luma-events-actions {
  display: flex;
  align-items: center;
}

.luma-tab-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.luma-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 150ms ease;
}

.luma-tab:hover { color: var(--text-primary); }

.luma-tab.active {
  background: var(--bg-page);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.luma-timeline {
  position: relative;
}

.luma-day-group {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0;
  min-height: 0;
}

.luma-day-group + .luma-day-group {
  margin-top: var(--space-5);
}

.luma-date-label {
  padding-top: var(--space-3);
  position: relative;
  padding-right: var(--space-5);
}

.luma-date-label::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.luma-date-main {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.luma-date-weekday {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.luma-day-events {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.luma-ev-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 150ms ease;
  animation: fadeInUp 0.3s ease both;
}

.luma-ev-row:hover {
  background: var(--bg-smoke);
}

.luma-ev-body {
  flex: 1;
  min-width: 0;
}

.luma-ev-time {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.luma-ev-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
}

.luma-ev-organizer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.luma-ev-organizer i {
  font-size: 13px;
  color: var(--text-tertiary);
}

.luma-ev-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.luma-ev-location i {
  font-size: 13px;
}

.luma-ev-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.luma-ev-labels {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.luma-ev-thumb {
  width: 120px;
  height: 90px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.luma-ev-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.luma-ev-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 28px;
  opacity: 0.3;
}

@media (max-width: 767px) {
  .luma-day-group {
    grid-template-columns: 1fr;
  }

  .luma-date-label {
    padding-right: 0;
    padding-bottom: var(--space-2);
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
  }

  .luma-date-label::after { display: none; }

  .luma-ev-thumb {
    width: 80px;
    height: 60px;
  }

  .luma-ev-title { font-size: 15px; }

  .luma-events-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .luma-events-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Event status badges */
.event-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
}

.event-status-badge.draft { color: var(--text-tertiary); background: var(--bg-secondary); }
.event-status-badge.upcoming { color: var(--status-open); background: color-mix(in srgb, var(--status-open) 10%, transparent); }
.event-status-badge.active { color: var(--status-success); background: color-mix(in srgb, var(--status-success) 10%, transparent); }
.event-status-badge.completed { color: var(--status-closed); background: color-mix(in srgb, var(--status-closed) 10%, transparent); }
.event-status-badge.cancelled { color: var(--status-danger); background: color-mix(in srgb, var(--status-danger) 10%, transparent); }

.event-type-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

/* ─── Luma-style Event Detail ─── */

.evd { max-width: 900px; }

.evd-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.evd-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.evd-breadcrumb:hover { color: var(--accent); text-decoration: none; }
.evd-breadcrumb i { font-size: 14px; }

.evd-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.evd-top-right {
  flex-shrink: 0;
  padding-top: 24px;
}

/* Action buttons row */
.evd-actions {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

/* Event detail tabs */
.evd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.evd-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.evd-tab:hover { color: var(--text-primary); }

.evd-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.evd-tab-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  margin-left: 4px;
}

.evd-tab.active .evd-tab-count {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.evd-tab-content {
  display: none;
}

.evd-tab-content.active {
  display: block;
  animation: pageReveal 0.25s ease both;
}

.evd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.evd-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.evd-action-btn i { font-size: 16px; }

/* Two-column body */
.evd-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

/* Left — poster card */
.evd-poster {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.evd-banner {
  height: 200px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.evd-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.evd-banner-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.evd-poster-info {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evd-poster-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.evd-poster-date,
.evd-poster-time,
.evd-poster-loc {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.evd-poster-date i,
.evd-poster-time i,
.evd-poster-loc i {
  font-size: 14px;
  color: var(--text-tertiary);
  width: 16px;
  text-align: center;
}

/* Hosted by */
.evd-hosted {
  margin-top: var(--space-4);
}

.evd-hosted-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.evd-hosted-person {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Luma link */
.evd-luma-row {
  margin-top: var(--space-3);
}

.evd-luma-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.evd-luma-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.evd-labels {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Right — When & Where card */
.evd-when-card {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.evd-when-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.evd-when-row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.evd-when-cal {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  flex-shrink: 0;
}

.evd-when-cal-mon {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1;
}

.evd-when-cal-day {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.evd-when-info { flex: 1; }

.evd-when-date {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.evd-when-time {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.evd-where-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}

.evd-where-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-size: 15px;
  flex-shrink: 0;
}

.evd-where-info { flex: 1; }

.evd-where-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Description card */
.evd-desc-card {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.evd-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.evd-desc-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Guests section */
.evd-section {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.evd-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.evd-section-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.evd-guest-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.evd-guest-count::before {
  content: '\u2022';
  color: var(--status-success);
  margin-right: 4px;
}

.evd-cap {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 8px;
}

.evd-guest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2px;
}

.evd-guest-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  transition: background 120ms ease;
}

.evd-guest-chip:hover { background: var(--bg-smoke); }

.evd-guest-info { flex: 1; min-width: 0; }

.evd-guest-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.evd-guest-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
}

.evd-empty {
  color: var(--text-tertiary);
  font-size: 14px;
  padding: var(--space-4) 0;
}

@media (max-width: 767px) {
  .evd-body { grid-template-columns: 1fr; }
  .evd-title { font-size: 22px; }
  .evd-actions { flex-wrap: wrap; }
  .evd-action-btn { flex: 1; justify-content: center; }
  .evd-guest-grid { grid-template-columns: 1fr; }
}

/* Attendee cards */
.attendee-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bg-secondary);
}

.attendee-card:last-child {
  border-bottom: none;
}

/* Attendee status pills */
.attendee-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  text-transform: capitalize;
}

.attendee-status-pill.confirmed { color: var(--status-success); background: color-mix(in srgb, var(--status-success) 12%, transparent); }
.attendee-status-pill.maybe { color: var(--status-warning); background: color-mix(in srgb, var(--status-warning) 12%, transparent); }
.attendee-status-pill.declined { color: var(--status-danger); background: color-mix(in srgb, var(--status-danger) 12%, transparent); }
.attendee-status-pill.invited { color: var(--text-tertiary); background: var(--bg-secondary); }
.attendee-status-pill.waitlist { color: var(--status-review); background: color-mix(in srgb, var(--status-review) 12%, transparent); }

/* Attendee role badge */
.attendee-role-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: capitalize;
}

/* Luma link styling */
.luma-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 500;
}

.luma-link:hover {
  text-decoration: underline;
}

/* Form textarea */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  resize: vertical;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ─── Responsive ─── */

@media (max-width: 1199px) {
  .sidebar { width: 220px; min-width: 220px; }
  .detail-layout { grid-template-columns: 1fr 280px; }
  .content { padding: var(--space-5) var(--space-6); }
}

/* Tablet */
@media (max-width: 1023px) {
  .content { padding: var(--space-5) var(--space-5); }
  .header { padding: 0 var(--space-4); gap: var(--space-3); }
  .search-box { min-width: 240px; font-size: 13px; }
  .search-box kbd { display: none; }
  .chat-link span,
  .chat-link:not(:first-child) { font-size: 0; }
  .chat-link i { font-size: 16px; }
}

/* Mobile */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .content { padding: var(--space-4) var(--space-4); }

  /* Header — compact mobile layout */
  .header {
    padding: 0 var(--space-3);
    gap: var(--space-2);
    height: 48px;
    min-height: 48px;
  }

  .header-left { display: none; }

  .header-center { justify-content: stretch; }

  .search-box {
    min-width: 0;
    max-width: none;
    padding: 8px 14px;
    font-size: 13px;
    gap: 8px;
  }

  .search-box kbd { display: none; }

  .header-right { gap: var(--space-2); }

  .chat-link {
    padding: 6px 8px;
    font-size: 0;
    gap: 0;
  }

  .chat-link i {
    font-size: 16px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .user-switcher-wrap .avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
  }

  /* Search modal — full width on mobile */
  .search-modal {
    width: 100%;
    max-width: 100vw;
    max-height: 85vh;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .modal-backdrop {
    padding: var(--space-3);
  }

  /* Task list — stack vertically */
  .task-list-item {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3);
  }

  .task-list-key { min-width: auto; font-size: 12px; }
  .task-list-title { min-width: 100%; order: 10; font-size: 14px; }
  .task-list-project { font-size: 12px; }
  .task-list-date { min-width: auto; text-align: left; font-size: 12px; }

  /* Layouts that go single-column */
  .detail-layout { grid-template-columns: 1fr; }
  .person-detail-grid { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }

  /* Board — vertical scroll */
  .board { flex-direction: column; }
  .board-column { min-width: 100%; max-width: 100%; }

  /* Doc TOC — hide on mobile (moves inline) */
  .doc-toc { display: none; }

  /* Breadcrumbs — wrap and shrink */
  .doc-breadcrumbs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .doc-crumb {
    padding: 4px 10px;
    font-size: 12px;
  }

  .doc-crumb-project { margin-left: 0; }

  /* Grids — mobile-friendly columns */
  .people-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .events-grid { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr !important; }

  /* Folder view */
  .folder-hero { gap: var(--space-3); }
  .folder-hero-icon { width: 56px; height: 46px; }
  .folder-hero-overlay { font-size: 18px; }
  .folder-sub-grid { grid-template-columns: 1fr; }

  /* Page title smaller on mobile */
  .page-title { font-size: 22px; }

  /* Form modal — full width on mobile */
  .form-modal {
    width: 100%;
    max-width: 100vw;
    border-radius: 0;
  }

  .form-row { flex-direction: column; gap: 0; }

  /* Profile header — stack on mobile */
  .profile-header { flex-direction: column; text-align: center; }

  /* Mobile menu button */
  .header-left { display: flex !important; }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 100ms;
  }

  .mobile-menu-btn:hover { background: var(--bg-secondary); }

  /* Mobile sidebar slide-in */
  .sidebar.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    min-width: 280px;
    z-index: 2000;
    animation: slideInLeft 0.25s ease both;
  }

  @keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
  }
}

/* Mobile menu button — hidden on desktop */
.mobile-menu-btn { display: none; }

/* Mobile nav overlay */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1999;
  animation: fadeIn 0.2s ease both;
}

/* ─── Sidebar Tabs ─── */

.sidebar-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

.sidebar-tab:hover {
  color: var(--text-secondary);
}

.sidebar-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.sidebar-tab .icon {
  font-size: 14px;
}

.sidebar-tab-content {
  flex: 1;
  overflow-y: auto;
}

/* ─── Docs Landing Page ─── */

.docs-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  gap: var(--space-4);
}

.docs-page-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.docs-page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.docs-view-toggle {
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.docs-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 16px;
}

.docs-view-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.docs-view-btn.active {
  color: var(--text-primary);
  background: var(--bg-page);
  box-shadow: var(--shadow-sm);
}

/* Grid */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.docs-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 72px;
}

.docs-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.docs-card.expanded {
  border-color: var(--accent);
  background: var(--bg-smoke);
}

.docs-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 20px;
  flex-shrink: 0;
}

/* Folder icon with SVG shape + overlaid icon */
.docs-folder-icon-wrap {
  position: relative;
  width: 52px;
  height: 44px;
  flex-shrink: 0;
}

.docs-folder-svg {
  width: 100%;
  height: 100%;
}

.docs-folder-icon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 6px;
  font-size: 17px;
}

/* List view folder icon (smaller) */
.docs-list-folder-icon-wrap {
  position: relative;
  width: 36px;
  height: 30px;
  flex-shrink: 0;
}

.docs-list-folder-svg {
  width: 100%;
  height: 100%;
}

.docs-list-folder-icon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
  font-size: 13px;
}

.docs-card-doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 18px;
  flex-shrink: 0;
}

.docs-card-info {
  flex: 1;
  min-width: 0;
}

.docs-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-card-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.docs-card-project {
  display: flex;
  align-items: center;
  gap: 4px;
}

.docs-card-status {
  flex-shrink: 0;
}

.docs-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
  margin-top: var(--space-4);
}

/* Folder expand */
.docs-folder-expand {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.docs-folder-expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.docs-folder-expand-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

/* List view */
.docs-list-folder {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
  overflow: hidden;
  background: var(--bg-page);
}

.docs-list-folder-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.docs-list-folder-header:hover {
  background: var(--bg-smoke);
}

.docs-list-folder-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.docs-list-folder-header .docs-list-folder-icon-wrap + .docs-list-folder-name {
  margin-left: 2px;
}

.docs-list-folder-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.docs-list-folder-count {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.docs-list-chevron {
  font-size: 14px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.docs-list-folder.expanded .docs-list-chevron {
  transform: rotate(90deg);
}

.docs-list-folder-items {
  display: none;
  border-top: 1px solid var(--border);
}

.docs-list-folder.expanded .docs-list-folder-items {
  display: block;
}

.docs-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-5);
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border);
}

.docs-list-item:last-child {
  border-bottom: none;
}

.docs-list-item:hover {
  background: var(--bg-smoke);
}

.docs-list-item-icon {
  font-size: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.docs-list-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-list-item-project {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.docs-list-item-status {
  flex-shrink: 0;
}

.docs-list-item-time {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

/* ─── Collapsible Sidebar ─── */

.sidebar-collapse-btn {
  position: absolute;
  top: 20px;
  right: 12px;
  background: none;
  border: none;
  color: var(--sidebar-label-color);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1;
  transition: all 150ms ease;
  opacity: 0;
}

.sidebar:hover .sidebar-collapse-btn,
.sidebar.collapsed .sidebar-collapse-btn {
  opacity: 1;
}

.sidebar-collapse-btn:hover {
  color: #E6E6E6;
  background: var(--sidebar-hover-bg);
}

.sidebar-header {
  position: relative;
}

.sidebar.collapsed .sidebar-collapse-btn {
  position: static;
  display: block;
  margin: 0 auto 4px;
}

.sidebar.collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

.sidebar {
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar.collapsed .sidebar-text {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  padding: 14px 8px 8px;
  align-items: center;
}

.sidebar.collapsed .sidebar-logo img {
  margin-right: 0;
}

.sidebar.collapsed .sidebar-section {
  padding: var(--space-2) 8px;
}

.sidebar.collapsed .sidebar-item {
  justify-content: center;
  padding: 8px;
  gap: 0;
}

.sidebar.collapsed .sidebar-item .icon,
.sidebar.collapsed .sidebar-item [class^="icon-"],
.sidebar.collapsed .sidebar-item [class*=" icon-"] {
  width: auto;
  font-size: 18px;
}

.sidebar.collapsed .sidebar-expanded-only {
  display: none !important;
}

.sidebar.collapsed .sidebar-divider {
  margin: var(--space-2) 8px;
}

/* ─── Folder Listing View ─── */

.folder-hero {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.folder-hero-icon {
  position: relative;
  width: 72px;
  height: 60px;
  flex-shrink: 0;
}

.folder-hero-svg {
  width: 100%;
  height: 100%;
}

.folder-hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 8px;
  font-size: 24px;
}

.folder-hero-info .page-title {
  margin-bottom: 4px;
}

.folder-hero-count {
  font-size: 14px;
  color: var(--text-tertiary);
}

.folder-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.folder-sub-section {
  margin-bottom: var(--space-6);
}

.folder-sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.folder-sub-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all 150ms ease;
}

.folder-sub-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.folder-sub-icon-wrap {
  position: relative;
  width: 40px;
  height: 34px;
  flex-shrink: 0;
}

.folder-sub-icon-wrap svg {
  width: 100%;
  height: 100%;
}

.folder-sub-icon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4px;
  font-size: 14px;
}

.folder-sub-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.folder-sub-count {
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.folder-files-section {
  margin-bottom: var(--space-5);
}

.folder-files-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-file-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms ease;
}

.folder-file-row:hover {
  background: var(--bg-smoke);
}

.folder-file-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 17px;
  flex-shrink: 0;
}

.folder-file-info {
  flex: 1;
  min-width: 0;
}

.folder-file-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.folder-file-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.folder-file-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ─── Dashboard v3 ─── */

.dash {
  max-width: 1100px;
}

.dash-header {
  margin-bottom: var(--space-6);
}

.dash-date {
  color: var(--text-tertiary);
  font-size: 15px;
  margin-top: 4px;
}

.dash-row {
  margin-bottom: var(--space-6);
}

.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.dash-section-head h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-section-head h2 i {
  font-size: 18px;
  color: var(--text-tertiary);
}

.dash-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dash-link i { font-size: 13px; }
.dash-link:hover { text-decoration: none; opacity: 0.85; }

/* ── Document carousel ── */

.dash-carousel-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dash-carousel-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.dash-carousel-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.dash-doc-carousel {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -ms-overflow-style: none;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.dash-doc-carousel::-webkit-scrollbar { display: none; }

.dash-doc-card {
  flex-shrink: 0;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-3) var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 150ms ease;
  text-align: center;
  text-decoration: none;
  color: inherit;
  scroll-snap-align: start;
}

.dash-doc-card:hover {
  background: var(--bg-secondary);
  text-decoration: none;
  color: inherit;
}

.dash-doc-card-page {
  position: relative;
  width: 56px;
  height: 68px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 4px 12px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 150ms ease;
}

.dash-doc-card:hover .dash-doc-card-page {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
}

.dash-doc-card-fold {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  background: var(--bg-secondary);
  border-bottom-left-radius: 6px;
  border-left: 1px solid var(--border);
  border-top-right-radius: 11px;
  border-bottom: 1px solid var(--border);
}

.dash-doc-card-new .dash-doc-card-page {
  border-style: dashed;
}

.dash-doc-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
}

.dash-doc-card-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Duo: events timeline + people sidebar ── */

.dash-duo {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.dash-panel {
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* People column (left) — no background */
.dash-people-col {
  /* transparent, no panel styling */
}

/* Events column — no background (legacy) */
.dash-events-col {
  /* transparent, no panel styling */
}

/* Events list */
.dash-ev-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-ev-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 150ms ease;
}

.dash-ev-item:hover {
  background: var(--bg-smoke);
}

.dash-ev-date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  flex-shrink: 0;
  padding-top: 2px;
}

.dash-ev-month {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1;
}

.dash-ev-day {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.dash-ev-weekday {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-ev-info {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.dash-ev-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.dash-ev-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.dash-ev-loc {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-ev-loc i { font-size: 13px; }

/* People list */
.dash-people-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-pl-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-2);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 150ms ease;
}

.dash-pl-row:hover {
  background: var(--bg-secondary);
  text-decoration: none;
  color: inherit;
}

.dash-pl-avatar,
.dash-pl-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.dash-pl-avatar-img { object-fit: cover; }

.dash-pl-info { flex: 1; min-width: 0; }

.dash-pl-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-pl-role {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Projects tiles ── */

.dash-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

.dash-project-tile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-smoke);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all 150ms ease;
}

.dash-project-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.dash-project-tile-icon {
  font-size: 22px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.dash-project-tile-info {
  flex: 1;
  min-width: 0;
}

.dash-project-tile-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-project-tile-stat {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
}

.dashboard-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--space-5);
  font-size: 14px;
}

/* ── Dashboard: People card grid ── */

.dash-people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.dash-person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 200ms ease, transform 200ms ease;
  text-align: center;
}

.dash-person-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.dash-person-avatar,
.dash-person-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.dash-person-avatar-img { object-fit: cover; }

.dash-person-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.dash-person-role {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.3;
}

/* ── Dashboard: Event card grid ── */

.dash-events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.dash-event-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  cursor: pointer;
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.dash-event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dash-event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 58px;
  flex-shrink: 0;
  background: var(--bg-smoke);
  border-radius: var(--radius-md);
  padding: 10px 8px;
}

.dash-event-month {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1;
}

.dash-event-daynum {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.dash-event-weekday {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-event-body {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.dash-event-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.dash-event-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.dash-event-loc {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-event-loc i { font-size: 13px; }

@media (max-width: 767px) {
  .dash-duo { grid-template-columns: 1fr; }
  .dash-doc-card { width: 100px; }
  .dash-project-grid { grid-template-columns: 1fr; }
  .dash-people-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .dash-events-grid { grid-template-columns: 1fr; }
}
