/* ============================================================
   QA Discussion Tracker — Design System
   Dark mode · Glassmorphism · Premium UI
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Colors - Deep Obsidian Dark Theme */
  --bg-base:        #07070a;
  --bg-surface:     #0c0d13;
  --bg-elevated:    #11131c;
  --bg-overlay:     rgba(255,255,255,0.03);
  --bg-overlay-md:  rgba(255,255,255,0.055);

  --primary:        #7c3aed;
  --primary-light:  #9d5ff5;
  --primary-glow:   rgba(124,58,237,0.25);

  --accent:         #06b6d4;
  --accent-glow:    rgba(6,182,212,0.18);

  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;

  --status-open:    #06b6d4;
  --status-review:  #f59e0b;
  --status-closed:  #10b981;

  /* Party colors */
  --party-a:        #7c3aed;
  --party-b:        #06b6d4;

  /* Text - High Contrast Readability */
  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #07070a;

  /* Borders */
  --border:         rgba(255,255,255,0.065);
  --border-focus:   rgba(139,92,246,0.65);

  /* Spacing */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  22px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.45);
  --shadow-md:  0 6px 24px rgba(0,0,0,0.55);
  --shadow-lg:  0 12px 48px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 25px var(--primary-glow);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Background mesh: Deep Obsidian Studio Vibe ─────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 15% 5%, rgba(124,58,237,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 55% 35% at 85% 95%, rgba(6,182,212,0.04) 0%, transparent 60%),
    var(--bg-base);
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }
p  { color: var(--text-secondary); }
a  { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Glass Card ────────────────────────────────────────────── */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover { border-color: rgba(255,255,255,0.12); box-shadow: var(--shadow-md); }

.card-glass {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #0891b2);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-accent:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-overlay-md);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-overlay); color: var(--text-primary); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label {
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
}
.form-input, .form-textarea, .form-select {
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.9rem;
  padding: 0.65rem 1rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  width: 100%;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; appearance: none; }
.form-select option { background: var(--bg-surface); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Status Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-open    { background: rgba(6,182,212,0.12);  color: var(--status-open);   }
.badge-open::before    { background: var(--status-open);   box-shadow: 0 0 6px var(--status-open); animation: pulse 2s infinite; }
.badge-review  { background: rgba(245,158,11,0.12); color: var(--status-review); }
.badge-review::before  { background: var(--status-review); }
.badge-closed  { background: rgba(16,185,129,0.12); color: var(--status-closed); }
.badge-closed::before  { background: var(--status-closed); }

.badge-party-a { background: rgba(124,58,237,0.15); color: var(--party-a); border: 1px solid rgba(124,58,237,0.2); }
.badge-party-b { background: rgba(6,182,212,0.12);  color: var(--party-b); border: 1px solid rgba(6,182,212,0.2); }

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

/* ── Navigation Sidebar ────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: transform var(--dur) var(--ease);
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; margin-bottom: 0.6rem;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.logo-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.logo-sub  { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }

.nav-section-label {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); padding: 0.5rem 0.5rem 0.25rem;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.nav-item:hover { background: var(--bg-overlay); color: var(--text-primary); }
.nav-item.active {
  background: rgba(124,58,237,0.15);
  color: var(--primary-light);
  border: 1px solid rgba(124,58,237,0.2);
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--primary);
  color: white; font-size: 0.65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}
.user-info {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem; border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.user-info:hover { background: var(--bg-overlay); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: white; flex-shrink: 0;
}
.user-details { flex: 1; min-width: 0; }
.user-name  { font-size: 0.85rem; font-weight: 600; truncate; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role  { font-size: 0.7rem; color: var(--text-muted); }

/* ── Main Content ──────────────────────────────────────────── */
.main { margin-left: 240px; flex: 1; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,15,0.8); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex; align-items: center; gap: 1rem;
}
.topbar-title { font-size: 1.1rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.page-content { padding: 1.75rem 2rem; width: 100%; max-width: 100%; }

/* ── Lang Toggle ───────────────────────────────────────────── */
.lang-toggle {
  display: flex; background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
}
.lang-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: none; background: transparent;
  color: var(--text-muted); font-family: inherit;
  transition: all var(--dur) var(--ease);
}
.lang-btn.active { background: var(--primary); color: white; }

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

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  position: relative; overflow: hidden;
  transition: all var(--dur) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-icon  { position: absolute; right: 1rem; top: 1rem; font-size: 1.75rem; opacity: 0.15; }

/* Dashboard Split Grid */
.dashboard-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .dashboard-split-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* ── Topic Cards ───────────────────────────────────────────── */
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }

