:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #ebf0ff;
  --text: #1e293b;
  --text-muted: #64748b;
  --s-color: #2563eb;
  --o-color: #7c3aed;
  --a-color: #d97706;
  --p-color: #059669;
  --danger: #dc2626;
  --etio-color: #0891b2;
  --pato-color: #6366f1;
  --komp-color: #e11d48;
  --prog-color: #0284c7;
  --eduk-color: #0d9488;
  --rujuk-color: #dc2626;
  --badge-bg: #e2e8f0;
  --badge-text: #475569;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --radius: 10px;
  --radius-sm: 6px;
}

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

html {
  height: 100%;
}

html, body {
  overflow-x: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

main,
main.container,
.main-content {
  flex: 1 0 auto;
}

#app > .container:last-of-type {
  flex: 1 0 auto;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.topbar-logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.3px;
  white-space: nowrap;
}

.topbar-logo span { opacity: .75; font-weight: 400; }

.topbar-back {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
  text-decoration: none;
}

.topbar-back:hover { background: rgba(255,255,255,.25); }

/* ── SITE HEADER (SIMETRIS: KIRI LOGO, TENGAH SEARCH, KANAN USER) ── */
.site-header {
  background: var(--primary-dark);
  color: #fff;
  padding: .5rem 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1100px;
  padding-top: 0;
  padding-bottom: 0;
  position: relative;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  white-space: nowrap;
  z-index: 10;
  letter-spacing: -0.3px;
}

.brand-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

/* ── HEADER SEARCH (DEAD CENTER 100% SIMETRIS) ── */
.header-search-wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: clamp(240px, 34vw, 440px);
  z-index: 5;
}

@media (max-width: 768px) {
  .header-search-wrap {
    display: none !important;
  }
}

.header-search-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  color: #0f172a;
  padding: 7px 38px 7px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  transition: all 0.18s ease;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.header-search-input::placeholder {
  color: #64748b;
  font-weight: 400;
}

.header-search-input:focus {
  background: #ffffff;
  color: #0f172a;
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22), 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.header-search-input:focus::placeholder {
  color: #94a3b8;
}

.header-search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: color 0.15s;
}

.header-search-input:focus ~ .header-search-icon {
  color: #1a56db;
}

.header-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.header-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.86rem;
  transition: background 0.12s;
}

.header-search-item:last-child {
  border-bottom: none;
}

.header-search-item:hover, .header-search-item.selected {
  background: #eff6ff;
  color: var(--primary);
}

.header-search-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-search-item-nama {
  font-weight: 600;
}

.header-search-item-syn {
  font-size: 0.74rem;
  color: var(--text-muted);
}

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

.header-search-skdi {
  font-size: 0.72rem;
  font-weight: 700;
  background: #059669;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ── AI DOCASSIST BTN ── */
.header-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #4338ca, #6366f1);
  border: 1px solid rgba(199, 210, 254, 0.4);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.35);
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.header-ai-btn:hover {
  background: linear-gradient(135deg, #3730a3, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
}

.header-ai-icon {
  font-size: 0.85rem;
  animation: sparklePulse 2s infinite ease-in-out;
}

@keyframes sparklePulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255,255,255,0.8)); }
  50% { transform: scale(1.18); filter: drop-shadow(0 0 6px #a5b4fc); }
}

.site-nav {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: .5rem;
  flex-wrap: nowrap;
  z-index: 10;
}

.site-nav a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: .84rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.site-nav a:hover, .site-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ── SUB-HEADER NAVIGATION (PENGELOMPOKAN MENU NAVIGASI) ── */
.sub-header-nav {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.sub-header-nav .container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 10px;
  padding-bottom: 8px;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 1100px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .sub-header-nav .container {
    justify-content: flex-start;
  }
}

.sub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.sub-nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sub-nav-link.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  border-color: rgba(26, 86, 219, 0.2);
}

.sub-nav-link.sub-nav-ai {
  position: relative;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-weight: 700;
}

.sub-nav-link.sub-nav-ai:hover {
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  border-color: #a5b4fc;
}

.sub-nav-link.sub-nav-ai::after {
  content: "(beta)";
  position: absolute;
  top: -7px;
  right: -8px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.25);
  border: 1.5px solid #ffffff;
  pointer-events: none;
}

.sub-nav-link.sub-nav-vision {
  position: relative;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #a7f3d0;
  color: #047857;
  font-weight: 700;
}

.sub-nav-link.sub-nav-vision:hover {
  background: linear-gradient(135deg, #dcfce7, #d1fae5);
  border-color: #6ee7b7;
}

.sub-nav-link.sub-nav-vision.active {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
}

/* ── MEDICAL VISION WORKSPACE (AI EKG & RADIOLOGI) ── */
.vision-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: stretch;
  margin-top: 16px;
  margin-bottom: 40px;
  min-height: calc(100vh - 280px);
}

@media (max-width: 960px) {
  .vision-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }
}

.vision-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Card Header */
.vision-card-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vision-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text, #1e293b);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Dropzone & Viewer */
.viewer-viewport {
  position: relative;
  background: #090d16;
  min-height: 400px;
  height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}

.viewer-dropzone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  cursor: pointer;
  border: 2px dashed #334155;
  margin: 16px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  transition: all 0.2s ease;
  z-index: 5;
}

.viewer-dropzone:hover, .viewer-dropzone.dragover {
  border-color: #3b82f6;
  background: rgba(30, 58, 138, 0.25);
  color: #e2e8f0;
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
}

.dropzone-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  max-width: 320px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.dropzone-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-upload-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-upload-action:hover {
  background: #334155;
  border-color: #64748b;
  transform: translateY(-1px);
}

.btn-upload-action.primary {
  background: #2563eb;
  border-color: #3b82f6;
}

.btn-upload-action.primary:hover {
  background: #1d4ed8;
}

/* Active Canvas Stage */
.viewer-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.viewer-stage.panning {
  cursor: grabbing;
}

.viewer-stage img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  transition: filter 0.15s ease;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  transform-origin: center center;
  will-change: transform;
}

/* Floating Toolbar */
.viewer-toolbar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
  color: #f8fafc;
}

