/* ============ THEME SYSTEM ============ */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all .2s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: all .3s cubic-bezier(.4, 0, .2, 1);
  --success: #10b981;
  --success-light: #34d399;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --danger: #ef4444;
  --danger-light: #f87171;
  --info: #3b82f6;
  --info-light: #60a5fa;
}

[data-theme="sunset"] {
  --primary: #fb7185;
  --primary-dark: #f43f5e;
  --primary-light: #ffe4e6;
  --primary-glow: rgba(244, 63, 94, .28);
  --bg-base: #fff7ed;
  --bg-elevated: #fff;
  --bg-card: #fff;
  --bg-hover: #fffbeb;
  --bg-active: #fed7aa;
  --bg-input: #fff;
  --text-primary: #3b0f1f;
  --text-secondary: #7c2d12;
  --text-muted: #9a3412;
  --text-dim: #f97316;
  --border: #fed7aa;
  --border-light: #ffedd5;
  --border-focus: #f97316;
  --shadow-sm: 0 1px 3px rgba(124, 45, 18, .08);
  --shadow-md: 0 4px 12px rgba(124, 45, 18, .1);
  --shadow-lg: 0 10px 25px rgba(124, 45, 18, .12);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 10% 0%, rgba(248, 113, 113, .14) 0%, transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(251, 191, 36, .12) 0%, transparent 55%);
}

[data-theme="ocean"] {
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --primary-light: #e0f2fe;
  --primary-glow: rgba(56, 189, 248, .3);
  --bg-base: #f0f9ff;
  --bg-elevated: #fff;
  --bg-card: #fff;
  --bg-hover: #e0f2fe;
  --bg-active: #bae6fd;
  --bg-input: #fff;
  --text-primary: #0f172a;
  --text-secondary: #0e7490;
  --text-muted: #0369a1;
  --text-dim: #38bdf8;
  --border: #bae6fd;
  --border-light: #7dd3fc;
  --border-focus: #0ea5e9;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .1);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, .12);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 15% 0%, rgba(56, 189, 248, .16) 0%, transparent 55%), radial-gradient(ellipse at 85% 100%, rgba(37, 99, 235, .1) 0%, transparent 55%);
}

[data-theme="vibrant"] {
  --primary: #a855f7;
  --primary-dark: #7c3aed;
  --primary-light: #e9d5ff;
  --primary-glow: rgba(168, 85, 247, .3);
  --bg-base: #faf5ff;
  --bg-elevated: #fff;
  --bg-card: #fff;
  --bg-hover: #f3e8ff;
  --bg-active: #e9d5ff;
  --bg-input: #fff;
  --text-primary: #2e1065;
  --text-secondary: #4c1d95;
  --text-muted: #6b21a8;
  --text-dim: #a855f7;
  --border: #ddd6fe;
  --border-light: #e9d5ff;
  --border-focus: #a855f7;
  --shadow-sm: 0 1px 3px rgba(46, 16, 101, .08);
  --shadow-md: 0 4px 12px rgba(46, 16, 101, .1);
  --shadow-lg: 0 10px 25px rgba(46, 16, 101, .12);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 20% 0%, rgba(168, 85, 247, .18) 0%, transparent 55%), radial-gradient(ellipse at 80% 100%, rgba(45, 212, 191, .12) 0%, transparent 55%);
}

[data-theme="light"] {
  --primary: #0ea5e9;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --primary-glow: rgba(14, 165, 233, .25);
  --bg-base: #f9fafb;
  --bg-elevated: #fff;
  --bg-card: #fff;
  --bg-hover: #f3f4f6;
  --bg-active: #e5e7eb;
  --bg-input: #fff;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #4b5563;
  --text-dim: #6b7280;
  --border: #e5e7eb;
  --border-light: #d1d5db;
  --border-focus: #0ea5e9;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, .1);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 15% 0%, rgba(148, 163, 184, .12) 0%, transparent 55%), radial-gradient(ellipse at 85% 100%, rgba(14, 165, 233, .12) 0%, transparent 55%);
}

[data-theme="dark"] {
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-light: #5eead4;
  --primary-glow: rgba(45, 212, 191, .45);
  --bg-base: #020617;
  --bg-elevated: #02071f;
  --bg-card: #020b27;
  --bg-hover: #031022;
  --bg-active: #041326;
  --bg-input: #020a20;
  --text-primary: #f3f4f6;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  --text-dim: #22c55e;
  --border: #1f2937;
  --border-light: #334155;
  --border-focus: #2dd4bf;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .7);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, .85);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .85);
  --shadow-glow: 0 0 40px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 0% 0%, rgba(45, 212, 191, .2) 0%, transparent 55%), radial-gradient(ellipse at 100% 100%, rgba(88, 28, 135, .35) 0%, transparent 55%);
}

[data-theme="mint"] {
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-light: #5eead4;
  --primary-glow: rgba(45, 212, 191, .3);
  --bg-base: #f0fdfa;
  --bg-elevated: #fff;
  --bg-card: #fff;
  --bg-hover: #e6fffa;
  --bg-active: #ccfbf1;
  --bg-input: #fff;
  --text-primary: #0d3331;
  --text-secondary: #115e59;
  --text-muted: #0f766e;
  --text-dim: #14b8a6;
  --border: #99f6e4;
  --border-light: #5eead4;
  --border-focus: #14b8a6;
  --shadow-sm: 0 1px 3px rgba(13, 51, 49, .08);
  --shadow-md: 0 4px 12px rgba(13, 51, 49, .1);
  --shadow-lg: 0 10px 25px rgba(13, 51, 49, .12);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --gradient-bg: radial-gradient(ellipse at 20% 0%, rgba(45, 212, 191, .1) 0%, transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(147, 51, 234, .05) 0%, transparent 50%);
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background .35s, color .35s;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-bg);
  pointer-events: none;
  z-index: 0;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes shimmer { 0% { left: -100%; } 100% { left: 100%; } }

/* ============ LAYOUT ============ */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: 250px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  transition: background .35s, border-color .35s, width .25s ease;
}
.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); transition: padding .25s ease; }
.sidebar-brand img, .sidebar-logo { max-width: 150px; height: auto; display: block; transition: max-width .25s ease; }
.sidebar-brand span {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 2px; display: block; margin-top: 5px;
  transition: opacity .2s ease;
}
.sidebar-nav { flex: 1; padding: 8px 10px; overflow-y: auto; transition: padding .25s ease; }
.nav-group {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-muted); padding: 16px 12px 6px; opacity: .6;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  transition: var(--transition); margin-bottom: 1px; position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--primary); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; background: var(--primary); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .65; }
.nav-item.active svg { opacity: 1; color: var(--primary); }
.nav-badge {
  margin-left: auto; background: var(--primary); color: var(--bg-base);
  font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: var(--radius-full);
}

/* ============ MAIN ============ */
.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s ease; }

/* ============ TOP BAR ============ */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); position: sticky; top: 0; z-index: 15;
  transition: background .35s;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.breadcrumb .bc-link { color: var(--primary); cursor: pointer; font-weight: 600; }