.topic-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none; color: inherit; display: block;
}
.topic-card:hover {
  border-color: rgba(124,58,237,0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(124,58,237,0.15);
}
.topic-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.topic-no { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.topic-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.4rem; line-height: 1.4; }
.topic-desc  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-footer { display: flex; align-items: center; justify-content: space-between; }
.topic-meta  { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }
.topic-counts { display: flex; gap: 0.5rem; }
.issue-count {
  font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  display: flex; align-items: center; gap: 0.3rem;
}
.ic-open   { background: rgba(6,182,212,0.12);  color: var(--status-open); }
.ic-review { background: rgba(245,158,11,0.12); color: var(--status-review); }
.ic-closed { background: rgba(16,185,129,0.12); color: var(--status-closed); }

/* ── Issues Table ──────────────────────────────────────────── */
.issue-list { display: flex; flex-direction: column; gap: 0.75rem; }

.issue-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: all var(--dur) var(--ease);
}
.issue-row:hover {
  border-color: rgba(124,58,237,0.25);
  background: rgba(124,58,237,0.04);
  transform: translateX(4px);
}
.issue-row-no {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-overlay-md); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.issue-row-info { flex: 1; min-width: 0; }
.issue-row-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.issue-row-sub   { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.issue-row-meta  { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* ── Issue Detail ──────────────────────────────────────────── */
.issue-detail { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }

.thread { display: flex; flex-direction: column; gap: 1rem; }

.thread-message {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
}
.thread-msg-a {
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.15);
  border-left: 3px solid var(--party-a);
}
.thread-msg-b {
  background: rgba(6,182,212,0.06);
  border: 1px solid rgba(6,182,212,0.12);
  border-left: 3px solid var(--party-b);
}
.thread-header {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem;
}
.thread-sender { font-size: 0.82rem; font-weight: 600; }
.thread-time   { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.thread-body   { font-size: 0.9rem; color: var(--text-primary); line-height: 1.7; white-space: pre-wrap; }
.thread-body-muted { color: var(--text-muted); font-style: italic; }

/* Reply box */
.reply-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.reply-box-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.reply-box-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

/* ── Sidebar Panels ────────────────────────────────────────── */
.detail-sidebar { display: flex; flex-direction: column; gap: 1rem; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-secondary);
}
.panel-body { padding: 1rem 1.25rem; }

/* Attachments */
.attachment-list { display: flex; flex-direction: column; gap: 0.5rem; }
.attachment-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-overlay); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}
.attachment-icon { font-size: 1.1rem; }
.attachment-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.attachment-size { color: var(--text-muted); font-size: 0.75rem; flex-shrink: 0; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center; cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(124,58,237,0.06);
}
.upload-zone-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.upload-zone-text { font-size: 0.82rem; color: var(--text-muted); }