.viewer-tool-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.viewer-tool-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.viewer-tool-btn.active {
  background: #3b82f6;
  color: #ffffff;
}

.viewer-tool-separator {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
}

.viewer-slider-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #94a3b8;
}

.viewer-slider-group input[type="range"] {
  width: 70px;
  height: 4px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* Right Panel Controls */
.vision-sidebar-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Modality Selector */
.modality-selector-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
  display: block;
}

.modality-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modality-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.modality-pill:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.modality-pill.active {
  background: #1a56db;
  border-color: #1a56db;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(26, 86, 219, 0.3);
}

/* Clinical Context Input */
.clinical-context-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clinical-context-textarea {
  width: 100%;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  background: #f8fafc;
  color: var(--text, #1e293b);
  transition: border-color 0.15s;
}

.clinical-context-textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Primary Trigger Button */
.btn-analyze-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.25);
  transition: all 0.15s ease;
}

.btn-analyze-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1742a7, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26, 86, 219, 0.35);
}

.btn-analyze-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Critical Alert Banner */
.critical-alert-banner {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 6px solid #7f1d1d;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: criticalPulse 2s infinite ease-in-out;
}

@keyframes criticalPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25); }
  50% { box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5); }
}

.critical-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.critical-alert-desc {
  font-size: 0.86rem;
  line-height: 1.45;
  color: #fef2f2;
}

/* Expertise Output Area */
.expertise-panel {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  overflow: hidden;
}

.expertise-panel-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.expertise-content {
  padding: 16px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text, #1e293b);
  max-height: 480px;
  overflow-y: auto;
}

.expertise-content p {
  margin-top: 0;
  margin-bottom: 8px;
}

.expertise-content h3, .expertise-content h4 {
  color: #0f172a;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.98rem;
}

.expertise-section-title {
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
}

.expertise-section-title:first-child {
  margin-top: 0;
}

.expertise-content ul, .expertise-content ol {
  margin: 4px 0 10px 20px;
  padding: 0;
}

.expertise-content li {
  margin-bottom: 4px;
  line-height: 1.55;
}

.expertise-content strong {
  color: #0f172a;
}

/* Action Buttons */
.expertise-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border, #e2e8f0);
}

.btn-expertise-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid var(--border, #cbd5e1);
  background: #ffffff;
  color: var(--text, #334155);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-expertise-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-expertise-action.pro {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
}

.btn-expertise-action.pro:hover {
  background: linear-gradient(135deg, #3730a3, #4f46e5);
}

/* Follow-up Chat */
.followup-chat-wrap {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.followup-chat-input {
  flex: 1;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
}

.followup-chat-input:focus {
  outline: none;
  border-color: #2563eb;
}

.btn-followup-send {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-followup-send:hover {
  background: #1d4ed8;
}

/* ── VISION LOADING ANIMATION ── */
.vision-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  text-align: center;
  color: #1e40af;
}

.vision-loading-spinner {
  font-size: 2.2rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: visionPulseSpin 1.8s infinite ease-in-out;
}

@keyframes visionPulseSpin {
  0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.2)); }
  50% { transform: scale(1.18) rotate(180deg); filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.45)); }
  100% { transform: scale(1) rotate(360deg); filter: drop-shadow(0 2px 4px rgba(37, 99, 235, 0.2)); }
}

.vision-loading-dots {
  display: inline-block;
  min-width: 20px;
  text-align: left;
  font-weight: 800;
  color: #2563eb;
}

/* ── LAYOUT ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── HOME PAGE HERO & SEARCH ── */
.hero-inline {
  text-align: center;
  padding: 24px 0 26px;
}

.hero-inline h1 {
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.hero-inline p {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 580px;
  margin: 0 auto 20px;
  line-height: 1.55;
}

.search-wrap {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 13px 50px 13px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  outline: none;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  color: var(--text);
  font-family: inherit;
}

.search-wrap input::placeholder {
  color: #94a3b8;
}

.search-wrap input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 8px 25px -4px rgba(26, 86, 219, 0.18), 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.search-wrap .icon-search {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 20px;
  height: 20px;
}

.site-footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 24px 0 26px;
  margin-top: auto;
  font-size: .85rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.site-footer-disclaimer {
  margin: 0;
  color: #94a3b8;
  font-size: 0.83rem;
  line-height: 1.5;
  max-width: 780px;
}

.site-footer-copyright {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.site-footer-copyright strong {
  color: #ffffff;
}

.site-footer-copyright a {
  color: #93c5fd;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.site-footer-copyright a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-dot {
  color: #64748b;
  font-weight: 700;
  user-select: none;
}

.footer-legal-link {
  color: #cbd5e1 !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

.footer-legal-link:hover {
  color: #ffffff !important;
}

/* ── CUSTOM COLORED DROPDOWNS ── */
.filter-dropdowns-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.custom-dropdown-wrap {
  position: relative;
  display: inline-flex;
}

.custom-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  font-family: inherit;
}

.custom-dropdown-btn:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.custom-dropdown-btn.is-active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.dropdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.dropdown-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

.dropdown-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.custom-dropdown-btn[aria-expanded="true"] .dropdown-caret {
  transform: rotate(180deg);
}

.custom-dropdown-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.18), 0 8px 12px -3px rgba(0, 0, 0, 0.08);
  padding: 12px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skdi-popover {
  width: 320px;
  max-width: 90vw;
}

.system-popover {
  width: 560px;
  max-width: 92vw;
}

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

.popover-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
}

.popover-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.popover-close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.popover-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.84rem;
  outline: none;
  font-family: inherit;
  background: var(--surface-2);
  transition: all 0.15s;
  box-sizing: border-box;
}

.popover-search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.skdi-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skdi-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  font-size: 0.84rem;
}

.skdi-option-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  transform: translateY(-1px);
}

.skdi-option-item.selected {
  font-weight: 700;
}

.system-grid-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.system-grid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}

.system-grid-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
  transform: translateY(-1px);
}

.system-grid-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 700;
}

.system-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-item-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  flex-shrink: 0;
}

.system-grid-item.selected .system-item-count {
  background: var(--primary);
  color: #ffffff;
}

.filter-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fee2e2;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
  box-sizing: border-box;
}