.breadcrumb .bc-link:hover { text-decoration: underline; }
.breadcrumb .bc-sep { opacity: .4; }
.breadcrumb .bc-current { color: var(--text-primary); font-weight: 700; }
.top-bar-right { display: flex; align-items: center; gap: 10px; }
.skin-picker {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 5px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-full);
}
.skin-picker label {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); padding: 0 5px;
}
.skin-btn {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; transition: var(--transition);
}
.skin-btn:hover { transform: scale(1.2); }
.skin-btn.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-base); }
.skin-btn[data-t="sunset"] { background: linear-gradient(135deg, #fb7185, #f59e0b); }
.skin-btn[data-t="ocean"] { background: linear-gradient(135deg, #38bdf8, #3b82f6); }
.skin-btn[data-t="vibrant"] { background: linear-gradient(135deg, #a855f7, #2dd4bf); }
.skin-btn[data-t="light"] { background: linear-gradient(135deg, #e5e7eb, #0ea5e9); }
.skin-btn[data-t="dark"] { background: linear-gradient(135deg, #020617, #2dd4bf); }
.skin-btn[data-t="mint"] { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }

.content { padding: 24px 28px; flex: 1; }

/* ============ VIEWS ============ */
.view { display: none; }
.view.active { display: block; animation: fadeSlide .3s ease; }

/* ============ STAT CARDS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--primary); opacity: 0; transition: opacity .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card:hover::after { opacity: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; background: var(--bg-hover);
}
.stat-icon svg { width: 15px; height: 15px; color: var(--primary); }
.stat-change { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full); }
.stat-change.up { background: rgba(16, 185, 129, .12); color: var(--success); }
.stat-change.down { background: rgba(239, 68, 68, .12); color: var(--danger); }
.stat-value {
  font-family: 'Outfit', sans-serif; font-size: 26px; font-weight: 800;
  color: var(--text-primary); letter-spacing: -1px; line-height: 1;
}
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 3px; }

/* ============ FILTER BAR ============ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 16px; flex-wrap: nowrap; overflow-x: auto;
}
.filter-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted); white-space: nowrap;
}
.filter-select, .filter-date {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600;
  padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary); cursor: pointer;
  transition: var(--transition); outline: none;
}
.filter-search {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  transition: var(--transition); outline: none; min-width: 200px;
}
.filter-search::placeholder { color: var(--text-muted); font-weight: 500; }
.filter-search:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow);
}
.filter-select:focus, .filter-date:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow);
}
.filter-sep { width: 1px; height: 22px; background: var(--border); }
.chip {
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  padding: 5px 13px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: var(--bg-base); border-color: var(--primary); }
.filter-clear {
  font-family: 'Manrope', sans-serif; font-size: 10px; font-weight: 700;
  padding: 5px 10px; border: none; background: transparent;
  color: var(--danger-light); cursor: pointer; margin-left: auto;
}
.filter-clear:hover { background: rgba(239, 68, 68, .08); border-radius: var(--radius-sm); }

/* ============ TABLE ============ */
.tbl-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.tbl-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.tbl-head h3 { font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
table th {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); padding: 9px 18px;
  text-align: left; background: var(--bg-hover); border-bottom: 1px solid var(--border);
}
table td {
  font-size: 12.5px; font-weight: 500; padding: 12px 18px;
  border-bottom: 1px solid var(--border); color: var(--text-secondary);
}
table tr:last-child td { border-bottom: none; }
table tr { cursor: pointer; transition: var(--transition); }
table tr:hover td { background: var(--bg-hover); }
table tr.row-active td { background: var(--bg-active); }
.td-id { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--primary); font-size: 12px; }
.td-bold { font-weight: 700; color: var(--text-primary); }
.pill {
  font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 10px; border-radius: 6px; display: inline-block;
  white-space: nowrap; line-height: 1.4;
}
.pill-pending { background: rgba(245, 158, 11, .10); color: var(--warning); }
.pill-approved { background: rgba(16, 185, 129, .10); color: var(--success); }
.pill-revision { background: rgba(239, 68, 68, .10); color: var(--danger); }
.pill-review { background: rgba(59, 130, 246, .10); color: var(--info); }

/* ============ SUBMISSION DETAIL VIEW ============ */
.detail-back {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--primary);
  cursor: pointer; margin-bottom: 16px; padding: 5px 0; transition: var(--transition);
}
.detail-back:hover { opacity: .7; }
.detail-back svg { width: 16px; height: 16px; }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.detail-title-row { display: flex; align-items: center; gap: 12px; }
.detail-title { font-family: 'Outfit', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.detail-type-badge {
  font-size: 11px; font-weight: 700; padding: 4px 14px;
  border-radius: var(--radius-full); background: var(--bg-active);
  color: var(--primary); border: 1px solid var(--border);
}
.detail-meta { display: flex; gap: 20px; margin-top: 8px; }
.detail-meta-item { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.detail-meta-item b { font-weight: 700; color: var(--text-secondary); }
.detail-actions { display: flex; gap: 8px; align-items: center; }
.detail-actions .ai-scan-btn {
  margin: 0; padding: 6px 14px;
  font-size: 11px; border-radius: var(--radius-full);
  height: auto;
}
.detail-actions .ai-scan-btn svg { width: 14px; height: 14px; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  font-family: 'Manrope', sans-serif; font-size: 12.5px; font-weight: 700;
  padding: 10px 20px; cursor: pointer; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge {
  background: var(--primary); color: var(--bg-base);
  font-size: 9px; font-weight: 800; padding: 1px 6px;
  border-radius: 10px; margin-left: 5px;
}
.tab-panel { display: none; animation: fadeSlide .25s ease; }
.tab-panel.active { display: block; }

/* ============ DOC LIST ============ */
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: var(--transition); cursor: pointer;
}
.doc-row:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.doc-row.doc-clickable:hover { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.doc-row.doc-disabled { opacity: .55; cursor: default; }
.doc-row.doc-disabled:hover { border-color: var(--border); box-shadow: none; transform: none; }
.doc-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-icon svg { width: 20px; height: 20px; }
.doc-icon-pdf { background: rgba(239, 68, 68, .1); color: var(--danger); }
.doc-icon-doc { background: rgba(59, 130, 246, .1); color: var(--info); }
.doc-icon-xls { background: rgba(16, 185, 129, .1); color: var(--success); }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.doc-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.doc-row-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.doc-size { font-size: 10.5px; color: var(--text-muted); font-weight: 600; }
.doc-review-status { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; }
.doc-review-status.needs-review { color: var(--warning); }
.doc-review-status.reviewed { color: var(--success); }
.doc-review-status.issues { color: var(--danger); }
.doc-review-status svg { width: 13px; height: 13px; }
.doc-open-arrow { color: var(--text-muted); opacity: .4; transition: var(--transition); }
.doc-row:hover .doc-open-arrow { opacity: 1; color: var(--primary); }

/* ============ METADATA GRID ============ */
.meta-panel-header { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.edit-meta-form { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.meta-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 18px;
}
.meta-card-title {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 10px;
}
.meta-row {
  display: flex; justify-content: space-between; padding: 5px 0;
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.meta-row:last-child { border-bottom: none; }
.meta-label { color: var(--text-muted); font-weight: 600; }
.meta-value { color: var(--text-primary); font-weight: 700; text-align: right; }

/* ============ ACTIVITY LOG ============ */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-dot.dot-submit { background: var(--info); }
.activity-dot.dot-review { background: var(--warning); }
.activity-dot.dot-approve { background: var(--success); }
.activity-dot.dot-upload { background: var(--primary); }
.activity-dot.dot-comment { background: var(--text-muted); }
.activity-content { flex: 1; min-width: 0; }
.activity-text { font-size: 12.5px; color: var(--text-primary); font-weight: 500; }
.activity-text b { font-weight: 700; }
.activity-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ============ REVIEWER CARDS ============ */
.reviewer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.reviewer-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
  display: flex; align-items: center; gap: 12px;
}
.reviewer-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white; flex-shrink: 0;
}
.reviewer-info { flex: 1; min-width: 0; }
.reviewer-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.reviewer-role { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.reviewer-status {
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: var(--radius-full); margin-top: 4px; display: inline-block;
}

/* ============ BUTTONS ============ */
.btn {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  padding: 8px 18px; border-radius: var(--radius-sm); border: none;
  cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); color: var(--bg-base); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.btn-accent { background: var(--success); color: #fff; }
.btn-accent:hover { background: #059669; box-shadow: var(--shadow-md); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; box-shadow: var(--shadow-md); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; box-shadow: var(--shadow-md); }
.btn-warn { background: var(--warning); color: white; }
.btn-warn:hover { background: #d97706; }
.btn-sm { padding: 6px 12px; font-size: 11px; }

/* ============ SUBMISSION TYPE CARDS ============ */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.type-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; cursor: pointer;
  transition: var(--transition-slow); position: relative; overflow: hidden;
}
.type-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: transparent; transition: background .25s;
}
.type-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.type-card:hover::before, .type-card.selected::before { background: var(--primary); }
.type-card.selected { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.type-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--bg-hover); display: flex; align-items: center;
  justify-content: center; margin-bottom: 14px; transition: var(--transition);
}
.type-card:hover .type-card-icon, .type-card.selected .type-card-icon { background: var(--primary); }
.type-card-icon svg { width: 20px; height: 20px; color: var(--primary); transition: color .2s; }
.type-card:hover .type-card-icon svg, .type-card.selected .type-card-icon svg { color: var(--bg-base); }
.type-card h3 {
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 5px;
}
.type-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.type-tag {
  display: inline-block; font-size: 9.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
  padding: 3px 9px; border-radius: 6px; margin-top: 12px;
}
.type-tag-full { background: rgba(239, 68, 68, .1); color: var(--danger); }
.type-tag-exp { background: rgba(16, 185, 129, .1); color: var(--success); }
.type-tag-req { background: rgba(245, 158, 11, .1); color: var(--warning); }
.type-tag-urgent { background: rgba(239, 68, 68, .15); color: var(--danger-light); }

/* ============ DYNAMIC FORM ============ */
.form-panel { display: none; margin-top: 24px; animation: fadeSlide .3s ease; }
.form-panel.active { display: block; }
.form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 28px; box-shadow: var(--shadow-sm);
}
.form-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--border);
}
.form-header h3 { font-family: 'Outfit', sans-serif; font-size: 17px; font-weight: 700; }
.form-type-badge {
  font-size: 11px; font-weight: 700; padding: 4px 14px;
  border-radius: var(--radius-full); background: var(--bg-hover);
  color: var(--primary); border: 1px solid var(--border);
}
.form-section { margin-bottom: 22px; }
.form-section-label {
  font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-muted); margin-bottom: 14px; opacity: .7;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.full { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field .field-hint { display: block; font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 4px; }
.file-count-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); margin-top: 8px; text-align: right;
}
.field input, .field select, .field textarea {
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 500;
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  transition: var(--transition); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow);
}
.field textarea { resize: vertical; min-height: 72px; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); opacity: .5; }

/* Upload */
.upload-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 28px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg-hover);
}
.upload-drop:hover { border-color: var(--primary); background: var(--bg-active); }
.upload-drop svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.upload-drop p { font-size: 12.5px; color: var(--text-muted); }
.upload-drop .accent { color: var(--primary); font-weight: 700; }
.upload-drop .hint { font-size: 11px; color: var(--text-muted); opacity: .6; margin-top: 3px; }
.uploaded-list { margin-top: 10px; }
.uploaded-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-top: 6px; font-size: 12.5px; animation: fadeSlide .2s;
}
.uploaded-item svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }
.uploaded-item .fname { flex: 1; font-weight: 600; color: var(--text-primary); }
.uploaded-item .fsize { color: var(--text-muted); font-size: 11px; }
.uploaded-item .fremove {
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(239, 68, 68, .1); color: var(--danger);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; transition: var(--transition);
}
.uploaded-item .fremove:hover { background: var(--danger); color: white; }
.form-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* ============ TOAST ============ */
/* ============ TOAST SYSTEM ============ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column-reverse; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px 11px 14px; border-radius: var(--radius-md);
  font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  transform: translateX(120%); opacity: 0;
  transition: all .35s cubic-bezier(.4, 0, .2, 1);
  pointer-events: auto; cursor: default;
  max-width: 400px; min-width: 240px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.exit { transform: translateX(120%); opacity: 0; }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
  font-size: 16px; line-height: 1; cursor: pointer; opacity: 0.5;
  padding: 0 2px; transition: opacity .15s;
}
.toast-close:hover { opacity: 1; }

/* Toast types */
.toast-success { background: #065f46; color: #d1fae5; border: 1px solid rgba(16,185,129,.3); }
.toast-success svg { color: #34d399; }
.toast-error { background: #7f1d1d; color: #fee2e2; border: 1px solid rgba(239,68,68,.3); }
.toast-error svg { color: #f87171; }
.toast-warning { background: #78350f; color: #fef3c7; border: 1px solid rgba(245,158,11,.3); }
.toast-warning svg { color: #fbbf24; }
.toast-info { background: #1e3a5f; color: #dbeafe; border: 1px solid rgba(59,130,246,.3); }
.toast-info svg { color: #60a5fa; }

/* ============================================================
   DOC REVIEW VIEW — Split Pane Layout
   ============================================================ */

/* Doc Info Bar (inside doc-review view) */
.doc-info-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.doc-info-bar .doc-id {
  font-family: 'Outfit', sans-serif; font-weight: 800;
  color: var(--primary); font-size: 13px;
}
.doc-info-bar .doc-meta { color: var(--text-muted); font-weight: 500; }
.doc-info-bar .doc-meta b { color: var(--text-secondary); font-weight: 700; }
.doc-info-bar .pill {
  font-size: 10px; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-full); background: rgba(59, 130, 246, .12); color: var(--info);
}
.doc-info-bar .doc-actions { margin-left: auto; display: flex; gap: 6px; }

/* Split Pane */
.split-pane { display: flex; height: calc(100vh - 140px); position: relative; z-index: 1; }

/* PDF Pane (Left) */
.pdf-pane {
  flex: 1; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--bg-elevated); min-width: 0;
}
.pdf-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.pdf-tool {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-input);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); position: relative;
}
.pdf-tool:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.pdf-tool.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--bg-active); box-shadow: 0 0 0 2px var(--primary-glow);
}
.pdf-tool svg { width: 16px; height: 16px; }
.pdf-tool-sep { width: 1px; height: 22px; background: var(--border); }

/* Document / Original PDF tab switcher */
.pdf-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-input);
  color: var(--text-muted); cursor: pointer;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  transition: var(--transition);
}
.pdf-tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.pdf-tab:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.pdf-tab.active {
  border-color: var(--primary); color: var(--primary);
  background: var(--bg-active); box-shadow: 0 0 0 2px var(--primary-glow);
}
.pdf-tool-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.pdf-page-nav {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.pdf-page-nav input {
  width: 36px; text-align: center; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; padding: 3px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg-input); color: var(--text-primary);
}
.pdf-viewport {
  flex: 1; overflow: auto; padding: 20px;
  display: flex; justify-content: center; position: relative;
}
.pdf-pages-container { display: flex; flex-direction: column; align-items: center; gap: 24px; padding-bottom: 20px; }
.pdf-mock-page {
  width: 680px; background: white;
  box-shadow: 0 2px 20px rgba(0, 0, 0, .12); border-radius: 2px;
  padding: 60px 65px 80px; position: relative;
  color: #1a1a2e; line-height: 1.75; font-size: 13.5px;
  min-height: 880px;
}
[data-theme="dark"] .pdf-mock-page { background: #f8f9fa; color: #1a1a2e; }
.pdf-mock-page h1 {
  font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 800;
  text-align: center; margin-bottom: 4px; color: #111;
}
.pdf-mock-page h2 {
  font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 700;
  text-align: center; margin-bottom: 20px; color: #333;
}
.pdf-mock-page h3 {
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .5px;
  margin: 22px 0 8px; color: #111; padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}
.pdf-mock-page p { margin-bottom: 10px; text-align: justify; }
.pdf-mock-page .page-num { position: absolute; bottom: 30px; right: 40px; font-size: 10px; color: #999; }

/* Highlight Zones */
.hl-zone {
  position: relative; cursor: pointer; transition: background .2s, border-color .2s;
  border-radius: 4px; padding: 4px 6px 4px 14px; margin: 2px 0;
  border-left: 3px solid transparent;
}
.hl-zone:hover { background: rgba(0, 0, 0, .03); }

/* Passive status strip (worst result) */
.hl-zone.hl-pass { border-left-color: var(--success); background: rgba(16, 185, 129, .04); }
.hl-zone.hl-fail { border-left-color: var(--danger); background: rgba(239, 68, 68, .05); }
.hl-zone.hl-warn { border-left-color: var(--warning); background: rgba(245, 158, 11, .05); }
.hl-zone.hl-pend { border-left-color: #d1d5db; }

/* Mini status dots — shows all statuses for this zone */
.hl-zone::after {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  display: none; /* shown via JS data attribute */
}
.hl-zone[data-has-mixed="true"]::after {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid white;
  left: -5px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}
.hl-zone[data-has-mixed="true"][data-worst="fail"]::after { background: var(--danger); }
.hl-zone[data-has-mixed="true"][data-worst="warn"]::after { background: var(--warning); }

/* Active state — clicked rule's zone */
.hl-zone.hl-active {
  border-left-width: 5px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
  z-index: 1;
}
.hl-zone.hl-active.hl-pass {
  border-left-color: var(--success);
  background: rgba(16, 185, 129, .10);
}
.hl-zone.hl-active.hl-fail {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, .12);
}
.hl-zone.hl-active.hl-warn {
  border-left-color: var(--warning);
  background: rgba(245, 158, 11, .12);
}
.hl-zone.hl-active.hl-pend {
  border-left-color: #9ca3af;
  background: rgba(156, 163, 175, .08);
}

/* Dimmed state — zones NOT related to clicked rule fade */
.hl-zone.hl-dimmed {
  opacity: .4;
  transition: opacity .2s;
}

/* Annotation Pins */
.anno-pin {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--warning); color: white;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  z-index: 5; transform: translate(-50%, -50%); transition: transform .15s;
}
.anno-pin:hover { transform: translate(-50%, -50%) scale(1.2); }
.anno-pin.pin-danger { background: var(--danger); }
.anno-pin.pin-info { background: var(--info); }

/* Annotation Popover */
.anno-popover {
  position: absolute; width: 280px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 14px; z-index: 10; display: none; animation: fadeSlide .2s ease;
}
.anno-popover.show { display: block; }
.anno-popover textarea {
  font-family: 'Manrope', sans-serif; width: 100%; font-size: 12px;
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary);
  resize: vertical; min-height: 60px; outline: none; transition: var(--transition);
}
.anno-popover textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }
.anno-popover .anno-actions { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }

/* ============ CHECKLIST PANE (Right) ============ */
.checklist-pane {
  width: 420px; display: flex; flex-direction: column;
  background: var(--bg-elevated); overflow: hidden; flex-shrink: 0;
}
.checklist-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.checklist-header h3 { font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.checklist-header .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.checklist-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.progress-bar { flex: 1; height: 6px; background: var(--bg-active); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--success); border-radius: var(--radius-full); transition: width .4s ease; }
.progress-text { font-size: 11px; font-weight: 800; color: var(--text-muted); white-space: nowrap; }

.checklist-stats { display: flex; gap: 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cl-stat {
  flex: 1; text-align: center; padding: 8px 6px;
  border-right: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.cl-stat:last-child { border-right: none; }
.cl-stat:hover { background: var(--bg-hover); }
.cl-stat.active { background: var(--bg-active); }
.cl-stat-num { font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 800; line-height: 1; }
.cl-stat-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted); margin-top: 2px;
}
.cl-stat.s-pass .cl-stat-num { color: var(--success); }
.cl-stat.s-fail .cl-stat-num { color: var(--danger); }
.cl-stat.s-warn .cl-stat-num { color: var(--warning); }
.cl-stat.s-pend .cl-stat-num { color: var(--text-muted); }

.checklist-body { flex: 1; overflow-y: auto; padding: 10px 0; }

/* Checklist Section */
.cl-section { margin-bottom: 4px; }
.cl-section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; cursor: pointer;
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  transition: var(--transition); user-select: none;
}
.cl-section-head:hover { background: var(--bg-hover); color: var(--text-primary); }
.cl-section-head svg { width: 12px; height: 12px; transition: transform .2s; }
.cl-section-head.open svg { transform: rotate(90deg); }
.cl-section-head .sec-count {
  margin-left: auto; font-size: 10px; font-weight: 700;
  color: var(--text-dim); opacity: .6;
}
.cl-section-body { display: none; padding: 0 10px 6px 10px; }
.cl-section-head.open + .cl-section-body { display: block; }

/* Checklist Item */
.cl-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  margin-bottom: 2px;
  border: 1.5px solid transparent;
  border-left: 3px solid transparent;
}

