/* Phorge Redesign — Notion-inspired polish */
/* Color tokens preserved from Mattermost-aligned theme */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&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 — PRESERVED */
  --accent: #0366D6;
  --accent-hover: #024EA4;

  /* Border — PRESERVED */
  --border: #DAE1E9;
  --border-focus: #0366D6;

  /* Sidebar — PRESERVED */
  --sidebar-bg: #EDF2F7;
  --sidebar-text: #4E5C6E;
  --sidebar-active-bg: #0366D6;
  --sidebar-active-text: #FFFFFF;

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

  /* Priority — PRESERVED */
  --priority-crit: #ED2651;
  --priority-high: #F08A24;
  --priority-norm: #0366D6;
  --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 — Notion-like softness */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --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: 'Plus Jakarta Sans', -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: #4DA3FF;
  --accent-hover: #6BB5FF;
  --border: #2A2F3E;
  --border-focus: #4DA3FF;
  --sidebar-bg: #08090C;
  --sidebar-text: #9AACBE;
  --sidebar-active-bg: #1A3A5C;
  --sidebar-active-text: #FFFFFF;
  --status-success: #2EAE6A;
  --status-running: #4DD4FF;
  --status-danger: #FF4D6D;
  --status-review: #B47EFF;
  --status-open: #4DA3FF;
  --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 pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

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(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.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(--text-tertiary);
  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: all 120ms ease;
  text-decoration: none;
  line-height: 32px;
}

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

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

.sidebar-item .icon {
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-size: 15px;
}

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

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

.sidebar-divider {
  height: 1px;
  background: var(--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: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  background: var(--bg-page);
  z-index: 10;
}

.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: 10px;
  padding: 9px 16px;
  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-6) var(--space-7);
}

/* ─── 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 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 120ms 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-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: var(--radius-md);
  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; }

/* ─── Empty / zero states ─── */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-6);
  color: var(--text-tertiary);
  font-size: 15px;
}

/* ─── Modal Backdrop ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

@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 ─── */
.form-modal {
  width: 520px;
  max-width: 90vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 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 24px 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: 12px 24px 20px;
  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 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  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 ─── */
.forge-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.forge-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;
}

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

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

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

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

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

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

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

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

.forge-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;
}

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

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

.forge-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;
}

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

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

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

/* Status pill in dropdown */
.forge-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 .forge-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 ─── */
.forge-th-check,
.forge-td-check {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: center;
  padding: 10px 8px;
}

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

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

.user-switcher-wrap .forge-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;
}

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

@media (max-width: 767px) {
  .sidebar { display: none; }
  .detail-layout { grid-template-columns: 1fr; }
  .board { flex-direction: column; }
  .board-column { min-width: 100%; max-width: 100%; }
  .doc-layout { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr; }
  .content { padding: var(--space-4) var(--space-4); }
  .search-box { min-width: 200px; }
}
