/**
 * MedicineGuard - Modern Pharmaceutical UI Design System
 * Pure Vanilla CSS - Zero external dependencies, zero remote fonts
 */

:root {
    /* Brand Palette - Deep Navy, Clean White, Restrained Cyan */
    --color-navy-950: #060d1f;
    --color-navy-900: #0b152d;
    --color-navy-800: #112144;
    --color-navy-700: #1a315e;
    
    --color-cyan-500: #0284c7;
    --color-cyan-400: #0ea5e9;
    --color-cyan-300: #38bdf8;
    --color-cyan-100: #e0f2fe;
    --color-cyan-50:  #f0f9ff;

    --color-slate-900: #0f172a;
    --color-slate-800: #1e293b;
    --color-slate-700: #334155;
    --color-slate-600: #475569;
    --color-slate-500: #64748b;
    --color-slate-400: #94a3b8;
    --color-slate-300: #cbd5e1;
    --color-slate-200: #e2e8f0;
    --color-slate-100: #f1f5f9;
    --color-slate-50:  #f8fafc;
    --color-white:     #ffffff;

    /* Functional Semantic Colors */
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;

    /* Layout Metrics */
    --sidebar-width: 270px;
    --topbar-height: 70px;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

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

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* =========================================================================
 * Base Reset & Typography
 * ========================================================================= */

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--color-slate-50);
    color: var(--color-slate-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-cyan-500);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-cyan-400);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* =========================================================================
 * Layout Architecture (Desktop Left Sidebar + Main Content)
 * ========================================================================= */

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--color-navy-950) 0%, var(--color-navy-900) 100%);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-cyan-400) 0%, var(--color-cyan-500) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.brand-info h1 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-white);
    line-height: 1.2;
}

.brand-tagline {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-cyan-300);
    font-weight: 600;
}

/* Role Selector inside Sidebar */
.role-picker-container {
    padding: 1rem 1.25rem 0.5rem;
}

.role-picker-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-slate-400);
    margin-bottom: 0.5rem;
}

.role-select-box {
    width: 100%;
    background-color: var(--color-navy-800);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.role-select-box:focus {
    border-color: var(--color-cyan-400);
}

.role-select-box option {
    background-color: var(--color-navy-900);
    color: var(--color-white);
}

/* Navigation Menu */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-group-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-slate-400);
    padding: 0 0.5rem 0.5rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-slate-300);
    transition: all 0.15s ease;
    user-select: none;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-slate-400);
    transition: color 0.15s ease;
}

.nav-link:hover {
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.06);
}

.nav-link:hover svg {
    color: var(--color-cyan-300);
}

.nav-link.active {
    color: var(--color-white);
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.2) 0%, rgba(14, 165, 233, 0.08) 100%);
    border-left: 3px solid var(--color-cyan-400);
    padding-left: calc(0.875rem - 3px);
    font-weight: 600;
}

.nav-link.active svg {
    color: var(--color-cyan-400);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.system-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
}

.system-pill-label {
    color: var(--color-slate-400);
    font-weight: 500;
}

.system-pill-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.75rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.pulse-dot.ready {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.pulse-dot.loading {
    background-color: var(--color-warning);
    animation: pulseAnim 1.5s infinite;
}

.pulse-dot.failed {
    background-color: var(--color-danger);
}

@keyframes pulseAnim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.test-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-slate-300);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.test-link-btn:hover {
    background-color: rgba(255, 255, 255, 0.09);
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.16);
}

/* =========================================================================
 * Main Content Area
 * ========================================================================= */

.main-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Topbar Header */
.topbar {
    height: var(--topbar-height);
    background-color: var(--color-white);
    border-bottom: 1px solid var(--color-slate-200);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    color: var(--color-slate-700);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.mobile-menu-btn:hover {
    background-color: var(--color-slate-100);
}

.page-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-slate-900);
    letter-spacing: -0.01em;
}

