/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active-bg: rgba(232,80,42,0.15);
  --sidebar-active-border: #E8502A;
  --sidebar-text: #ccd6f6;
  --sidebar-muted: #6b7a99;
  --sidebar-section: #4a5568;
  --accent: #E8502A;
  --accent-hover: #d4441f;
  --accent-light: rgba(232,80,42,0.1);
  --content-bg: #f8f9fb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #6ee7b7;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fcd34d;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-border: #93c5fd;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --topbar-height: 56px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.brand-icon {
  font-size: 22px;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
}

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

.sidebar-section-header {
  padding: 14px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 20px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
  color: #ffffff;
  font-weight: 500;
}

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

.sidebar-item .item-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-phase-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 20px 6px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.sidebar-phase-header:hover {
  color: #e2e8f0;
}

.sidebar-phase-header .phase-arrow {
  font-size: 9px;
  transition: transform 0.2s;
  margin-left: auto;
}

.sidebar-phase-header.open .phase-arrow {
  transform: rotate(90deg);
}

.sidebar-subsection {
  padding-left: 16px;
  border-left: 2px solid var(--accent);
  margin-left: 20px;
  margin-right: 8px;
  margin-bottom: 4px;
  display: none;
}

.sidebar-subsection.open {
  display: block;
}

.sidebar-subsection .sidebar-item {
  padding: 6px 12px;
  font-size: 12.5px;
  border-left: 2px solid transparent;
}

.sidebar-subsection .sidebar-item.active {
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  color: var(--sidebar-muted);
  font-size: 11px;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
}

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

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 10;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.breadcrumb-item {
  color: var(--text-secondary);
}

.breadcrumb-item.current {
  color: var(--text);
  font-weight: 500;
}

.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  font-size: 13px;
  color: var(--text-secondary);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--content-bg);
}

.content-area::-webkit-scrollbar {
  width: 6px;
}
.content-area::-webkit-scrollbar-track {
  background: transparent;
}
.content-area::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 15px;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--border);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.stat-trend {
  font-size: 11px;
  margin-top: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ─── Hero Card ──────────────────────────────────────────────────────────────── */
.hero-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  border: none;
  box-shadow: var(--shadow-md);
}

.hero-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-content {
  flex: 1;
}

.hero-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.hero-role {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 12px;
}

.hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #E8502A;
}

.hero-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-green {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid var(--success-border);
}

.badge-blue {
  background: var(--info-bg);
  color: #1e3a8a;
  border: 1px solid var(--info-border);
}

.badge-yellow {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid var(--warning-border);
}

.badge-red {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid var(--danger-border);
}

.badge-orange {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.badge-gray {
  background: #f9fafb;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.badge-purple {
  background: #f5f3ff;
  color: #4c1d95;
  border: 1px solid #c4b5fd;
}

.badge-white {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232,80,42,0.3);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 6px 10px;
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--text);
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

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

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,80,42,0.15);
}

.input::placeholder {
  color: var(--text-muted);
}

.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  appearance: none;
}

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

.inline-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  appearance: none;
  color: var(--text);
  max-width: 140px;
}