.filter-reset-btn:hover {
  background: #fecaca;
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .filter-dropdowns-container {
    gap: 8px;
  }
  .custom-dropdown-wrap {
    flex: 1 1 calc(50% - 4px);
  }
  .custom-dropdown-btn {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.78rem;
    gap: 4px;
    justify-content: space-between;
  }
  .dropdown-label {
    max-width: 96px;
  }
  .system-popover, .skdi-popover {
    width: 92vw;
    left: 50%;
    transform: translateX(-50%);
  }
  .system-grid-list {
    grid-template-columns: 1fr;
    max-height: 280px;
  }
}

/* ── FILTER CONTAINER & CHIPS ── */
.filter-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-divider {
  height: 1px;
  background: var(--border);
  width: 100%;
  margin: 2px 0;
  opacity: 0.85;
}

.filter-row-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  min-width: 68px;
  flex-shrink: 0;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease, color .15s ease;
  white-space: nowrap;
}

.chip:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.chip.chip-system {
  font-size: .84rem;
  padding: 5px 13px;
  gap: 2px;
}

.chip.chip-system:hover {
  transform: translateY(-1.5px);
  filter: brightness(0.94);
}

.chip.chip-system.active {
  transform: translateY(-1px);
}

.chip.chip-toggle-sistem {
  background: var(--surface);
  border: 1.5px dashed var(--primary);
  color: var(--primary);
  font-weight: 700;
  font-size: .84rem;
  padding: 5px 13px;
  cursor: pointer;
  transition: all .15s ease;
}

.chip.chip-toggle-sistem:hover {
  background: var(--primary-light);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
  transform: translateY(-1.5px);
  box-shadow: 0 2px 6px rgba(26, 86, 219, 0.15);
}

.chip.chip-toggle-sistem.expanded {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: var(--text-muted);
}

.chip.chip-toggle-sistem.expanded:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

.chip.chip-skdi {
  font-size: .84rem;
  font-weight: 700;
  font-family: inherit;
  padding: 5px 13px;
}

/* ── SYSTEM ORGAN DROPDOWN POPOVER ── */
.system-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.system-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  font-family: inherit;
}

.system-dropdown-btn:hover {
  background: var(--surface-2);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.system-dropdown-btn.is-active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.15);
}

.system-dropdown-caret {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.system-dropdown-btn[aria-expanded="true"] .system-dropdown-caret {
  transform: rotate(180deg);
}

.system-dropdown-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
  font-size: 0.75rem;
  margin-left: 2px;
  cursor: pointer;
  transition: all 0.12s;
}

.system-dropdown-reset:hover {
  background: #dc2626;
  color: #fff;
}

.system-dropdown-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 580px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 35px -5px rgba(0, 0, 0, 0.18), 0 8px 12px -3px rgba(0, 0, 0, 0.08);
  padding: 14px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.system-popover-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-popover-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.84rem;
  outline: none;
  font-family: inherit;
  background: var(--surface-2);
  transition: all 0.15s;
  box-sizing: border-box;
}

.system-popover-search:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.system-grid-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.system-grid-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}

.system-grid-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
  transform: translateY(-1px);
}

.system-grid-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 700;
}

.system-item-left {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-item-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  flex-shrink: 0;
}

.system-grid-item.selected .system-item-count {
  background: var(--primary);
  color: #ffffff;
}

@media (max-width: 640px) {
  .system-dropdown-popover {
    width: 95vw;
  }
  .system-grid-list {
    grid-template-columns: 1fr;
    max-height: 280px;
  }
}

/* ── DISEASE LIST ── */
.penyakit-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.penyakit-card {
  display: flex;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  position: relative;
  overflow: hidden;
}

.penyakit-card:last-child { border-bottom: none; }

.penyakit-card:hover { background: var(--surface-2); }

.penyakit-card:hover .card-arrow { opacity: 1; transform: translateX(0); }

/* accent left bar */
.card-accent {
  width: 5px;
  flex-shrink: 0;
}

/* number */
.card-num {
  width: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: .5;
}

/* main content */
.card-body {
  flex: 1;
  padding: 16px 12px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.penyakit-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  white-space: normal;
}

.card-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 2px;
}

.badge-system-sub {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-preview-text {
  font-size: .83rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.35;
}

/* right side: DB count + arrow */
.card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 8px;
  flex-shrink: 0;
}

.card-db-count {
  font-size: .76rem;
  color: var(--text-muted);
  background: var(--badge-bg);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-skdi {
  font-size: .76rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: .3px;
  line-height: 1.2;
}

/* SKDI 4 — Emerald solid: tuntas mandiri */
.card-skdi.skdi-4 {
  color: #ffffff;
  background: #059669;
}

/* SKDI 3B — Merah solid: gawat darurat, terapi awal & rujuk segera */
.card-skdi.skdi-3b {
  color: #ffffff;
  background: #dc2626;
}

/* SKDI 3A — Ungu/Purple solid: non-gawat darurat, terapi awal & rujuk */
.card-skdi.skdi-3a {
  color: #ffffff;
  background: #9333ea;
}

/* SKDI 2 — Slate solid: diagnosis & rujuk */
.card-skdi.skdi-2 {
  color: #ffffff;
  background: #475569;
}

/* SKDI 1 — Abu-abu muda solid: mengenali gambaran klinis */
.card-skdi.skdi-1 {
  color: #ffffff;
  background: #94a3b8;
}

.card-arrow {
  color: var(--primary);
  opacity: 0;
  transform: translateX(-4px);
  transition: all .15s;
  font-size: 1.1rem;
  line-height: 1;
}

.card-icd {
  font-size: .76rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #ffffff;
  background: var(--primary);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: .3px;
  line-height: 1.2;
}

.detail-icd {
  margin-top: 8px;
  font-size: .88rem;
  color: var(--text-muted);
}

.detail-icd span {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.sediaan {
  display: inline;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .9em;
  font-weight: 500;
  font-style: normal;
  margin: 0 2px;
}

/* ── LIST META BAR & PER-PAGE SELECTOR ── */
.list-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.count-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0;
}

.per-page-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 6px;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.per-page-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
  margin-right: 2px;
}

