/* ============================================================
   DentAI: Clinical Medical Pro Stylesheet
   Sistem Deteksi & Klasifikasi Penyakit Gigi Citra Panoramik
   Design System: Clinical Medical Pro (Clean Light Medical)
   Dials: ENERGY 2 / RHYTHM 2 / MOTION 2
   ============================================================ */

/* ===== CSS Variables (Design Tokens) ===== */
:root {
    /* Palette: Clinical Medical Pro */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-darkroom: #090d16;

    /* Border tokens */
    --border-subtle: #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong: #94a3b8;

    /* Text tokens (WCAG AAA compliant contrast) */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Brand / Clinical identity tokens */
    --brand-primary: #0f4c81;
    --brand-primary-hover: #0a355c;
    --brand-accent: #0284c7;
    --brand-accent-hover: #0369a1;
    --brand-accent-subtle: #e0f2fe;

    /* Status & Pathology tokens */
    --status-success: #059669;
    --status-success-bg: #ecfdf5;
    --status-warning: #d97706;
    --status-warning-bg: #fffbeb;
    --status-danger: #dc2626;
    --status-danger-bg: #fef2f2;
    --status-info: #0284c7;
    --status-info-bg: #f0f9ff;

    /* Pathology category tags */
    --pathology-caries: #b45309;
    --pathology-caries-bg: #fef3c7;
    --pathology-caries-border: #fcd34d;

    --pathology-periapical: #b91c1c;
    --pathology-periapical-bg: #fee2e2;
    --pathology-periapical-border: #fca5a5;

    --pathology-impacted: #4338ca;
    --pathology-impacted-bg: #e0e7ff;
    --pathology-impacted-border: #a5b4fc;

    /* Elevation / Shadows */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);

    /* Shape & Border radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing scale */
    --space-2xs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Motion & Transitions (Dial: MOTION 2) */
    --transition-fast: 150ms ease;
    --transition-normal: 220ms ease;
    --transition-smooth: 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Focus indicators for keyboard accessibility (R-32) */
:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.35rem;
}

h4 {
    font-size: 1.15rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

p:last-child {
    margin-bottom: 0;
}

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

a:hover {
    color: var(--brand-accent-hover);
}

.text-mono {
    font-family: var(--font-mono);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-caries {
    background-color: var(--pathology-caries-bg);
    color: var(--pathology-caries);
    border-color: var(--pathology-caries-border);
}

.badge-periapical {
    background-color: var(--pathology-periapical-bg);
    color: var(--pathology-periapical);
    border-color: var(--pathology-periapical-border);
}

.badge-impacted {
    background-color: var(--pathology-impacted-bg);
    color: var(--pathology-impacted);
    border-color: var(--pathology-impacted-border);
}

.badge-clinical {
    background-color: var(--brand-accent-subtle);
    color: #0369a1;
    border-color: #bae6fd;
}

.badge-normal,
.badge-success {
    background-color: var(--status-success-bg);
    color: #047857;
    border-color: #a7f3d0;
}

/* ===== Layout Structure ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.main-content {
    flex: 1;
    padding: var(--space-md) 0 var(--space-2xl);
}

.section {
    padding: var(--space-xs) 0 var(--space-2xl);
}

/* ===== Flash Messages / Notifikasi Sistem ===== */
.flash-container {
    width: 100%;
    max-width: 1200px;
    margin: var(--space-md) auto 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    z-index: 99;
}

.flash-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
    animation: flashFadeIn 250ms ease;
}

@keyframes flashFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-message.flash-error {
    background-color: var(--status-danger-bg);
    color: #991b1b;
    border-color: #fca5a5;
}

.flash-message.flash-success {
    background-color: var(--status-success-bg);
    color: #065f46;
    border-color: #6ee7b7;
}

.flash-message.flash-warning {
    background-color: var(--status-warning-bg);
    color: #92400e;
    border-color: #fcd34d;
}

.flash-message.flash-info {
    background-color: var(--status-info-bg);
    color: #075985;
    border-color: #7dd3fc;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    padding: 0 4px;
    transition: opacity var(--transition-fast);
}

.flash-close:hover {
    opacity: 1;
}

/* ===== Navigation Bar ===== */
.navbar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--brand-primary);
}

.nav-brand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
}

