:root {
    /* Color Palette - Academic Journal Style */
    --bg-base: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f9f9f9;
    --bg-card: #f2f2f2;
    
    --primary: #003366; /* Deep navy blue */
    --primary-dim: rgba(0, 51, 102, 0.05);
    --secondary: #003366;
    --secondary-dim: rgba(0, 51, 102, 0.05);
    --accent: #990000; /* Dark burgundy */
    
    --text-main: #1a1a1a;
    --text-muted: #555555;
    --text-bold: #000000;
    
    --border-light: #cccccc;
    --border-highlight: #999999;
    
    --success: #004d00; /* Dark green for print */
    --warning: #990000;
    --danger: #990000;

    /* Shadows & Effects (Removed for print feel) */
    --shadow-md: none;
    --shadow-glow: none;
    --blur: none;
    
    /* Layout */
    --radius-lg: 0px;
    --radius-md: 0px;
    --radius-sm: 0px;
    --spacing: 16px; /* Tighter padding */
    
    /* Fonts */
    --font-serif: Georgia, "Times New Roman", Times, serif;
    --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-serif);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-serif);
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.icon { width: 20px; height: 20px; }
.icon-small { width: 16px; height: 16px; }
.icon-tiny { width: 14px; height: 14px; margin-right: 4px; }
.icon-large { width: 32px; height: 32px; }
.success-color { color: var(--success); }
.action-color { color: var(--accent); }

/* Utility / App Wrapper */
.app-container {
    max-width: 800px; /* narrowed for manuscript feel */
    margin: 0 auto;
    padding: 24px 16px 60px 16px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

/* Base structural classes */
.glass-header, .glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: none; /* Flat rendering */
}

/* Header */
.glass-header {
    padding: 20px 24px;
    position: relative;
    border-top: 4px solid var(--primary); /* Solid color bar instead of gradient */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px; height: 32px;
    color: var(--primary);
}

.titles h1 {
    font-size: 1.6rem;
    font-weight: bold;
    letter-spacing: 0px;
    margin: 0;
    color: var(--primary);
}

.titles h2 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: normal;
    margin: 0;
    font-family: var(--font-sans); /* Contrasting sans-serif */
}

.titles p {
    font-family: var(--font-sans);
}

.subtitle-badge {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Section Cards */
.section {
    padding: 20px 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.section-icon {
    color: var(--primary);
}

/* Collapsible */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-left h3 { margin: 0; }

.collapse-icon {
    transition: transform 0.2s ease;
    color: var(--primary);
}
.collapse-icon.rotated {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
}

.collapsible-content.expanded {
    max-height: 1200px;
    transition: max-height 0.4s ease-in-out;
}

.content-inner {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-block {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid transparent;
    font-family: var(--font-sans); /* UI readability */
    font-size: 0.9rem;
}
.info-block h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-family: var(--font-sans);
}
.info-block.warning { border-left-color: var(--warning); border-color: rgba(153,0,0,0.3); }
.info-block.warning h4 { color: var(--warning); }
.info-block.primary { border-left-color: var(--primary); }
.info-block.primary h4 { color: var(--primary); }


/* Checklist */
.checklist {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-base);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.check-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    color: var(--text-bold);
    border: 1px solid var(--border-highlight);
    font-weight: bold;
    font-family: var(--font-sans);
    border-radius: 0; /* Sharp corners */
    flex-shrink: 0;
    font-size: 0.85rem;
}

.diagnostic-threshold {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}


/* Tabs */
.tab-controls {
    display: flex;
    gap: 4px; /* Tighter gaps */
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0px;
    border-bottom: 2px solid var(--primary);
}
.tab-controls::-webkit-scrollbar { display: none; }

.tab-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-bottom: none; /* Connect to the tab bar naturally */
    color: var(--text-muted);
    padding: 10px 16px;
    border-radius: var(--radius-md); /* zero */
    font-weight: bold;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.highlight-tab {
    background: var(--bg-base);
    color: var(--accent);
}
.highlight-tab.active {
    background: var(--accent);
    color: white;
}


.tab-content-container {
    min-height: 400px;
    padding: 24px;
    border-top: none; /* Let the tab bar border handle it */
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease forwards;
}

.pane-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.pane-subtitle {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-style: italic; /* Classic manuscript style for subtitles */
}

/* Tier Specifics */
.step-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.step-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 8px;
    margin-bottom: 16px;
    font-family: var(--font-sans);
}