.per-page-btn {
  background: transparent;
  border: none;
  font-size: .78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s ease;
  font-family: inherit;
}

.per-page-btn:hover {
  color: var(--primary);
  background: var(--surface-2);
}

.per-page-btn.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(26, 86, 219, 0.25);
}

/* ── PAGINATION CONTROLS ── */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  margin-bottom: 36px;
  padding: 8px 0;
}

.page-numbers-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.page-nav-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.page-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.page-num-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.page-num-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.page-num-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(26, 86, 219, 0.3);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 36px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .9rem;
  user-select: none;
}

@media (max-width: 640px) {
  .list-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-nav-btn span {
    display: none;
  }
  .page-nav-btn {
    padding: 0 10px;
  }
  .page-num-btn {
    min-width: 32px;
    height: 32px;
    font-size: .8rem;
  }
}

/* ── DETAIL PAGE ── */
.detail-header {
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  padding: 16px 0 20px;
  margin-bottom: 24px;
}

.detail-top-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: .86rem;
  padding: 6px 14px;
  border: 1px solid rgba(26, 86, 219, 0.18);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  transition: all .15s;
}

.back-link:hover {
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateX(-2px);
}

.back-link svg {
  flex-shrink: 0;
}

.detail-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 8px;
}

.detail-title-row h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -.5px;
  line-height: 1.25;
  margin: 0;
}

.detail-icd-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1.5px solid rgba(26, 86, 219, 0.22);
  color: var(--primary-dark);
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.detail-icd-badge:hover {
  background: #dbeafe;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(26, 86, 219, 0.15);
}

.detail-icd-badge:active {
  transform: translateY(0);
}

.detail-icd-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--primary);
  opacity: .85;
}

.detail-icd-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .95rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: .5px;
}

.detail-icd-copy-icon {
  color: var(--primary);
  opacity: .6;
  transition: opacity .15s;
  flex-shrink: 0;
}

.detail-icd-badge:hover .detail-icd-copy-icon {
  opacity: 1;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: .95rem;
  color: var(--text-muted);
}

.detail-kat-badge {
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.meta-dot {
  color: #cbd5e1;
  font-weight: bold;
}

.detail-synonyms-inline {
  color: var(--text-muted);
  font-size: .95rem;
  font-style: italic;
}

.version-notice {
  margin-top: 8px;
  font-size: .84rem;
  color: #d97706;
}

/* ── QUICK JUMP BAR ── */
.quick-jump-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.quick-jump-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-right: 4px;
}

.jump-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all .15s;
}

.jump-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.jump-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1;
}

