/* Root Variables - Dark Theme */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #1c2128;
    --bg-hover: #292e36;

    --border-primary: #30363d;
    --border-secondary: #21262d;
    --border-accent: #388bfd;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-link: #58a6ff;

    --accent-blue: #58a6ff;
    --accent-blue-dim: #1f6feb;
    --accent-green: #3fb950;
    --accent-green-dim: #238636;
    --accent-purple: #a371f7;
    --accent-orange: #d29922;
    --accent-red: #f85149;
    --accent-cyan: #39c5cf;
    --accent-pink: #db61a2;

    --gradient-primary: linear-gradient(135deg, #1f6feb 0%, #a371f7 100%);
    --gradient-accent: linear-gradient(135deg, #238636 0%, #39c5cf 100%);
    --gradient-header: linear-gradient(135deg, #161b22 0%, #0d1117 100%);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(88, 166, 255, 0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: all 0.15s ease;
    --transition: all 0.25s ease;
    --transition-slow: all 0.4s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(31, 111, 235, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(163, 113, 247, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(57, 197, 207, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 5px;
    border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Container */
.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
header {
    text-align: center;
    padding: 32px 32px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(88, 166, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -1px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

header .author {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.25rem;
}

header .author a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: var(--transition-fast);
}

header .author a:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* Header Navigation */
.header-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(163, 113, 247, 0.15);
    border: 1px solid rgba(163, 113, 247, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-purple);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
}

.nav-btn:hover {
    background: rgba(163, 113, 247, 0.25);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(163, 113, 247, 0.2);
}

.nav-btn.active {
    background: rgba(163, 113, 247, 0.3);
    border-color: var(--accent-purple);
    box-shadow: 0 0 16px rgba(163, 113, 247, 0.3);
}

.nav-btn svg {
    flex-shrink: 0;
}

/* References Section (Collapsible) */
.references-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}

.references-section.open {
    max-height: 2000px;
    opacity: 1;
    padding: 24px 28px;
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(163, 113, 247, 0.15);
}

.references-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.references-header h2 {
    font-size: 1.3rem;
    color: var(--accent-purple);
    margin: 0;
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.references-header h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--accent-purple);
    border-radius: 2px;
}

.close-btn {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--accent-red);
}

.references-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.references-body .reference-section {
    background: var(--bg-tertiary);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-secondary);
}

.references-body .reference-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--accent-cyan);
}

.references-body .reference-section ol {
    padding-left: 24px;
    margin: 0;
}