.page-title-group p {
    font-size: 0.8125rem;
    color: var(--color-slate-500);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badge-engine-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-engine-status.ready {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}

.badge-engine-status.loading {
    background-color: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: var(--color-warning-border);
}

.badge-engine-status.failed {
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

/* Content Container */
.page-container {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page-section {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.page-section.active {
    display: block;
}

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

/* =========================================================================
 * Components: Cards, Grids, Banners
 * ========================================================================= */

.card {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    border-color: var(--color-slate-300);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-slate-100);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-slate-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    color: var(--color-cyan-500);
    width: 20px;
    height: 20px;
}

/* Hero Banner on Overview */
.hero-banner {
    background: linear-gradient(135deg, var(--color-navy-900) 0%, var(--color-navy-800) 100%);
    color: var(--color-white);
    border-radius: var(--radius-xl);
    padding: 2.25rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-banner::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, rgba(14, 165, 233, 0) 70%);
    pointer-events: none;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background-color: rgba(14, 165, 233, 0.2);
    color: var(--color-cyan-300);
    border: 1px solid rgba(14, 165, 233, 0.4);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.75rem;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.hero-lead {
    font-size: 1.05rem;
    color: var(--color-slate-300);
    max-width: 800px;
    line-height: 1.6;
}

/* Role Cards Grid */
.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.role-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.role-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-cyan-400);
}

.role-card-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-box-mfg {
    background-color: #eff6ff;
    color: #2563eb;
}

.icon-box-pharm {
    background-color: #ecfdf5;
    color: #059669;
}

.icon-box-cust {
    background-color: #fdf2f8;
    color: #db2777;
}

.role-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-slate-900);
    margin-bottom: 0.5rem;
}

.role-card-desc {
    font-size: 0.875rem;
    color: var(--color-slate-600);
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.role-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-cyan-500);
}

.role-card-cta svg {
    width: 16px;
    height: 16px;
    transition: transform 0.15s ease;
}

.role-card:hover .role-card-cta svg {
    transform: translateX(3px);
}

/* Workflow Step Sequence */
.workflow-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-slate-900);
    margin-bottom: 1rem;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.workflow-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
}

.workflow-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background-color: var(--color-cyan-100);
    color: var(--color-cyan-500);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.workflow-step-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-slate-900);
    margin-bottom: 0.35rem;
}

.workflow-step-desc {
    font-size: 0.8125rem;
    color: var(--color-slate-600);
    line-height: 1.5;
}

/* =========================================================================
 * Clean Empty State Components
 * ========================================================================= */

.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    background-color: var(--color-white);
    border: 1px dashed var(--color-slate-300);
    border-radius: var(--radius-xl);
    margin: 1.5rem 0;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    background-color: var(--color-slate-100);
    color: var(--color-slate-400);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.empty-state-icon svg {
    width: 32px;
    height: 32px;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-slate-900);
    margin-bottom: 0.5rem;
}

.empty-state-desc {
    font-size: 0.875rem;
    color: var(--color-slate-500);
    max-width: 500px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

.empty-state-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background-color: var(--color-slate-100);
    color: var(--color-slate-600);
    border: 1px solid var(--color-slate-200);
}

/* =========================================================================
 * Algorithm & System Status Styles
 * ========================================================================= */

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.metric-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-slate-500);
    margin-bottom: 0.35rem;
}

.metric-card-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-slate-900);
    font-family: var(--font-mono);
}

.tech-spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tech-spec-table th,
.tech-spec-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-slate-200);
}

.tech-spec-table th {
    background-color: var(--color-slate-50);
    color: var(--color-slate-700);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tech-spec-table td.code-cell {
    font-family: var(--font-mono);
    color: var(--color-cyan-500);
    font-weight: 500;
}

.badge-pill-tech {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--color-slate-100);
    color: var(--color-slate-700);
}

/* Diagnostic Box */
.diagnostic-box {
    background-color: var(--color-navy-950);
    color: #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.diagnostic-line {
    display: flex;
    gap: 1rem;
}

