/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --border: #e1e4ed;
  --border-focus: #0D4E4A;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --primary: #0D4E4A;
  --primary-dark: #0a3d3a;
  --primary-light: #e8f0ef;
  --primary-subtle: #d0e3e1;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --gold: #C4993B;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0891b2;
  --info-bg: #ecfeff;
  --sidebar-w: 260px;
  --header-h: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: 0.18s ease;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}
html { font-size: 14px; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text-primary); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: inherit; }

/* ====== LOADING SCREEN ====== */
.loading-screen { position: fixed; inset: 0; background: var(--surface); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.loading-inner { text-align: center; }
.logo-mark { width: 60px; height: 60px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.loading-inner p { color: var(--text-muted); font-size: 13px; }

/* ====== LAYOUT ====== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: transform var(--transition); overflow-y: auto; }
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-header { height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.page-body { padding: 24px; flex: 1; }

/* ====== SIDEBAR ====== */
.sidebar-brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-group { margin-bottom: 4px; }
.nav-group-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; padding: 8px 18px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; border-radius: 0; transition: background var(--transition), color var(--transition); position: relative; border: none; background: none; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); border-radius: 0 2px 2px 0; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; border-radius: 20px; font-size: 10px; font-weight: 600; padding: 1px 7px; min-width: 18px; text-align: center; }
.sidebar-user { padding: 14px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-card { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }
.user-logout { padding: 5px; border-radius: 5px; color: var(--text-muted); cursor: pointer; transition: color var(--transition); border: none; background: none; display: flex; }
.user-logout:hover { color: var(--danger); }

/* ====== HEADER ====== */
.header-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ====== AUTH PAGES ====== */
.auth-layout { min-height: 100vh; background: linear-gradient(135deg, #0a3d3a 0%, #0D4E4A 50%, #1a6b65 100%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-mark { width: 120px; height: auto; margin: 0 auto 12px; }
.auth-logo-mark img { width: 100%; height: auto; }
.auth-logo h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: var(--radius); padding: 3px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-radius: 6px; transition: all var(--transition); border: none; background: none; }
.auth-tab.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ====== FORMS ====== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-label span { color: var(--danger); margin-left: 3px; }
.form-input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 13.5px; color: var(--text-primary); background: var(--surface); transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59,91,219,0.12); }
.form-input::placeholder { color: var(--text-muted); }
.form-input.error { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-section { background: var(--surface-2); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ====== BUTTONS ====== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all var(--transition); border: 1.5px solid transparent; line-height: 1; white-space: nowrap; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-bg); color: var(--success); border-color: #86efac; }
.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; font-weight: 600; }
.btn-full { width: 100%; }
.btn-icon { padding: 7px; border-radius: var(--radius); width: 34px; height: 34px; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 5px; }

/* ====== CARDS ====== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-muted); }
.card-sm { padding: 14px 16px; }
.card-hover { transition: box-shadow var(--transition), border-color var(--transition); }
.card-hover:hover { box-shadow: var(--shadow); border-color: #c7d2fe; }

/* ====== STATS ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-primary .stat-value { color: var(--primary); }
.stat-success .stat-value { color: var(--success); }
.stat-warning .stat-value { color: var(--warning); }
.stat-danger .stat-value { color: var(--danger); }

/* ====== BADGES & STATUS ====== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-pendente { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.badge-em_revisao { background: var(--info-bg); color: var(--info); border: 1px solid #a5f3fc; }
.badge-aprovado { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.badge-reprovado { background: var(--danger-bg); color: var(--danger); border: 1px solid #fca5a5; }
.badge-admin { background: #faf5ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-reviewer { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-subtle); }
.badge-bulas { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-laboratorios { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.badge-doencas { background: #fdf4ff; color: #86198f; border: 1px solid #f0abfc; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-pendente { background: var(--warning); }
.dot-em_revisao { background: var(--info); }
.dot-aprovado { background: var(--success); }
.dot-reprovado { background: var(--danger); }

/* ====== TABLES ====== */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--surface-2); padding: 11px 16px; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text-primary); vertical-align: middle; }