.references-body .reference-section li {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.references-body .reference-section li:last-child {
    margin-bottom: 0;
}

.references-body .reference-section li em {
    color: var(--text-primary);
}

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

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    position: relative;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.card h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.form-group:focus-within label {
    color: var(--accent-blue);
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--text-muted);
    background: var(--bg-hover);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
    background: var(--bg-elevated);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-group select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.form-group small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.form-group input[readonly] {
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: not-allowed;
    border-style: dashed;
}

.form-group input[type="number"] {
    font-variant-numeric: tabular-nums;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.result-item {
    background: var(--bg-tertiary);
    padding: 18px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--border-secondary);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: var(--transition);
}

.result-item:hover {
    border-color: var(--border-primary);
    transform: translateY(-2px);
}

.result-item:hover::before {
    opacity: 1;
}

.result-item.wide {
    grid-column: span 2;
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.result-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.result-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Antibiotic Tabs */
.antibiotic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.tab-btn {
    padding: 12px 20px;
    border: 1px solid var(--border-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

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

.tab-btn:hover::before {
    width: 60%;
}

.tab-btn.active {
    background: var(--accent-blue-dim);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.tab-btn.active::before {
    width: 100%;
    background: var(--accent-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeSlideIn 0.4s ease;
}

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

/* Antibiotic Grid */
.antibiotic-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
}

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

.dosing-inputs {
    background: var(--bg-tertiary);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
}

.dosing-inputs .form-group {
    margin-bottom: 16px;
}

.dosing-inputs .form-group:last-of-type {
    margin-bottom: 0;
}

.info-box {
    background: rgba(88, 166, 255, 0.08);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 20px;
    border-left: 3px solid var(--accent-blue);
    color: var(--text-secondary);
}

.info-box strong {
    color: var(--text-primary);
}

.info-box small {
    display: block;
    margin-top: 10px;
    color: var(--text-muted);
    font-style: italic;
}

/* PK Results Grid */
.pk-results {
    background: var(--bg-tertiary);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
}

.pk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
}

.pk-item {
    background: var(--bg-secondary);
    padding: 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-secondary);
    transition: var(--transition);
    position: relative;
}

.pk-item:hover {
    border-color: var(--border-primary);
    transform: scale(1.02);
}

.pk-item.highlight {
    background: rgba(63, 185, 80, 0.1);
    border-color: var(--accent-green-dim);
}

.pk-item.highlight .pk-value {
    color: var(--accent-green);
}

.pk-item.tissue {
    background: rgba(210, 153, 34, 0.1);
    border-color: rgba(210, 153, 34, 0.3);
}

.pk-item.tissue .pk-value {
    color: var(--accent-orange);
}

.pk-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pk-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-variant-numeric: tabular-nums;
}

.pk-unit {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Graph Section */
.graph-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-primary);
}

.graph-container {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-secondary);
    position: relative;
}

.graph-container canvas {
    width: 100% !important;
    height: 280px !important;
}

.graph-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 3px;
    border-radius: 2px;
}

.legend-color.total {
    background: var(--accent-cyan);
}

.legend-color.free {
    background: var(--accent-green);
}

.legend-color.mic {
    background: var(--accent-red);
    height: 2px;
    border-style: dashed;
}

/* CRRT Section */
.crrt-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 28px;
}

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

.crrt-inputs, .crrt-results {
    background: var(--bg-tertiary);
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
}

.crrt-unit-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 16px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-secondary);
}

.crrt-unit-header:first-of-type {
    margin-top: 8px;
}


/* Disclaimer Banner */
.disclaimer-banner {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.12) 0%, rgba(210, 153, 34, 0.12) 100%);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.disclaimer-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(248, 81, 73, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-red);
}

.disclaimer-icon svg {
    width: 24px;
    height: 24px;
}

.disclaimer-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: 12px;
}

.disclaimer-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.disclaimer-content p:last-child {
    margin-bottom: 0;
}

.disclaimer-content p strong {
    color: var(--text-primary);
}

/* Dismiss Buttons */
.dismiss-btn {
    flex-shrink: 0;
    align-self: flex-start;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    padding: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dismiss-btn:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: var(--accent-red);
}

.dismiss-btn-sm {
    padding: 4px;
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.3);
    color: var(--text-muted);
}

.dismiss-btn-sm:hover {
    background: rgba(63, 185, 80, 0.2);
    border-color: var(--accent-green);
    color: var(--text-secondary);
}

/* Privacy Notice */
.privacy-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(63, 185, 80, 0.08);
    border: 1px solid rgba(63, 185, 80, 0.25);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    margin-bottom: 28px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.privacy-notice svg {
    flex-shrink: 0;
    color: var(--accent-green);
}

.privacy-notice strong {
    color: var(--accent-green);
}


/* Measured CrCL - Fixed Layout */
.measured-crcl-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.measured-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-content: start;
}

.measured-results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-content: center;
}

.measured-results .result-item {
    background: rgba(163, 113, 247, 0.08);
    border-color: rgba(163, 113, 247, 0.2);
}

.measured-results .result-item .result-value {
    color: var(--accent-purple);
}