.nav-brand .accent {
    color: var(--brand-accent);
}

.nav-tagline {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: var(--space-xs);
    padding-left: var(--space-xs);
    border-left: 1px solid var(--border-default);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
    gap: var(--space-xs);
}

.nav-link {
    padding: var(--space-xs) var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--brand-primary);
    background-color: var(--bg-subtle);
}

.nav-link.active {
    color: var(--brand-primary);
    background-color: var(--brand-accent-subtle);
    font-weight: 600;
}

.nav-link-logout:hover,
.nav-link-logout:focus-visible {
    color: var(--status-danger) !important;
    background-color: var(--status-danger-bg) !important;
}

.nav-link-btn {
    background-color: var(--brand-primary);
    color: var(--text-inverse) !important;
}

.nav-link-btn:hover {
    background-color: var(--brand-primary-hover) !important;
    color: var(--text-inverse) !important;
}

/* ===== User Profile Dropdown Navigation ===== */
.nav-item-user {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-user-dropdown {
    position: relative;
}

.nav-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 6px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.nav-user-btn:hover,
.nav-user-btn.active {
    background-color: var(--bg-subtle);
    border-color: var(--brand-accent);
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--brand-accent-subtle);
}

.nav-user-avatar-initial {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: var(--text-inverse);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

.nav-user-name {
    color: var(--text-primary);
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-chevron {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.nav-user-btn.active .nav-user-chevron {
    transform: rotate(180deg);
}

.nav-user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 230px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.nav-user-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.nav-user-menu-header {
    padding: 8px 16px 6px;
}

.nav-user-menu-greeting {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 2px 0;
}

.nav-user-menu-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-user-menu-divider {
    height: 1px;
    background-color: var(--border-subtle);
    margin: 6px 0;
}

.nav-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    font-family: inherit;
    box-sizing: border-box;
}

.nav-user-menu-item svg {
    color: var(--text-muted);
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.nav-user-menu-item:hover {
    background-color: var(--bg-subtle);
    color: var(--brand-primary);
}

.nav-user-menu-item:hover svg {
    color: var(--brand-primary);
}

.nav-user-menu-item.active {
    background-color: var(--brand-accent-subtle);
    color: var(--brand-primary);
    font-weight: 600;
}

.nav-user-menu-item.active svg {
    color: var(--brand-primary);
}

.nav-user-menu-logout {
    color: var(--status-danger);
}

.nav-user-menu-logout svg {
    color: var(--status-danger);
}

.nav-user-menu-logout:hover {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
}

.nav-user-menu-logout:hover svg {
    color: var(--status-danger);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    color: var(--text-primary);
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-primary);
    margin: 5px 0;
    transition: var(--transition-fast);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    min-height: 44px;
    /* Minimum tap target R-03 */
}

.btn-primary {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-default);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-accent {
    background-color: var(--brand-accent);
    color: var(--text-inverse);
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    background-color: var(--brand-accent-hover);
    border-color: var(--brand-accent-hover);
    color: var(--text-inverse);
}

.btn-danger {
    background-color: var(--status-danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-lg {
    padding: 13px 26px;
    font-size: 1rem;
    min-height: 48px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    min-height: 36px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
}

/* ===== Card Component ===== */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-xl);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-2xs);
}

/* ===== Form Controls ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 44px;
}

.form-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px var(--brand-accent-subtle);
    outline: none;
}

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

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-2xs);
}

/* ===== Upload Zone (Console Radiologi) ===== */
.upload-zone {
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-normal), background-color var(--transition-normal);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--brand-accent);
    background-color: var(--brand-accent-subtle);
}

.upload-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background-color: var(--bg-subtle);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    transition: transform var(--transition-normal);
}

.upload-zone:hover .upload-icon-wrapper {
    transform: translateY(-2px);
    background-color: #e0f2fe;
    color: var(--brand-accent);
}

.upload-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.upload-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.upload-preview {
    display: none;
    margin-top: var(--space-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-darkroom);
    border: 1px solid var(--border-subtle);
}

.upload-preview.visible {
    display: block;
}