/* Status-based left accent + subtle background tint */
.cl-item[data-status="fail"] { 
  border-left-color: var(--danger); 
  background: rgba(239, 68, 68, .03);
}
.cl-item[data-status="warn"] { 
  border-left-color: var(--warning); 
  background: rgba(245, 158, 11, .03);
}
.cl-item[data-status="pass"] { border-left-color: transparent; }
.cl-item[data-status="pend"] { border-left-color: transparent; }

/* Hover */
.cl-item[data-status="fail"]:hover { background: rgba(239, 68, 68, .07); }
.cl-item[data-status="warn"]:hover { background: rgba(245, 158, 11, .06); }
.cl-item[data-status="pass"]:hover { background: rgba(16, 185, 129, .05); }
.cl-item[data-status="pend"]:hover { background: var(--bg-hover); }

/* Focused (clicked) */
.cl-item.focused { background: var(--bg-active); border-color: var(--primary); }
.cl-item[data-status="fail"].focused { 
  background: rgba(239, 68, 68, .06); 
  border-color: var(--danger); border-left-color: var(--danger); 
}
.cl-item[data-status="warn"].focused { 
  background: rgba(245, 158, 11, .06); 
  border-color: var(--warning); border-left-color: var(--warning); 
}
.cl-item[data-status="pass"].focused { 
  background: rgba(16, 185, 129, .05); 
  border-color: var(--success); border-left-color: var(--success); 
}

/* Deleted finding */
.cl-item-deleted {
  opacity: 0.45;
  border-left-color: var(--border) !important;
  background: var(--bg-subtle);
  position: relative;
}
.cl-item-deleted::after {
  content: 'Removed';
  position: absolute; top: 8px; right: 10px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 1px 6px; border-radius: 4px;
}
.cl-item-deleted:hover { opacity: 0.65; }
.cl-item-deleted .cl-detail,
.cl-item-deleted .cl-excerpt,
.cl-item-deleted .cl-ref { display: none; }

/* Deleted toggle */
.scan-deleted-toggle {
  padding: 4px 12px 8px;
}
.deleted-toggle-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; user-select: none;
}
.deleted-toggle-label input[type="checkbox"] {
  accent-color: var(--primary);
}

/* Status icon circle */
.cl-status {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.cl-status svg { width: 12px; height: 12px; }
.cl-status.st-pass { background: rgba(16, 185, 129, .15); color: var(--success); }
.cl-status.st-fail { background: rgba(239, 68, 68, .15); color: var(--danger); }
.cl-status.st-warn { background: rgba(245, 158, 11, .15); color: var(--warning); }
.cl-status.st-pend { background: var(--bg-active); color: var(--text-muted); }
.cl-status.st-scan { background: rgba(59, 130, 246, .15); color: var(--info); animation: pulse 1.5s infinite; }

/* Content */
.cl-content { flex: 1; min-width: 0; }
.cl-title { font-size: 12.5px; font-weight: 700; color: var(--text-primary); line-height: 1.4; }
.cl-ref {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  font-weight: 600; color: var(--text-dim); margin-top: 2px;
}
.cl-detail {
  font-size: 11.5px; color: var(--text-muted); margin-top: 4px;
  line-height: 1.5; display: none;
}
.cl-item.focused .cl-detail { display: block; }

/* AI reasoning narrative — color matches item status */
.cl-narrative {
  margin-top: 8px; padding: 8px 10px;
  background: var(--bg-hover); border-radius: var(--radius-sm);
  border-left: 3px solid var(--text-muted);
  font-size: 11px; color: var(--text-secondary);
  line-height: 1.5; display: none;
}
.cl-item[data-status="fail"] .cl-narrative { border-left-color: var(--danger); background: rgba(239, 68, 68, .04); }
.cl-item[data-status="warn"] .cl-narrative { border-left-color: var(--warning); background: rgba(245, 158, 11, .04); }
.cl-item[data-status="pass"] .cl-narrative { border-left-color: var(--success); background: rgba(16, 185, 129, .04); }
.cl-item.focused .cl-narrative { display: block; }

/* Actions */
.cl-item-actions { display: none; margin-top: 8px; gap: 6px; }
.cl-item.focused .cl-item-actions { display: flex; }

.scanning .cl-status { animation: pulse 1s infinite; }
/* ============ AI SCAN BUTTON ============ */
.ai-scan-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin: 10px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--bg-base); border: none; border-radius: var(--radius-md);
  font-family: 'Manrope', sans-serif; font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden;
}
.ai-scan-btn:hover { box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.ai-scan-btn svg { width: 18px; height: 18px; }
.ai-scan-btn .shimmer {
  position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .2), transparent);
  animation: shimmer 2s infinite;
}

/* ============ ROUTE MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .5);
  z-index: 100; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }

.modal {
  width: 520px; max-height: 80vh;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 28px; overflow-y: auto; animation: fadeSlide .25s ease;
}
.modal h3 { font-family: 'Outfit', sans-serif; font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.modal .modal-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .field label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
}
.modal .field label .req { color: var(--danger); }
.modal .field input, .modal .field select, .modal .field textarea {
  font-family: 'Manrope', sans-serif; width: 100%; font-size: 12.5px;
  font-weight: 500; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input);
  color: var(--text-primary); outline: none; transition: var(--transition);
}
.modal .field input:focus, .modal .field select:focus, .modal .field textarea:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow);
}
.modal .field textarea { resize: vertical; min-height: 80px; }
.modal .issue-summary {
  padding: 10px 12px; background: var(--bg-hover);
  border-radius: var(--radius-sm); border-left: 3px solid var(--danger);
  font-size: 11.5px; color: var(--text-secondary);
  line-height: 1.5; margin-bottom: 14px;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}

/* ============ AUDIT LOG ============ */

/* Dashboard Row Action Menu */
.td-actions-cell { position: relative; width: 40px; text-align: center; padding: 0 !important; }
.row-menu { position: relative; display: inline-block; }
.row-menu-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; font-weight: 700; color: var(--text-muted);
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.row-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.row-menu-dropdown {
  display: none; position: fixed; z-index: 200;
  min-width: 190px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 4px 0;
}
.row-menu-dropdown.show { display: block; }
.row-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: var(--transition);
}
.row-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.row-menu-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.row-menu-primary { color: var(--primary); }
.row-menu-primary:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.row-menu-success { color: var(--success); }
.row-menu-success:hover { background: color-mix(in srgb, var(--success) 8%, transparent); }
.row-menu-warn { color: var(--warning); }
.row-menu-warn:hover { background: color-mix(in srgb, var(--warning) 8%, transparent); }
.row-menu-danger { color: var(--danger); }
.row-menu-danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.row-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Assign Reviewer Modal */
.assign-reviewer-list {
  display: flex; flex-direction: column; gap: 4px;
  margin: 12px 0 18px; max-height: 320px; overflow-y: auto;
}
.assign-reviewer-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; cursor: pointer;
  transition: var(--transition);
}
.assign-reviewer-row:hover { background: var(--bg-hover); }
.assign-reviewer-row.already-assigned {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
  border-color: color-mix(in srgb, var(--primary) 15%, transparent);
}
.assign-avatar {
  width: 30px; height: 30px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.assign-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.assign-name { font-size: 12.5px; font-weight: 700; color: var(--text-primary); }
.assign-role-label { font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.assign-role-select { font-size: 11px; padding: 4px 8px; flex-shrink: 0; }
.assign-remove-btn {
  background: none; border: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  flex-shrink: 0; transition: var(--transition); margin-left: 4px;
}
.assign-remove-btn:hover { background: rgba(239,68,68,.12); color: var(--danger); }

/* Status Transition Modal */
.status-options { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 12px; }
.status-option-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); cursor: pointer;
  transition: var(--transition);
}
.status-option-card:hover { border-color: var(--primary); background: var(--bg-hover); }
.status-option-card.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.status-option-label { display: flex; align-items: center; gap: 8px; flex: 1; }
.status-option-text { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.status-note-hint { font-size: 10.5px; color: var(--text-muted); margin-left: auto; font-style: italic; }
.status-notes {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px; font-family: inherit;
  resize: vertical; background: var(--bg-primary); color: var(--text-primary);
  margin-bottom: 4px;
}
.status-notes:focus { outline: none; border-color: var(--primary); }
.modal-sub strong.pill { display: inline; padding: 2px 8px; }

/* Page badge on checklist items */
.cl-page-badge {
  display: inline-block; font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; font-weight: 700; padding: 1px 6px;
  border-radius: var(--radius-full); background: var(--bg-hover);
  color: var(--text-muted); margin-left: 8px; vertical-align: middle;
}

/* Routed badge on checklist items */
.cl-routed-badge {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
  font-size: 11px; color: var(--text-secondary);
}
.cl-routed-badge svg { width: 12px; height: 12px; color: var(--warning); flex-shrink: 0; }
.cl-routed-badge strong { color: var(--text-primary); font-weight: 700; }

/* Comment thread */
.cl-actions {
  margin-top: 8px;
}

.cl-actions .btn + .btn {
  margin-left: 6px;
}
.cl-comment-thread { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cl-comment-thread:empty { display: none; }
.cl-comment-bubble {
  display: flex; gap: 8px; padding: 7px 10px;
  background: var(--bg-hover); border-radius: var(--radius-sm);
}
.cl-comment-avatar {
  width: 24px; height: 24px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.cl-comment-body { flex: 1; min-width: 0; }
.cl-comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.cl-comment-author { font-size: 11px; font-weight: 700; color: var(--text-primary); }
.cl-comment-time { font-size: 10px; color: var(--text-muted); }
.cl-comment-text { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; }

/* Comment delete/restore action */
.cl-comment-action {
  margin-left: auto; padding: 0 4px; opacity: 0;
  transition: opacity .15s; font-size: 10px;
}
.cl-comment-action svg { width: 11px; height: 11px; }
.cl-comment-bubble:hover .cl-comment-action { opacity: 0.6; }
.cl-comment-bubble:hover .cl-comment-action:hover { opacity: 1; }

/* Deleted comment */
.cl-comment-deleted { opacity: 0.5; }
.cl-comment-deleted .cl-comment-action { opacity: 0.7; }

/* Comment input */
.cl-comment-input-row { margin-top: 6px; }
.cl-comment-input {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; font-family: inherit;
  resize: none; background: var(--bg-primary); color: var(--text-primary);
}
.cl-comment-input:focus { outline: none; border-color: var(--primary); }
.cl-comment-input-actions {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 5px;
}
.btn-xs { font-size: 11px; padding: 3px 10px; border-radius: var(--radius-sm); }

/* PDF.js canvas viewer */
.pdf-page-nav-bar {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 6px 12px; background: var(--bg-card);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.pdf-page-label {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 700; color: var(--text-primary); min-width: 60px; text-align: center;
}
.pdf-canvas-container {
  flex: 1; overflow: auto; padding: 16px;
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-hover);
}
.pdf-canvas-container canvas {
  box-shadow: var(--shadow-md); border-radius: 2px;
  max-width: 100%;
}

/* Search input in filter bar */
.audit-search {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600;
  padding: 6px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-input); color: var(--text-primary); outline: none;
  transition: var(--transition); min-width: 200px;
}
.audit-search:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow);
}
.audit-search::placeholder { color: var(--text-dim); font-weight: 500; }

/* Count badge next to title */
.audit-count {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  background: var(--bg-hover); padding: 2px 10px;
  border-radius: var(--radius-full);
}

/* Table overrides */
.audit-table { width: 100%; border-collapse: collapse; }
.audit-table td { vertical-align: top; padding: 11px 18px; }
.audit-table tr { cursor: default; }
.audit-table tr:hover td { background: var(--bg-hover); }

/* Timestamp cell */
.audit-ts { white-space: nowrap; }
.audit-ts .ts-date {
  display: block; font-size: 12px; font-weight: 700; color: var(--text-primary);
}
.audit-ts .ts-time {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-muted); font-weight: 500; margin-top: 1px;
}

