:root {
    --bg-dark: #050511;
    --bg-card: rgba(255, 255, 255, 0.03);
    --primary: #00f2ff;
    --primary-dim: rgba(0, 242, 255, 0.1);
    --secondary: #7000ff;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --gradient-main: linear-gradient(135deg, #00f2ff 0%, #7000ff 100%);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scrollbar & Selection Polish */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

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

::selection {
    background: rgba(0, 242, 255, 0.3);
    color: white;
}

/* Background Effects */
.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(112, 0, 255, 0.08) 0%, rgba(5, 5, 17, 0) 50%);
    z-index: -1;
    pointer-events: none;
}

/* Creator Banner */
.creator-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1001;
}

.creator-banner a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.creator-banner a:hover {
    opacity: 0.8;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    position: fixed;
    width: 100%;
    top: 40px;
    /* Offset for creator banner */
    z-index: 1000;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2rem;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo span {
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1;
}

.logo img {
    height: 60px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: translateX(5px);
}

.logo:hover img {
    transform: scale(1.1);
}

.logo i {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Buttons */
.btn-primary {
    background: var(--gradient-main);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    backdrop-filter: blur(5px);
    transition: background 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary.large,
.btn-secondary.large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 5%;
    padding-top: 170px;
    /* Adjusted for creator banner + navbar */
    gap: 4rem;
}

.hero-content {
    flex: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-dim);
    border: 1px solid rgba(0, 242, 255, 0.2);
    color: var(--primary);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(0, 242, 255, 0.7);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(0, 242, 255, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 242, 255, 0);
    }
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.gradient-text {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* Hero Visual */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.glass-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: rotateY(-5deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.glass-card:hover {
    transform: rotateY(0) rotateX(0);
}

.float-animation {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px) rotateY(-5deg) rotateX(5deg);
    }

    50% {
        transform: translateY(-20px) rotateY(-5deg) rotateX(5deg);
    }

    100% {
        transform: translateY(0px) rotateY(-5deg) rotateX(5deg);
    }
}

.code-snippet {
    background: #0f0f1a;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #a1a1aa;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.code-header {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.red {
    background: #ff5f56;
}

.yellow {
    background: #ffbd2e;
}

.green {
    background: #27c93f;
}

.arrow-down {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.5rem;
    margin: 1rem 0;
    opacity: 0.5;
}

.fhir-preview {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--primary);
    font-weight: 600;
}

.status-badge {
    background: rgba(39, 201, 63, 0.2);
    color: #27c93f;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Features */
.features {
    padding: 5rem 5%;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.15);
}

.icon-box {
    width: 60px;
    height: 60px;
    background: var(--primary-dim);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text-muted);
}

/* How It Works */
.how-it-works {
    padding: 5rem 5%;
    text-align: center;
}

.steps-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 3rem;
}

.step {
    flex: 1;
    max-width: 300px;
}

.step-number {
    font-size: 4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.03);
    font-family: var(--font-heading);
    margin-bottom: -1rem;
    position: relative;
    z-index: -1;
}

.step h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.line {
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin-top: 5rem;
}

/* Footer */
.footer {
    padding: 3rem 5%;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4rem;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary);
}

/* Tech Stack */
.tech-stack {
    padding: 5rem 5%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 242, 255, 0.05) 100%);
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tech-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

.tech-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(0, 242, 255, 0.15);
}

.tech-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.tech-card h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: white;
}

/* CTA Section */
.cta-section {
    padding: 6rem 5%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.1;
    z-index: -1;
}

.cta-content h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.cta-form {
    display: flex;
    justify-content: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 1.5rem auto;
}

/* Update Table Actions Layout */
.table-actions {
    display: flex;
    justify-content: space-between;
    /* Add Row (Left) - Save (Right) */
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.8rem 2rem;
    /* Larger touch target */
    border-radius: 50px;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
}

.btn-success:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-success.small {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    text-transform: none;
}