.upload-preview img {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.upload-file-meta {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

/* ===== Radiograph Viewports (Result Page) ===== */
.viewer-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-xl);
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.viewer-tabs {
    display: inline-flex;
    background-color: var(--bg-subtle);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 2px;
}

.viewer-tab-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.viewer-tab-btn.active {
    background-color: var(--bg-surface);
    color: var(--brand-primary);
    box-shadow: var(--shadow-xs);
}

.darkroom-viewport {
    background-color: var(--bg-darkroom);
    border-radius: var(--radius-md);
    padding: var(--space-xs);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    border: 1px solid #1e293b;
}

.darkroom-viewport img {
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-xs);
    transition: opacity var(--transition-normal);
}

.viewport-toolbar {
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Grad-CAM Dual Viewport & Intensity Scale ===== */
.gradcam-dual-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.gradcam-subcard {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    box-shadow: var(--shadow-xs);
}

.gradcam-subcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding: 0 var(--space-xs);
}

.gradcam-subcard-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin: 0;
}

.gradcam-subcard-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.gradcam-intensity-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-xs);
}

.gradcam-gradient-bar {
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(to right, #000080 0%, #0000ff 15%, #00ffff 35%, #00ff00 50%, #ffff00 65%, #ff7f00 80%, #ff0000 95%, #800000 100%);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    margin: var(--space-xs) 0;
}

.gradcam-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ===== Diagnosis Summary & Pathology Cards ===== */
.diagnosis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.metric-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-xs);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-2xs);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.finding-item {
    background-color: var(--bg-surface);
    border-left: 4px solid var(--brand-accent);
    border-top: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.finding-item.caries {
    border-left-color: var(--pathology-caries);
}

.finding-item.periapical {
    border-left-color: var(--pathology-periapical);
}

.finding-item.impacted {
    border-left-color: var(--pathology-impacted);
}

.finding-info h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.finding-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ===== Gemini Consultation Panel ===== */
.consultation-panel {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-top: var(--space-xl);
}

.consultation-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    color: #166534;
}

.consultation-header h3 {
    font-size: 1.15rem;
    color: #166534;
}

.consultation-content {
    color: #14532d;
    font-size: 0.94rem;
    line-height: 1.7;
}

.consultation-content p {
    color: #14532d;
    margin-bottom: var(--space-sm);
}

.consultation-content h2,
.consultation-content h3,
.consultation-content h4 {
    color: #166534;
    font-weight: 700;
    margin-top: var(--space-md);
    margin-bottom: var(--space-xs);
}

.consultation-content h2 {
    font-size: 1.15rem;
}

.consultation-content h3 {
    font-size: 1.05rem;
}

.consultation-content h4 {
    font-size: 0.95rem;
}

.consultation-content hr {
    border: 0;
    height: 1px;
    background-color: #bbf7d0;
    margin: var(--space-md) 0;
}

.consultation-content ul,
.consultation-content ol {
    margin: var(--space-xs) 0 var(--space-md) var(--space-lg);
    padding-left: var(--space-xs);
}

.consultation-content li {
    margin-bottom: 0.35rem;
    line-height: 1.6;
}

.consultation-content strong {
    color: #14532d;
    font-weight: 700;
}

.consultation-content em {
    font-style: italic;
}

.consultation-content blockquote {
    border-left: 4px solid #16a34a;
    background-color: #dcfce7;
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: var(--space-md) 0;
    color: #166534;
    font-size: 0.88rem;
}

.consultation-content blockquote p {
    margin-bottom: 0;
    color: #166534;
}

.disclaimer-callout {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background-color: #fefce8;
    border: 1px solid #fef08a;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: #854d0e;
}

/* ===== Result Page Inline Chatbot ===== */
.result-chat-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px dashed #bbf7d0;
}

.result-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.chat-status-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
    animation: statusPulse 2s infinite ease-in-out;
}

@keyframes statusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.suggestion-chips-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.chips-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #166534;
    margin-right: 2px;
}

.suggestion-chip {
    background-color: #ffffff;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.suggestion-chip:hover {
    background-color: #dcfce7;
    border-color: #4ade80;
    color: #14532d;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(22, 101, 52, 0.1);
}

.suggestion-chip:active {
    transform: translateY(0);
}

.inline-chat-messages {
    max-height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    padding-right: 4px;
}

.inline-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.inline-msg-row.user {
    flex-direction: row-reverse;
}