/* User cell */
.audit-user { display: flex; align-items: center; gap: 9px; }
.audit-avatar {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0;
  letter-spacing: .5px;
}
.audit-user-text { display: flex; flex-direction: column; min-width: 0; }
.audit-user-name { font-size: 12px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.audit-user-role { font-size: 10.5px; color: var(--text-dim); font-weight: 500; margin-top: 1px; }

/* Action pill */
.audit-action-pill {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap;
}
.action-status { background: rgba(99,102,241,.12); color: #6366f1; }
.action-created { background: rgba(16,185,129,.12); color: var(--success); }
.action-assigned { background: rgba(59,130,246,.12); color: #3b82f6; }
.action-upload { background: rgba(139,92,246,.12); color: #8b5cf6; }
.action-download { background: rgba(107,114,128,.12); color: var(--text-muted); }
.action-review { background: rgba(245,158,11,.12); color: #f59e0b; }
.action-comment { background: rgba(20,184,166,.12); color: #14b8a6; }
.action-approved { background: rgba(16,185,129,.18); color: var(--success); }
.action-warning { background: rgba(239,68,68,.12); color: var(--danger); }

/* Target cell */
.audit-target-id {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  font-weight: 700; color: var(--primary); cursor: pointer;
}
.audit-target-id:hover { text-decoration: underline; }
.audit-target-type { display: block; font-size: 10.5px; color: var(--text-dim); font-weight: 500; margin-top: 1px; }

/* Detail cell */
.audit-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.5; max-width: 340px; }

/* IP cell */
.audit-ip { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--text-dim); white-space: nowrap; }

/* Empty state */
.audit-empty { text-align: center; padding: 48px 18px !important; color: var(--text-muted); font-size: 13px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: 1fr; }
}

/* ============ VERSION HISTORY ============ */
.version-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.version-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--bg-hover);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; transition: var(--transition);
}
.version-item:first-child { border-color: var(--primary); background: var(--bg-active); }
.version-item .ver-tag {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--primary); color: var(--bg-base);
}
.version-item:not(:first-child) .ver-tag {
  background: var(--bg-active); color: var(--text-muted);
}
.version-item .ver-name { font-weight: 700; color: var(--text-primary); flex: 1; min-width: 0; }
.version-item .ver-date { font-size: 11px; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.version-item .ver-uploader { font-size: 11px; color: var(--text-dim); font-weight: 600; white-space: nowrap; }

/* Upload New Version area inside modal */
.upload-version-drop {
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 22px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg-hover); margin-bottom: 14px;
}
.upload-version-drop:hover { border-color: var(--primary); background: var(--bg-active); }
.upload-version-drop svg { width: 28px; height: 28px; color: var(--text-muted); margin-bottom: 6px; }
.upload-version-drop p { font-size: 12px; color: var(--text-muted); }
.upload-version-drop .accent { color: var(--primary); font-weight: 700; }
.upload-version-drop .hint { font-size: 10.5px; color: var(--text-muted); opacity: .6; margin-top: 2px; }
.upload-selected-file {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; background: var(--bg-elevated);
  border: 1px solid var(--success); border-radius: var(--radius-sm);
  margin-bottom: 14px; font-size: 12px;
}
.upload-selected-file svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }
.upload-selected-file .fname { flex: 1; font-weight: 600; color: var(--text-primary); }
.upload-selected-file .fsize { color: var(--text-muted); font-size: 11px; }