@media (max-width: 900px) {
    .measured-crcl-container {
        grid-template-columns: 1fr;
    }

    .measured-inputs {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .measured-inputs {
        grid-template-columns: 1fr;
    }

    .disclaimer-banner {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .disclaimer-icon {
        margin-bottom: 8px;
    }
}

/* Graph Fullscreen */
.graph-fullscreen-btn {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.graph-fullscreen-btn:hover {
    background: rgba(88, 166, 255, 0.2);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.graph-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.graph-fullscreen-overlay.open {
    opacity: 1;
}

.graph-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.graph-fullscreen-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

.graph-fullscreen-close {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.graph-fullscreen-close:hover {
    background: rgba(248, 81, 73, 0.25);
    border-color: var(--accent-red);
}

.graph-fullscreen-body {
    flex: 1;
    min-height: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    padding: 20px;
    position: relative;
}

.graph-fullscreen-body canvas {
    width: 100% !important;
    height: 100% !important;
}

.graph-fullscreen-overlay .graph-legend {
    flex-shrink: 0;
    margin-top: 16px;
}

/* Vancomycin PK Assessment Sections */
.vanco-pk-section {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--border-primary);
}

.vanco-pk-section h3 {
    font-size: 1rem;
    color: var(--accent-purple);
    margin-bottom: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 12px;
    border-left: 3px solid var(--accent-purple);
}

.vanco-pk-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

.vanco-pk-inputs {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
}

.vanco-pk-inputs .form-group {
    margin-bottom: 14px;
}

.vanco-pk-inputs .form-group:last-of-type {
    margin-bottom: 16px;
}

.vanco-pk-results {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-secondary);
}

.calc-btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    background: var(--accent-blue-dim);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.calc-btn:hover {
    background: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

@media (max-width: 1000px) {
    .vanco-pk-grid {
        grid-template-columns: 1fr;
    }
}

/* Footer */
footer {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 20px;
}

.footer-text {
    color: var(--text-secondary);
    font-style: italic;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading .pk-value {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    body::before {
        display: none;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        background: white;
    }

    .tab-content {
        display: block !important;
        page-break-before: always;
    }

    .antibiotic-tabs {
        display: none;
    }

    header {
        background: #1a5f7a;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .result-value, .pk-value {
        color: #1a5f7a !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    header {
        padding: 32px 20px;
        border-radius: var(--radius-lg);
    }

    header h1 {
        font-size: 1.75rem;
    }

    .card {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .result-item.wide {
        grid-column: span 1;
    }

    .pk-grid {
        grid-template-columns: 1fr 1fr;
    }

    .antibiotic-tabs {
        justify-content: center;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
    }

    .result-value {
        font-size: 1.4rem;
    }

    .pk-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.4rem;
    }

    .results-grid,
    .pk-grid {
        grid-template-columns: 1fr;
    }

    .graph-legend {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}

/* fT>MIC Progress Bar */
.ftmic-container {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-secondary);
}

.ftmic-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.ftmic-label span {
    color: var(--text-primary);
    font-weight: 600;
}

.ftmic-bar-track {
    width: 100%;
    height: 10px;
    background: var(--bg-primary);
    border-radius: 5px;
    overflow: hidden;
}

.ftmic-bar-fill {
    height: 100%;
    border-radius: 5px;
    width: 0%;
    transition: width 0.8s ease;
}

.ftmic-bar-fill.meets-target {
    background: linear-gradient(90deg, var(--accent-green-dim), var(--accent-green));
}

.ftmic-bar-fill.below-target {
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-red));
}

/* Table of Contents Navigation */
.toc-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.toc-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.toc-nav a:hover {
    color: var(--accent-blue);
    background: var(--bg-hover);
    border-color: var(--border-primary);
}

.toc-nav a.active {
    color: var(--accent-blue);
    background: rgba(56, 139, 253, 0.1);
    border-color: var(--accent-blue-dim);
}

/* Formula Tooltip (floating div appended to body) */
.formula-tooltip {
    position: fixed;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.8rem;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10000;
    box-shadow: var(--shadow-md);
    max-width: 420px;
    white-space: nowrap;
    line-height: 1.4;
}

.formula-tooltip.visible {
    opacity: 1;
}

/* Clickable indicator for result items with formulas */
.result-item[data-formula],
.pk-item[data-formula] {
    cursor: pointer;
}

.result-item[data-formula]:hover,
.pk-item[data-formula]:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.15);
}

/* ==========================================
   Reference Page Styles
   ========================================== */

/* Container modifier for reference page */
.ref-page {
    max-width: 960px;
}

/* Table of Contents */
.ref-toc {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.ref-toc-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
}

.ref-toc-link:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    transform: translateX(4px);
}