.step-badge {
    background: var(--bg-card);
    border: 1px solid var(--text-muted);
    color: var(--text-bold);
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.clinical-decision {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 600px) {
    .clinical-decision { grid-template-columns: 1fr 1fr; }
}

.decision-branch {
    background: var(--bg-card);
    padding: 16px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
}
.decision-branch h5 { color: var(--primary); font-family: var(--font-sans); }

.sub-step {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dotted var(--border-highlight);
    font-size: 0.9rem;
    color: var(--text-main);
}

.next-step-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

/* Horizontal Flowchart (Tier 1) */
.h-flowchart {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hf-path {
    display: flex;
    align-items: stretch;
    gap: 12px;
}

.hf-condition {
    flex: 0 0 200px;
    padding: 12px;
    font-weight: bold;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid var(--border-highlight);
    background: #fff;
    color: var(--text-bold);
    font-family: var(--font-sans);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hf-sub-cond {
    font-size: 0.8rem;
    font-weight: normal;
    margin-top: 4px;
    font-style: italic;
}

.hf-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hf-arrow .text-muted { color: var(--text-main); fill: none; stroke-width: 1.5; }

.hf-action {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    padding: 12px 16px;
}
.hf-action-title {
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}
.hf-action-desc {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

.hf-divider {
    height: 1px;
    background: var(--border-light);
    width: 100%;
}

@media (max-width: 600px) {
    .hf-path { flex-direction: column; align-items: stretch; text-align: center; gap: 8px; }
    .hf-condition { flex: auto; }
    .hf-arrow i { transform: rotate(90deg); }
}

/* Timeline (Tier 2) */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border-light);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}
.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 24px;
    height: 24px;
    background: var(--bg-base);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    font-weight: bold;
    color: var(--primary);
    z-index: 2;
}

.timeline-content {
    background: var(--bg-base);
    padding: 16px;
    border: 1px solid var(--border-light);
}


/* Monitoring Success Card */
.success-card {
    text-align: center;
    padding: 32px 20px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--success);
}

.success-icon-wrapper {
    margin-bottom: 16px;
    display: inline-block;
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-item {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
}

.accordion-item.open {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
}

.accordion-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.accordion-header h4 { margin: 0; font-family: var(--font-sans); font-size: 0.95rem; color: var(--text-bold); }

.accordion-icon {
    transition: transform 0.2s;
    color: var(--primary);
}
.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    transition: all 0.2s ease-out;
}
.accordion-item.open .accordion-content {
    max-height: 400px;
    padding: 0 16px 16px 16px;
    opacity: 1;
}

/* Flowchart Visuals (Global) */
.flowchart-container {
    background: #ffffff; /* Stark white */
    padding: 30px 20px;
    font-size: 0.85rem;
    overflow-x: auto;
    text-align: center;
    border: 1px solid var(--border-light);
    font-family: var(--font-sans);
}

.fc-node {
    display: inline-block;
    padding: 10px 16px;
    background: #ffffff;
    border: 2px solid var(--primary); /* Navy borders */
    font-family: var(--font-sans);
    font-weight: bold;
    color: #000000; /* Black text */
    position: relative;
    margin: 10px auto;
    max-width: 250px;
}

.fc-node.primary-node { border-color: var(--primary); }
.fc-node.decision-node { border-color: var(--primary); border-style: dotted; } /* Dotted for decisions instead of yellow */
.fc-node.action-node { border-color: var(--primary); }
.fc-node.endpoint { font-weight: bold; background: var(--bg-card); border-color: var(--border-highlight); }
.fc-node.monitoring { border-color: var(--success); color: var(--success); }
.fc-node.tier-node { background: var(--primary); color: #ffffff; padding: 6px 16px; letter-spacing: 1px; border: none; }
.fc-node.skip-node { border-style: dashed; border-color: var(--text-muted); color: var(--text-muted); font-weight: normal; }
.fc-node.rescue { border-color: var(--accent); color: var(--accent); }

.fc-connector {
    width: 2px;
    height: 20px;
    background: var(--primary); /* Navy connecting lines */
    margin: 0 auto;
}

.fc-path-split {
    display: flex;
    justify-content: center;
    position: relative;
    padding-top: 15px;
}

.fc-path-split::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--primary); /* Navy connecting lines */
}
.fc-path-split::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 15px;
    background: var(--primary);
}

.fc-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    padding: 0 10px;
}
.fc-branch.w-50 {
    width: 50%;
}

.fc-branch::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 15px;
    background: var(--primary);
}

.fc-label {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 6px;
    position: absolute;
    top: -8px;
    background: #ffffff;
    border: 1px solid var(--primary);
    color: var(--primary);
    z-index: 2;
}
.fc-label.p-yes { color: var(--primary); } /* Academic: standard color, rely on text 'Yes' 'No' */
.fc-label.p-no { color: var(--text-muted); border-color: var(--text-muted); }

.fc-divider {
    margin: 30px 0;
    border-top: 1px solid var(--border-light);
    position: relative;
}
.fc-divider span {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    padding: 0 12px;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    letter-spacing: 0.5px;
}

.mt-4 { margin-top: 20px; }

/* Animations - simplified */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    margin-top: 20px;
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .glass-header { padding: 16px; }
    .titles h1 { font-size: 1.4rem; }
    .section { padding: 16px; }
    .tab-content-container { padding: 16px; }
    .fc-node { font-size: 0.75rem; padding: 6px 10px; }
}