.inline-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.inline-msg-row.ai .inline-msg-avatar {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.inline-msg-row.user .inline-msg-avatar {
    background-color: var(--brand-primary);
    color: #ffffff;
}

.inline-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
}

.inline-msg-bubble.user {
    background-color: var(--brand-primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.inline-msg-bubble.user p,
.inline-msg-bubble.user span,
.inline-msg-bubble.user strong,
.inline-msg-bubble.user em,
.inline-msg-bubble.user li,
.inline-msg-bubble.user blockquote {
    color: #ffffff !important;
}

.inline-msg-bubble.ai {
    background-color: #ffffff;
    color: #14532d;
    border: 1px solid #bbf7d0;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.inline-msg-bubble.ai p {
    color: #14532d;
}

.inline-msg-bubble ul,
.inline-msg-bubble ol {
    margin: 6px 0 8px 0;
    padding-left: 24px;
}

.inline-msg-bubble li {
    margin-bottom: 4px;
    line-height: 1.55;
}

.inline-msg-bubble li:last-child {
    margin-bottom: 0;
}

.inline-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background-color: #ffffff;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: var(--space-sm);
}

.inline-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: var(--space-xs);
}

.inline-chat-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid #86efac;
    background-color: #ffffff;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    transition: all 0.15s ease;
}

.inline-chat-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.inline-chat-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    white-space: nowrap;
    border-radius: var(--radius-md);
}

/* ===== Chatbot Active Context Banner ===== */
.active-context-banner {
    background-color: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
    padding: var(--space-sm) var(--space-md);
}

.active-context-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #dcfce7;
    color: #166534;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== Table Styling (History Page) ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-xs);
}

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

.table th {
    background-color: var(--bg-subtle);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.table tr:hover td {
    background-color: #f8fafc;
}

.table-thumbnail {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    background-color: var(--bg-darkroom);
    border: 1px solid var(--border-subtle);
}

/* ===== Chatbot Interface ===== */
.chat-layout-container {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    transition: max-width var(--transition-smooth), width var(--transition-smooth);
}

.chat-layout-container.is-expanded {
    max-width: 1440px;
    width: 96%;
}

.chat-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 620px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    overflow: hidden;
    transition: height var(--transition-smooth), box-shadow var(--transition-smooth);
}

.chat-layout-container.is-expanded .chat-container {
    height: calc(100vh - 220px);
    min-height: 650px;
    box-shadow: var(--shadow-md);
}

.chat-header {
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-header-btn:hover {
    background-color: var(--brand-accent-subtle);
    border-color: var(--brand-accent);
    color: var(--brand-primary);
    transform: scale(1.05);
}

.chat-header-btn:active {
    transform: scale(0.96);
}

.chat-header-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    background-color: var(--bg-app);
}

.chat-message {
    display: flex;
    gap: var(--space-xs);
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.ai {
    align-self: flex-start;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-subtle);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background-color: var(--brand-accent-subtle);
    color: var(--brand-accent);
}

.chat-bubble {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
}

.chat-bubble ul,
.chat-bubble ol {
    margin: 8px 0 10px 0;
    padding-left: 28px; /* Jarak yang cukup agar tanda bulat/bullet tidak menempel ke batas card */
}

.chat-bubble li {
    margin-bottom: 6px;
    line-height: 1.6;
    padding-left: 4px;
}

.chat-bubble li:last-child {
    margin-bottom: 0;
}

.chat-bubble p {
    margin-bottom: 8px;
}

.chat-bubble p:last-child,
.chat-bubble ul:last-child,
.chat-bubble ol:last-child {
    margin-bottom: 0;
}

.chat-message.user .chat-bubble {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
    border-top-right-radius: 2px;
}

.chat-message.user .chat-bubble p {
    color: var(--text-inverse);
}

.chat-message.ai .chat-bubble {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-top-left-radius: 2px;
    box-shadow: var(--shadow-xs);
}

.chat-message.ai .chat-bubble p {
    color: var(--text-secondary);
}

.typing-indicator {
    display: none;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
}

.typing-indicator.visible {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--brand-accent);
    margin-right: 4px;
    animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-input-area {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: var(--space-xs);
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 0.92rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 44px;
}

.chat-input:focus {
    border-color: var(--brand-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--brand-accent-subtle);
}

