/* ══════════════════════════════════════════════════════════════════════════
   Meridian Boards — Main CSS
   Design: Clean dark-on-white, professional SaaS, Inter/system fonts
   ══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Brand */
  --indigo-50:  #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
  --indigo-900: #312e81;

  /* Grays */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger:  #ef4444;
  --color-info:    #3b82f6;

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 56px;
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
}

html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-900); line-height: 1.5; }

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

/* ── Boot spinner ─────────────────────────────────────────────────────────── */
.boot-spinner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 16px; color: var(--gray-500);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--indigo-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--indigo-600);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo-text { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.sidebar-logo-sub { font-size: 10px; color: var(--gray-400); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-section { padding: 8px 12px 4px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--gray-500); padding: 0 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--gray-300);
  transition: background .15s, color .15s;
  user-select: none;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--indigo-600); color: #fff; }
.nav-item-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item-label { flex: 1; }
.nav-item-badge {
  background: rgba(255,255,255,.15); color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px;
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.user-pill:hover { background: rgba(255,255,255,.07); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
  background: var(--indigo-500);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.user-pill-info { flex: 1; min-width: 0; }
.user-pill-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill-role { font-size: 11px; color: var(--gray-400); }

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

.topbar {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.topbar-subtitle { font-size: 13px; color: var(--gray-500); }
.topbar-spacer { flex: 1; }

.page-body { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.card-subtitle { font-size: 12px; color: var(--gray-500); margin-top: 1px; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ── Grid layouts ─────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.cards-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.page-grid   { display: grid; grid-template-columns: 1fr; gap: 24px; }

/* ── Stat card ────────────────────────────────────────────────────────────── */
.stat-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.stat-card-icon  { font-size: 20px; }
.stat-card-header { display: flex; justify-content: space-between; align-items: flex-start; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--indigo-600); color: #fff; border-color: var(--indigo-600); }
.btn-primary:hover:not(:disabled) { background: var(--indigo-700); border-color: var(--indigo-700); }
.btn-secondary { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-400); }
.btn-danger { background: #fff; color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-ghost { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--gray-800); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-icon { padding: 7px; }

/* ── Form controls ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--indigo-500);
  box-shadow: 0 0 0 3px var(--indigo-100);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--gray-500); }
.form-error { font-size: 11px; color: var(--color-danger); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  animation: slideUp .2s ease;
  max-height: 90vh;
  display: flex; flex-direction: column;
}
.modal-lg { max-width: 720px; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 20px; padding: 2px; border-radius: 4px; }
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-yellow  { background: #fef3c7; color: #92400e; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-purple  { background: #ede9fe; color: #7c3aed; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-indigo  { background: var(--indigo-100); color: var(--indigo-700); }
.badge-orange  { background: #ffedd5; color: #c2410c; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; display: flex; align-items: flex-start; gap: 10px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center; color: var(--gray-500);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; max-width: 320px; }

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.breadcrumb-item { color: var(--gray-500); cursor: pointer; }
.breadcrumb-item:hover { color: var(--indigo-600); text-decoration: underline; }
.breadcrumb-item.active { color: var(--gray-800); font-weight: 500; cursor: default; }
.breadcrumb-item.active:hover { text-decoration: none; }
.breadcrumb-sep { color: var(--gray-300); }

/* ── Status dot ───────────────────────────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.active  { background: var(--color-success); }
.status-dot.suspended { background: var(--color-danger); }
.status-dot.inactive { background: var(--gray-400); }

/* ── Section headers ──────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.section-desc { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--gray-200); margin-bottom: 24px; }
.tab {
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--gray-800); }
.tab.active { color: var(--indigo-600); border-bottom-color: var(--indigo-600); font-weight: 600; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--indigo-900) 0%, var(--indigo-700) 50%, var(--indigo-600) 100%);
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.login-brand { max-width: 480px; }
.login-brand-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-brand-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,.15); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; color: #fff;
}
.login-brand-name { font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.login-brand-tagline { font-size: 32px; font-weight: 700; color: #fff; line-height: 1.25; margin-bottom: 16px; letter-spacing: -.5px; }
.login-brand-sub { font-size: 16px; color: rgba(255,255,255,.7); line-height: 1.6; }
.login-features { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.login-feature { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.85); font-size: 14px; }
.login-feature-icon { width: 28px; height: 28px; background: rgba(255,255,255,.15); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

.login-right {
  width: 440px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.login-form-container { width: 100%; max-width: 360px; }
.login-form-title { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; letter-spacing: -.3px; }
.login-form-subtitle { font-size: 13px; color: var(--gray-500); margin-bottom: 32px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-footer { margin-top: 24px; text-align: center; font-size: 12px; color: var(--gray-400); }

/* ── Org card ─────────────────────────────────────────────────────────────── */
.org-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 20px;
  cursor: pointer; transition: all .2s;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.org-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--indigo-500);
}
.org-card:hover { border-color: var(--indigo-200); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.org-card-name { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.org-card-slug { font-size: 11px; color: var(--gray-400); font-family: monospace; margin-bottom: 12px; }
.org-card-stats { display: flex; gap: 16px; }
.org-card-stat { font-size: 12px; color: var(--gray-500); }
.org-card-stat strong { color: var(--gray-800); font-weight: 600; }
.org-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-100); }

/* ── Team card ────────────────────────────────────────────────────────────── */
.team-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 20px;
  cursor: pointer; transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.team-card:hover { border-color: var(--indigo-200); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.team-card-name { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.team-card-desc { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; min-height: 32px; }
.team-card-stats { display: flex; gap: 16px; }

/* ── Project card ─────────────────────────────────────────────────────────── */
.project-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 20px;
  cursor: pointer; transition: all .2s;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.project-card:hover { border-color: var(--indigo-200); box-shadow: var(--shadow-md); }
.project-card-key {
  font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--indigo-600); background: var(--indigo-50);
  padding: 2px 8px; border-radius: 4px;
  display: inline-block; margin-bottom: 8px;
}
.project-card-name { font-size: 15px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.project-card-desc { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; min-height: 32px; }
.project-card-team { font-size: 11px; color: var(--gray-400); display: flex; align-items: center; gap: 4px; }

/* ── Member row ───────────────────────────────────────────────────────────── */
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.member-row:last-child { border-bottom: none; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 500; color: var(--gray-800); }
.member-email { font-size: 12px; color: var(--gray-400); }

/* ── Search & filter bar ──────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 14px; }
.search-input { padding-left: 34px !important; }

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

/* ── Text utils ───────────────────────────────────────────────────────────── */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-center { text-align: center; }
.font-mono { font-family: 'SF Mono', Consolas, monospace; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ── Inline actions ───────────────────────────────────────────────────────── */
.row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
tbody tr:hover .row-actions { opacity: 1; }

/* ── Loading overlay ──────────────────────────────────────────────────────── */
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--gray-400);
}

/* ── Role colors ──────────────────────────────────────────────────────────── */
.role-super_admin { background: #1e1b4b; color: #a5b4fc; }
.role-org_admin   { background: var(--indigo-100); color: var(--indigo-700); }
.role-team_admin  { background: #e0f2fe; color: #0369a1; }
.role-member      { background: var(--gray-100); color: var(--gray-600); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .login-left { display: none; }
  .login-right { width: 100%; }
  .sidebar { width: 200px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Phase 2: Work Items, Backlog, Detail Panel
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Work Item List Row ───────────────────────────────────────────────────── */
.wi-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.wi-list-row:last-child { border-bottom: none; }
.wi-list-row:hover { background: var(--indigo-50); }

/* ── Project Layout (normal / split with detail panel) ───────────────────── */
.project-layout-full { width: 100%; }
.project-layout-split {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 0;
  height: 100%;
  overflow: hidden;
}
.project-main-area { overflow-y: auto; min-width: 0; }
.project-detail-panel-wrap {
  border-left: 1px solid var(--gray-200);
  background: #fff;
  overflow-y: auto;
  height: 100%;
}

/* ── Work Item Detail Panel ──────────────────────────────────────────────── */
.wi-detail-panel { display: flex; flex-direction: column; height: 100%; }
.wi-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--gray-50);
  gap: 12px;
}
.wi-detail-title-area {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.wi-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.4;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.wi-detail-title:hover { background: var(--gray-100); }

.wi-detail-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  flex-direction: column-reverse;
}
@media (min-width: 900px) {
  .wi-detail-body { flex-direction: row; }
}

.wi-detail-sidebar {
  width: 100%;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
  overflow-y: auto;
  background: var(--gray-50);
  flex-shrink: 0;
}
@media (min-width: 900px) {
  .wi-detail-sidebar {
    width: 200px;
    border-top: none;
    border-right: 1px solid var(--gray-200);
    flex-shrink: 0;
  }
}

.wi-detail-main {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  min-width: 0;
}

/* ── Backlog Tree ─────────────────────────────────────────────────────────── */
.backlog-page { display: flex; flex-direction: column; gap: 0; }

.backlog-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 16px;
  flex-wrap: wrap;
}

.backlog-tree-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 8px;
}

.backlog-tree {
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.backlog-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .12s;
  user-select: none;
}
.backlog-row:last-child { border-bottom: none; }
.backlog-row:hover { background: var(--indigo-50); }
.backlog-row-dimmed { opacity: 0.5; }
.backlog-row-dimmed:hover { opacity: 1; }

.backlog-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-size: 12px;
  padding: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background .12s;
}
.backlog-expand-btn:hover { background: var(--gray-200); }

/* ── Green/Purple badge additions ────────────────────────────────────────── */
.badge-green  { background: #d1fae5; color: #059669; }
.badge-yellow { background: #fef9c3; color: #a16207; }

/* green palette is defined inline in JS components */


/* ══════════════════════════════════════════════════════════════════════════
   Phase 3: Sprint Board (Kanban), Sprint Planning, Enhanced Sprints
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Board Page Layout ────────────────────────────────────────────────────── */
.board-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(100vh - 200px);
  min-height: 500px;
}

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
}

.board-sprint-selector {
  display: flex;
  align-items: center;
}

.board-progress-bar {
  width: 80px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.board-progress-fill {
  height: 100%;
  background: var(--indigo-600);
  border-radius: 4px;
  transition: width .3s ease;
}

/* ── Board Columns ─────────────────────────────────────────────────────────── */
.board-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex: 1;
  overflow: hidden;
  align-items: stretch;
}

.board-column {
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .15s, background .15s;
  min-height: 0;
}

.board-column-drag-over {
  border-color: var(--indigo-400);
  background: var(--indigo-50);
}

.board-col-header {
  padding: 12px 14px 10px;
  border-top: 3px solid transparent;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.board-col-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.board-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.board-col-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 1px 7px;
  border-radius: 12px;
  margin-left: 4px;
}

.board-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background .15s;
  min-height: 60px;
}

.board-col-body.drop-active {
  background: rgba(79, 70, 229, 0.04);
}

.board-col-empty {
  text-align: center;
  padding: 24px 10px;
  color: var(--gray-400);
  font-size: 12px;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  transition: all .15s;
}

.board-col-empty-hover {
  border-color: var(--indigo-300);
  background: var(--indigo-50);
  color: var(--indigo-500);
}

/* ── Board Card ─────────────────────────────────────────────────────────────── */
.board-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: grab;
  transition: box-shadow .15s, opacity .15s, transform .15s;
  position: relative;
  user-select: none;
}

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

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

.board-card-dragging {
  opacity: 0.5;
  transform: rotate(2deg) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.board-card-moving {
  opacity: 0.7;
  animation: card-move .3s ease;
}

@keyframes card-move {
  0% { transform: scale(0.95); opacity: 0.5; }
  100% { transform: scale(1); opacity: 0.7; }
}

.board-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.board-card-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.board-card-id {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 600;
}

.board-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 5px;
  word-break: break-word;
}

.board-card-parent {
  font-size: 11px;
  color: var(--gray-400);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--gray-100);
}