.diagnostic-tag {
    color: var(--color-cyan-300);
    font-weight: 600;
    min-width: 140px;
}

/* =========================================================================
 * Mobile Drawer & Responsive Breakpoints
 * ========================================================================= */

.backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 35;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.backdrop.active {
    display: block;
    opacity: 1;
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }

    .main-content-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .topbar {
        padding: 0 1rem;
    }

    .page-container {
        padding: 1.25rem 1rem;
    }

    .hero-banner {
        padding: 1.5rem 1.25rem;
    }

    .hero-title {
        font-size: 1.35rem;
    }
}

/* =========================================================================
 * Phase 3B: Form Elements, Results Grid, Table & Modal Styles
 * ========================================================================= */

.alert-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.alert-box svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.alert-warning {
    background-color: var(--color-warning-bg);
    color: #92400e;
    border: 1px solid var(--color-warning-border);
}

.alert-danger {
    background-color: var(--color-danger-bg);
    color: #991b1b;
    border: 1px solid var(--color-danger-border);
}

.alert-success {
    background-color: var(--color-success-bg);
    color: #065f46;
    border: 1px solid var(--color-success-border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-slate-700);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-slate-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--color-slate-900);
    background-color: var(--color-white);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    border-color: var(--color-cyan-500);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.form-input.input-error {
    border-color: var(--color-danger);
    background-color: #fffbfa;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-slate-500);
}

.form-error-msg {
    font-size: 0.75rem;
    color: var(--color-danger);
    font-weight: 500;
}

.preset-container {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.preset-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-slate-400);
    margin-right: 0.25rem;
}

.preset-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background-color: var(--color-slate-100);
    color: var(--color-slate-700);
    border: 1px solid var(--color-slate-200);
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background-color: var(--color-cyan-100);
    color: var(--color-cyan-500);
    border-color: var(--color-cyan-300);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--color-cyan-500) 0%, #0369a1 100%);
    color: var(--color-white);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
    transition: all 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-cyan-400) 0%, var(--color-cyan-500) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.35);
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background-color: var(--color-white);
    color: var(--color-slate-700);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--color-slate-300);
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background-color: var(--color-slate-50);
    border-color: var(--color-slate-400);
    color: var(--color-slate-900);
}

.hex-display-box {
    background-color: var(--color-navy-950);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.hex-value {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-cyan-300);
    word-break: break-all;
    user-select: all;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.625rem;
    background-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.16);
    color: var(--color-white);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.search-box {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-box input {
    padding-left: 2rem;
}

.search-box svg {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-slate-400);
}

.unit-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    background-color: var(--color-white);
}

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

.unit-table th {
    background-color: var(--color-slate-50);
    color: var(--color-slate-600);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-slate-200);
}

.unit-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--color-slate-100);
    color: var(--color-slate-800);
    vertical-align: middle;
}

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

.unit-table tr:hover td {
    background-color: var(--color-slate-50);
}

.btn-inspect-proof {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-cyan-500);
    background-color: var(--color-cyan-50);
    border: 1px solid var(--color-cyan-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-inspect-proof:hover {
    background-color: var(--color-cyan-100);
    color: #0369a1;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0.5rem 0;
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--color-slate-100);
    border-color: var(--color-slate-400);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal Dialog */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out;
}

.modal-backdrop.active,
.modal-backdrop.open {
    display: flex;
}

.modal-dialog {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-slate-900);
}

.modal-close-btn {
    color: var(--color-slate-400);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: var(--color-slate-700);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-slate-200);
    background-color: var(--color-slate-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.proof-step-card {
    background-color: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.proof-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-slate-600);
}

.dir-badge {
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
}

.dir-badge.left {
    background-color: #dbeafe;
    color: #1e40af;
}

.dir-badge.right {
    background-color: #fef3c7;
    color: #92400e;
}