.ref-toc-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Formula display blocks */
.ref-formula-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 16px;
}

.ref-formula-card h3 {
    font-size: 0.95rem;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    padding-left: 10px;
    border-left: 3px solid var(--accent-cyan);
}

.ref-formula {
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    overflow-x: auto;
}

/* KaTeX dark theme overrides */
.ref-formula .katex {
    color: var(--text-primary);
    font-size: 1.15em;
}

.ref-formula .katex-display {
    margin: 0.75em 0;
}

.ref-formula .katex-display > .katex {
    text-align: left;
    padding-left: 8px;
}

/* Formula labels (used between KaTeX blocks) */
.ref-formula-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 8px 0 2px 0;
    padding-left: 4px;
}

/* Inline KaTeX in tables and notes */
.ref-table .katex,
.ref-note .katex,
.ref-citation .katex {
    font-size: 1em;
}

.ref-drug-section .ref-note .katex {
    font-size: 1.05em;
}

/* Reference tables */
.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 8px;
}

.ref-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-primary);
    color: var(--accent-blue);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-primary);
}

.ref-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    vertical-align: top;
}

.ref-table tr:hover td {
    background: rgba(88, 166, 255, 0.04);
}

.ref-table td:first-child {
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
}

.ref-table-wide {
    margin-top: 20px;
}

.ref-table-wide td:nth-child(2),
.ref-table-wide td:nth-child(3) {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ref-table-wide th:nth-child(2),
.ref-table-wide th:nth-child(3) {
    text-align: center;
}

/* Callout / info box for notes */
.ref-note {
    background: rgba(88, 166, 255, 0.08);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 12px;
    border-left: 3px solid var(--accent-blue);
    color: var(--text-secondary);
    line-height: 1.6;
}

.ref-note ul {
    margin: 6px 0 0 20px;
    padding: 0;
}

.ref-note li {
    margin-bottom: 4px;
}

/* Citation styling */
.ref-citation {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
    line-height: 1.6;
}

.ref-citation a {
    color: var(--accent-blue);
    text-decoration: none;
}

.ref-citation a:hover {
    text-decoration: underline;
}

.ref-citation em {
    color: var(--text-secondary);
}

/* Drug sections within antibiotic card */
.ref-drug-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.ref-drug-name {
    font-size: 1.05rem !important;
    color: var(--accent-purple) !important;
    margin-bottom: 14px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding-left: 12px;
    border-left: 3px solid var(--accent-purple);
}

/* Bibliography list */
.ref-bibliography {
    padding-left: 28px;
    counter-reset: bib-counter;
}

.ref-bibliography li {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-left: 4px;
}

.ref-bibliography li em {
    color: var(--text-primary);
}

.ref-bibliography li a {
    color: var(--accent-blue);
    text-decoration: none;
}

.ref-bibliography li a:hover {
    text-decoration: underline;
}

/* Responsive adjustments for reference page */
@media (max-width: 600px) {
    .ref-toc {
        grid-template-columns: 1fr;
    }

    .ref-formula {
        font-size: 0.85rem;
        padding: 12px 14px;
    }

    .ref-table td:first-child {
        white-space: normal;
    }

    .ref-drug-section {
        padding: 16px;
    }
}