/* ============ USER MANAGEMENT ============ */
.user-mgmt-view { max-width: 1100px; }
.user-mgmt-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.user-mgmt-header h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.user-mgmt-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Stats row */
.user-stats-row { display: flex; gap: 16px; margin-bottom: 20px; }
.user-stat-card {
  flex: 1; display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.user-stat-icon { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.user-stat-icon svg { width: 18px; height: 18px; }
.user-stat-value { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.user-stat-label { font-size: 12px; color: var(--text-muted); }

/* Table tweaks */
.user-table .th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-cell-info { display: flex; flex-direction: column; gap: 1px; }
.user-cell-name { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.user-cell-email { font-size: 11px; color: var(--text-muted); }
.user-last-active { font-size: 12px; color: var(--text-muted); }
.user-perm-count { font-size: 12px; color: var(--text-secondary); }
.user-actions-cell { display: flex; gap: 4px; }
.row-inactive { opacity: 0.6; }
.row-inactive:hover { opacity: 0.85; }

/* Role badges */
.role-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.role-chair { background: #f3e8ff; color: #7c3aed; }
.role-admin { background: #fce7f3; color: #db2777; }
.role-coordinator { background: #dbeafe; color: #2563eb; }
.role-reviewer { background: #fef3c7; color: #d97706; }
.role-medical { background: #d1fae5; color: #059669; }
.role-statistical { background: #ffedd5; color: #ea580c; }
.role-pi { background: #fee2e2; color: #dc2626; }
.role-research { background: #e0f2fe; color: #0284c7; }

/* User form modal */
.user-form { display: flex; flex-direction: column; gap: 14px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.user-form-field { display: flex; flex-direction: column; gap: 4px; }
.user-form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.user-form-section { margin-top: 8px; }
.user-form-section-label { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.form-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--card-bg); color: var(--text-primary);
  box-sizing: border-box;
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(16,185,129,0.15); }

/* Permissions grid */
.perm-grid { display: flex; flex-direction: column; gap: 6px; }
.perm-row { padding: 6px 8px; border-radius: 6px; transition: background 0.15s; }
.perm-row:hover { background: var(--hover-bg); }
.perm-label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-primary); }
.perm-label input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); }
.perm-desc { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ============ SETTINGS ============ */
.settings-view { max-width: 1000px; }
.settings-header { margin-bottom: 24px; }
.settings-header h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.settings-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Two-column layout */
.settings-layout { display: flex; gap: 24px; min-height: 500px; }
.settings-nav {
  width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 8px; align-self: flex-start; position: sticky; top: 80px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: var(--transition);
}
.settings-nav-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.settings-nav-item.active { background: var(--primary-glow); color: var(--accent); font-weight: 700; }
.settings-nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.settings-nav-icon svg { width: 16px; height: 16px; }

/* Panel area */
.settings-panel-area { flex: 1; min-width: 0; }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeSlide .25s ease; }

/* Section headings */
.settings-section-title { margin-bottom: 24px; }
.settings-section-title h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 0 0 4px; }
.settings-section-desc { font-size: 13px; color: var(--text-muted); }

/* Profile card */
.settings-profile-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 24px;
}
.settings-avatar {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.settings-profile-name { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.settings-profile-role { font-size: 13px; color: var(--text-secondary); }
.settings-profile-email { font-size: 12px; color: var(--text-muted); }

/* Form */
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-form-row { display: flex; gap: 16px; }
.settings-form-row > * { flex: 1; }
.settings-field { display: flex; flex-direction: column; gap: 4px; }
.settings-field-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.settings-actions { margin-top: 20px; display: flex; gap: 10px; }

/* Groups */
.settings-group { margin-bottom: 20px; }
.settings-group-label { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.settings-group .form-input { max-width: 260px; }
.settings-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* Toggle rows */
.settings-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 14px 16px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 10px;
}
.settings-toggle-text { flex: 1; }
.settings-toggle-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.settings-toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 22px;
  transition: .25s;
}
.toggle-slider::before {
  content: ''; position: absolute; height: 16px; width: 16px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Theme grid */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-card {
  padding: 12px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); text-align: center;
}
.theme-card:hover { border-color: var(--text-muted); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--primary-glow); }
.theme-swatch {
  width: 100%; height: 32px; border-radius: 6px; margin-bottom: 8px;
}
.theme-swatch[data-swatch="mint"] { background: linear-gradient(135deg, #10b981, #14b8a6); }
.theme-swatch[data-swatch="ocean"] { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.theme-swatch[data-swatch="sunset"] { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.theme-swatch[data-swatch="vibrant"] { background: linear-gradient(135deg, #a855f7, #ec4899); }
.theme-swatch[data-swatch="light"] { background: linear-gradient(135deg, #e5e7eb, #f9fafb); }
.theme-swatch[data-swatch="dark"] { background: linear-gradient(135deg, #1f2937, #374151); }
.theme-card-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.theme-card-desc { font-size: 11px; color: var(--text-muted); }

/* System info */
.settings-info-grid {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 24px;
}
.settings-info-row {
  display: flex; padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.settings-info-row:last-child { border-bottom: none; }
.settings-info-key { width: 140px; font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.settings-info-val { font-size: 13px; color: var(--text-primary); }

/* Danger zone */
.settings-danger {
  margin-top: 24px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 10px;
}

/* ============ COMPACT SIDEBAR ============ */
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-label { white-space: nowrap; overflow: hidden; }

.sidebar.compact { width: 64px; overflow: hidden; }
.sidebar.compact .sidebar-brand span { display: none; }
.sidebar.compact .sidebar-brand img, .sidebar.compact .sidebar-logo { max-width: 36px; height: auto; }
.sidebar.compact .sidebar-brand { padding: 16px 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.sidebar.compact .sidebar-nav { padding: 8px 6px; }
.sidebar.compact .nav-group { height: 0; overflow: hidden; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--border); }
.sidebar.compact .nav-group:first-child { border-top: none; margin-top: 0; }
.sidebar.compact .nav-item {
  justify-content: center; padding: 10px; gap: 0;
}
.sidebar.compact .nav-item .nav-label { display: none; }
.sidebar.compact .nav-item .nav-icon svg { width: 20px; height: 20px; }
.sidebar.compact .nav-item.active::before { display: none; }
.sidebar.compact ~ .main { margin-left: 64px; }

/* Tooltip on hover in compact mode */
.sidebar.compact .nav-item { position: relative; }
.sidebar.compact .nav-item::after {
  content: attr(data-tip); position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  background: var(--text-primary); color: var(--bg-base); padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s; margin-left: 8px; z-index: 100;
}
.sidebar.compact .nav-item:hover::after { opacity: 1; }

/* ============ COMPACT ROWS ============ */
.compact-rows table td { padding: 4px 14px; font-size: 11px; line-height: 1.3; }
.compact-rows table th { padding: 5px 14px; font-size: 9px; }
.compact-rows .audit-table td { padding: 5px 14px; font-size: 11px; }
.compact-rows .user-table .user-cell { padding: 5px 10px; }
.compact-rows .user-table .th { padding: 5px 10px; font-size: 9px; }
.compact-rows .user-avatar { width: 26px; height: 26px; font-size: 10px; }
.compact-rows .status-pill { font-size: 9px; padding: 1px 8px; }
.compact-rows .td-id { font-size: 10px; }
.compact-rows .role-badge { font-size: 9px; padding: 1px 7px; }

/* ============ REPORTS & ANALYTICS ============ */
.reports-view .view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }

.reports-filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.reports-chip-group { display: flex; gap: 4px; background: var(--bg-hover); border-radius: var(--radius-sm); padding: 3px; }
.reports-chip {
  padding: 5px 14px; border-radius: var(--radius-sm); border: none; background: transparent;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.reports-chip:hover { color: var(--text-primary); }
.reports-chip.active { background: var(--bg-base); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.reports-kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 24px; }
.reports-kpi-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 18px 16px; text-align: center; transition: var(--transition);
}
.reports-kpi-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px var(--primary-glow); }
.reports-kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.reports-kpi-icon svg { width: 18px; height: 18px; }
.reports-kpi-value { font-size: 24px; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; }
.reports-kpi-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.reports-chart-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 18px; }
.reports-chart-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 20px; transition: var(--transition);
}
.reports-chart-card:hover { border-color: var(--primary); }
.reports-chart-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; }
.reports-chart-body { position: relative; }
.reports-empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* Donut */
.reports-donut-layout { display: flex; align-items: center; gap: 24px; justify-content: center; }
.reports-legend { display: flex; flex-direction: column; gap: 8px; }
.reports-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.reports-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.reports-legend-val { color: var(--text-muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* Horizontal bars */
.reports-hbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.reports-hbar-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 80px; text-align: right; }
.reports-hbar-track { flex: 1; height: 18px; background: var(--bg-hover); border-radius: 9px; overflow: hidden; }
.reports-hbar-fill { height: 100%; background: var(--primary); border-radius: 9px; transition: width .5s ease; min-width: 4px; }
.reports-hbar-val { font-size: 11px; font-weight: 700; color: var(--text-muted); min-width: 50px; font-variant-numeric: tabular-nums; }

/* Gauges */
.reports-gauges { display: flex; flex-direction: column; gap: 16px; }
.reports-gauge-row { display: flex; align-items: center; gap: 14px; }
.reports-gauge-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* Responsive */
@media (max-width: 1100px) {
  .reports-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .reports-chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .reports-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============ NOTIFICATION BELL ============ */
.notif-wrapper { position: relative; }
.notif-bell {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: var(--transition); color: var(--text-muted);
}
.notif-bell:hover { background: var(--bg-hover); color: var(--text-primary); }
.notif-bell svg { width: 18px; height: 18px; }
.notif-bell.has-unread svg { animation: bellShake 0.5s ease-in-out; }
@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
}
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: white; font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

/* Dropdown */
.notif-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  width: 380px; max-height: 480px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,.15); z-index: 200; overflow: hidden;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notif-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.notif-mark-all {
  font-size: 11px; font-weight: 600; color: var(--primary); background: none; border: none;
  cursor: pointer; font-family: 'Manrope', sans-serif;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px;
  cursor: pointer; transition: var(--transition); border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-glow); }
.notif-item.unread:hover { background: var(--bg-hover); }
.notif-icon { flex-shrink: 0; margin-top: 2px; }
.notif-icon svg { width: 16px; height: 16px; }
.notif-content { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.notif-item-body { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-item-meta { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 6px; }
.notif-empty { padding: 40px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============ @MENTION AUTOCOMPLETE ============ */
.mention-dropdown {
  position: absolute; 
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: 0 -4px 20px rgba(0,0,0,.12); z-index: 50; max-height: 240px; overflow-y: auto;
  z-index: 10000;
}
.mention-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  cursor: pointer; transition: var(--transition);
}
.mention-item:hover, .mention-item.active { background: var(--bg-hover); }
.mention-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
}
.mention-info { display: flex; flex-direction: column; }
.mention-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.mention-role { font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* ============ VERSION SELECTOR ============ */
.version-selector {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-primary); cursor: pointer;
}
.version-selector:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }

/* Version read-only banner */
.version-readonly-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin-bottom: 12px;
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  color: #b45309;
}
.version-readonly-banner svg { width: 14px; height: 14px; flex-shrink: 0; }
.version-back-link { color: var(--primary); cursor: pointer; text-decoration: underline; margin-left: auto; }

/* Checklist diff indicators */
.cl-item-changed { border-left: 3px solid var(--primary); }
.cl-diff-badge {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.cl-diff-arrow { color: var(--text-muted); }
.cl-diff-prior, .cl-diff-new { padding: 1px 6px; border-radius: 9999px; }
.cl-st-pass { background: rgba(16,185,129,.12); color: #059669; }
.cl-st-fail { background: rgba(239,68,68,.12); color: #dc2626; }
.cl-st-warn { background: rgba(245,158,11,.12); color: #d97706; }
.cl-st-pend { background: rgba(148,163,184,.12); color: #64748b; }

/* Comment version tag */
.cl-comment-version {
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 9999px;
  background: rgba(99,102,241,.1); color: #6366f1; margin-left: 4px;
}

/* @mention highlight in comments */
.mention-highlight { color: var(--primary); font-weight: 700; }

/* ============ LOADING SPINNER ============ */
.loading-spinner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; color: var(--text-muted);
}
.spinner-ring {
  width: 20px; height: 20px; border: 2.5px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spinRing 0.7s linear infinite;
}
@keyframes spinRing { to { transform: rotate(360deg); } }
.spinner-text { font-size: 12px; font-weight: 600; }

/* ============ PAGINATION ============ */
.pagination-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}
.page-info { font-weight: 600; }
.page-controls { display: flex; align-items: center; gap: 4px; }
.page-btn {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-primary); cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-ellipsis { padding: 0 6px; color: var(--text-muted); font-weight: 700; }
.page-size-select {
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 600;
  padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary); cursor: pointer;
}

/* ============ TABLE HEADER SEARCH ============ */
.tbl-head-right { display: flex; align-items: center; gap: 10px; }
.deleted-toggle svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.deleted-toggle.active { color: var(--danger); border-color: var(--danger); }
.tbl-search-wrap {
  position: relative; display: flex; align-items: center;
}
.tbl-search-icon {
  position: absolute; left: 10px; pointer-events: none;
  color: var(--text-muted); display: flex; align-items: center;
}
.tbl-search-icon svg { width: 14px; height: 14px; }
.tbl-search {
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 500;
  padding: 7px 12px 7px 32px; border-radius: var(--radius-full); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary); width: 160px;
  transition: all .2s ease;
}
.tbl-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); width: 220px; }
.tbl-search::placeholder { color: var(--text-muted); font-weight: 500; }
.td-empty { padding: 40px 16px !important; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============ EMPTY STATES ============ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center;
}
.empty-state-icon {
  width: 100px; height: 84px; color: var(--text-muted); margin-bottom: 16px;
  opacity: 0.7;
}
.empty-state-icon svg { width: 100%; height: 100%; }
.empty-state-title {
  font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5;
  max-width: 300px; margin-bottom: 16px;
}
.empty-state .btn { font-size: 12px; }

/* ============ CONFIRM DIALOG ============ */
.confirm-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 24px 20px;
  width: 380px; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-xl);
  animation: confirmEnter .2s ease;
}
@keyframes confirmEnter {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.confirm-icon {
  width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-icon-danger { background: rgba(239,68,68,.1); color: #ef4444; }
.confirm-icon-warning { background: rgba(245,158,11,.1); color: #f59e0b; }
.confirm-icon-primary { background: rgba(99,102,241,.1); color: #6366f1; }
.confirm-title {
  font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 8px;
}
.confirm-message {
  font-size: 13px; color: var(--text-muted); line-height: 1.55; margin-bottom: 20px;
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: center;
}
.confirm-actions .btn { min-width: 100px; font-size: 12.5px; }
.btn-danger {
  background: #ef4444; color: white; border: 1px solid #ef4444;
}
.btn-danger:hover { background: #dc2626; }
.btn-warning {
  background: #f59e0b; color: white; border: 1px solid #f59e0b;
}
.btn-warning:hover { background: #d97706; }

/* ============ BULK ACTIONS ============ */
.bulk-cb {
  width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary);
}
.td-cb { padding-left: 12px !important; width: 36px; }
.td-cb .bulk-cb { pointer-events: auto; }
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--primary-glow);
  border-bottom: 1px solid var(--primary);
  animation: bulkSlide .2s ease;
}
@keyframes bulkSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.bulk-count {
  font-size: 12.5px; font-weight: 700; color: var(--primary);
}
.bulk-actions {
  display: flex; align-items: center; gap: 6px;
}
.bulk-actions .btn svg { width: 13px; height: 13px; }
.bulk-clear {
  color: var(--text-muted) !important; font-size: 11px !important;
}
.bulk-hint {
  font-size: 11px; color: var(--text-muted); font-style: italic; padding: 0 8px;
}

/* ============ SIDEBAR SHORTCUT HINT ============ */
.sidebar-shortcut-hint {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin: 8px 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  transition: var(--transition); background: rgba(255,255,255,.02);
}
.sidebar-shortcut-hint:hover {
  border-color: var(--primary); color: var(--text-secondary);
  background: var(--primary-glow);
}
.sidebar-shortcut-hint svg { width: 13px; height: 13px; flex-shrink: 0; }
.sidebar-shortcut-hint span { flex: 1; }
.sidebar-shortcut-hint kbd {
  font-family: 'Manrope', sans-serif; font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-active); border: 1px solid var(--border);
  color: var(--text-muted); line-height: 1;
}
.sidebar.compact .sidebar-shortcut-hint { justify-content: center; padding: 8px; margin: 8px 6px; }
.sidebar.compact .sidebar-shortcut-hint span,
.sidebar.compact .sidebar-shortcut-hint kbd { display: none; }

/* ============ COMMAND PALETTE ============ */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
}
.cmd-overlay.show { opacity: 1; pointer-events: auto; }
.cmd-modal {
  width: 520px; max-width: 90vw; max-height: 70vh;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: 0 24px 48px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  animation: cmdEnter .15s ease;
  overflow: hidden;
}
@keyframes cmdEnter {
  from { transform: scale(0.96) translateY(-8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.cmd-search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.cmd-search-icon { display: flex; color: var(--text-muted); }
.cmd-search-icon svg { width: 16px; height: 16px; }
.cmd-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 500;
  color: var(--text-primary);
}
.cmd-input::placeholder { color: var(--text-muted); }
.cmd-esc-hint {
  font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 4px;
  background: var(--bg-active); border: 1px solid var(--border);
  color: var(--text-muted);
}
.cmd-results {
  flex: 1; overflow-y: auto; padding: 6px 0;
  max-height: calc(70vh - 110px);
}
.cmd-section {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted);
  padding: 10px 16px 4px;
}
.cmd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer;
  transition: background .1s;
}
.cmd-item:hover, .cmd-item.active {
  background: var(--primary-glow);
}
.cmd-item.active { border-left: 2px solid var(--primary); }
.cmd-item-icon { display: flex; color: var(--text-muted); flex-shrink: 0; }
.cmd-item-icon svg { width: 15px; height: 15px; }
.cmd-item-text { display: flex; flex-direction: column; min-width: 0; }
.cmd-item-label {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmd-item-sub {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmd-empty {
  padding: 28px 16px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}
.cmd-footer {
  display: flex; gap: 16px; padding: 8px 16px;
  border-top: 1px solid var(--border);
}
.cmd-foot-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--text-muted);
}
.cmd-foot-item kbd {
  font-family: 'Manrope', sans-serif; font-size: 9px; font-weight: 800;
  padding: 1px 5px; border-radius: 3px;
  background: var(--bg-active); border: 1px solid var(--border);
}

/* ============ SHORTCUTS HELP MODAL ============ */
.shortcuts-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  width: 460px; max-width: 90vw; box-shadow: var(--shadow-xl);
  text-align: center;
}
.shortcuts-modal h3 {
  font-family: 'Outfit', sans-serif; font-size: 16px; font-weight: 700;
  margin-bottom: 20px;
}
.shortcuts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  text-align: left; margin-bottom: 20px;
}
.shortcut-group-title {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: 10px;
}
.shortcut-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 12.5px; color: var(--text-secondary);
}
.shortcut-row kbd {
  font-family: 'Manrope', sans-serif; font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 4px; min-width: 28px; text-align: center;
  background: var(--bg-active); border: 1px solid var(--border);
  color: var(--text-muted);
}
.shortcut-row span { flex: 1; }

/* ============ CHECKLIST ACTION ROW ============ */
.checklist-action-row {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; margin-bottom: 2px;
}
/* scan button no longer in action row */
.checklist-action-row .btn svg { width: 13px; height: 13px; }

/* ============ AI REVIEW RULES ============ */
.airules-stats {
  display: flex; gap: 12px; margin-bottom: 16px;
}
.airules-stat {
  flex: 1; padding: 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); text-align: center;
  background: var(--bg-active);
}
.airules-stat-val {
  display: block; font-family: 'Outfit', sans-serif;
  font-size: 22px; font-weight: 800; color: var(--primary);
}
.airules-stat-lbl {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-muted);
}
.airules-add-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.airules-add-row .btn svg { width: 13px; height: 13px; }
.airules-list { display: flex; flex-direction: column; gap: 10px; }
.airule-card {
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  transition: var(--transition);
}
.airule-card:hover { border-color: var(--primary); }
.airule-disabled { opacity: 0.55; }
.airule-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.airule-name-wrap { display: flex; align-items: center; gap: 8px; }
.airule-name {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.airule-priority {
  font-size: 9px; font-weight: 800; padding: 2px 8px; border-radius: 9999px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.airule-priority-req { background: rgba(239,68,68,.1); color: #ef4444; }
.airule-priority-rec { background: rgba(245,158,11,.1); color: #d97706; }
.airule-prompt {
  font-size: 12px; color: var(--text-secondary); line-height: 1.55;
  padding: 8px 10px; background: var(--bg-active); border-radius: var(--radius-xs);
  margin-bottom: 8px;
}
.airule-actions { display: flex; gap: 6px; }
.airule-actions .btn { font-size: 11px; }

/* Rule modal */
.airule-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; width: 480px;
  max-width: 90vw; box-shadow: var(--shadow-xl);
}
.airule-modal h3 {
  font-family: 'Outfit', sans-serif; font-size: 16px;
  font-weight: 700; margin-bottom: 4px;
}
.airule-textarea {
  min-height: 100px; resize: vertical; font-family: 'Manrope', sans-serif;
  font-size: 12.5px; line-height: 1.55;
}
.airule-char-count {
  font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 4px;
}

/* ============ AI SCAN ANIMATION ============ */
.cl-scanning {
  background: var(--primary-glow) !important;
  transition: background .15s;
}

/* ============ CONTEXT SWITCHER ============ */
.ctx-switcher {
  margin: 4px 12px 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.ctx-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
  font-size: 11.5px;
  color: var(--text-secondary);
}
.ctx-row:hover {
  background: var(--bg-active);
}
.ctx-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .6;
}
.ctx-icon svg {
  width: 14px;
  height: 14px;
}
.ctx-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.ctx-chevron {
  font-size: 10px;
  opacity: .5;
}

/* Compact sidebar: hide labels */
.sidebar.compact .ctx-switcher {
  margin: 4px 6px 8px;
}
.sidebar.compact .ctx-label,
.sidebar.compact .ctx-chevron {
  display: none;
}
.sidebar.compact .ctx-row {
  justify-content: center;
  padding: 5px;
}

/* Context picker modal */
.ctx-picker-modal {
  max-width: 400px !important;
  padding: 20px !important;
}
.ctx-picker-modal h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.ctx-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}
.ctx-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.ctx-picker-item:hover {
  background: var(--bg-active);
}
.ctx-picker-active {
  background: var(--primary-glow);
  cursor: default;
}
.ctx-picker-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}
.ctx-picker-check {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}
.ctx-picker-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
}
.ctx-badge-inactive {
  background: #fef2f2;
  color: #dc2626;
}
.ctx-picker-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ============ SITE CARDS ============ */
.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding: 0 2px;
}
.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color .15s, box-shadow .15s;
}
.site-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.site-inactive {
  opacity: .6;
}
.site-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.site-card-name {
  font-size: 14px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}
.site-card-status {
  font-size: 11px;
}
.site-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.site-card-detail {
  font-size: 11.5px;
  color: var(--text-secondary);
}
.site-label {
  font-weight: 600;
  color: var(--text-muted);
  display: inline-block;
  min-width: 52px;
}
.site-card-actions {
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ============ ORG TABLE ENHANCEMENTS ============ */
.clickable-row {
  cursor: pointer;
  transition: background .12s;
}
.clickable-row:hover {
  background: var(--bg-active);
}
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge-purple {
  background: #f3e8ff;
  color: #7c3aed;
}
.badge-blue {
  background: #dbeafe;
  color: #2563eb;
}
.badge-gray {
  background: #f3f4f6;
  color: #6b7280;
}
.modal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 14px;
}

/* ============ RULES UI (three-tier) ============ */
.rules-header {
  margin-bottom: 16px;
}
.rules-title {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 4px;
}
.rules-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.rules-add-area {
  margin-bottom: 18px;
}
.rules-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 18px;
}
.rules-add-btn svg {
  width: 14px;
  height: 14px;
}
.rules-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.rules-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
  padding: 14px 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.rules-group-std {
  color: var(--text-muted);
  margin-top: 8px;
}

/* Rule card */
.rule-card {
  padding: 14px 16px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.rule-card:hover {
  background: var(--bg-active);
}
.rule-org {
  border-left-color: var(--primary);
}
.rule-std {
  border-left-color: #d1d5db;
}
.rule-disabled {
  opacity: .5;
}
.rule-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.rule-name {
  font-size: 13.5px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  line-height: 1.3;
}
.rule-chips {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rule-chip {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 2px 7px;
  border-radius: 9999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.rule-chip svg {
  width: 10px;
  height: 10px;
}
.rule-chip-org {
  background: var(--primary-glow);
  color: var(--primary);
}
.rule-chip-std {
  background: #f3f4f6;
  color: #6b7280;
}
.rule-chip-req {
  background: #fef2f2;
  color: #dc2626;
}
.rule-chip-rec {
  background: #fffbeb;
  color: #d97706;
}
.rule-chip-lock {
  background: #f0fdf4;
  color: #16a34a;
}
.rule-prompt {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 4px;
}
.rule-ref {
  font-size: 10.5px;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 4px;
}
.rule-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.rule-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rule-toggle-label {
  font-size: 11px;
  color: var(--text-muted);
}
.rule-actions {
  display: flex;
  gap: 4px;
}
.rule-delete-btn {
  color: #ef4444 !important;
}
.rule-lock-note {
  font-size: 11px;
  color: #16a34a;
  font-style: italic;
}

/* Rule modal */
.rule-modal {
  max-width: 520px !important;
}
.rule-modal h3 {
  margin: 0 0 4px;
  font-size: 17px;
}
.rule-modal-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.rule-field {
  margin-bottom: 16px;
}
.rule-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
}
.rule-prompt-input {
  min-height: 90px;
  resize: vertical;
  font-size: 12.5px !important;
  line-height: 1.5;
}
.rule-prio-pills {
  display: flex;
  gap: 8px;
}
.rule-prio-pill {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}
.rule-prio-pill strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}
.rule-prio-pill span {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}
.rule-prio-pill:hover {
  border-color: var(--primary);
  background: var(--primary-glow);
}
.rule-prio-active {
  border-color: var(--primary) !important;
  background: var(--primary-glow) !important;
}
.rule-prio-active strong {
  color: var(--primary);
}
.rule-ref-toggle {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 0;
}
.rule-ref-toggle:hover {
  text-decoration: underline;
}
.rule-ref-input {
  margin-top: 6px;
}

/* ============ RULES CONTEXT BANNER ============ */
.rules-ctx {
  background: var(--bg-active);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.rules-ctx-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.rules-ctx-icon {
  width: 14px;
  height: 14px;
  opacity: .6;
}
.rules-ctx-icon svg {
  width: 14px;
  height: 14px;
}
.rules-ctx-site {
  font-family: 'Outfit', sans-serif;
  color: var(--primary);
}
.rules-ctx-sep {
  color: var(--text-muted);
}
.rules-ctx-org {
  color: var(--text-secondary);
  font-weight: 500;
}
.rules-ctx-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.rules-summary {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.rules-summary-count {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--primary);
  margin-right: 4px;
}
.rules-add-area {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.btn-outline:hover {
  background: var(--primary-glow);
}
.rules-group-count {
  font-weight: 400;
  opacity: .7;
}
.rules-tier-site {
  color: var(--primary) !important;
}
.rules-tier-org {
  color: #7c3aed !important;
}
.rules-tier-std {
  color: var(--text-muted) !important;
}
.rule-tier-site { border-left-color: var(--primary); }
.rule-tier-org  { border-left-color: #7c3aed; }
.rule-tier-standard { border-left-color: #d1d5db; }
.rule-chip-site {
  background: var(--primary-glow);
  color: var(--primary);
}
.rule-disabled-reason {
  font-size: 10.5px;
  color: #ef4444;
  font-style: italic;
  padding: 2px 0 4px;
}
.rule-muted-btn {
  color: var(--text-muted) !important;
  font-size: 11px !important;
}

/* ============ MEMBERS LIST (org/site views) ============ */
.members-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 12px 0;
  max-height: 400px;
  overflow-y: auto;
}
.member-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background .12s;
}
.member-row:hover {
  background: var(--bg-active);
}
.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.member-info {
  flex: 1;
  min-width: 0;
}
.member-name {
  font-size: 13px;
  font-weight: 600;
}
.member-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.member-email {
  font-size: 11px;
  color: var(--text-muted);
}
.member-perm-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.member-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.member-site-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  background: var(--bg-active);
  border-radius: 6px;
  padding: 3px 8px;
}
.msc-site {
  font-weight: 600;
}
.msc-role {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 1px 6px;
  border-radius: 9999px;
}
.role-admin { background: #fef2f2; color: #dc2626; }
.role-sadmin { background: #f3e8ff; color: #7c3aed; }
.role-reviewer { background: #dbeafe; color: #2563eb; }
.role-user { background: #f3f4f6; color: #6b7280; }

/* ============ USER ACCESS SECTION (user edit modal) ============ */
.user-access-section {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}
.user-access-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.user-access-title {
  font-size: 13px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}
.user-access-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.user-access-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
}
.user-access-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-active);
  border-radius: 8px;
  font-size: 12px;
}
.ua-info {
  flex: 1;
  min-width: 0;
}
.ua-site {
  font-weight: 600;
  font-size: 12.5px;
}
.ua-org {
  font-size: 10.5px;
  color: var(--text-muted);
}
.ua-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ua-perms {
  font-size: 10px;
  color: var(--text-muted);
}
.ua-remove {
  font-size: 16px !important;
  padding: 0 4px !important;
  color: #ef4444 !important;
  line-height: 1;
}

/* ============ ACCESS PERMISSION GRID ============ */
.access-perm-grid {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
.access-perm-group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 6px 0 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.access-perm-group:first-child {
  padding-top: 0;
}
.access-perm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}
.access-perm-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

/* ============ SITE ACCESS LIST (user edit) ============ */
.user-access-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.site-access-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.site-access-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  transition: background .12s;
}
.site-access-row:hover {
  background: var(--bg-active);
}
.site-access-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.site-access-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.site-access-role {
  width: 140px;
  font-size: 12px !important;
  padding: 4px 8px !important;
  flex-shrink: 0;
}
.site-inactive {
  opacity: .45;
}

/* Members modal search + pagination */
.members-search-wrap {
  margin-bottom: 10px;
}
.members-pag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  justify-content: center;
}
.pag-info {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ USER MANAGEMENT — REWRITE ============ */
.um-layout {
  display: flex;
  gap: 0;
  min-height: 500px;
}
.um-table-wrap {
  flex: 1;
  min-width: 0;
}
.um-detail-container {
  width: 0;
  overflow: hidden;
  transition: width .25s ease;
  border-left: 0 solid var(--border);
}
.um-detail-container.open {
  width: 380px;
  min-width: 380px;
  border-left-width: 1px;
}
.um-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.um-search-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.um-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  opacity: .4;
}
.um-search-icon svg {
  width: 14px;
  height: 14px;
}
.um-search-input {
  padding-left: 32px !important;
  font-size: 12.5px !important;
}
.um-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Table cells */
.um-user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.um-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.um-name {
  font-size: 12.5px;
  font-weight: 600;
}
.um-email-cell {
  font-size: 12px;
  color: var(--text-secondary);
}
.um-site-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.um-site-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  background: var(--bg-active);
  border-radius: 5px;
  padding: 2px 7px;
}
.um-chip-name {
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.um-chip-role {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 4px;
  border-radius: 3px;
}
.um-role-reviewer { background: #dbeafe; color: #2563eb; }
.um-role-coordinator { background: #f3e8ff; color: #7c3aed; }
.um-role-chair { background: #fef2f2; color: #dc2626; }
.um-role-pi { background: #ecfdf5; color: #059669; }
.um-role-admin { background: #fef3c7; color: #d97706; }
.um-no-sites {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}
.um-site-more {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ============ DETAIL PANEL ============ */
.um-detail {
  padding: 18px;
  position: relative;
}
.um-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg-active);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.um-detail-close:hover {
  background: var(--border);
}
.um-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 32px;
}
.um-detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.um-detail-name-block {
  min-width: 0;
}
.um-detail-name {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
}
.um-detail-email {
  font-size: 12px;
  color: var(--text-muted);
}

/* Sections */
.um-section {
  margin-bottom: 20px;
}
.um-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.um-section-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Site rows */
.um-site-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.um-site-row:last-child {
  border-bottom: none;
}
.um-site-inactive {
  opacity: .45;
}
.um-site-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.um-site-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.um-site-name {
  font-size: 12.5px;
  font-weight: 600;
}
.um-site-tag-inactive {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: #ef4444;
  background: #fef2f2;
  padding: 1px 5px;
  border-radius: 3px;
}
.um-role-select {
  width: 140px;
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 5px 8px !important;
}

/* Permission grid */
.um-perm-grid {
  max-height: 280px;
  overflow-y: auto;
}
.um-perm-group {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 8px 0 2px;
}
.um-perm-group:first-child {
  padding-top: 0;
}
.um-perm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}
.um-perm-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
}
.um-inline-select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 4px;
  background: var(--surface, #fff);
  color: var(--text-primary, #1f2937);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.um-inline-select:hover { border-color: var(--primary, #6366f1); }
.um-inline-select:focus { border-color: var(--primary, #6366f1); box-shadow: 0 0 0 2px rgba(99,102,241,.15); }

/* Members modal (site view) */
.members-search-wrap {
  margin-bottom: 10px;
}
.members-pag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
}
.pag-info {
  font-size: 11px;
  color: var(--text-muted);
  flex: 1;
}
.badge-green {
  background: #ecfdf5;
  color: #059669;
}

/* ============ QUOTA BADGE ============ */
.view-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quota-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}
.quota-ok {
  background: #f0fdf4;
  color: #16a34a;
}
.quota-warn {
  background: #fffbeb;
  color: #d97706;
}
.quota-full {
  background: #fef2f2;
  color: #dc2626;
}

/* ============ VIEW HEADER (shared across views) ============ */
.user-mgmt-view .view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.user-mgmt-view .view-header h2 {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  margin: 0;
}
.view-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.view-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.user-mgmt-view .um-search-bar {
  margin-bottom: 16px;
}

/* ============ STATUS FILTER PILLS ============ */
.um-status-pills {
  display: flex;
  gap: 2px;
  background: var(--bg-active);
  border-radius: 8px;
  padding: 2px;
}
.um-status-pill {
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.um-status-pill:hover {
  color: var(--text-primary);
}
.um-pill-active {
  background: #fff;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Deactivated row */
.um-row-deactivated {
  opacity: .5;
}
.um-row-deactivated:hover {
  opacity: .75;
}

/* Detail panel status bar */
.um-detail-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.btn-danger-ghost {
  background: transparent !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  font-size: 11.5px;
}
.btn-danger-ghost:hover {
  background: #fef2f2 !important;
}

/* Badge red */
.badge-red {
  background: #fef2f2;
  color: #dc2626;
}

/* ============ SCAN RUN TOOLBAR ============ */
.scan-run-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.scan-run-select {
  flex: 1;
  min-width: 0;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  padding: 0 8px !important;
  height: 30px;
  border-radius: 6px !important;
  background: var(--bg-active) !important;
  border: 1px solid transparent !important;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.scan-run-select:hover { border-color: var(--border) !important; }
.scan-run-select:focus { border-color: var(--primary) !important; outline: none; }
.scan-run-row .ai-scan-btn {
  margin: 0 !important;
  padding: 0 12px !important;
  font-size: 11px !important;
  height: 30px;
  border-radius: 6px !important;
  white-space: nowrap;
  flex-shrink: 0;
  gap: 5px !important;
}
.scan-run-row .ai-scan-btn svg { width: 13px !important; height: 13px !important; }
.scan-export-btn {
  padding: 0 !important;
  width: 30px; height: 30px; min-width: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px !important;
  border: none !important;
  background: var(--bg-active) !important;
  color: var(--text-muted) !important;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}
.scan-export-btn:hover { background: var(--bg-hover) !important; color: var(--primary) !important; }
.scan-export-btn svg { width: 13px; height: 13px; }

/* Stale banner */
.scan-stale-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 16px;
  background: #fffbeb; border-bottom: 1px solid #fde68a;
  color: #92400e; font-size: 11px; font-weight: 500; flex-shrink: 0;
}
.scan-stale-banner svg { width: 13px; height: 13px; flex-shrink: 0; }

/* Provenance */
.scan-provenance {
  display: flex; flex-wrap: wrap; gap: 3px 10px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.prov-item {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--text-muted); white-space: nowrap; font-weight: 500;
}
.prov-item svg { width: 10px; height: 10px; opacity: .4; }


/* ============ SCAN RESULT ITEMS ============ */
/* Section group headers */
.scan-grp-std { font-weight: 600; color: #374151; }
.scan-grp-org { font-weight: 600; color: #7c3aed; }
.scan-grp-site { font-weight: 600; color: #4f46e5; }
.sec-fail { font-size: 9.5px; font-weight: 600; background: #fef2f2; color: #dc2626; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
.sec-warn { font-size: 9.5px; font-weight: 600; background: #fffbeb; color: #d97706; padding: 2px 6px; border-radius: 4px; margin-left: 6px; }

/* Title row with priority chip */
.cl-title-row { display: flex; align-items: center; gap: 6px; }
.scan-pri-chip {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; padding: 2px 6px; border-radius: 3px;
  flex-shrink: 0; line-height: 1;
}
.pri-required { background: #fef2f2; color: #dc2626; }
.pri-warning { background: #fffbeb; color: #d97706; }

/* AI reasoning block */
.scan-reasoning {
  display: flex; align-items: flex-start; gap: 6px;
  font-style: italic; color: var(--text-secondary);
  font-size: 11.5px; line-height: 1.55; margin-top: 6px;
  padding: 8px 10px; background: #f9fafb; border-radius: 6px;
  border-left: 3px solid var(--primary);
}
.scan-reasoning svg {
  width: 13px; height: 13px; min-width: 13px;
  flex-shrink: 0; margin-top: 2px; opacity: .35;
}

/* Excerpt from document */
.cl-excerpt {
  font-size: 11px;
  color: #6b7280;
  font-style: italic;
  margin-top: 5px;
  padding: 3px 0 3px 10px;
  border-left: 2px solid #d1d5db;
  line-height: 1.5;
}

/* Scan button disabled state — nothing changed since last run */
.scan-run-row .ai-scan-btn.scan-btn-disabled {
  opacity: .4;
  cursor: not-allowed;
  background: var(--bg-active) !important;
  color: var(--text-muted) !important;
}
.scan-run-row .ai-scan-btn.scan-btn-disabled:hover {
  box-shadow: none !important;
  transform: none !important;
}
.scan-run-row .ai-scan-btn.scan-btn-disabled .shimmer {
  display: none;
}


/* ============ PROTOCOL AUTOCOMPLETE ============ */
.proto-ac {
  position: relative;
  width: 100%;
}
.proto-ac-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.proto-ac-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.proto-ac-search-icon svg { width: 14px; height: 14px; }
.proto-ac-input {
  width: 100%; padding: 9px 12px 9px 32px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12.5px; font-family: 'Manrope', sans-serif;
  background: var(--bg-base); color: var(--text-primary);
  transition: var(--transition);
}
.proto-ac-input:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 99,102,241), .1);
}
.proto-ac-input::placeholder { color: var(--text-muted); }
.proto-ac-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
  line-height: 1.4;
}

/* Dropdown */
.proto-ac-dropdown {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 280px; overflow-y: auto; margin-top: 4px;
}
.proto-ac-item {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-light, rgba(0,0,0,.04));
  transition: background .15s;
}
.proto-ac-item:last-child { border-bottom: none; }
.proto-ac-item:hover, .proto-ac-item.active {
  background: var(--bg-hover);
}
.proto-ac-item-main {
  display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.proto-ac-item-code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11.5px; font-weight: 700; color: var(--primary);
  white-space: nowrap;
}
.proto-ac-item-study {
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proto-ac-item-meta {
  font-size: 11px; color: var(--text-muted);
}
.proto-ac-empty {
  padding: 20px 14px; text-align: center;
  color: var(--text-muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.proto-ac-empty svg { width: 28px; height: 28px; opacity: .4; }

/* Selected card */
.proto-ac-selected { margin-top: 0; }
.proto-ac-card {
  background: var(--bg-hover); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); padding: 12px 14px;
  position: relative;
  animation: protoCardEnter .2s ease;
}
@keyframes protoCardEnter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.proto-ac-card-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.proto-ac-card-code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px; font-weight: 700; color: var(--primary);
}
.proto-ac-card-study {
  font-size: 13px; font-weight: 700; color: var(--text-primary);
  line-height: 1.4;
}
.proto-ac-card-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}
.pill-sm {
  font-size: 9.5px; padding: 1px 7px; border-radius: 9999px;
}
.proto-ac-clear {
  position: absolute; top: 10px; right: 10px;
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px;
  font-size: 11px; font-weight: 700; font-family: 'Manrope', sans-serif;
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: var(--transition);
}
.proto-ac-clear svg { width: 12px; height: 12px; }
.proto-ac-clear:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--bg-hover);
}

/* ============ PROTOCOL AUTOCOMPLETE — ADDITIONS ============ */

/* Loading state */
.proto-ac-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* Error state */
.proto-ac-error {
  color: var(--danger) !important;
}
.proto-ac-error svg {
  color: var(--danger);
  opacity: .7;
}

/* Empty state — structured layout */
.proto-ac-empty-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.proto-ac-empty-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.proto-ac-empty-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Result count footer */
.proto-ac-footer {
  padding: 6px 14px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--bg-hover);
  text-align: center;
}

/* Read-only fields (auto-filled from selected protocol) */
.field-readonly input,
.field-readonly select,
.field-readonly textarea {
  background: var(--bg-hover); color: var(--text-muted);
  pointer-events: none; opacity: .7;
  border-color: var(--border);
}
.field-readonly label::after {
  content: ' (auto-filled)';
  font-size: 10px; font-weight: 400; color: var(--text-muted);
  font-style: italic;
}


/* ============ FIELD VALIDATION ============ */
.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-color: var(--danger) !important;
}
.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  line-height: 1.3;
  animation: fieldErrorEnter .2s ease;
}
@keyframes fieldErrorEnter {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}



/* ============ SUBMISSION PROGRESS PANEL ============ */
.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding: 4px 0;
}

/* Vertical connector line — sits behind icons */
.progress-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 0 24px 0;
  position: relative;
  margin-left: 10px;
}
.progress-step:last-child { padding-bottom: 0; }

/* The connecting line between steps */
.progress-step::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transition: background .3s;
}
.progress-step:last-child::before { display: none; }
.progress-complete::before { background: var(--success); }
.progress-active::before { background: var(--border); }
.progress-error::before { background: var(--danger); }

/* Icon circle — sits on top of the line */
.progress-step-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}
.progress-step-icon svg {
  width: 18px;
  height: 18px;
}

/* Label */
.progress-step-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 20px;
  padding-top: 0;
}