.board-card-points {
  font-size: 10px;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-600);
  padding: 1px 6px;
  border-radius: 10px;
}

.board-card-assignee { display: flex; align-items: center; }

.board-card-unassigned {
  font-size: 12px;
  color: var(--gray-300);
}

.board-card-drag-hint {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 14px;
  color: var(--gray-300);
  opacity: 0;
  transition: opacity .15s;
  cursor: grab;
}

.board-card:hover .board-card-drag-hint { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   Sprint Planning Page
   ══════════════════════════════════════════════════════════════════════════ */

.planning-page {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  height: calc(100vh - 200px);
  min-height: 500px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
}

/* ── Planning Sidebar (sprint list) ──────────────────────────────────────── */
.planning-sidebar {
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--gray-50);
}

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

.planning-sprint-list {
  flex: 1;
  overflow-y: auto;
}

.planning-sprint-item {
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid var(--gray-100);
}

.planning-sprint-item:hover { background: var(--gray-100); }
.planning-sprint-item.active { background: var(--indigo-50); border-left: 3px solid var(--indigo-600); }

/* ── Planning Main Area ───────────────────────────────────────────────────── */
.planning-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.planning-sprint-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.planning-sprint-stats {
  display: flex;
  gap: 20px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px 18px;
  flex-shrink: 0;
}