.cta-form input {
    flex: 1;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.cta-form input:focus {
    border-color: var(--primary);
}

.small-text {
    font-size: 0.9rem !important;
    opacity: 0.7;
}

/* Mobile */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem 5%;
    }

    .logo {
        font-size: 1.5rem;
        gap: 0.8rem;
    }

    .logo img {
        height: 45px;
    }

    .nav-links {
        display: none;
    }

    .hero {
        flex-direction: column;
        padding-top: 100px;
        text-align: center;
        gap: 3rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .steps-container {
        flex-direction: column;
        align-items: center;
    }

    .line {
        display: none;
    }

    .cta-form {
        flex-direction: column;
    }

    .cta-content h2 {
        font-size: 2rem;
    }
}

/* --- Live Demo Styles --- */
.demo-section {
    padding: 5rem 5%;
    background: linear-gradient(180deg, rgba(5, 5, 17, 0) 0%, rgba(0, 242, 255, 0.05) 100%);
}

.demo-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.demo-input {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.input-header label {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1rem;
}

/* Toggle Switch */
.input-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Text Area */
#hl7-input {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #a1a1aa;
    font-family: 'Courier New', monospace;
    padding: 1rem;
    resize: vertical;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.3s;
}

#hl7-input:focus {
    border-color: var(--primary);
    color: white;
}

.full-width {
    width: 100%;
    cursor: pointer;
}

/* Results Area */
.demo-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hidden {
    display: none !important;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
}

.patient-card {
    border-left: 4px solid var(--primary);
}

.summary-card {
    border-left: 4px solid var(--secondary);
}