/* ── State: Pending ── */
.progress-pending .progress-step-icon {
  color: var(--text-muted);
  opacity: .5;
  font-size: 11px;
}
.progress-pending .progress-step-label {
  color: var(--text-muted);
  opacity: .5;
}

/* ── State: Active (parsing) ── */
.progress-active .progress-step-icon .spinner-ring {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: var(--border);
  border-top-color: var(--primary);
}
.progress-active .progress-step-label {
  color: var(--primary);
  font-weight: 700;
}

/* ── State: Complete ── */
.progress-complete .progress-step-icon {
  color: var(--success);
}
.progress-complete .progress-step-label {
  color: var(--text-primary);
}

/* ── State: Error ── */
.progress-error .progress-step-icon {
  color: var(--danger);
}
.progress-error .progress-step-label {
  color: var(--danger);
}

/* ============ PROGRESS INFO BOXES ============ */
.progress-estimate {
  margin: 20px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.progress-estimate b {
  font-weight: 700;
  color: var(--text-secondary);
}

.progress-notice {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  background: rgba(99, 102, 241, .05);
  border: 1px solid rgba(99, 102, 241, .12);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.progress-notice svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--primary);
  opacity: .6;
}
.progress-notice b {
  font-weight: 700;
  color: var(--text-primary);
}