/* ─── Filters Bar ────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters-bar .select,
.filters-bar .input {
  max-width: 180px;
  font-size: 13px;
}

.filters-bar .btn {
  height: 34px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

thead th {
  background: #f3f4f6;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover {
  background: #e9eaec;
  color: var(--text);
}

thead th.sorted-asc::after {
  content: ' ↑';
  color: var(--accent);
}

thead th.sorted-desc::after {
  content: ' ↓';
  color: var(--accent);
}

thead th.no-sort {
  cursor: default;
}

thead th.no-sort:hover {
  background: #f3f4f6;
  color: var(--text-secondary);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  font-size: 13px;
  color: var(--text);
}

tbody tr:hover {
  background: #fafafa;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr.selected {
  background: var(--accent-light);
}

.checkbox-cell {
  width: 36px;
  padding-right: 0;
}

.text-muted {
  color: var(--text-muted);
  font-size: 12px;
}

/* ─── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  justify-content: space-between;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Bulk Bar ───────────────────────────────────────────────────────────────── */
.bulk-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.bulk-bar-count {
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.bulk-bar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.bulk-btn {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: white;
  transition: background 0.15s;
}

.bulk-btn:hover {
  background: rgba(255,255,255,0.25);
}

.bulk-select {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: white;
  cursor: pointer;
  appearance: none;
}

.bulk-close {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: white;
  margin-left: auto;
}

.bulk-close:hover {
  background: rgba(0,0,0,0.15);
}

/* ─── Kanban Board ───────────────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 0;
  min-height: 0;
}

.kanban-col {
  background: #f3f4f6;
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.kanban-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.kanban-count {
  background: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.kanban-body {
  flex: 1;
  min-height: 200px;
  transition: background 0.15s;
}

.kanban-body.drag-over {
  background: #e9ecef;
  border-radius: 6px;
}

.kanban-card {
  background: white;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: grab;
  border-left: 3px solid transparent;
  transition: box-shadow 0.15s, transform 0.1s;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
}

.kanban-card:active {
  cursor: grabbing;
  transform: rotate(1deg);
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.kanban-card[data-priority="krytyczny"] {
  border-left-color: var(--danger);
}
.kanban-card[data-priority="wysoki"] {
  border-left-color: var(--accent);
}
.kanban-card[data-priority="planowany"] {
  border-left-color: var(--info);
}
.kanban-card[data-priority="informacja"] {
  border-left-color: var(--success);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.kanban-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.kanban-card-deadline {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

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

.kanban-card-responsible {
  font-size: 11px;
  color: var(--text-secondary);
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
}

/* ─── Progress Bar ───────────────────────────────────────────────────────────── */
.progress-bar-outer {
  background: #e5e7eb;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-inner {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

/* ─── Login Screen ───────────────────────────────────────────────────────────── */
.login-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 60%, #16213e 100%);
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 360px;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 0;
  min-width: 400px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

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

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text);
  background: #f3f4f6;
}

.modal-body {
  padding: 20px 24px;
}

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

/* ─── Toast Notifications ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: white;
  border-left: 4px solid var(--info);
  padding: 12px 16px;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  pointer-events: all;
  min-width: 250px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.toast-message {
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

.toast.hiding {
  animation: fadeOut 0.3s ease forwards;
}

/* ─── Section Headers ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── Dashboard Grid ─────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ─── Status List ────────────────────────────────────────────────────────────── */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

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

.status-list-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-list-value {
  font-weight: 600;
  color: var(--text);
}

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

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

.empty-state-text {
  font-size: 13px;
  max-width: 300px;
}

/* ─── Phase Info Card ────────────────────────────────────────────────────────── */
.phase-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.phase-info-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.phase-info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.phase-info-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Prep Stage ─────────────────────────────────────────────────────────────── */
.prep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.prep-checklist {
  list-style: none;
}

.prep-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

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

.prep-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.prep-check.done {
  background: var(--success);
  color: white;
}

.prep-check.pending {
  background: #e5e7eb;
  color: var(--text-muted);
}

.prep-check.active {
  background: var(--accent);
  color: white;
}