/* ====== DOCUMENT LIST ====== */
.doc-grid { display: grid; gap: 14px; }
.doc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; cursor: pointer; transition: all var(--transition); display: flex; align-items: flex-start; gap: 14px; }
.doc-card:hover { box-shadow: var(--shadow); border-color: #c7d2fe; }
.doc-card-locked { opacity: 0.5; cursor: not-allowed; pointer-events: none; background: var(--surface-2); }
.doc-category-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.doc-category-bulas { background: #fff7ed; }
.doc-category-laboratorios { background: #f0f9ff; }
.doc-category-doencas { background: #fdf4ff; }
.doc-info { flex: 1; min-width: 0; }
.doc-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-meta-item { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.doc-status-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* ====== JSON EDITOR ====== */
.json-editor-layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - var(--header-h)); overflow: hidden; }
.json-nav-panel { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.json-main-panel { overflow-y: auto; padding: 24px; }
.section-nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.section-nav-item:hover { background: var(--surface-2); }
.section-nav-item.active { background: var(--primary-light); }
.section-nav-title { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-validated-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.section-validated { background: var(--success); }
.section-unvalidated { background: var(--border); }
.json-section-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; transition: border-color var(--transition); }
.json-section-card.validated { border-color: #86efac; }
.json-section-card.editing { border-color: var(--primary); }
.section-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; background: var(--surface); border-bottom: 1px solid transparent; user-select: none; }
.section-header.open { border-bottom-color: var(--border); background: var(--surface-2); }
.section-toggle-icon { width: 18px; height: 18px; color: var(--text-muted); transition: transform var(--transition); flex-shrink: 0; }
.section-toggle-icon.open { transform: rotate(90deg); }
.section-title-text { font-size: 14px; font-weight: 600; flex: 1; }
.section-actions { display: flex; align-items: center; gap: 6px; }
.section-body { padding: 16px; display: none; }
.section-body.open { display: block; }
.json-display { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); background: var(--surface-2); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; word-break: break-all; line-height: 1.7; max-height: 350px; overflow-y: auto; }
.json-display .json-key { color: #7c3aed; font-weight: 500; }
.json-display .json-string { color: #15803d; }
.json-display .json-number { color: #b45309; }
.json-display .json-bool { color: #0369a1; }
.json-display .json-null { color: var(--text-muted); }
.json-textarea { width: 100%; font-family: var(--font-mono); font-size: 12.5px; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px; color: var(--text-primary); background: var(--surface); resize: vertical; min-height: 160px; line-height: 1.7; transition: border-color var(--transition); outline: none; }
.json-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(59,91,219,0.12); }
.section-notes-input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 12.5px; color: var(--text-primary); background: var(--surface); resize: vertical; min-height: 60px; outline: none; margin-top: 10px; transition: border-color var(--transition); font-family: inherit; }
.section-notes-input:focus { border-color: var(--border-focus); }
.validation-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface-2); border-top: 1px solid var(--border); margin-top: 12px; border-radius: 0 0 calc(var(--radius-lg) - 2px) calc(var(--radius-lg) - 2px); }
.validation-info { flex: 1; font-size: 12px; color: var(--text-muted); }
.validated-tag { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--success); }

/* ====== NDA ====== */
.nda-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.nda-modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 700px; max-height: 90vh; display: flex; flex-direction: column; }
.nda-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.nda-header-icon { width: 40px; height: 40px; background: var(--warning-bg); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--warning); flex-shrink: 0; }
.nda-body { padding: 24px; overflow-y: auto; flex: 1; }
.nda-document { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; font-size: 13px; line-height: 1.8; color: var(--text-secondary); max-height: 380px; overflow-y: auto; }
.nda-document h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); text-align: center; margin-bottom: 20px; }
.nda-document p { margin-bottom: 14px; }
.nda-document strong { color: var(--text-primary); }
.nda-document ol, .nda-document ul { padding-left: 20px; margin-bottom: 14px; }
.nda-document li { margin-bottom: 6px; }
.nda-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nda-agree-row { display: flex; align-items: center; gap: 10px; }
.nda-checkbox { width: 17px; height: 17px; cursor: pointer; accent-color: var(--primary); }
.nda-agree-label { font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; }