.planning-stat {
  text-align: center;
}

.planning-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
}

.planning-stat-label {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── Two-panel planning layout ───────────────────────────────────────────── */
.planning-panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.planning-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--gray-200);
}

.planning-panel:last-child { border-right: none; }

.planning-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.planning-panel-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 1px 7px;
  border-radius: 10px;
}

.planning-panel-body {
  flex: 1;
  overflow-y: auto;
}

.planning-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--gray-400);
  font-size: 12px;
}

/* ── Planning Center Actions ──────────────────────────────────────────────── */
.planning-center-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-right: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* ── Planning Item Row ───────────────────────────────────────────────────── */
.planning-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .12s;
  cursor: pointer;
}

.planning-item:last-child { border-bottom: none; }
.planning-item:hover { background: var(--gray-50); }
.planning-item-selected { background: var(--indigo-50) !important; }

.planning-item-type {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.planning-item-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.planning-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-item-title:hover { color: var(--indigo-600); text-decoration: underline; }

.planning-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.planning-item-pts {
  font-size: 10px;
  font-weight: 700;
  background: var(--indigo-100);
  color: var(--indigo-700);
  padding: 1px 6px;
  border-radius: 10px;
}

/* ── Green palette for badges ────────────────────────────────────────────── */
.badge-green  { background: #d1fae5; color: #059669; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-purple { background: #ede9fe; color: #7c3aed; }

/* ── More color vars ──────────────────────────────────────────────────────── */
:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-700: #15803d;
}