.jump-s .jump-letter { background: var(--s-color); color: #fff; }
.jump-o .jump-letter { background: var(--o-color); color: #fff; }
.jump-a .jump-letter { background: var(--a-color); color: #fff; }
.jump-p .jump-letter { background: var(--p-color); color: #fff; }
.jump-dd .jump-letter { background: var(--danger); color: #fff; }
.jump-info .jump-letter { background: var(--etio-color); color: #fff; }

.jump-s:hover { border-color: var(--s-color); background: color-mix(in srgb, var(--s-color) 8%, white); color: var(--s-color); }
.jump-o:hover { border-color: var(--o-color); background: color-mix(in srgb, var(--o-color) 8%, white); color: var(--o-color); }
.jump-a:hover { border-color: var(--a-color); background: color-mix(in srgb, var(--a-color) 8%, white); color: var(--a-color); }
.jump-p:hover { border-color: var(--p-color); background: color-mix(in srgb, var(--p-color) 8%, white); color: var(--p-color); }
.jump-dd:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, white); color: var(--danger); }
.jump-info:hover { border-color: var(--etio-color); background: color-mix(in srgb, var(--etio-color) 8%, white); color: var(--etio-color); }

/* ── DETAIL MODE BAR (RINGKAS & KOMPLIT) ── */
.detail-mode-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.detail-mode-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-right: 2px;
}

html {
  scroll-behavior: smooth;
}

.soap-card, .db-section, .info-section-heading {
  scroll-margin-top: 75px;
}

.detail-badges {
  margin-top: .5rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.detail-badges .badge {
  display: inline-block;
  background: #e0f2fe;
  color: var(--primary-dark);
  font-size: .8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── SOAP SECTIONS ── */
.soap-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.soap-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

.soap-card.s { border-left: 5px solid var(--s-color); }
.soap-card.o { border-left: 5px solid var(--o-color); }
.soap-card.a { border-left: 5px solid var(--a-color); }
.soap-card.p { border-left: 5px solid var(--p-color); }
.soap-card.etio { border-left: 5px solid var(--etio-color); }
.soap-card.pato { border-left: 5px solid var(--pato-color); }
.soap-card.komp { border-left: 5px solid var(--komp-color); }
.soap-card.prog { border-left: 5px solid var(--prog-color); }
.soap-card.eduk { border-left: 5px solid var(--eduk-color); }
.soap-card.rujuk { border-left: 5px solid var(--rujuk-color); }

.soap-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 92px 14px 20px;
  border-bottom: 1.5px solid var(--border);
  position: relative;
}

.soap-letter {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  font-weight: 700;
  flex-shrink: 0;
}

.soap-card.s .soap-letter { background: var(--s-color); color: #fff; }
.soap-card.o .soap-letter { background: var(--o-color); color: #fff; }
.soap-card.a .soap-letter { background: var(--a-color); color: #fff; }
.soap-card.p .soap-letter { background: var(--p-color); color: #fff; }
.soap-card.etio .soap-letter { background: var(--etio-color); color: #fff; }
.soap-card.pato .soap-letter { background: var(--pato-color); color: #fff; }
.soap-card.komp .soap-letter { background: var(--komp-color); color: #fff; }
.soap-card.prog .soap-letter { background: var(--prog-color); color: #fff; }
.soap-card.eduk .soap-letter { background: var(--eduk-color); color: #fff; }
.soap-card.rujuk .soap-letter { background: var(--rujuk-color); color: #fff; }

.soap-card.etio .soap-letter,
.soap-card.pato .soap-letter,
.soap-card.komp .soap-letter,
.soap-card.prog .soap-letter,
.soap-card.eduk .soap-letter,
.soap-card.rujuk .soap-letter {
  width: auto;
  min-width: 28px;
  padding: 0 8px;
  font-size: .78rem;
  letter-spacing: .3px;
}

.soap-card.s .soap-header { background: color-mix(in srgb, var(--s-color) 10%, white); }
.soap-card.o .soap-header { background: color-mix(in srgb, var(--o-color) 10%, white); }
.soap-card.a .soap-header { background: color-mix(in srgb, var(--a-color) 10%, white); }
.soap-card.p .soap-header { background: color-mix(in srgb, var(--p-color) 10%, white); }
.soap-card.etio .soap-header { background: color-mix(in srgb, var(--etio-color) 10%, white); }
.soap-card.pato .soap-header { background: color-mix(in srgb, var(--pato-color) 10%, white); }
.soap-card.komp .soap-header { background: color-mix(in srgb, var(--komp-color) 10%, white); }
.soap-card.prog .soap-header { background: color-mix(in srgb, var(--prog-color) 10%, white); }
.soap-card.eduk .soap-header { background: color-mix(in srgb, var(--eduk-color) 10%, white); }
.soap-card.rujuk .soap-header { background: color-mix(in srgb, var(--rujuk-color) 10%, white); }

.soap-title { font-weight: 700; font-size: 1.1rem; }
.soap-subtitle { font-size: .84rem; color: var(--text-muted); }

.soap-body {
  padding: 18px 22px;
}

.soap-body p {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 8px;
}

.soap-body p:last-child {
  margin-bottom: 0;
}

.soap-body strong,
.soap-body b {
  font-weight: 700;
  color: #0f172a;
}

.soap-body em,
.soap-body i {
  font-style: italic;
}

.soap-body u {
  text-decoration: underline;
}

.soap-body ul,
.soap-body ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 6px 0;
}

.soap-body ul {
  list-style-type: disc;
}

.soap-body ol {
  list-style-type: decimal;
}

.soap-body li {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
}

/* Quill list formatting compatibility in view mode */
.soap-body ol > li[data-list="bullet"] {
  list-style-type: disc;
}

.soap-body ol > li[data-list="ordered"] {
  list-style-type: decimal;
}

.soap-body li.ql-indent-1,
.soap-body li[data-indent="1"],
.soap-body li.is-subitem {
  list-style-type: circle;
  margin-left: 18px;
}

.soap-body li.ql-indent-2,
.soap-body li[data-indent="2"] {
  list-style-type: square;
  margin-left: 36px;
}

.soap-body .ql-ui {
  display: none;
}

/* Judul sub-fase / header dalam list (tanpa bullet) */
.soap-body li.is-heading {
  list-style-type: none;
  margin-left: -20px;
  padding-left: 0;
  font-weight: 700;
  color: #0f172a;
  margin-top: 10px;
  margin-bottom: 2px;
}

.soap-body li.is-heading:first-child {
  margin-top: 0;
}

/* Poin bernomor (1., 2., A., dll.) — TANPA bullet point */
.soap-body li.is-numbered {
  list-style-type: none;
  margin-left: -4px;
  padding-left: 0;
  margin-top: 2px;
}

.soap-body .ql-size-small { font-size: .8rem; }
.soap-body .ql-size-large { font-size: 1.25rem; }
.soap-body .ql-size-huge { font-size: 1.6rem; }
.soap-body .ql-align-center { text-align: center; }
.soap-body .ql-align-right { text-align: right; }
.soap-body .ql-align-justify { text-align: justify; }

.subsection {
  margin-bottom: 16px;
}

.subsection:last-child { margin-bottom: 0; }

.subsection-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.plan-group {
  margin-bottom: 16px;
}

.plan-group:last-child { margin-bottom: 0; }

.plan-group-title {
  font-size: .86rem;
  font-weight: 700;
  color: var(--p-color);
  background: color-mix(in srgb, var(--p-color) 10%, white);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 8px;
}

/* ── DIAGNOSIS BANDING ── */
.db-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--danger);
  overflow: hidden;
  margin-bottom: 24px;
}

.db-section .soap-header {
  background: color-mix(in srgb, var(--danger) 10%, white);
  border-bottom: 1.5px solid var(--border);
}

.db-section .soap-letter {
  background: var(--danger);
  color: #fff;
  width: auto;
  padding: 0 10px;
  font-size: .8rem;
}

.db-section .soap-title { color: var(--text); }

.db-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.db-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  transition: background .15s;
  text-decoration: none;
}

.db-chip:last-child { border-bottom: none; }

.db-chip:hover {
  background: var(--surface-2);
}

.db-chip .arrow { font-size: .8rem; color: var(--danger); }

.db-chip.disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── INFORMASI KLINIS TAMBAHAN ── */
.info-section-heading {
  margin: 36px 0 18px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-section-heading h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
  padding-left: 12px;
  border-left: 4px solid var(--etio-color);
  line-height: 1.2;
}

.info-grid {
  margin-bottom: 24px;
}

/* ── EMPTY STATE ── */

/* ── ADMIN EDITOR ── */
.card-edit-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  background: var(--surface);
  color: var(--primary);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  z-index: 5;
}

.card-edit-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(26, 86, 219, 0.2);
}

.card-edit-btn svg {
  flex-shrink: 0;
}

/* ── EDIT BANNERS & CHIPS ── */
.edit-status-banner {
  margin-top: 12px;
  padding: 8px 14px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  color: #065f46;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-edit-banner {
  margin-bottom: 16px;
  padding: 10px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  color: #1e40af;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-edit-chip {
  font-size: .76rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid rgba(26, 86, 219, 0.2);
}

/* ── IN-PLACE LIVE CARD EDITOR ── */
.soap-card.editing {
  box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
  border-color: var(--primary);
  background: var(--surface);
}

.soap-card.editing .card-edit-btn {
  display: none;
}

.soap-card.editing .soap-body {
  padding: 0 !important;
}

.ed-quill-wrap {
  margin-bottom: 0;
}

/* Toolbar flush & modern */
.ed-quill-wrap .ql-toolbar.ql-snow {
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--surface-2);
  padding: 8px 16px;
  border-radius: 0;
}

.ed-quill-wrap .ql-toolbar.ql-snow .ql-formats {
  margin-right: 8px;
}

/* Container & Editor */
.ed-quill-wrap .ql-container.ql-snow {
  border: none !important;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
}

.ed-quill-wrap .ql-editor {
  padding: 18px 22px !important;
  min-height: 90px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
}

.ed-quill-wrap .ql-editor strong,
.ed-quill-wrap .ql-editor b {
  font-weight: 700 !important;
  color: inherit;
}

.ed-quill-wrap .ql-editor .ql-size-small { font-size: .8rem !important; }
.ed-quill-wrap .ql-editor .ql-size-large { font-size: 1.25rem !important; }
.ed-quill-wrap .ql-editor .ql-size-huge { font-size: 1.6rem !important; }

/* Bullet list and number list inside Quill match .soap-body exactly */
.ed-quill-wrap .ql-editor ul,
.ed-quill-wrap .ql-editor ol {
  padding-left: 0 !important;
  margin: 0 !important;
}

.ed-quill-wrap .ql-editor li {
  padding-left: 22px !important;
  font-size: 1rem !important;
  color: inherit;
  line-height: 1.65 !important;
  font-family: inherit !important;
}

.ed-quill-wrap .ql-editor li::before {
  margin-left: -22px !important;
  font-size: 1rem !important;
  color: var(--text-muted);
  margin-right: 6px !important;
  text-align: left !important;
  width: 16px !important;
}

.ed-quill-wrap .ql-editor p {
  font-size: 1rem !important;
  color: inherit;
  line-height: 1.65 !important;
  font-family: inherit !important;
  margin: 0 0 8px 0 !important;
}

.ed-quill-wrap .ql-editor p:last-child {
  margin-bottom: 0 !important;
}

.ed-quill-wrap .ql-editor.ql-blank::before {
  left: 22px !important;
  top: 18px !important;
  font-style: italic;
  color: var(--text-muted);
}

.ed-quill-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 4px 0;
}

.soap-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 4px 2px;
  vertical-align: top;
}

.ql-editor img {
  display: inline-block;
  vertical-align: top;
}

/* Sub-section headings in edit mode */
.soap-card.editing .ed-section-label,
.soap-card.editing .subsection-title,
.soap-card.editing .plan-group-title {
  margin: 16px 20px 4px !important;
}

.soap-card.editing .subsection-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}

.soap-card.editing .plan-group-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--p-color);
  background: color-mix(in srgb, var(--p-color) 10%, white);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* Actions bar (Simpan / Batal) */
.ed-actions-bar {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  justify-content: flex-end;
  align-items: center;
}

.admin-btn {
  padding: 7px 16px;
  font-size: .86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.admin-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(26, 86, 219, 0.2);
}

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

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty svg { margin-bottom: 12px; opacity: .4; }
.empty p { font-size: .95rem; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .hero-inline h1 { font-size: 1.3rem; }
  .detail-title-row h1 { font-size: 1.4rem; }
  .container { padding: 16px 12px; }
  .site-header .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
  }
  .header-search-wrap {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin: 4px 0 0;
    min-width: 100%;
  }
  .header-ai-btn { padding: 4px 9px; font-size: .78rem; }
  .site-nav { gap: 6px; }
  .auth-nav-area { gap: 6px; }
  .auth-nav-divider { display: none; }
  .auth-badge-active, .auth-badge-admin { display: none; }
  .auth-username { max-width: 75px; font-size: .84rem; }
  .auth-user-pill { padding: 2px 8px 2px 2px; gap: 5px; }
  .auth-user-avatar { width: 22px; height: 22px; font-size: .7rem; }
  .auth-logout-btn { padding: 4px 8px; font-size: .78rem; }
  .auth-login-btn { padding: 4px 10px; font-size: .82rem; }
  .detail-top-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .detail-toolbar-actions { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
  .detail-mode-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .soap-mode-toggle { width: 100%; display: flex; }
  .soap-mode-btn { flex: 1; justify-content: center; }
  .detail-icd-badge { padding: 3px 8px; }
  .detail-icd-code { font-size: .86rem; }
  .version-toggle-area { justify-content: flex-start; }
  .quick-jump-bar { gap: 6px; }
  .jump-pill { padding: 3px 8px; font-size: .76rem; }
  .edit-item-actions { flex-direction: column; gap: 4px; }
  .edit-item-info { flex-wrap: wrap; }
}

/* ── AUTH NAV & USER PROFILE DROPDOWN WIDGET ── */
.auth-nav-area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.auth-user-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.auth-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}

.auth-user-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.auth-caret {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  transition: transform 0.15s ease;
  margin-left: 1px;
}

.auth-user-pill[aria-expanded="true"] .auth-caret {
  transform: rotate(180deg);
}

.auth-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.auth-user-avatar.admin-avatar {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.auth-username {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff !important;
}

.auth-badge-active {
  font-size: .72rem;
  font-weight: 600;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(110, 231, 183, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

.auth-badge-admin {
  font-size: .72rem;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(252, 165, 165, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

.auth-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 215px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.16), 0 6px 12px -2px rgba(0, 0, 0, 0.06);
  padding: 6px;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}

.auth-dropdown-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.auth-dropdown-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.auth-dropdown-role {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 7px;
  color: #0f172a !important;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: all 0.12s;
  box-sizing: border-box;
}

.auth-dropdown-item:hover {
  background: #f1f5f9;
  color: #000000 !important;
}

.auth-dropdown-item.danger {
  color: #dc2626 !important;
  font-weight: 600;
}

.auth-dropdown-item.danger:hover {
  background: #fef2f2;
  color: #991b1b !important;
}

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

.auth-login-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  line-height: 1.4;
  height: 31px;
}

.auth-login-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
}

/* ── AUTH MODAL ── */
.auth-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease-out;
}

.auth-modal-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  overflow: hidden;
  animation: modalScale .2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.auth-modal-header {
  background: var(--surface-2);
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-modal-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.auth-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.auth-modal-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.auth-field label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.auth-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.auth-toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  color: var(--text-muted);
  opacity: .7;
  transition: opacity .15s;
}

.auth-toggle-pw:hover {
  opacity: 1;
}

.auth-error-msg {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: .85rem;
  font-weight: 500;
}

.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.auth-modal-actions .admin-btn {
  padding: 8px 18px;
  font-size: .9rem;
}

/* ── DETAIL TOOLBAR ACTIONS & SOAP MODE TOGGLE (Ringkas / Komplit) ── */
.detail-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.soap-mode-toggle {
  display: inline-flex;
  background: var(--surface-2, #f1f5f9);
  border: 1.5px solid var(--border, #cbd5e1);
  padding: 3px;
  border-radius: 9px;
}

.soap-mode-btn {
  padding: 5px 14px;
  font-size: .84rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: inherit;
}

.soap-mode-btn:hover:not(.disabled) {
  color: var(--text, #0f172a);
}

.soap-mode-btn.active {
  background: #ffffff;
  color: var(--primary-dark, #1e40af);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.soap-mode-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mode-pill-badge.soon {
  font-size: 0.68rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  font-weight: 700;
  line-height: 1.3;
}

/* ── VERSION TOGGLE (Original / Community) ── */
.version-toggle-area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.version-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  padding: 3px;
  border-radius: 9px;
}

.version-btn {
  padding: 5px 14px;
  font-size: .84rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.version-btn:hover {
  color: var(--text);
}

.version-btn.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.version-btn.active:hover {
  color: var(--primary);
}

.version-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}

.version-btn.active .version-count {
  background: var(--primary);
  color: #fff;
}

.version-info {
  font-size: .85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── COMMUNITY EDIT SELECTOR ── */
.community-edit-selector {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.edit-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

.edit-pending-badge {
  font-size: .75rem;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 2px 8px;
  border-radius: 999px;
}

.edit-list-items {
  max-height: 240px;
  overflow-y: auto;
}

.edit-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  gap: 10px;
}

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

.edit-list-item:hover {
  background: var(--surface-2);
}

.edit-list-item.selected {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.edit-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.edit-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.edit-status-dot.pending {
  background: #f59e0b;
}

.edit-status-dot.approved {
  background: #10b981;
}

.edit-item-date {
  font-size: .84rem;
  color: var(--text);
  font-weight: 500;
}

.edit-item-status {
  font-size: .78rem;
  color: var(--text-muted);
}

.edit-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.edit-approve-btn,
.edit-reject-btn {
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid;
  cursor: pointer;
  transition: all .15s;
}

.edit-approve-btn {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #059669;
}

.edit-approve-btn:hover {
  background: #059669;
  color: #fff;
  border-color: #059669;
}

.edit-reject-btn {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.edit-reject-btn:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ── AI FLOATING ACTION BUBBLE (FAB) ── */
.ai-fab-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.ai-fab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e3a8a, #4338ca, #6366f1);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  font-size: 0.90rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px -4px rgba(67, 56, 202, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.2px;
  text-decoration: none;
}

.ai-fab-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 30px -4px rgba(67, 56, 202, 0.65);
  border-color: rgba(255, 255, 255, 0.6);
}

.ai-fab-btn:active {
  transform: translateY(-1px) scale(0.98);
}

.ai-fab-icon {
  font-size: 1.15rem;
  line-height: 1;
  animation: sparklePulse 2.2s infinite ease-in-out;
}

.ai-fab-pro-chip {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  margin-left: 2px;
}

@media (max-width: 640px) {
  .ai-fab-container { bottom: 16px; right: 16px; }
  .ai-fab-btn { padding: 8px 14px; font-size: 0.84rem; }
}

/* ── AI DOCASSIST MODAL ── */
.ai-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease-out;
}

.ai-modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 95%;
  max-width: 880px;
  height: 92vh;
  max-height: 92vh;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-modal-header {
  background: linear-gradient(135deg, #1e3a8a, #3730a3);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-modal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-modal-icon-badge {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.ai-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.ai-modal-sub {
  font-size: 0.78rem;
  color: #c7d2fe;
}

.ai-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.15s;
}

.ai-modal-close:hover {
  background: rgba(239, 68, 68, 0.5);
}

.ai-modal-body {
  padding: 16px 20px;
  overflow-y: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* ── PRO BANNER INSIDE MODAL ── */
.ai-modal-pro-banner {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.ai-modal-pro-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-modal-pro-link {
  background: linear-gradient(135deg, #4338ca, #6366f1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.3);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ai-modal-pro-link:hover {
  background: linear-gradient(135deg, #3730a3, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.45);
}

.ai-prompts-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ai-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.ai-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ai-chip:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
  transform: translateY(-1px);
}

.ai-chat-thread {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 90%;
  font-size: 0.88rem;
  line-height: 1.55;
}

.ai-msg.user {
  align-self: flex-end;
  background: #1a56db;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px 12px 2px 12px;
}

.ai-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 12px 12px 12px 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ai-msg.assistant strong {
  color: #1e3a8a;
}

.ai-msg.assistant ul {
  margin: 6px 0 6px 18px;
}

.ai-msg.assistant li {
  margin-bottom: 4px;
}

.ai-disease-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  text-decoration: none;
  margin: 2px 0;
  transition: all 0.12s;
}

.ai-disease-card-link:hover {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
}

.ai-input-wrap {
  display: flex;
  gap: 8px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.ai-input-field {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-input-field:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ai-send-btn {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  border: none;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.ai-send-btn * {
  pointer-events: none;
}

.ai-send-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.ai-send-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #3730a3, #4338ca);
  transform: translateY(-1px);
}

/* ── ADMIN BADGE ── */
.auth-badge-admin {
  font-size: .72rem;
  font-weight: 600;
  color: #fde047;
  background: rgba(234, 179, 8, 0.22);
  border: 1px solid rgba(253, 224, 71, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

/* ── TOAST NOTIFICATION ── */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 10000;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-notification.info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.toast-notification.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.toast-notification.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ── EDIT LOG LINK (header button) ── */
.edit-log-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1.5px solid rgba(26, 86, 219, 0.2);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.edit-log-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ── EDIT LOG SECTION (bottom) ── */
.edit-log-section {
  margin-top: 32px;
  margin-bottom: 24px;
  scroll-margin-top: 80px;
}

.edit-log-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.edit-log-heading h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.edit-log-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  font-style: italic;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}

.edit-log-section .edit-list-items {
  max-height: none;
}

/* ── AUTH USERNAME IN NAV ── */
.auth-username {
  font-size: .92rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── AUTH SWITCH (login/register toggle) ── */
.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ── AUTH FIELD HINT ── */
.auth-field-hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── EDIT LOG AUTHOR ── */
.edit-item-author {
  font-size: .88rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* ── QUILL SEDIAAN TOOLBAR BUTTON ── */
.ql-sediaan {
  width: auto !important;
  padding: 0 8px !important;
  color: #0369a1 !important;
  background: #e0f2fe !important;
  border-radius: 4px !important;
  border: 1px solid #bae6fd !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all .15s !important;
}

.ql-sediaan:hover {
  background: #0369a1 !important;
  color: #fff !important;
  border-color: #0369a1 !important;
}

/* ── QUILL FONT SIZE DROPDOWN LABELS ── */
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
  content: 'Normal' !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="small"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
  content: 'Kecil' !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="large"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
  content: 'Besar' !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="huge"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
  content: 'Sangat Besar' !important;
}

.ql-snow .ql-picker.ql-size {
  width: 110px !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
  font-size: 10px !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-item::before {
  font-size: 13px !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
  font-size: 18px !important;
}

.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
  font-size: 24px !important;
}

/* ── ADMIN PANEL PAGE ── */
.auth-user-pill.is-admin-link {
  text-decoration: none;
  cursor: pointer;
  border-color: rgba(253, 224, 71, 0.35);
  background: rgba(254, 240, 138, 0.08);
}

.auth-user-pill.is-admin-link:hover {
  background: rgba(254, 240, 138, 0.16);
  border-color: rgba(253, 224, 71, 0.6);
  transform: translateY(-1px);
}

.auth-user-avatar.admin-avatar {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.auth-admin-icon {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-left: 2px;
}

.admin-header-box {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-header-box h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.admin-header-box p {
  font-size: .92rem;
  color: var(--text-muted);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.admin-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.admin-stat-icon.total { background: #eff6ff; color: #1e40af; }
.admin-stat-icon.admin { background: #fef3c7; color: #b45309; }
.admin-stat-icon.contributor { background: #ecfdf5; color: #065f46; }
.admin-stat-icon.db { background: #f3e8ff; color: #6b21a8; }

.admin-stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.admin-stat-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.admin-table-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.admin-table-toolbar {
  padding: 16px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-search-input {
  max-width: 320px;
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
  background: #fff;
}

.admin-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: .9rem;
}

.admin-table th {
  background: var(--surface-2);
  padding: 12px 18px;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.admin-table tr:hover {
  background: var(--surface-2);
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  flex-shrink: 0;
}

.admin-user-avatar.admin {
  background: linear-gradient(135deg, #d97706, #b45309);
}

.admin-user-avatar.contributor {
  background: linear-gradient(135deg, #10b981, #047857);
}

.admin-user-name {
  font-weight: 700;
  color: var(--text);
}

.admin-user-sub {
  font-size: .78rem;
  color: var(--text-muted);
}

.admin-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.admin-role-badge.admin {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.admin-role-badge.contributor {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.admin-date-cell {
  font-size: .84rem;
  color: var(--text-muted);
}

.admin-empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}

.admin-empty-state svg {
  margin-bottom: 12px;
  opacity: .4;
}

.admin-access-denied {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 48px 24px;
  text-align: center;
  max-width: 500px;
  margin: 40px auto;
  box-shadow: var(--shadow-md);
}

.admin-access-icon {
  font-size: 3rem;
  margin-bottom: 14px;
}

.admin-access-denied h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 8px;
}

.admin-access-denied p {
  font-size: .92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-action-role {
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}

.btn-action-role:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-action-role.is-promote {
  border-color: #fcd34d;
  background: #fef3c7;
  color: #92400e;
}

.btn-action-role.is-promote:hover {
  background: #fde047;
  border-color: #eab308;
  color: #713f12;
}

.btn-action-delete {
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  cursor: pointer;
  transition: all .15s;
}

.btn-action-delete:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ── GUEST SAVE CONFIRMATION & CAPTCHA MODAL ── */
.guest-captcha-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease-out;
  box-sizing: border-box;
}

.guest-captcha-overlay.active {
  opacity: 1;
}

.guest-captcha-dialog {
  background: var(--surface, #ffffff);
  width: 100%;
  max-width: 440px;
  border-radius: 16px;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.25), 0 8px 16px -4px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  transform: scale(0.94) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.guest-captcha-overlay.active .guest-captcha-dialog {
  transform: scale(1) translateY(0);
}

.guest-captcha-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}

.guest-captcha-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-captcha-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.guest-captcha-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0;
  line-height: 1.3;
}

.guest-captcha-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin: 2px 0 0;
  line-height: 1.4;
}

.guest-captcha-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}

.guest-captcha-close:hover {
  background: #e2e8f0;
  color: var(--text, #0f172a);
}

.guest-captcha-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guest-captcha-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guest-captcha-field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  display: flex;
  align-items: center;
  gap: 6px;
}

.guest-opt-badge {
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  font-weight: normal;
}

.guest-req-badge {
  color: #dc2626;
  font-weight: 700;
}

.guest-captcha-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border, #cbd5e1);
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text, #1e293b);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.guest-captcha-input:focus {
  border-color: var(--primary, #1a56db);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.guest-captcha-hint {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.guest-captcha-calc-box {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.guest-captcha-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: 8px;
  user-select: none;
  flex-shrink: 0;
}

.guest-captcha-math-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e40af;
  letter-spacing: 1px;
}

.guest-captcha-reload-btn {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.guest-captcha-reload-btn:hover {
  background: #dbeafe;
  color: #1d4ed8;
  transform: rotate(45deg);
}

.guest-captcha-calc-box .ans-input {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.guest-captcha-error {
  font-size: 0.8rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 8px 12px;
  border-radius: 6px;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

.guest-captcha-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface-2, #f8fafc);
  border-top: 1px solid var(--border, #e2e8f0);
}

@keyframes captchaShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.guest-captcha-calc-box.shake {
  animation: captchaShake 0.35s ease;
}