/* ===== Chat History Sliding Drawer & Backdrop ===== */
.chat-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.chat-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 410px;
    max-width: 92vw;
    height: 100vh;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-drawer.open {
    transform: translateX(0);
}

.chat-drawer-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-drawer-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background-color: var(--brand-accent-subtle);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-drawer-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
}

.chat-drawer-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin: 2px 0 0;
    white-space: nowrap;
}

.btn-new-chat-drawer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--brand-primary);
    background-color: var(--brand-accent-subtle);
    border: 1px solid rgba(30, 92, 179, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    line-height: 1;
}

.btn-new-chat-drawer:hover {
    background-color: var(--brand-primary);
    color: var(--text-inverse);
    border-color: var(--brand-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.btn-new-chat-drawer:active {
    transform: translateY(0);
}

.chat-drawer-close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.chat-drawer-close:hover {
    background-color: var(--bg-subtle);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.chat-drawer-tabs {
    display: flex;
    padding: 8px 16px;
    gap: 6px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.chat-drawer-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid transparent;
    background-color: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
}

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

.chat-drawer-tab.active {
    background-color: var(--brand-accent-subtle);
    color: var(--brand-primary);
    border-color: rgba(30, 92, 179, 0.2);
}

.chat-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    background-color: var(--bg-app);
}

.chat-drawer-loading,
.chat-drawer-empty {
    padding: var(--space-xl) var(--space-md);
    text-align: center;
}

.chat-drawer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-session-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.chat-session-card:hover {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.chat-session-card.active {
    border-color: var(--brand-primary);
    background-color: #f8fafc;
    box-shadow: 0 0 0 1px var(--brand-primary);
}

.chat-session-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.chat-session-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.chat-session-badge.exam {
    background-color: #dcfce7;
    color: #166534;
}

.chat-session-badge.general {
    background-color: #e0f2fe;
    color: #0369a1;
}

.chat-session-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-session-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-session-preview {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-session-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-subtle);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.chat-session-del-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.chat-session-del-btn:hover {
    color: var(--status-danger);
}

@media (max-width: 640px) {
    .chat-drawer {
        width: 100vw;
        max-width: 100vw;
    }
}


/* ===== Flash / Alert Messages ===== */
.flash-container {
    max-width: 1200px;
    margin: var(--space-md) auto 0;
    padding: 0 var(--space-lg);
}

.flash-message {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-xs);
}

.flash-success {
    background-color: var(--status-success-bg);
    color: var(--status-success);
    border: 1px solid #a7f3d0;
}

.flash-error {
    background-color: var(--status-danger-bg);
    color: var(--status-danger);
    border: 1px solid #fecaca;
}

.flash-warning {
    background-color: var(--status-warning-bg);
    color: var(--status-warning);
    border: 1px solid #fde68a;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    line-height: 1;
    padding: 0 var(--space-2xs);
}

/* ===== Modal Dialog ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transform: scale(0.96);
    transition: transform var(--transition-normal);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-subtle);
    color: var(--brand-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.modal-content p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: var(--space-xs);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

/* ===== Loading State (Clinical Pulse) ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(248, 250, 252, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-md);
}

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

.loading-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2xs);
}

.loading-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-xl) 0;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-xs);
}

.footer-brand {
    font-weight: 700;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.footer-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 600px;
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Empty State (R-27) ===== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.empty-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.empty-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.empty-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 440px;
    margin: 0 auto var(--space-lg);
}

/* ===== Profile Page ===== */
.profile-hero-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.profile-avatar-container {
    position: relative;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

.profile-hero-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-surface);
    box-shadow: var(--shadow-md);
}

.profile-hero-initial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border: 3px solid var(--bg-surface);
    box-shadow: var(--shadow-md);
}

.profile-avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--brand-accent);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--bg-surface);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.profile-avatar-badge:hover {
    background-color: var(--brand-accent-hover);
    transform: scale(1.08);
}

.profile-hero-meta {
    display: flex;
    flex-direction: column;
}