/* Fade out animation for removing notice */
.progress-notice.fade-out {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s, transform .3s;
}

/* ============ SUCCESS / ERROR CARDS ============ */
.progress-result {
  margin: 24px 0 0;
  padding: 24px;
  border-radius: var(--radius-md);
  text-align: center;
  animation: fadeSlide .35s ease;
}
.progress-result-success {
  background: rgba(16, 185, 129, .05);
  border: 1px solid rgba(16, 185, 129, .15);
}
.progress-result-error {
  background: rgba(239, 68, 68, .05);
  border: 1px solid rgba(239, 68, 68, .15);
}
.progress-result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.progress-result-icon svg {
  width: 18px;
  height: 18px;
}
.progress-result-success .progress-result-icon {
  color: var(--success);
}
.progress-result-error .progress-result-icon {
  color: var(--danger);
}
.progress-result-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.progress-result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.progress-result-actions .btn svg {
  width: 14px;
  height: 14px;
}

/* ============ DOCUMENT PARSE STATUS (detail view) ============ */
.doc-row.doc-parsing {
  opacity: 1;
  cursor: default;
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  background: color-mix(in srgb, var(--primary) 3%, var(--bg-card));
}
.doc-row.doc-parsing:hover {
  transform: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}
.doc-row.doc-error {
  opacity: 1;
  cursor: default;
  border-color: color-mix(in srgb, var(--danger) 20%, var(--border));
  background: color-mix(in srgb, var(--danger) 2%, var(--bg-card));
}
.doc-row.doc-error:hover {
  transform: none;
  box-shadow: none;
  border-color: color-mix(in srgb, var(--danger) 20%, var(--border));
}

/* Parse status banner in detail view doc tab */
.doc-parse-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, .05);
  border: 1px solid rgba(99, 102, 241, .12);
}
.doc-parse-banner svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 1px;
}
.doc-parse-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.doc-parse-banner-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.doc-parse-banner-hint {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-style: italic;
}

.doc-table-wrap { margin: 8px 0; overflow-x: auto; }
.doc-table-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; line-height: 1.4; }
.doc-table-wrap th, .doc-table-wrap td { border: 1px solid #d1d5db; padding: 4px 8px; text-align: left; }
.doc-table-wrap th { background: #f3f4f6; font-weight: 700; font-size: 10px; }
.doc-table-wrap tr:nth-child(even) td { background: #f9fafb; }


/* ============ ADD USER MODAL — SITE PICKER ============ */
.um-modal-site-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-top: 6px;
}
.um-modal-site-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  transition: background .12s;
}
.um-modal-site-row:hover {
  background: var(--bg-active);
}
.um-modal-site-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.um-modal-site-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.um-modal-site-row .um-role-select {
  width: 140px !important;
  min-width: 140px;
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 4px 8px !important;
}
.um-no-sites-msg {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

/* ============ SCAN-TIER DASHBOARD ============ */

/* Stats grid auto-adjusts to 4 columns when scan-tier has 4 cards */
.stats-grid:has(.stat-card:nth-child(4):last-child) {
  grid-template-columns: repeat(4, 1fr);
}

/* Quick-action hero card */
.scan-quick-action {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  margin-bottom: 22px; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.scan-quick-action::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent, var(--primary)));
  opacity: .6; transition: opacity .2s;
}
.scan-quick-action:hover {
  box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.scan-quick-action:hover::before { opacity: 1; }

.scan-qa-content { display: flex; align-items: center; gap: 16px; }
.scan-qa-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover); flex-shrink: 0;
}
.scan-qa-icon svg { width: 22px; height: 22px; color: var(--primary); }
.scan-qa-title {
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 2px;
}
.scan-qa-desc {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  max-width: 520px;
}

@media (max-width: 960px) {
  .scan-quick-action { flex-direction: column; gap: 14px; text-align: center; }
  .scan-qa-content { flex-direction: column; }
  .stats-grid:has(.stat-card:nth-child(4):last-child) {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============ TIER HINT (upsell nudge) ============ */

.tier-hint {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 12px 16px; margin-top: 16px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius-sm); opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
}
.tier-hint-show { opacity: 1; transform: translateY(0); }
.tier-hint-exit { opacity: 0; transform: translateY(-4px); transition: opacity .25s ease, transform .25s ease; }

.tier-hint-body { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }

.tier-hint-icon {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px;
  color: var(--text-dim); opacity: .5;
}
.tier-hint-icon svg { width: 16px; height: 16px; }

.tier-hint-content {
  font-size: 12px; line-height: 1.5; color: var(--text-muted);
}
.tier-hint-ctx { color: var(--text-secondary); }
.tier-hint-text { color: var(--text-muted); }

.tier-hint-link {
  color: var(--primary); text-decoration: none; font-weight: 600;
  opacity: .7; transition: opacity .15s;
}
.tier-hint-link:hover { opacity: 1; text-decoration: underline; }

.tier-hint-dismiss {
  flex-shrink: 0; background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 16px; line-height: 1;
  padding: 0 2px; opacity: .3; transition: opacity .15s;
}
.tier-hint-dismiss:hover { opacity: .7; }


/* ============ SUBSCRIPTION VIEW ============ */

.sub-view { padding: 0; }

.sub-header { margin-bottom: 24px; }
.sub-header h2 {
  font-size: 28px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -.02em; margin: 0 0 6px;
  font-family: 'Outfit', sans-serif;
}
.sub-subheading { color: var(--text-muted); font-size: 15px; }

/* Cards */
.sub-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; margin-bottom: 24px;
  backdrop-filter: blur(10px);
}
.sub-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px;
}
.sub-card-title {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .08em; margin: 0;
  font-family: 'Outfit', sans-serif;
}

/* Status badges */
.sub-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em;
}
.sub-status-badge::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
}
.sub-status-active { background: rgba(16,185,129,.12); color: var(--success-light); }
.sub-status-active::before { background: var(--success-light); animation: sub-pulse 2s ease-in-out infinite; }
.sub-status-trialing { background: rgba(245,158,11,.12); color: var(--warning-light); }
.sub-status-trialing::before { background: var(--warning-light); }
.sub-status-past_due { background: rgba(239,68,68,.12); color: var(--danger-light); }
.sub-status-past_due::before { background: var(--danger-light); animation: sub-pulse 1s ease-in-out infinite; }
.sub-status-cancelling { background: rgba(245,158,11,.12); color: var(--warning-light); }
.sub-status-cancelling::before { background: var(--warning-light); }
.sub-status-cancelled { background: rgba(148,163,184,.12); color: var(--text-muted); }
.sub-status-cancelled::before { background: var(--text-muted); }
.sub-status-suspended { background: rgba(239,68,68,.12); color: var(--danger-light); }
.sub-status-suspended::before { background: var(--danger-light); }

@keyframes sub-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* Plan info */
.sub-plan-info { display: flex; align-items: baseline; gap: 14px; margin-bottom: 4px; }
.sub-plan-name {
  font-size: 26px; font-weight: 800; color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}
.sub-plan-price { font-size: 17px; color: var(--primary); font-weight: 700; }
.sub-plan-price span { font-size: 13px; color: var(--text-dim); font-weight: 400; }

.sub-billing-info { color: var(--text-muted); font-size: 14px; margin-top: 10px; }
.sub-billing-info strong { color: var(--text-secondary); }

/* Quota bar */
.sub-quota-row { margin-top: 20px; }
.sub-quota-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.sub-quota-label strong { color: var(--text-secondary); }
.sub-quota-bar {
  height: 8px; background: var(--bg-hover); border-radius: var(--radius-full);
  overflow: hidden;
}
.sub-quota-fill {
  height: 100%; background: var(--primary); border-radius: var(--radius-full);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.sub-quota-fill.warning { background: var(--warning); }
.sub-quota-fill.danger { background: var(--danger); }

/* Notices */
.sub-notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius-md); margin-top: 16px;
  font-size: 13px; line-height: 1.5;
}
.sub-notice svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.sub-notice.warning {
  background: rgba(245,158,11,.08); color: var(--warning-light);
  border: 1px solid rgba(245,158,11,.15);
}
.sub-notice.danger {
  background: rgba(239,68,68,.08); color: var(--danger-light);
  border: 1px solid rgba(239,68,68,.15);
}
.sub-notice strong { color: inherit; }

/* Buttons */
.sub-btn-group { display: flex; gap: 12px; margin-top: 24px; }