/* Notes */
.note-item {
  padding: 0.75rem;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.12);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.note-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.modal-lg { max-width: 700px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title  { font-size: 1.2rem; font-weight: 700; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 1.5rem; }

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

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-box {
  width: 100%; max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo-icon {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 18px; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-glow);
}
.login-title  { font-size: 1.5rem; font-weight: 700; }
.login-sub    { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ── Setup Wizard ──────────────────────────────────────────── */
.setup-steps { display: flex; gap: 0.5rem; margin-bottom: 2rem; }
.setup-step-dot {
  flex: 1; height: 3px; border-radius: 2px;
  background: var(--border); transition: background var(--dur) ease;
}
.setup-step-dot.done { background: var(--primary); }
.setup-step-dot.active { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state-text  { font-size: 0.875rem; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  max-width: 320px;
  display: flex; align-items: center; gap: 0.75rem;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--primary); }

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.6rem 1rem; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; border: none; background: transparent;
  color: var(--text-muted); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all var(--dur) ease;
}
.tab-btn:hover  { color: var(--text-primary); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* ── Mobile Menu & Sidebar Backdrop ────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: var(--bg-overlay-md);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.15rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-close-btn {
  display: none;
  font-size: 1rem;
  min-height: 28px;
  width: 28px;
  height: 28px;
  background: var(--bg-overlay-md);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Responsive Breakpoints ────────────────────────────────── */
@media (max-width: 900px) {
  .mobile-menu-btn { display: inline-flex; }
  .sidebar-close-btn { display: inline-flex; }
  .sidebar-logo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  }
  
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.85);
    z-index: 1000;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  
  .topbar {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
  }
  
  .page-content {
    padding: 1.25rem;
  }
  
  .issue-detail {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  
  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.6rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    gap: 0.4rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .topbar-title {
    font-size: 0.95rem;
  }
  
  .page-content {
    padding: 1rem 0.75rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  
  .stat-card {
    padding: 0.85rem 1rem;
  }
  .stat-value {
    font-size: 1.45rem;
  }
  .stat-label {
    font-size: 0.72rem;
  }
  
  .topics-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  
  .modal {
    width: 95vw;
    max-height: 88vh;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    overflow-y: auto;
  }
  
  .login-page {
    padding: 1rem;
  }
  
  .login-box {
    padding: 1.5rem 1.15rem;
    border-radius: var(--radius-lg);
  }
  
  .spreadsheet-container {
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .qa-table th, .qa-table td {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .thread-message {
    padding: 1rem;
  }
  
  .reply-box {
    border-radius: var(--radius-md);
  }
  
  .reply-box-header, .reply-box-body {
    padding: 1rem;
  }
  
  .breadcrumb {
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  
  .btn {
    min-height: 38px;
  }
  
  .btn-sm {
    min-height: 32px;
    padding: 0.35rem 0.7rem;
    font-size: 0.76rem;
  }
  
  #fast-test-bar {
    bottom: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.7rem;
  }
}

/* ── Utility ───────────────────────────────────────────────── */
.flex    { display: flex; }
.flex-1  { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1   { gap: 0.5rem; }
.gap-2   { gap: 1rem; }
.gap-3   { gap: 1.5rem; }
.mb-1    { margin-bottom: 0.5rem; }
.mb-2    { margin-bottom: 1rem; }
.mb-3    { margin-bottom: 1.5rem; }
.mb-4    { margin-bottom: 2rem; }
.mt-1    { margin-top: 0.5rem; }
.mt-2    { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* ── Loading Spinner ───────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(10,10,15,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.loading-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem 3rem;
  text-align: center;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px; background: var(--border);
  margin: 1.25rem 0;
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-bar {
  height: 4px; background: var(--bg-overlay-md); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ── Animations ────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.3s ease; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-overlay) 25%, var(--bg-overlay-md) 50%, var(--bg-overlay) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Interactive Spreadsheet Grid (Excel-like UI) ───────────── */
.spreadsheet-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(0, 0, 0, 0.3);
  -webkit-overflow-scrolling: touch;
}

.spreadsheet-container::-webkit-scrollbar {
  height: 8px;
}
.spreadsheet-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
}
.spreadsheet-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}
.spreadsheet-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

.qa-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
  line-height: 1.55;
}

.qa-table thead th {
  background: #0d0e14;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.qa-table tbody tr {
  transition: background var(--dur) var(--ease);
  cursor: pointer;
}

.qa-table tbody tr:hover td {
  background: rgba(124, 58, 237, 0.04);
}

.qa-table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
  color: var(--text-primary);
}

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

/* Table columns */
.cell-no {
  width: 46px;
  min-width: 46px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.cell-item {
  min-width: 160px;
  font-weight: 600;
  color: var(--text-primary);
}
.cell-kp {
  min-width: 190px;
  max-width: 300px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}
.cell-comment {
  min-width: 210px;
  max-width: 340px;
  background: rgba(124, 58, 237, 0.02);
  border-left: 2px solid rgba(124, 58, 237, 0.2);
}
.cell-reply {
  min-width: 210px;
  max-width: 340px;
  background: rgba(6, 182, 212, 0.02);
  border-left: 2px solid rgba(6, 182, 212, 0.2);
}
.cell-status {
  width: 95px;
  min-width: 95px;
  text-align: center;
  white-space: nowrap;
}
.cell-files {
  width: 80px;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
}
.cell-action {
  width: 110px;
  min-width: 110px;
  text-align: center;
  white-space: nowrap;
}

/* Dual language text helper */
.dual-primary {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.dual-secondary {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Reply round badge */
.round-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}
.round-pill-0 { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.round-pill-1 { background: rgba(6,182,212,0.15); color: var(--accent); border: 1px solid rgba(6,182,212,0.3); }
.round-pill-2 { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }
.round-pill-3 { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }

/* Reply History Cards in Issue Detail */
.reply-round-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.reply-round-card.party-a-reply {
  border-left-color: var(--party-a);
  background: rgba(124, 58, 237, 0.04);
}
.reply-round-card.party-b-reply {
  border-left-color: var(--accent);
  background: rgba(6, 182, 212, 0.03);
}
.badge-party-a {
  background: rgba(124, 58, 237, 0.15);
  color: var(--party-a);
  border: 1px solid rgba(124, 58, 237, 0.3);
}
.badge-party-b {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent);
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.reply-round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.locked-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* File items with download icons */
.file-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  transition: all var(--dur) var(--ease);
}
.file-card:hover {
  background: var(--bg-overlay-md);
  border-color: var(--primary-light);
}
.file-card-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.file-card-info {
  flex: 1;
  min-width: 0;
}
.file-card-name {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-card-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
}
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--dur) var(--ease);
}
.btn-download:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  text-decoration: none;
}