/* ─── Tags ───────────────────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ─── Hamburger & Sidebar Overlay ───────────────────────────────────────────── */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.hamburger:hover { background: var(--hover-bg); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
/* open state */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  .content-area {
    padding: 18px;
  }
  .filters-bar {
    padding: 10px 18px;
  }
  .filters-bar .select,
  .filters-bar .input {
    max-width: 150px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
    --topbar-height: 52px;
  }

  /* ─ Hamburger */
  .hamburger { display: flex; }

  /* ─ Sidebar: off-canvas */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.3);
  }

  /* ─ Main takes full width */
  .main { width: 100%; }

  /* ─ Topbar */
  .topbar { padding: 0 14px; }
  .topbar-user { display: none; }

  /* ─ Content */
  .content-area {
    padding: 14px;
  }

  /* ─ Page header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-header > .btn,
  .page-header > .topbar-actions,
  .page-header > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }

  /* ─ Grids → single column */
  .stats-grid            { grid-template-columns: 1fr 1fr; }
  .kanban-board          { grid-template-columns: 1fr; }
  .prep-grid             { grid-template-columns: 1fr; }
  .phase-info-grid       { grid-template-columns: 1fr; }
  .dashboard-grid        { grid-template-columns: 1fr; }

  /* ─ Filters: scrollable row */
  .filters-bar {
    padding: 10px 14px;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .filters-bar::-webkit-scrollbar { display: none; }
  .filter-group { flex-shrink: 0; }
  .filters-bar .select,
  .filters-bar .input { max-width: 140px; }

  /* ─ Tables */
  .table-wrapper { border-radius: 0; margin: 0 -14px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }

  /* ─ Bulk bar */
  .bulk-bar {
    left: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }

  /* ─ Modal */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    min-width: unset;
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90dvh;
  }

  /* ─ Q&A Apple modal */
  .qam-overlay { padding: 0; align-items: flex-end; }
  .qam-sheet {
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 92dvh;
  }
  .qam-overlay.open .qam-sheet {
    transform: translateY(0) scale(1);
  }

  /* ─ Q&A topbar */
  .qa-topbar { flex-wrap: wrap; gap: 8px; }
  .qa-topbar-actions { width: 100%; justify-content: flex-start; }

  /* ─ Q&A section entry */
  .qa-card-q-row,
  .qa-card-a-row { flex-wrap: wrap; }
  .qa-card-actions { flex-shrink: 0; }

  /* ─ Cards */
  .card { padding: 14px; }

  /* ─ Hero */
  .hero-section { padding: 16px 14px; }
  .hero-stats { gap: 16px; }
}