.sub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  font-family: 'Outfit', sans-serif;
}
.sub-btn:disabled { opacity: .5; cursor: not-allowed; }
.sub-btn svg { width: 16px; height: 16px; }

.sub-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 0 20px var(--primary-glow);
}
.sub-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px); box-shadow: 0 4px 20px var(--primary-glow);
}

.sub-btn-secondary {
  background: var(--bg-hover); color: var(--text-muted);
  border: 1px solid var(--border);
}
.sub-btn-secondary:hover:not(:disabled) {
  background: var(--bg-active); color: var(--text-primary);
}

.sub-btn-danger {
  background: rgba(239,68,68,.08); color: var(--danger-light);
  border: 1px solid rgba(239,68,68,.18);
}
.sub-btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3);
}

.sub-btn-sm { padding: 7px 14px; font-size: 12px; }

/* Payment Method */
.sub-payment-method {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.sub-card-brand {
  width: 48px; height: 32px;
  background: linear-gradient(135deg, #1a1f36, #252d4a);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .05em;
}
.sub-card-details { flex: 1; }
.sub-card-number {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace; letter-spacing: .04em;
}
.sub-card-expiry { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* Invoice Table */
.sub-invoice-table { width: 100%; border-collapse: collapse; }
.sub-invoice-table .sub-th {
  text-align: left; font-size: 11px; font-weight: 700;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.sub-invoice-table .sub-td {
  padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 13px;
}
.sub-invoice-table tr:last-child .sub-td { border-bottom: none; }
.sub-td-date { color: var(--text-muted); }
.sub-td-desc { color: var(--text-primary); font-weight: 500; }
.sub-td-amount {
  color: var(--text-secondary); font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.sub-invoice-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.sub-invoice-succeeded { background: rgba(16,185,129,.1); color: var(--success-light); }
.sub-invoice-failed { background: rgba(239,68,68,.1); color: var(--danger-light); }

.sub-invoice-link {
  color: var(--primary); text-decoration: none; font-weight: 600;
  font-size: 12px; transition: color .15s;
}
.sub-invoice-link:hover { text-decoration: underline; }

.sub-invoice-loading {
  padding: 32px 0; text-align: center; color: var(--text-dim); font-size: 14px;
}

/* Pagination */
.sub-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.sub-page-label { font-size: 13px; color: var(--text-muted); }

/* Empty state */
.sub-empty-state { padding: 24px 0; text-align: center; }
.sub-empty-state p { color: var(--text-dim); font-size: 14px; margin: 0; }

/* Error banner */
.sub-error-banner {
  padding: 16px 20px; border-radius: var(--radius-md);
  background: rgba(239,68,68,.08); color: var(--danger-light);
  border: 1px solid rgba(239,68,68,.15);
  font-size: 14px; line-height: 1.5; text-align: center;
}

/* ──── Modals ──── */

/* Overlay that also works for subscription modals */
.sub-view .modal-overlay,
.sub-confirm-modal ~ .modal-overlay {
  /* inherits from global .modal-overlay */
}

.sub-confirm-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px;
  max-width: 440px; width: 90%;
  transform: scale(.95) translateY(20px);
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.show .sub-confirm-modal {
  transform: scale(1) translateY(0);
}

.sub-modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 16px;
}
.sub-modal-icon.success { background: rgba(16,185,129,.1); }
.sub-modal-icon.warning { background: rgba(239,68,68,.1); }

.sub-confirm-modal h3 {
  margin: 0 0 10px; font-size: 19px; font-weight: 700;
  color: var(--text-primary); text-align: center;
  font-family: 'Outfit', sans-serif;
}
.sub-confirm-modal p {
  margin: 0 0 24px; color: var(--text-muted); text-align: center;
  font-size: 14px; line-height: 1.6;
}
.sub-confirm-modal strong { color: var(--text-secondary); }

.sub-modal-buttons { display: flex; gap: 12px; }
.sub-modal-buttons .sub-btn { flex: 1; }

.sub-modal-close {
  position: absolute; top: 20px; right: 20px;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 8px; border-radius: var(--radius-sm);
  transition: all .15s;
}
.sub-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ──── Change Plan Modal ──── */
.sub-plan-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); max-width: 900px; width: 95%;
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
  transform: scale(.95) translateY(20px);
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.show .sub-plan-modal {
  transform: scale(1) translateY(0);
}

.sub-plan-modal-header {
  padding: 20px 28px 14px; border-bottom: 1px solid var(--border);
  position: relative;
}
.sub-plan-modal-header h3 {
  margin: 0 0 4px; font-size: 19px; font-weight: 700;
  color: var(--text-primary); text-align: left;
  font-family: 'Outfit', sans-serif;
}
.sub-plan-modal-header p {
  margin: 0; color: var(--text-muted); font-size: 13px; text-align: left;
}

.sub-plan-options {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; padding: 20px 24px;
}

.sub-plan-option {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  position: relative; transition: all .2s;
  display: flex; flex-direction: column;
}
.sub-plan-option:hover { border-color: var(--border-light); background: var(--bg-hover); }
.sub-plan-option.current {
  border-color: var(--primary); background: var(--primary-glow);
}
.sub-plan-option.featured {
  border-color: var(--primary); box-shadow: 0 0 30px var(--primary-glow);
}

.sub-current-badge, .sub-featured-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; white-space: nowrap;
}
.sub-current-badge { background: var(--primary); color: #fff; }
.sub-featured-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
}

.sub-plan-option-header { margin-bottom: 14px; padding-top: 6px; }
.sub-plan-option-name {
  display: block; font-size: 15px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 4px;
  font-family: 'Outfit', sans-serif;
}
.sub-plan-option-price {
  font-size: 26px; font-weight: 800; color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}
.sub-plan-option-price span {
  font-size: 12px; font-weight: 400; color: var(--text-dim);
}

.sub-plan-features {
  list-style: none; padding: 0; margin: 0 0 18px; flex: 1;
}
.sub-plan-features li {
  padding: 4px 0; font-size: 12px; color: var(--text-muted);
  display: flex; align-items: flex-start; gap: 8px; line-height: 1.3;
}
.sub-plan-features li::before {
  content: '\2713'; color: var(--primary); font-weight: 700;
  font-size: 11px; margin-top: 1px;
}

.sub-plan-select-btn { width: 100%; margin-top: auto; }

.sub-plan-modal-footer {
  padding: 12px 28px; border-top: 1px solid var(--border); text-align: center;
}
.sub-plan-modal-footer p {
  margin: 0; font-size: 13px; color: var(--text-dim);
}
.sub-plan-modal-footer a {
  color: var(--primary); text-decoration: none;
}
.sub-plan-modal-footer a:hover { text-decoration: underline; }

/* ──── Payment Modal ──── */
.sub-payment-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); max-width: 480px; width: 95%;
  max-height: 90vh; display: flex; flex-direction: column;
  transform: scale(.95) translateY(20px);
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.show .sub-payment-modal {
  transform: scale(1) translateY(0);
}

.sub-payment-body {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}

.sub-card-error {
  color: var(--danger-light); font-size: 13px; margin-top: 12px;
  min-height: 18px;
}

/* ──── Invoice Detail Modal ──── */
.sub-invoice-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); max-width: 600px; width: 95%;
  max-height: 90vh; overflow-y: auto; position: relative;
  transform: scale(.95) translateY(20px);
  transition: all .3s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.show .sub-invoice-modal {
  transform: scale(1) translateY(0);
}

.sub-invoice-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,.9); border: 1px solid #e2e8f0;
  color: #64748b; z-index: 10;
}

.sub-invoice-document {
  background: #fff; color: #1a1a1a; padding: 36px;
}

.sub-inv-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}
.sub-inv-title-block { text-align: right; }
.sub-inv-title {
  font-size: 24px; font-weight: 800; color: #14b8a6;
  letter-spacing: .05em;
}
.sub-inv-number {
  font-size: 12px; color: #64748b; margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
}

.sub-inv-info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 28px;
}
.sub-inv-info-label {
  font-size: 10px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px;
}
.sub-inv-info-value { font-size: 13px; color: #334155; line-height: 1.5; }
.sub-inv-info-value strong { color: #0f172a; }

.sub-inv-paid-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  background: rgba(16,185,129,.1); color: #16a34a;
}
.sub-inv-paid-badge::before { content: '\2713'; font-size: 10px; }
.sub-inv-failed-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
  background: rgba(239,68,68,.1); color: #dc2626;
}
.sub-inv-failed-badge::before { content: '\2715'; font-size: 10px; }

.sub-inv-items-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.sub-inv-items-table .sub-th {
  text-align: left; font-size: 10px; font-weight: 700;
  color: #64748b; text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 0; border-bottom: 2px solid #e2e8f0;
}
.sub-inv-items-table td {
  padding: 14px 0; font-size: 13px; color: #334155;
  border-bottom: 1px solid #f1f5f9;
}
.text-right { text-align: right; }

.sub-inv-totals { margin-left: auto; width: 200px; margin-bottom: 28px; }
.sub-inv-total-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 13px; color: #64748b;
}
.sub-inv-total-row.total {
  border-top: 2px solid #e2e8f0; margin-top: 6px; padding-top: 12px;
  font-size: 16px; font-weight: 700; color: #0f172a;
}

.sub-inv-pm-info {
  background: #f8fafc; border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 20px;
}
.sub-inv-pm-label {
  font-size: 10px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px;
}
.sub-inv-pm-value { font-size: 13px; color: #334155; }

.sub-inv-footer {
  text-align: center; padding-top: 20px; border-top: 1px solid #f1f5f9;
}
.sub-inv-footer p { margin: 0; font-size: 13px; color: #64748b; }
.sub-inv-contact { margin-top: 6px !important; font-size: 11px !important; color: #94a3b8 !important; }

.sub-inv-actions {
  display: flex; gap: 12px; padding: 16px 20px;
  background: var(--bg-card); border-top: 1px solid var(--border);
}
.sub-inv-actions .sub-btn { flex: 1; }

/* ──── Responsive ──── */
@media (max-width: 768px) {
  .sub-plan-options { grid-template-columns: 1fr; }
  .sub-plan-info { flex-direction: column; gap: 4px; }
  .sub-payment-method { flex-direction: column; text-align: center; }
  .sub-btn-group { flex-direction: column; }
  .sub-inv-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .sub-card { padding: 20px; }
  .sub-card-header { flex-direction: column; gap: 10px; }
  .sub-invoice-table .sub-th:nth-child(2),
  .sub-invoice-table .sub-td:nth-child(2) { display: none; }
}

/* ============ TAB BAR ============ */

.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--bg-active);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}

.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}

.tab-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

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

.tab-icon {
  display: inline-flex;
  align-items: center;
  width: 16px;
  height: 16px;
}
.tab-icon svg {
  width: 16px;
  height: 16px;
}

.tab-content {
  min-height: 200px;
}

/* ============ STATUS PILL (inline badges) ============ */

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.status-approved {
  background: rgba(16, 185, 129, .12);
  color: var(--success);
}

.status-revision {
  background: rgba(239, 68, 68, .12);
  color: var(--danger);
}

/* ============ ACCOUNT MENU ============ */

.account-menu { position: relative; display: inline-flex; }

.account-btn {
  display: flex; padding: 10px 14px; gap: 10px;
  align-items: center; cursor: pointer;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.account-btn:hover { background: var(--bg-hover); }

.account-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  box-shadow: var(--shadow-sm); flex: 0 0 auto;
}

.account-label { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.account-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.account-plan { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.account-caret { margin-left: 2px; color: var(--text-muted); font-size: 12px; }

.account-popover {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 260px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 10px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: var(--transition); z-index: 200;
}
.account-menu.open .account-popover {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.account-popover-header { padding: 10px 10px 8px 10px; }
.account-popover-title { font-size: 13px; font-weight: 800; color: var(--text-primary); }
.account-popover-sub { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }

.account-popover-group {
  padding: 6px; background: var(--bg-hover);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}

.account-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px; border: none; background: transparent;
  cursor: pointer; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13px; font-weight: 700;
  transition: var(--transition); text-align: left;
}
.account-item:hover { background: var(--bg-active); color: var(--text-primary); }
.account-item:active { transform: translateY(1px); }

.account-item-icon { width: 18px; display: inline-flex; justify-content: center; }

.account-item.danger { color: var(--danger); }
.account-item.danger:hover { background: rgba(239, 68, 68, 0.12); }

.account-popover-divider { height: 1px; background: var(--border); margin: 10px 6px; }

.account-btn:focus-visible,
.account-item:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
  border-radius: var(--radius-md);
}

.account-btn.account-past-due {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  animation: pastDuePulse 2s ease-in-out infinite;
}
.account-btn.account-past-due:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.5);
}
.account-avatar.past-due { background: linear-gradient(135deg, #ef4444, #dc2626); font-size: 16px; font-weight: 900; }
.account-plan.past-due { color: #ef4444; font-weight: 700; }

@keyframes pastDuePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
}

.account-popover-past-due-banner {
  background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px; padding: 12px 14px; margin: 0 12px 12px;
  font-size: 12px; line-height: 1.4; color: #dc2626;
}

.account-item.highlight { background: rgba(239, 68, 68, 0.08); color: #dc2626; font-weight: 700; }
.account-item.highlight:hover { background: rgba(239, 68, 68, 0.15); }
.account-item.highlight .account-item-icon { animation: shake 0.5s ease-in-out infinite; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* ============ EXPORT ACTIONS (Doc Review) ============ */

.scan-export-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.btn-export-annotated {
  flex: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: -0.1px;
}
.btn-export-annotated:hover {
  box-shadow: var(--shadow-md), 0 0 20px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-export-annotated:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn-export-annotated svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-export-report {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-export-report:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-hover);
}
.btn-export-report:active {
  background: var(--bg-active);
}
.btn-export-report svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}