.card-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.card-body {
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Tabs */
.result-tabs {
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.tab-header {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.tab-btn.active {
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
}

.about-section {
    padding: 170px 5% 5rem;
    min-height: 80vh;
}

.tab-content {
    display: none;
    padding: 1.5rem;
    max-height: none;
    overflow-y: visible;
}

.tab-content.active {
    display: block;
}

/* Obs Table */
.obs-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-main);
}

.obs-table th {
    text-align: left;
    color: var(--text-muted);
    padding: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.obs-table td {
    padding: 0.8rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

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

.obs-flag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
}

.flag-high {
    background: rgba(255, 95, 86, 0.2);
    color: #ff5f56;
}

.flag-low {
    background: rgba(255, 189, 46, 0.2);
    color: #ffbd2e;
}

.flag-normal {
    color: #27c93f;
}

/* JSON Code */
pre {
    margin: 0;
    background: #0f0f1a;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #a1a1aa;
}

/* ========================================
   DASHBOARD STYLES
   ======================================== */

.dashboard-page {
    padding-top: 220px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 5% 2rem 5%;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-header h1 i {
    color: var(--primary);
}

.dashboard-header p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.messages {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
}

.stat-icon.patients {
    background: rgba(112, 0, 255, 0.1);
    color: var(--secondary);
}

.stat-icon.abnormal {
    background: rgba(255, 95, 86, 0.1);
    color: #ff5f56;
}

.stat-icon.recent {
    background: rgba(39, 201, 63, 0.1);
    color: #27c93f;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-box input:focus {
    border-color: var(--primary);
}

.filter-group {
    display: flex;
    gap: 0.75rem;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.filter-group select:focus {
    border-color: var(--primary);
}

/* Messages Table */
.messages-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
}

.table-container {
    overflow-x: auto;
}

.messages-table {
    width: 100%;
    border-collapse: collapse;
}

.messages-table th {
    text-align: left;
    padding: 1rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.messages-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.messages-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.expand-col {
    width: 50px;
}

.expand-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expand-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.patient-cell .patient-name {
    color: white;
    font-weight: 500;
}

.obs-count {
    text-align: center;
}

.flags-cell {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.flag-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

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

.timestamp-cell {
    font-size: 0.85rem;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* Table Footer / Pagination */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.15);
}

.table-footer span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

.page-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

#page-info {
    font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.modal-close:hover {
    background: rgba(255, 95, 86, 0.2);
    color: #ff5f56;
    border-color: #ff5f56;
}

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

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.detail-card h3 {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.detail-card h3 i {
    color: var(--primary);
}

.detail-content {
    padding: 1.25rem;
}

.patient-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.patient-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.patient-field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.patient-field span {
    font-weight: 500;
    color: white;
}

/* Detail Tabs */
.detail-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.detail-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.detail-tab:hover {
    color: white;
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.detail-tab-content {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.detail-tab-content.active {
    display: block;
}

.obs-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.obs-detail-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.obs-detail-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Nav link active state */
.nav-links a.active {
    color: var(--primary);
}

/* Toast styles for dashboard */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(0, 242, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.toast-error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Dashboard Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-box {
        max-width: 100%;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        flex: 1;
    }

    .patient-detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-tabs {
        overflow-x: auto;
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* ============================================
   AI Query Assistant Styles
   ============================================ */

.query-section {
    margin-bottom: 2rem;
}

.query-container {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.query-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.query-title i {
    color: var(--primary);
    font-size: 1.5rem;
}

.query-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary-dim);
    border: 1px solid rgba(0, 242, 255, 0.2);
    color: var(--primary);
    border-radius: 20px;
    font-weight: 500;
}

.query-messages {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-ai .message-avatar {
    background: var(--gradient-main);
    color: white;
}

.message-user .message-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.message-content {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message-ai .message-content {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.1);
    color: var(--text-main);
}

.message-user .message-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.message-user {
    flex-direction: row-reverse;
}

.message-examples {
    margin: 0.75rem 0 0 0;
    padding-left: 1.25rem;
    color: var(--text-muted);
}

.message-examples li {
    margin-bottom: 0.25rem;
}

.message-loading {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.message-loading span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingPulse 1.4s infinite ease-in-out;
}

.message-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.message-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

.message-loading span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loadingPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.query-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#query-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#query-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.1);
}

#query-input::placeholder {
    color: var(--text-muted);
}

.btn-query-submit {
    width: 48px;
    height: 48px;
    background: var(--gradient-main);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reasoning-selector-container {
    display: flex;
    align-items: center;
}

.query-depth-select {
    height: 48px;
    padding: 0 1rem;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    text-align: left;
    min-width: 100px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(156, 163, 175, 0.8)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.query-depth-select:hover {
    background: rgba(31, 41, 55, 0.9);
    border-color: var(--primary);
}

.query-depth-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 242, 255, 0.1);
}

.btn-query-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.4);
}

.btn-query-submit:active {
    transform: translateY(0);
}

.btn-query-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.query-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.suggestion-chip {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
}

.message-error {
    color: #ef4444;
}

.message-sql {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow-x: auto;
}

.message-highlights {
    margin-top: 0.75rem;
    padding-left: 1rem;
}

.message-highlights li {
    color: var(--primary);
    margin-bottom: 0.25rem;
}

/* RAG Source Citations */
.message-sources {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sources-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sources-header i {
    color: var(--primary);
}

.source-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s ease;
}

.source-card:hover {
    border-color: rgba(0, 242, 255, 0.3);
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.source-title {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-main);
}

.source-relevance {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.source-relevance.high {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.source-relevance.medium {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.source-relevance.low {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.source-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

/* Responsive adjustments for query section */
@media (max-width: 768px) {
    .query-container {
        padding: 1rem;
    }

    .query-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .query-messages {
        max-height: 200px;
    }

    .suggestion-chip {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}

.query-disclaimer {
    margin-top: 1.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.5;
}

/* =====================================================
   PATIENT TIMELINE PAGE STYLES
   ===================================================== */

/* Patient Header */
.patient-header {
    margin-bottom: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--primary);
}

.patient-info-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
}

.patient-avatar {
    width: 80px;
    height: 80px;
    background: var(--gradient-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.patient-details h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.patient-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.patient-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.patient-meta i {
    color: var(--primary);
}

/* AI Summary Section */
.ai-summary-section {
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 2rem;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.summary-header span {
    font-weight: 600;
    flex: 1;
}

.summary-content {
    min-height: 60px;
}

.summary-content .placeholder-text {
    color: var(--text-muted);
    font-style: italic;
}

.summary-content .summary-text {
    color: var(--text-main);
    line-height: 1.7;
}

.summary-content .loading-text {
    color: var(--primary);
}

.summary-content .error-text {
    color: #ef4444;
}

/* Chart Section */
.chart-section {
    margin-bottom: 2rem;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header h3 i {
    color: var(--primary);
}

.chart-header select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.chart-wrapper {
    height: 250px;
}

/* Timeline Section */
.timeline-section {
    margin-bottom: 2rem;
}

.timeline-section h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.timeline-section h2 i {
    color: var(--primary);
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-card {
    display: flex;
    position: relative;
}

.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 1.5rem;
}

.marker-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
    z-index: 1;
}

.marker-line {
    width: 2px;
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    min-height: 40px;
}

.timeline-content {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.timeline-card.latest .timeline-content {
    border-color: var(--primary);
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.visit-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.visit-date i {
    color: var(--primary);
}

.latest-badge {
    background: var(--gradient-main);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}

.observations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.obs-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.obs-item.flag-high {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.obs-item.flag-low {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.obs-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.obs-value {
    font-weight: 600;
    color: white;
}

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

.obs-flag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.flag-high .obs-flag {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.flag-low .obs-flag {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.no-data {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .patient-info-card {
        flex-direction: column;
        text-align: center;
    }

    .patient-meta {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .chart-header {
        flex-direction: column;
        gap: 1rem;
    }

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

/* Dashboard Patient Link */
.patient-name-link {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.patient-name-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* --- Clinical Alerts --- */
.alert-row {
    background: rgba(239, 68, 68, 0.1) !important;
    /* Red tint */
    border-left: 3px solid #ef4444;
}

.alert-row:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.active-alerts-banner {
    background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(255, 100, 100, 0.5);
    display: none;
    /* Hidden by default */
}

.active-alerts-banner p {
    margin: 0;
    font-weight: 600;
}

/* Critical Alerts Banner (Dashboard) */
.alerts-banner {
    background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    position: fixed;
    top: 148px;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    animation: pulse-alert 2s infinite;
}

.alerts-banner.hidden {
    display: none;
}

.alerts-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.alerts-content i {
    font-size: 1.5rem;
    animation: shake 0.5s infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

@keyframes pulse-alert {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* Critical row highlighting */
.dashboard-table tbody tr.critical-row {
    background: rgba(239, 68, 68, 0.15) !important;
    border-left: 4px solid #ef4444;
}

.dashboard-table tbody tr.critical-row:hover {
    background: rgba(239, 68, 68, 0.25) !important;
}

/* ============================================ */
/* Premium RAG Sources Styles                   */
/* ============================================ */

.sources-collapsible {
    margin-top: 1.25rem;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    backdrop-filter: blur(8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sources-collapsible:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.5);
}

.sources-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.3s ease;
}

.sources-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.toggle-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 242, 255, 0.1);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.8rem;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sources-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
    background: rgba(0, 242, 255, 0.2);
}

.sources-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    font-weight: 500;
}

.sources-summary i {
    color: var(--primary);
}

.best-match {
    margin-left: auto;
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.15));
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
}

.sources-content {
    padding: 0 1.25rem 1.25rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Source Cards */
.source-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.source-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.source-card:hover {
    border-color: rgba(0, 242, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.source-card:hover::before {
    opacity: 1;
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    gap: 1rem;
}

.source-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.source-relevance {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.source-relevance.high {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.source-relevance.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.source-relevance.low {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.source-snippet {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 1rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-doc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-doc-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: rgba(0, 242, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 242, 255, 0.1);
}

/* ============================================ */
/* Premium Document Viewer Modal                */
/* ============================================ */

.doc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
}

.doc-modal.visible {
    opacity: 1;
    visibility: visible;
}

.doc-modal-content {
    background: rgba(15, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.doc-modal.visible .doc-modal-content {
    transform: scale(1) translateY(0);
}

.doc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.doc-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    letter-spacing: -0.02em;
}

.doc-modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: rotate(90deg);
}

.doc-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
}

.doc-modal-body::-webkit-scrollbar {
    width: 8px;
}

.doc-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.doc-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.doc-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.doc-content {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    padding-bottom: 2rem;
}

.doc-loading,
.doc-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-muted);
    gap: 1.5rem;
    height: 100%;
}

.doc-loading i {
    font-size: 2.5rem;
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-dim));
}

.doc-error i {
    font-size: 3rem;
    color: #f59e0b;
    margin-bottom: 0.5rem;
}

/* Highlight in document */
mark.highlight {
    background: rgba(255, 255, 0, 0.25);
    color: #fff;
    padding: 2px 4px;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.4);
    border: 1px solid rgba(255, 255, 0, 0.3);
    animation: pulseHighlight 2s infinite;
}

@keyframes pulseHighlight {
    0% {
        background: rgba(255, 255, 0, 0.25);
    }

    50% {
        background: rgba(255, 255, 0, 0.4);
    }

    100% {
        background: rgba(255, 255, 0, 0.25);
    }
}

/* ========================================
   Agent UI Styles
   ======================================== */

/* Tool Usage Badge */
.agent-tools-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(112, 0, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(112, 0, 255, 0.2);
}

.agent-tools-badge i {
    color: var(--secondary);
}

.agent-tools-badge .tool-name {
    background: rgba(112, 0, 255, 0.2);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
    color: #a78bfa;
}

/* Clarification Options */
.clarification-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.clarification-btn {
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.clarification-btn:hover {
    background: rgba(0, 242, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 242, 255, 0.2);
}

/* Reasoning Trace */
.reasoning-trace {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
}

.trace-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

.trace-toggle:hover {
    color: var(--primary);
}

.trace-toggle .toggle-icon {
    width: 16px;
    text-align: center;
}

.trace-content {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.trace-step {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.trace-step:last-child {
    border-bottom: none;
}

.trace-thought {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.trace-thought strong {
    color: var(--primary);
    font-style: normal;
}

.trace-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.trace-tool {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(112, 0, 255, 0.15);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #a78bfa;
}

.trace-tool i {
    font-size: 0.65rem;
}

.trace-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.trace-result {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.trace-result.success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.trace-result.error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* --- Hero Mini-Dashboard --- */
.mini-dashboard {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dashboard-header span {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chat-interface {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 380px;
    /* Increased height for breathing room */
    justify-content: flex-start;
}

.chat-message {
    max-width: 80%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: slideIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.user-msg {
    align-self: flex-end;
    background: rgba(112, 0, 255, 0.2);
    color: white;
    border-bottom-right-radius: 2px;
    border: 1px solid rgba(112, 0, 255, 0.3);
}

.ai-msg {
    align-self: flex-start;
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.typing-indicator {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    width: fit-content;
    animation: slideIn 0.5s ease-out forwards;
    animation-delay: 4.5s;
    /* Appear after everything else */
    opacity: 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Animation Delays for Sequential Chat */
.user-msg:nth-child(1) {
    animation-delay: 0.5s;
}

.ai-msg:nth-child(2) {
    animation-delay: 1.5s;
}

.user-msg.delayed-1 {
    animation-delay: 3.0s;
}

.ai-msg.delayed-2 {
    animation-delay: 4.0s;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}