/* ====== MODALS ====== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-container { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; z-index: 151; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.modal-overlay.hidden, .modal-container.hidden { display: none !important; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { padding: 5px; border-radius: var(--radius); color: var(--text-muted); cursor: pointer; border: none; background: none; display: flex; transition: color var(--transition); }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ====== TOAST ====== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 280px; max-width: 380px; animation: slideIn 0.22s ease; font-size: 13.5px; }
.toast-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.toast-error { background: #fef2f2; border: 1px solid #fca5a5; color: #dc2626; }
.toast-info { background: #eff6ff; border: 1px solid #93c5fd; color: #1d4ed8; }
.toast-warning { background: #fffbeb; border: 1px solid #fde68a; color: #d97706; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close { cursor: pointer; opacity: 0.5; padding: 2px; line-height: 1; background: none; border: none; color: inherit; }
.toast-close:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ====== EMPTY STATES ====== */
.empty-state { text-align: center; padding: 64px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; line-height: 1.6; max-width: 360px; margin: 0 auto 20px; }

/* ====== FILTER BAR ====== */
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-bar .form-input { max-width: 260px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer; border: 1.5px solid var(--border); color: var(--text-muted); background: var(--surface); transition: all var(--transition); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ====== PAGINATION ====== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.page-btn { width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all var(--transition); }
.page-btn:hover:not(:disabled) { background: var(--surface-2); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ====== AUDIT TRAIL ====== */
.audit-log { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.audit-log:last-child { border-bottom: none; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary-subtle); border: 2px solid var(--primary); flex-shrink: 0; margin-top: 4px; }
.audit-content { flex: 1; min-width: 0; }
.audit-action { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.audit-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 8px; }
.audit-time { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }

/* ====== COMMENTS ====== */
.comments-section { margin-top: 20px; }
.comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.comment-bubble { flex: 1; background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 10px 14px; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.comment-author { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.comment-time { font-size: 11.5px; color: var(--text-muted); }
.comment-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.comment-input-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.comment-input-row textarea { flex: 1; }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .json-editor-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ====== UTILITIES ====== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-primary-color { color: var(--primary); }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner-dark { border-color: rgba(0,0,0,0.15); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 2px 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; font-size: 11.5px; color: var(--text-secondary); }

/* Progress bar */
.progress-bar-wrap { background: var(--surface-2); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: var(--primary); transition: width 0.3s ease; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb-sep { color: var(--border); }
.breadcrumb a { color: var(--primary); cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* Code block */
.code-block { background: #1e1e2e; color: #cdd6f4; border-radius: var(--radius); padding: 16px; font-family: var(--font-mono); font-size: 12.5px; overflow-x: auto; line-height: 1.7; }

/* Alert */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; }
.alert-info { background: var(--info-bg); border: 1px solid #a5f3fc; color: var(--info); }
.alert-warning { background: var(--warning-bg); border: 1px solid #fde68a; color: var(--warning); }
.alert-success { background: var(--success-bg); border: 1px solid #86efac; color: var(--success); }
.alert-danger { background: var(--danger-bg); border: 1px solid #fca5a5; color: var(--danger); }

/* Invite Code display */
.invite-code-box { background: var(--surface-2); border: 2px dashed var(--border); border-radius: var(--radius); padding: 14px 18px; font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--primary); letter-spacing: 2px; text-align: center; margin: 12px 0; cursor: pointer; transition: border-color var(--transition); }
.invite-code-box:hover { border-color: var(--primary); }

/* Import Dropzone */
.import-dropzone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 40px 20px; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.import-dropzone:hover, .import-dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.import-dropzone-icon { margin-bottom: 10px; }
.import-dropzone-icon svg { width: 36px; height: 36px; color: var(--text-muted); }