.verif-result-card {
    padding: 1rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.verif-result-card.success {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: #065f46;
}

.verif-result-card.failed {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: #991b1b;
}

/* =========================================================================
 * Pharmacist Verification Portal Styles (Phase 3C)
 * ========================================================================= */

.session-notice-banner {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background-color: var(--color-cyan-50);
    border: 1px solid var(--color-cyan-100);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-top: 1rem;
}

.session-notice-banner .notice-icon {
    color: var(--color-cyan-500);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.session-notice-banner .notice-text {
    font-size: 0.8125rem;
    color: var(--color-slate-700);
    line-height: 1.5;
}

.session-batches-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background-color: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
}

.batch-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-300);
    color: var(--color-slate-800);
    cursor: pointer;
    transition: all 0.15s ease;
}

.batch-chip:hover {
    border-color: var(--color-cyan-400);
    color: var(--color-cyan-500);
}

.batch-chip.active {
    background-color: var(--color-cyan-100);
    border-color: var(--color-cyan-300);
    color: #0369a1;
}

.verif-state-card {
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.verif-state-card.verified {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: #065f46;
}

.verif-state-card.failed {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: #991b1b;
}

.verif-state-card.notfound {
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    color: #92400e;
}

.verif-state-card.nobatch {
    background-color: var(--color-slate-100);
    border: 1px solid var(--color-slate-300);
    color: var(--color-slate-700);
}

.verif-state-card.unavailable {
    background-color: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: #991b1b;
}

.verif-state-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

.verif-state-headline {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.verif-state-desc {
    font-size: 0.8125rem;
    line-height: 1.5;
}

.pharm-telemetry-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    background-color: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    margin-bottom: 1.25rem;
}

.telemetry-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
}

.telemetry-label {
    color: var(--color-slate-500);
    font-weight: 600;
}

.telemetry-value {
    font-weight: 700;
    color: var(--color-slate-900);
}

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

.proof-drawer {
    background-color: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    animation: fadeIn 0.2s ease-out;
}

.proof-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.proof-meta-box {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.65rem;
    text-align: center;
}

.proof-meta-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--color-slate-400);
}

.proof-meta-val {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-slate-800);
    margin-top: 0.15rem;
}

/* =========================================================================
 * Phase 3D: Backend, Auth, Admin & Shared Registry Styles
 * ========================================================================= */

.auth-status-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-role-admin {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.badge-role-mfg {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #60a5fa;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.badge-role-pharm {
    background-color: #ccfbf1;
    color: #115e59;
    border: 1px solid #2dd4bf;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.source-toggle-group {
    display: inline-flex;
    background-color: var(--color-slate-100);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    gap: 0.25rem;
}

.source-toggle-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    color: var(--color-slate-600);
    transition: all 0.15s ease;
}

.source-toggle-btn:hover {
    color: var(--color-slate-900);
}

.source-toggle-btn.active {
    background-color: var(--color-white);
    color: var(--color-cyan-500);
    box-shadow: var(--shadow-sm);
}

.upload-progress-container {
    margin-top: 0.75rem;
    background-color: var(--color-slate-100);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background-color: var(--color-slate-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--color-cyan-500);
    width: 0%;
    transition: width 0.2s ease-in-out;
}

.ambiguous-match-item {
    background-color: var(--color-white);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ambiguous-match-item:hover {
    border-color: var(--color-cyan-500);
    box-shadow: var(--shadow-sm);
    background-color: var(--color-cyan-50);
}

.auth-tab-nav {
    display: flex;
    border-bottom: 1px solid var(--color-slate-200);
    margin-bottom: 1.25rem;
}

.auth-tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-slate-500);
    border-bottom: 2px solid transparent;
}

.auth-tab-btn.active {
    color: var(--color-cyan-500);
    border-bottom-color: var(--color-cyan-500);
}

/* =========================================================================
 * Phase 4: QR Generation & Customer Verification Styles
 * ========================================================================= */