@media (max-width: 480px) {
  :root { --topbar-height: 50px; }

  .content-area { padding: 10px; }
  .topbar { padding: 0 10px; }

  .stats-grid { grid-template-columns: 1fr; }

  .page-title { font-size: 17px; }

  /* Filters */
  .filters-bar { padding: 8px 10px; }

  /* Buttons in header: icon only on xs */
  .btn-label-xs { display: none; }

  /* Table: tighter */
  thead th, tbody td { padding: 6px 8px; }

  /* Modal sheet */
  .qam-header { padding: 20px 18px 0; }
  .qam-body   { padding: 18px; }
  .qam-footer { padding: 14px 18px 20px; }

  /* Toast */
  .toast-container { bottom: 12px; right: 10px; left: 10px; }
  .toast { min-width: unset; width: 100%; }
}

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-secondary { color: var(--text-secondary); }
.text-muted-color { color: var(--text-muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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


/* ─── Q&A — Claude-style ──────────────────────────────────────────────────── */

:root {
  --qa-bg:       #f9f9f8;
  --qa-surface:  #ffffff;
  --qa-border:   #e5e5e4;
  --qa-q-accent: #d97706;
  --qa-a-accent: #059669;
  --qa-text:     #1a1a18;
  --qa-muted:    #6b7280;
  --qa-radius:   12px;
}

/* wrapper */
.qa-wrap {
  padding: 0 0 80px;
}

/* topbar */
.qa-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 24px 24px 0;
}
.qa-topbar-left { display: flex; align-items: flex-start; gap: 12px; }
.qa-topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.qa-back-btn {
  margin-top: 4px;
  background: none;
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  color: var(--qa-muted);
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.qa-back-btn:hover { background: var(--qa-border); color: var(--qa-text); }

.qa-title { font-size: 22px; font-weight: 700; color: var(--qa-text); margin: 0 0 4px; line-height: 1.3; }
.qa-sub   { font-size: 13px; color: var(--qa-muted); margin: 0; }
.qa-meta-new { color: #d97706; font-weight: 600; }

/* buttons */
.qa-btn-primary {
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.qa-btn-primary:hover { opacity: 0.85; }
.qa-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.qa-btn-ghost {
  background: transparent;
  color: var(--qa-muted);
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.qa-btn-ghost:hover { background: var(--qa-border); color: var(--qa-text); }

/* doc list */
.qa-doc-list { display: flex; flex-direction: column; gap: 0; }

.qa-doc-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--qa-surface);
  border: none;
  border-bottom: 1px solid var(--qa-border);
  border-left: 4px solid #1a1a2e;
  padding: 18px 24px;
  cursor: pointer;
  transition: background 0.12s;
}
.qa-doc-card:hover { background: #fafaf9; }
.qa-doc-card:first-child { border-top: 1px solid var(--qa-border); }

.qa-doc-icon {
  width: 40px; height: 40px;
  background: #1a1a2e;
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  flex-shrink: 0;
}
.qa-doc-card-body { flex: 1; min-width: 0; }
.qa-doc-card-title { font-size: 15px; font-weight: 600; color: var(--qa-text); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.qa-doc-card-meta  { font-size: 12px; color: var(--qa-muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.qa-sep { color: #d1d1cf; }
.qa-doc-card-arrow { color: var(--qa-muted); font-size: 20px; flex-shrink: 0; }

/* empty */
.qa-empty-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center; gap: 12px;
}
.qa-empty-icon { font-size: 40px; color: #d1d1cf; font-weight: 100; line-height: 1; }
.qa-empty-title { font-size: 18px; font-weight: 600; color: var(--qa-text); }
.qa-empty-desc  { font-size: 14px; color: var(--qa-muted); max-width: 380px; line-height: 1.6; }

/* dot badge */
.qa-dot-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #d97706; color: #fff;
  border-radius: 99px; font-size: 10px; font-weight: 700;
}

/* inline badges */
.qa-inline-badge {
  display: inline-block;
  font-size: 9px; font-weight: 700; letter-spacing: 0.6px;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; vertical-align: middle;
}
.qa-badge-new    { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.qa-badge-answer { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* body */
.qa-body { }

/* sections */
.qa-sections { display: flex; flex-direction: column; gap: 0; }

.qa-section {
  background: var(--qa-surface);
  border: none;
  border-top: 1px solid var(--qa-border);
  border-left: 4px solid var(--sec-bar, #6366f1);
  overflow: hidden;
}

.qa-section-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.qa-section-hd:hover { background: #fafaf9; }

.qa-section-chevron {
  color: var(--qa-muted);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.qa-section-chevron.open { transform: rotate(90deg); }

.qa-section-name { font-size: 14px; font-weight: 600; color: var(--qa-text); flex: 1; }
.qa-section-count { font-size: 12px; color: var(--qa-muted); flex-shrink: 0; }
.qa-section-acts { display: flex; gap: 4px; margin-left: 4px; }

.qa-section-body { padding: 0 18px 4px; }
.qa-section-body.collapsed { display: none; }

.qa-no-entries { padding: 20px 0; font-size: 13px; color: var(--qa-muted); }
.qa-link { color: var(--accent, #E8502A); cursor: pointer; text-decoration: underline; }

/* icon buttons */
.qa-icon-btn {
  background: none; border: none; padding: 4px 6px;
  font-size: 13px; color: var(--qa-muted); cursor: pointer;
  border-radius: 6px; line-height: 1;
  transition: background 0.12s, color 0.12s;
}
.qa-icon-btn:hover { background: #f0f0ef; color: var(--qa-text); }
.qa-icon-sm { font-size: 11px; padding: 2px 5px; }
.qa-icon-danger:hover { background: #fef2f2 !important; color: #dc2626 !important; }

/* status pill */
.qa-status-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.qa-status-pill:hover { opacity: 0.8; }
.qa-status-draft    { background: #f3f4f6; color: #6b7280; }
.qa-status-reviewed { background: #dbeafe; color: #1e40af; }
.qa-status-approved { background: #d1fae5; color: #065f46; }

/* status dropdown */
.qa-status-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid var(--qa-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  min-width: 150px;
  padding: 6px 0;
  margin-top: 4px;
}
.qa-status-option {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--qa-text);
  transition: background 0.1s;
}
.qa-status-option:hover { background: #f9f9f8; }
.qa-status-option.active { font-weight: 600; background: #f9f9f8; }

/* ── Entry CARD ─────────────────────────────────────── */
.qa-section-body { padding: 8px 20px 12px; }

.qa-entry-card {
  background: var(--qa-surface);
  border: none;
  border-bottom: 1px solid var(--qa-border);
  border-left: 3px solid var(--entry-bar, #6366f1);
  margin-bottom: 0;
  overflow: hidden;
}
.qa-entry-card:last-child { border-bottom: none; }

/* Q row */
.qa-card-q-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px 10px;
  background: var(--entry-bg, #eef2ff);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.qa-card-q-label {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: var(--entry-bar, #6366f1);
  color: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  margin-top: 2px;
}
.qa-card-q-text {
  flex: 1;
  font-size: 14px; font-weight: 600; color: #1a1a18;
  line-height: 1.55;
}
.qa-card-actions {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0; margin-left: 6px;
}

/* A row */
.qa-card-a-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px 14px;
}
.qa-card-a-label {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: #e5e7eb;
  color: #374151;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  margin-top: 2px;
}
.qa-card-a-body { flex: 1; min-width: 0; }
.qa-answer-text {
  font-size: 13px; color: #374151; line-height: 1.7;
}
.qa-answer-empty {
  font-size: 13px; color: var(--qa-muted); font-style: italic;
}

/* thread toggle */
.qa-card-thread-toggle {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-top: 1px solid #f0f0ef;
  background: #fafaf9;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.qa-card-thread-toggle:hover { background: #f3f4f6; }
.qa-thread-icon  { font-size: 12px; }
.qa-thread-label { font-size: 12px; color: var(--qa-muted); flex: 1; }
.qa-thread-chevron {
  font-size: 14px; color: var(--qa-muted);
  transition: transform 0.2s;
}

/* thread body */
.qa-card-thread {
  padding: 14px 16px;
  background: #fafaf9;
  border-top: 1px solid #f0f0ef;
  display: flex; flex-direction: column; gap: 10px;
}
.qa-card-thread.collapsed { display: none; }

/* comments */
.qa-thread-comments { display: flex; flex-direction: column; gap: 10px; }

.qa-comment {
  display: flex; align-items: flex-start; gap: 10px;
}
.qa-comment-avatar {
  width: 26px; height: 26px;
  background: #e5e7eb; color: #374151;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.qa-comment-body { flex: 1; min-width: 0; }
.qa-comment-hd {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px; flex-wrap: wrap;
}
.qa-comment-name { font-size: 12px; font-weight: 700; color: var(--qa-text); }
.qa-comment-role {
  font-size: 10px; color: var(--qa-muted);
  background: #f3f4f6; border-radius: 4px; padding: 1px 5px;
}
.qa-comment-ts   { font-size: 11px; color: #9ca3af; margin-right: auto; }
.qa-comment-acts { display: flex; gap: 2px; margin-left: auto; }
.qa-comment-text { font-size: 13px; color: #4b5563; line-height: 1.5; }

/* compose */
.qa-comment-compose {
  display: flex; align-items: flex-start; gap: 10px;
}
.qa-compose-avatar {
  width: 26px; height: 26px;
  background: #1a1a2e; color: #fff;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0; margin-top: 6px;
}
.qa-compose-field {
  flex: 1;
  border: 1px solid var(--qa-border);
  border-radius: 10px;
  background: var(--qa-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.qa-compose-field:focus-within {
  border-color: #a8a8a5;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.qa-compose-ta {
  width: 100%; box-sizing: border-box;
  border: none; outline: none; resize: none;
  padding: 10px 14px 6px;
  font-size: 13px; font-family: inherit;
  color: var(--qa-text); background: transparent;
  line-height: 1.5; min-height: 38px;
}
.qa-compose-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 8px;
}
.qa-compose-hint { font-size: 11px; color: #9ca3af; }
.qa-btn-send {
  background: #1a1a2e; color: #fff;
  border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.qa-btn-send:hover { opacity: 0.85; }
.qa-btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── section color dot ───── */
.qa-sec-color-dot {
  width: 10px; height: 10px; border-radius: 99px;
  flex-shrink: 0;
}

/* ── Preview panel ──────────────────────────────────── */
.qa-preview-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: stretch;
  justify-content: flex-end;
}
.qa-preview-overlay.open { display: flex; animation: qa-fade-in 0.18s ease; }
@keyframes qa-fade-in { from { opacity:0 } to { opacity:1 } }

.qa-preview-panel {
  width: 720px; max-width: 96vw;
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -12px 0 48px rgba(0,0,0,0.18);
  animation: qa-slide-in 0.22s cubic-bezier(0.22,1,0.36,1);
}
@keyframes qa-slide-in {
  from { transform: translateX(60px); opacity:0 }
  to   { transform: translateX(0);    opacity:1 }
}

/* header */
.qa-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: #1a1a2e;
  flex-shrink: 0;
  gap: 12px;
}
.qa-preview-title {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qa-preview-header-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.qa-preview-close {
  background: rgba(255,255,255,0.12); border: none;
  font-size: 16px; cursor: pointer; color: #fff;
  padding: 5px 9px; line-height: 1;
  transition: background 0.15s;
}
.qa-preview-close:hover { background: rgba(255,255,255,0.22); }
.qa-btn-sm {
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.14); color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer; transition: background 0.15s;
}
.qa-btn-sm:hover { background: rgba(255,255,255,0.24); }

/* body scroll */
.qa-preview-body {
  flex: 1; overflow-y: auto;
  background: #f9f9f8;
}

/* doc title */
.qa-prev-doc-title {
  font-size: 20px; font-weight: 700; color: #1a1a18;
  padding: 28px 36px 20px;
  border-bottom: 2px solid #e5e5e4;
  background: #fff;
  margin: 0;
}

/* section */
.qa-prev-section {
  margin: 20px 24px 0;
  background: #fff;
  border: 1px solid #e5e5e4;
  border-left: 4px solid var(--sec-bar, #6366f1);
}
.qa-prev-section:last-child { margin-bottom: 24px; }

.qa-prev-sec-title {
  padding: 12px 20px;
  background: var(--sec-bg, #eef2ff);
  font-size: 13px; font-weight: 700; color: #1a1a18;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  letter-spacing: 0.01em;
}

/* entry */
.qa-prev-entry {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f0f0ef;
}
.qa-prev-entry:last-child { border-bottom: none; }

/* question */
.qa-prev-q {
  font-size: 14px; font-weight: 700; color: #1a1a18;
  line-height: 1.55; margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 10px;
}
.qa-prev-q-chip {
  flex-shrink: 0;
  width: 22px; height: 22px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; margin-top: 1px;
}

/* answer */
.qa-prev-a {
  font-size: 13px; color: #374151; line-height: 1.75;
  margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  background: #f9f9f8;
  border-left: 3px solid #d1d5db;
}
.qa-prev-a-chip {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: #e5e7eb; color: #374151;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; margin-top: 1px;
}
.qa-prev-a-text { flex: 1; }

/* meta row */
.qa-prev-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}

/* comments in preview */
.qa-prev-comments {
  margin-top: 10px;
  border-top: 1px dashed #e5e5e4;
  padding-top: 10px;
}
.qa-prev-comments-label {
  font-size: 11px; font-weight: 700; color: #9ca3af;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.qa-prev-comment {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 10px; margin-bottom: 4px;
  background: #f3f4f6;
}
.qa-prev-comment:last-child { margin-bottom: 0; }
.qa-prev-comment-avatar {
  width: 22px; height: 22px;
  background: #d1d5db; color: #374151;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; flex-shrink: 0;
  border-radius: 99px;
}
.qa-prev-comment-body { flex: 1; min-width: 0; }
.qa-prev-comment-hd {
  display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
}
.qa-prev-comment-who { font-size: 11px; font-weight: 700; color: #1a1a18; }
.qa-prev-comment-ts  { font-size: 10px; color: #9ca3af; }
.qa-prev-comment-text { font-size: 12px; color: #374151; line-height: 1.5; }

.qa-err { color: #dc2626; font-size: 14px; padding: 20px 0; }


/* ─── Q&A Apple Modal (qam-*) ───────────────────────────────────────────────── */

.qam-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.qam-overlay.open {
  opacity: 1;
}
.qam-overlay.closing {
  opacity: 0;
}

.qam-sheet {
  background: #ffffff;
  border-radius: 18px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.06),
    0 12px 40px rgba(0,0,0,0.18),
    0 32px 80px rgba(0,0,0,0.14);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.26s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.22s ease;
  opacity: 0;
}
.qam-overlay.open .qam-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.qam-overlay.closing .qam-sheet {
  transform: translateY(16px) scale(0.97);
  opacity: 0;
}

.qam-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 28px 0;
  flex-shrink: 0;
}
.qam-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.qam-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a18;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.qam-subtitle {
  font-size: 13px;
  color: #8d8d8b;
  font-weight: 400;
  line-height: 1.4;
}
.qam-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f2f2f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  flex-shrink: 0;
  margin-left: 16px;
  margin-top: -4px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.qam-close:hover {
  background: #e5e5e3;
  color: #1a1a18;
}

.qam-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overscroll-behavior: contain;
}
.qam-body::-webkit-scrollbar { width: 4px; }
.qam-body::-webkit-scrollbar-track { background: transparent; }
.qam-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.qam-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qam-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.01em;
}
.qam-optional {
  font-size: 11px;
  font-weight: 400;
  color: #9ca3af;
  margin-left: 5px;
  text-transform: none;
  letter-spacing: 0;
}
.qam-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: #1a1a18;
  background: #f9f9f7;
  border: 1.5px solid #e5e5e3;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
}
.qam-input:focus {
  border-color: #1a1a18;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(26,26,24,0.07);
}
.qam-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: #1a1a18;
  background: #f9f9f7;
  border: 1.5px solid #e5e5e3;
  border-radius: 10px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
}
.qam-textarea-lg {
  min-height: 160px;
}
.qam-textarea:focus {
  border-color: #1a1a18;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(26,26,24,0.07);
}

.qam-warning-text {
  font-size: 14px;
  color: #dc2626;
  line-height: 1.55;
}

.qam-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 24px;
  border-top: 1px solid #f0f0ee;
  flex-shrink: 0;
}
.qam-btn-cancel {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: #374151;
  background: #f2f2f0;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.qam-btn-cancel:hover {
  background: #e5e5e3;
  color: #1a1a18;
}
.qam-btn-confirm {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: #1a1a18;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.qam-btn-confirm:hover {
  background: #2d2d2b;
}
.qam-btn-confirm:active {
  transform: scale(0.97);
}
.qam-btn-danger {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: #dc2626;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.qam-btn-danger:hover {
  background: #b91c1c;
}
.qam-btn-danger:active {
  transform: scale(0.97);
}


/* ─── Action Menu ────────────────────────────────────────────────────────────── */
.action-menu {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