.profile-stats-grid {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.profile-stat-box {
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.profile-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.profile-stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1.2;
}

.profile-stat-sub {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-section-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background-color: var(--brand-accent-subtle);
    color: var(--brand-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== Mobile Responsiveness (R-03) ===== */
@media (max-width: 860px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--bg-surface);
        border-bottom: 1px solid var(--border-subtle);
        flex-direction: column;
        padding: var(--space-md);
        box-shadow: var(--shadow-md);
        gap: var(--space-xs);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        text-align: left;
        padding: 12px var(--space-md);
    }

    .nav-item-user {
        width: 100%;
    }

    .nav-user-dropdown {
        width: 100%;
    }

    .nav-user-btn {
        width: 100%;
        justify-content: space-between;
        padding: 10px 14px;
        border-radius: var(--radius-md);
    }

    .nav-user-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid var(--border-subtle);
        margin-top: 8px;
        transform: none;
    }

    .profile-hero-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-stats-grid {
        width: 100%;
    }

    .profile-stat-box {
        flex: 1;
    }

    .nav-tagline {
        display: none;
    }

    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .viewer-tabs {
        width: 100%;
    }

    .viewer-tab-btn {
        flex: 1;
        text-align: center;
    }

    h1 {
        font-size: 1.85rem;
    }

    h2 {
        font-size: 1.45rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--space-lg) 0;
    }

    .card {
        padding: var(--space-md);
    }

    .btn {
        width: 100%;
    }

    .modal-actions {
        flex-direction: column;
        width: 100%;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .profile-hero-main {
        flex-direction: column;
        text-align: center;
        width: 100%;
    }

    .profile-hero-meta {
        align-items: center;
    }

    .btn-sm {
        min-height: 44px;
        padding: 10px 16px;
    }
}

@media (max-width: 860px) {
    .btn-sm {
        min-height: 44px;
        padding: 10px 16px;
    }
}

/* ===== Pathology Class Grid (index.html) ===== */
.class-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    text-align: left;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.class-card-item:hover {
    transform: translateY(-4px);
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-md);
}

.class-card-item:focus-visible {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
}

.class-card-thumb-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    background: #090d16;
    overflow: hidden;
    border-bottom: 1px solid var(--border-subtle);
}

.class-card-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

.class-card-item:hover .class-card-thumb-img {
    transform: scale(1.06);
}

.class-card-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 50%, rgba(15, 23, 42, 0.75) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 8px 10px;
    pointer-events: none;
}

.badge-clinical-dark {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.class-card-body {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.class-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2xs);
    gap: 8px;
}

.class-card-title {
    margin: 4px 0 6px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
}

.class-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 var(--space-sm) 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.class-card-footer {
    margin-top: auto;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.class-card-action {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--brand-accent);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.class-card-item:hover .class-card-action {
    color: var(--brand-accent-hover);
    text-decoration: underline;
}

.class-card-extra {
    display: none;
}

/* Lightbox Modal Detail Kelas Radiograf */
.class-lightbox-content {
    max-width: 860px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: left;
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.class-lightbox-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-md);
}

.class-lightbox-viewport {
    background: #090d16;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #1e293b;
    margin-bottom: var(--space-md);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.4);
}

.class-lightbox-img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: #000;
}

.class-lightbox-caption {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid #1e293b;
    flex-wrap: wrap;
    gap: 8px;
}

.class-lightbox-fullscreen-btn {
    color: #38bdf8;
    font-size: 0.78rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.class-lightbox-fullscreen-btn:hover {
    color: #7dd3fc;
    text-decoration: underline;
}

.class-lightbox-info {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.class-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

/* ===== Pipeline Workflow Components (index.html) ===== */
.pipeline-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

@media (max-width: 960px) {
    .pipeline-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 580px) {
    .pipeline-grid {
        grid-template-columns: 1fr;
    }
}

.pipeline-step-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-md);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow var(--transition-fast);
}

.pipeline-step-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-default);
}

.pipeline-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--brand-accent-subtle);
    color: #0369a1;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.pipeline-step-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.pipeline-step-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* ===== Clinical Skeleton Shimmer Loader ===== */
.clinical-skeleton-wrapper {
    padding: var(--space-md) var(--space-xs);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-header-pulse {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.skeleton-status-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: #15803d;
}

.clinical-skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0fdf4 25%, #dcfce7 50%, #f0fdf4 75%);
    background-size: 200% 100%;
    animation: clinicalShimmer 1.8s infinite ease-in-out;
}

@keyframes clinicalShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.fade-in {
    animation: fadeInContent 0.4s ease-in-out forwards;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}