.qr-scanner-card {
    background-color: var(--color-slate-900);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: var(--color-white);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.scanner-viewport-box {
    position: relative;
    max-width: 360px;
    margin: 1rem auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: #000;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-cyan-500);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.25);
}

.scanner-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-viewfinder-overlay {
    position: absolute;
    inset: 15%;
    border: 2px dashed rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.scanner-laser {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #22d3ee, transparent);
    box-shadow: 0 0 8px #22d3ee;
    animation: scannerBeam 2s infinite ease-in-out;
}

@keyframes scannerBeam {
    0% { top: 15%; opacity: 0.2; }
    50% { top: 85%; opacity: 1; }
    100% { top: 15%; opacity: 0.2; }
}

.trust-disclaimer-card {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
}

.trust-disclaimer-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trust-disclaimer-text {
    font-size: 0.8125rem;
    color: #78350f;
    line-height: 1.55;
    font-weight: 500;
}

.cust-result-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-slate-200);
    padding: 1.5rem;
    margin-top: 1.5rem;
    background-color: var(--color-white);
    box-shadow: var(--shadow-md);
}

.cust-result-card.verified {
    border-top: 4px solid var(--color-success);
}

.cust-result-card.error {
    border-top: 4px solid var(--color-danger);
}

.cust-result-card.revoked {
    border-top: 4px solid var(--color-warning);
}

.cust-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0;
}

.cust-data-item {
    background-color: var(--color-slate-50);
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.cust-data-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-slate-400);
    margin-bottom: 0.25rem;
}

.cust-data-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-slate-900);
}

.qr-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-slate-200);
    margin: 1rem 0;
}

/* =========================================================================
 * PHASE 5: INTERACTIVE MERKLE TREE VISUALIZER
 * ========================================================================= */

.visualizer-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.visualizer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background-color: var(--color-slate-900);
    border: 1px solid var(--color-slate-800);
    border-radius: var(--radius-lg);
    color: var(--color-slate-200);
}

.visualizer-controls-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.visualizer-select, .visualizer-input {
    background-color: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-100);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.visualizer-select:focus, .visualizer-input:focus {
    border-color: var(--color-cyan-400);
}

.visualizer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.65rem;
    background-color: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-200);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.visualizer-btn:hover {
    background-color: var(--color-slate-700);
    color: var(--color-white);
}

.visualizer-btn.active {
    background-color: var(--color-cyan-500);
    border-color: var(--color-cyan-400);
    color: var(--color-white);
}

.visualizer-stage-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    align-items: stretch;
}

@media (max-width: 1024px) {
    .visualizer-stage-grid {
        grid-template-columns: 1fr;
    }
}

.visualizer-viewport-card {
    position: relative;
    background-color: #0b1120;
    border: 1px solid var(--color-slate-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 540px;
    display: flex;
    flex-direction: column;
}

.visualizer-viewport-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid #1e293b;
    font-size: 0.75rem;
    color: var(--color-slate-400);
    z-index: 2;
}

.visualizer-svg-canvas {
    width: 100%;
    height: 100%;
    min-height: 520px;
    flex: 1;
    display: block;
    user-select: none;
    touch-action: none;
}

.visualizer-floating-zoom {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    z-index: 5;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--color-slate-700);
    padding: 0.35rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.visualizer-floating-zoom button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    color: var(--color-slate-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: background 0.15s;
}

.visualizer-floating-zoom button:hover {
    background: var(--color-slate-700);
    color: #fff;
}

.visualizer-inspector-card {
    background-color: var(--color-slate-900);
    border: 1px solid var(--color-slate-800);
    border-radius: var(--radius-lg);
    padding: 1rem;
    color: var(--color-slate-200);
    overflow-y: auto;
    max-height: 600px;
}

.tree-node {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.tree-node:hover rect {
    filter: brightness(1.2);
}

.tree-node.active-path rect {
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.4));
}





