:root {
    --primary-color: #000066;
    --secondary-color: #209eb5;
    --accent-color: #e74c3c;
    --dark-color: #2c3e50;
    --success-color: #2ecc71;
    --warning-color: #f39c12; /* used by modal.js placeholder */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* form controls don't inherit the body font by default */
input, select, textarea, button {
    font-family: inherit;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background: #f6ffff;
    color: #1e2a41;
    line-height: 1.6;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #48eaea;
}

/* --------------------------------------------
   PAGE HEADER
   -------------------------------------------- */
.page-header { text-align: center; margin: 1rem 5.5rem; padding: 0 0 2rem 0; background-color: #fffffa; }
.page-header h1 {
    font-size: 2rem; font-weight: 600; letter-spacing: 2.5px; color: #0a1a3a;
    padding: 2px; margin-bottom: 0.3rem; background-color: #d5fafa;
    border-radius: 5px 5px 0 0; border-top: 5px solid #48eaea;
}
.page-header h1 span { color: #b31b1b; }
.page-header .subhead { font-size: 1.2rem; color: #3e5470; max-width: 800px; margin: 0.5rem auto 0; }

/* --------------------------------------------
   CATEGORY GRID
   -------------------------------------------- */
.calculator-categories { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.category-card {
    background-color: #fcfeff; border-radius: 8px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.category-card:hover { transform: translateY(-5px); box-shadow: 0 5px 20px rgba(0,0,0,0.1); }
.category-header { background-color: var(--secondary-color); color: white; padding: 15px; text-align: center; }
.category-header i { font-size: 28px; margin-bottom: 8px; display: block; }
.category-header h3 { color: white !important; font-size: 16px; margin: 0; }
.category-content { padding: 15px; }
.calculator-list { list-style-type: none; }
.calculator-list li { padding: 8px 0; border-bottom: 1px solid #eee; }
.calculator-list li:last-child { border-bottom: none; }
.calculator-list a {
    color: var(--dark-color); text-decoration: none; display: flex;
    justify-content: space-between; align-items: center; transition: color 0.3s ease;
}
.calculator-list a:hover { color: var(--secondary-color); }

/* --------------------------------------------
   MODAL (markup injected by modal.js)
   -------------------------------------------- */
.calculator-modal {
    display: none; position: fixed; inset: 0;
    background-color: rgba(0,0,0,0.7); z-index: 1000;
    overflow-y: auto; padding: 20px;
}
.modal-content {
    background-color: white; margin: 30px auto; padding: 30px;
    border-radius: 8px; max-width: 750px; position: relative;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 28px; cursor: pointer; color: #999; transition: color 0.3s ease; line-height: 1; }
.close-modal:hover { color: var(--accent-color); }
.modal-content h2 { color: var(--primary-color); margin-bottom: 20px; padding-right: 40px; }
.open-new-tab { position: absolute; top: 20px; right: 60px; font-size: 13px; color: var(--secondary-color); text-decoration: none; font-weight: 600; }
.open-new-tab:hover { text-decoration: underline; }

/* --------------------------------------------
   FORMS
   -------------------------------------------- */
.calculator-form { margin-top: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--dark-color); }
.form-group input, .form-group select {
    width: 100%; padding: 10px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 14px; transition: border-color 0.3s ease;
}
.form-group input:focus, .form-group select:focus { border-color: var(--secondary-color); outline: none; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; }
.help-text { font-size: 12px; color: #666; margin-top: 3px; }
.checkbox-group { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; }
.checkbox-group label { font-weight: normal; cursor: pointer; }

/* --------------------------------------------
   BUTTONS & RESULTS
   -------------------------------------------- */
.btn {
    display: inline-block; background-color: var(--secondary-color); color: white;
    padding: 10px 25px; border: none; border-radius: 4px; cursor: pointer;
    font-size: 16px; transition: background-color 0.3s ease; margin-right: 10px;
}
.btn:hover { background-color: #2980b9; }
.btn-reset { background-color: #95a5a6; }
.btn-reset:hover { background-color: #7f8c8d; }
.result-box {
    margin-top: 20px; padding: 20px; background-color: #f8f9fa;
    border-radius: 4px; border-left: 4px solid var(--success-color); display: none;
}
.result-box h3 { margin-bottom: 10px; color: var(--success-color); }
.result-box p { margin: 5px 0; }
.result-box .highlight { font-weight: bold; color: var(--primary-color); }

/* --------------------------------------------
   FORMULA INFO / REFERENCE FOOTNOTE
   -------------------------------------------- */
.formula-info { margin-top: 20px; padding: 20px; background-color: #e8f4fc; border-radius: 4px; font-size: 14px; }
.formula-info h4 { margin-bottom: 10px; color: var(--secondary-color); }
.formula-info h5 { margin: 15px 0 8px; color: var(--dark-color); }
.formula-info p { margin: 5px 0; }
.formula-info ul, .formula-info ol { margin: 8px 0 8px 20px; }
.formula-info li { margin: 3px 0; }
.reference { font-size: 12px; color: #666; margin-top: 20px; font-style: italic; border-top: 1px solid #ddd; padding-top: 15px; }

.no-results { display: none; text-align: center; padding: 40px; color: #666; }
.no-results i { font-size: 48px; margin-bottom: 15px; color: #ccc; }

/* --------------------------------------------
   TABS (wired by modal.js wireTabs)
   -------------------------------------------- */
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #ddd; flex-wrap: wrap; }
.tab {
    padding: 10px 20px; cursor: pointer; background-color: #f8f9fa;
    border: 1px solid #ddd; border-bottom: none; border-radius: 4px 4px 0 0;
    margin-right: 5px; margin-bottom: -1px; transition: background-color 0.3s ease;
}
.tab:hover { background-color: #e9ecef; }
.tab.active { background-color: white; border-bottom: 1px solid white; font-weight: 600; color: var(--secondary-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.method-content { padding: 10px 0; }

/* --------------------------------------------
   STANDALONE CALCULATOR PAGES
   (renderInline adds .calc-page and .inline-body)
   -------------------------------------------- */
.calc-page { max-width: 750px; margin: 30px auto; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.calc-page h2 { color: var(--primary-color); margin-bottom: 20px; }
.calc-page .inline-body .tabs { margin-top: 20px; }
.back-home { display: inline-block; margin: 20px 0 0; color: var(--secondary-color); text-decoration: none; font-weight: 600; }
.back-home:hover { text-decoration: underline; }

/* --------------------------------------------
   INDEX: CRISIS CARD + BADGES + REFERENCE BAND
   -------------------------------------------- */
.crisis-card { background-color: #fffffa;border: 2px solid #e74c3c; box-shadow: 0 4px 15px rgba(231, 76, 60, 0.15); }
.crisis-header { background-color: #e74c3c !important; }
.crisis-card .calculator-list a { font-weight: 600; }
.crisis-card .calculator-list a:hover { color: #e74c3c; }
.algorithm-item a { color: #555 !important; }
.algorithm-item a:hover { color: var(--secondary-color) !important; }
.algo-badge {
    display: inline-block; margin-left: 6px; padding: 2px 8px;
    background: #e8f4fc; color: var(--secondary-color); font-size: 10px;
    font-weight: 700; border-radius: 10px; letter-spacing: 0.5px;
    text-transform: uppercase; vertical-align: middle;
}
.reference-band {
    margin: 60px 0 40px; padding: 40px 30px;
    background: linear-gradient(135deg, #f8f9fc 0%, #e8f4fc 100%);
    border-radius: 12px; border: 1px solid #d0e4f0;
}
.reference-band h2 { text-align: center; color: var(--primary-color); font-size: 28px; margin-bottom: 8px; }
.reference-band h2 i { color: var(--secondary-color); margin-right: 10px; }
.reference-subhead { text-align: center; color: #666; margin-bottom: 30px; }
.reference-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.reference-card {
    display: block; padding: 25px 20px; background: white; border-radius: 10px;
    text-decoration: none; color: var(--dark-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid var(--secondary-color);
}
.reference-card:hover { transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }
.reference-card i { font-size: 32px; color: var(--secondary-color); margin-bottom: 12px; display: block; }
.reference-card h3 { font-size: 17px; color: var(--primary-color); margin-bottom: 8px; }
.reference-card p { font-size: 13.5px; color: #555; line-height: 1.5; margin: 0; }

/* --------------------------------------------
   CRISIS CALCULATOR PAGES (MH, LAST, ...)
   -------------------------------------------- */
.mh-warning {
    background: #fff5f5; border: 2px solid #e74c3c; border-radius: 6px;
    padding: 12px 16px; margin-bottom: 20px;
    color: #7a1c1c; font-size: 14px; line-height: 1.5;
}
.mh-warning strong { color: #e74c3c; }
.mh-section { background: #f8f9fa; border-left: 4px solid #e74c3c; padding: 15px 18px; margin: 15px 0; border-radius: 4px; }
.mh-section h4 { color: #e74c3c; margin-bottom: 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mh-section h4 i { font-size: 16px; }
.mh-section p { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.mh-contra { color: #c0392b; font-weight: 700; }
.mh-note {
    background: #fff3cd; border: 1px solid #ffc107; border-radius: 4px;
    padding: 12px 16px; margin-top: 15px; font-size: 14px; color: #665200; line-height: 1.5;
}

/* --------------------------------------------
   ALGORITHM BLOCK (checklist + print)
   -------------------------------------------- */
.mh-algorithm { padding: 5px 0; }
.mh-algo-header { background: #e74c3c; color: white; padding: 20px 24px; border-radius: 8px 8px 0 0; margin-bottom: 0; }
.mh-algo-header h3 { color: white; margin-bottom: 6px; font-size: 18px; }
.mh-algo-header p { color: rgba(255,255,255,0.9); font-size: 13px; margin-bottom: 12px; }
.mh-algo-header.algo-only { background: #c0392b; } /* CICO variant */
.mh-algo-header.algo-only h3 { font-size: 19px; }
.mh-algo-header.algo-only p { font-size: 13px; line-height: 1.5; }
.print-btn {
    background: white; color: #e74c3c; border: none; padding: 8px 16px;
    border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px; transition: transform 0.15s;
}
.print-btn:hover { transform: translateY(-1px); }
.mh-step { background: white; border: 1px solid #e0e0e0; border-top: none; padding: 20px 24px; margin: 0; }
.mh-step:last-of-type { border-radius: 0 0 8px 8px; }
.mh-step h4 { color: #2c3e50; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.mh-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; background: #e74c3c; color: white;
    border-radius: 50%; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.mh-check-list { list-style: none; padding-left: 0; margin: 0; }
.mh-check-list li { padding: 6px 0; font-size: 13.5px; line-height: 1.6; }
.mh-check-list label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: normal; }
.mh-check-list input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.mh-algo-footer {
    background: #fff5f5; border: 2px solid #e74c3c; border-radius: 8px;
    padding: 18px 24px; margin-top: 20px; font-size: 13.5px; line-height: 1.6;
}
.mh-algo-footer strong { color: #e74c3c; display: block; margin-bottom: 6px; }
.mh-algo-footer ul { margin: 6px 0 0 20px; }
.mh-algo-footer li { margin: 3px 0; }

/* --------------------------------------------
   REFERENCE PAGES
   -------------------------------------------- */
.reference-page { max-width: 1100px; margin: 30px auto; padding: 0 16px; }
.reference-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a1a8a 100%);
    color: white; padding: 30px 40px; border-radius: 12px; margin-bottom: 30px;
}
.reference-header h1 { font-size: 32px; margin-bottom: 8px; }
.reference-header h1 i { margin-right: 12px; color: var(--secondary-color); }
.reference-header p { font-size: 15px; opacity: 0.9; line-height: 1.5; max-width: 800px; }
.reference-nav { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 25px; }
.reference-nav a {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: white; border-radius: 8px; text-decoration: none;
    color: var(--dark-color); font-size: 13px; font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
}
.reference-nav a:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.reference-nav a.active { background: var(--secondary-color); color: white; }

#toc { background: #f8f9fc; border-left: 4px solid var(--secondary-color); padding: 18px 22px; border-radius: 6px; margin-bottom: 30px; }
#toc h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: #666; margin-bottom: 10px; }
.ref-toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.ref-toc-list a { color: var(--dark-color); text-decoration: none; font-size: 14px; font-weight: 500; }
.ref-toc-list a:hover { color: var(--secondary-color); text-decoration: underline; }

.ref-section {
    background: white; border-radius: 10px; padding: 25px 30px;
    margin-bottom: 22px; box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: background 0.3s;
}
.ref-section.highlighted { background: #e8f4fc; }
.ref-section h2 {
    font-size: 20px; color: var(--primary-color); margin-bottom: 18px;
    padding-bottom: 10px; border-bottom: 2px solid #e8f4fc;
    display: flex; align-items: center; gap: 10px;
}
.ref-section h2 i { color: var(--secondary-color); font-size: 18px; }
.ref-section h3 { font-size: 16px; color: var(--dark-color); margin: 20px 0 10px; }
.ref-section h4 { font-size: 14px; color: var(--secondary-color); margin: 15px 0 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.ref-section p { font-size: 14.5px; line-height: 1.6; color: #333; margin-bottom: 10px; }
.ref-section ul, .ref-section ol { margin: 8px 0 12px 22px; font-size: 14.5px; line-height: 1.7; }
.ref-section li { margin: 4px 0; }

/* collapsible sections (toggled by page scripts) */
.ref-section.collapsible h2.collapsible-heading { cursor: pointer; user-select: none; position: relative; padding-right: 30px; }
.ref-section.collapsible h2.collapsible-heading::after {
    content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: var(--secondary-color); transition: transform 0.2s;
}
.ref-section.collapsible.collapsed h2.collapsible-heading::after { transform: translateY(-50%) rotate(-90deg); }
.ref-section.collapsible.collapsed .ref-section-body { display: none; }

/* tables & formulas */
.ref-table { width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 14px; }
.ref-table th {
    background: var(--secondary-color); color: white; padding: 10px 12px;
    text-align: left; font-weight: 600; border: 1px solid #d0e4f0;
}
.ref-table td { padding: 9px 12px; border: 1px solid #e0e0e0; vertical-align: top; }
.ref-table tr:nth-child(even) td { background: #f8fbfd; }
.ref-table code, .ref-formula {
    font-family: 'Courier New', monospace; background: #f0f4f8;
    padding: 2px 6px; border-radius: 4px; color: var(--primary-color);
    font-weight: 600; font-size: 13.5px;
}
.ref-formula-block {
    background: #f0f4f8; border-left: 4px solid var(--secondary-color);
    padding: 12px 16px; margin: 10px 0; border-radius: 4px;
    font-family: 'Courier New', monospace; font-size: 14px;
    color: var(--primary-color); line-height: 1.6; overflow-x: auto;
}
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 15px 0; }
.formula-card { background: #f8fbfd; border: 1px solid #d0e4f0; border-radius: 8px; padding: 14px 16px; }
.formula-card h5 { font-size: 13px; color: var(--secondary-color); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.formula-card .formula { font-family: 'Courier New', monospace; font-size: 14px; color: var(--primary-color); font-weight: 600; word-break: break-word; line-height: 1.5; }
.formula-card .formula-note { font-size: 12px; color: #666; margin-top: 6px; font-style: italic; }

/* --------------------------------------------
   CONVERSIONS PAGE
   -------------------------------------------- */
.converter { background: #f8fbfd; border: 1px solid #d0e4f0; border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.converter h4 { font-size: 14px; color: var(--primary-color); margin-bottom: 12px; text-transform: none; letter-spacing: 0; }
.converter-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.converter-field { flex: 1; min-width: 130px; }
.converter-field label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; font-weight: 600; }
.converter-field input, .converter-field select {
    width: 100%; padding: 9px 12px; border: 1px solid #d0d7dd;
    border-radius: 6px; font-size: 14px; background: white;
    outline: none; transition: border-color 0.2s;
}
.converter-field input:focus, .converter-field select:focus { border-color: var(--secondary-color); }
.converter-arrow { color: var(--secondary-color); font-size: 18px; padding: 0 6px 10px; flex-shrink: 0; }

/* --------------------------------------------
   DRUG REFERENCE PAGE
   -------------------------------------------- */
.drug-search-bar {
    background: white; padding: 20px 24px; border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05); margin-bottom: 24px;
    position: sticky; top: 0; z-index: 50;
}
.drug-search-input-wrap { position: relative; margin-bottom: 14px; }
.drug-search-input-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #888; font-size: 15px; }
.drug-search-input-wrap input {
    width: 100%; padding: 12px 14px 12px 40px; border: 1px solid #d0d7dd;
    border-radius: 8px; font-size: 15px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.drug-search-input-wrap input:focus { border-color: var(--secondary-color); box-shadow: 0 0 0 3px rgba(38, 187, 214, 0.15); }
.drug-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
    padding: 6px 14px; background: #f0f4f8; border: 1px solid #d0d7dd;
    border-radius: 20px; font-size: 13px; font-weight: 500; color: #444;
    cursor: pointer; transition: all 0.15s;
}
.filter-chip:hover { background: #e0eaf5; border-color: #b0c4d8; }
.filter-chip.active { background: var(--secondary-color); border-color: var(--secondary-color); color: white; }
.drug-count { font-size: 13px; color: #666; margin-top: 10px; font-weight: 500; }
.drug-no-results { text-align: center; padding: 60px 20px; color: #888; }
.drug-no-results i { font-size: 48px; color: #ddd; margin-bottom: 15px; display: block; }
.drug-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.drug-card {
    background: white; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden; transition: transform 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column; break-inside: avoid;
}
.drug-card:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.drug-card-header { background: linear-gradient(135deg, var(--primary-color) 0%, #1a1a8a 100%); color: white; padding: 14px 18px; }
.drug-card-header h3 { font-size: 16px; margin: 0 0 4px; color: white; }
.drug-class-tag {
    display: inline-block; font-size: 11px; background: rgba(255,255,255,0.18);
    padding: 2px 8px; border-radius: 10px; font-weight: 500; letter-spacing: 0.3px;
}
.drug-card-body { padding: 14px 18px; flex: 1; }
.drug-card-body p { font-size: 13.5px; line-height: 1.55; margin: 0 0 8px; color: #333; }
.drug-card-body p:last-child { margin-bottom: 0; }
.drug-card-body strong { color: var(--primary-color); font-weight: 600; }
.drug-cautions { color: #c0392b !important; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #eee; }
.drug-cautions strong { color: #c0392b !important; }
.drug-card-footer { padding: 10px 18px; background: #f8f9fc; border-top: 1px solid #eee; }
.drug-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--secondary-color); text-decoration: none; }
.drug-link:hover { text-decoration: underline; }

/* --------------------------------------------
   CRISIS-ALGORITHMS REFERENCE PAGE
   -------------------------------------------- */
.btn-print-small {
    padding: 5px 12px; background: var(--secondary-color); color: white;
    border: none; border-radius: 5px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.btn-print-small:hover { background: #1a9bb5; }
.btn-print-small i { margin-right: 4px; font-size: 11px; }
.crisis-intro {
    background: #fff5f5; border-left: 4px solid #e74c3c; padding: 12px 16px;
    border-radius: 4px; margin-bottom: 18px; font-size: 13.5px; line-height: 1.6; color: #7a1c1c;
}
.crisis-intro strong { color: #e74c3c; }
.crisis-step { background: #f8fbfd; border-left: 3px solid var(--secondary-color); padding: 12px 18px; margin-bottom: 12px; border-radius: 4px; }
.crisis-step h4 { font-size: 14.5px; color: var(--primary-color); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; }
.crisis-step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; background: var(--secondary-color); color: white;
    border-radius: 50%; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.crisis-list { list-style: none; padding: 0; margin: 0; }
.crisis-list li { padding: 4px 0 4px 20px; font-size: 13.5px; line-height: 1.55; color: #333; position: relative; }
.crisis-list li::before {
    content: '\f111'; font-family: 'Font Awesome 6 Free'; font-weight: 400;
    font-size: 5px; position: absolute; left: 4px; top: 11px; color: var(--secondary-color);
}
.crisis-list li strong { color: #c0392b; }
.crisis-cross-link { margin-top: 14px; padding: 10px 14px; background: #e8f4fc; border-radius: 6px; font-size: 13px; color: var(--dark-color); }
.crisis-cross-link i { color: var(--secondary-color); margin-right: 6px; }
.crisis-cross-link a { color: var(--secondary-color); font-weight: 600; text-decoration: none; }
.crisis-cross-link a:hover { text-decoration: underline; }

/* --------------------------------------------
   PRINT — unified
   [data-print] buttons print the page; [data-print-algorithm]
   buttons (modal.js) set body.printing-algorithm to isolate
   the algorithm block.
   -------------------------------------------- */
@media print {
    foot, .site-footer, .reference-nav, .back-home, #toc, .print-btn,
    [data-print], .tabs, .close-modal, .open-new-tab, .top-nav, .search-box {
        display: none !important;
    }

    body { background: white !important; color: black !important; }
    a { color: black !important; text-decoration: none !important; }
    h1, h2, h3, h4, h5 { page-break-after: avoid; }
    table, .formula-card, .converter { page-break-inside: avoid; }

    /* crisis algorithm pages: hide everything except the algorithm
       (fallback below still works in browsers without :has()) */
    body:has(.mh-algorithm) .container,
    body:has(.mh-algorithm) .reference-page,
    body:has(.mh-algorithm) .calculator-modal .modal-content > *:not(.mh-algorithm) {
        display: none !important;
    }
    .mh-algorithm { position: static !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
    .mh-step { page-break-inside: avoid; border: 1px solid #000 !important; }
    .mh-algo-header { background: white !important; color: black !important; border: 2px solid black !important; page-break-after: avoid; }
    .mh-algo-header h3, .mh-algo-header p { color: black !important; }
    .mh-step-num { background: black !important; color: white !important; }
    .mh-algo-footer { background: white !important; border: 2px solid black !important; page-break-inside: avoid; }

    /* reference pages */
    .reference-page { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
    .reference-header {
        background: white !important; color: black !important;
        border: 2px solid black !important; padding: 15px !important;
        margin-bottom: 15px !important; page-break-after: avoid;
    }
    .reference-header h1, .reference-header p, .reference-header h1 i { color: black !important; }
    .ref-section {
        box-shadow: none !important; border: 1px solid #ccc !important;
        page-break-inside: avoid; margin-bottom: 12px !important; padding: 12px 15px !important;
    }
    .ref-section.collapsible.collapsed .ref-section-body { display: block !important; }
    .ref-section h2::after { display: none !important; }
    .ref-table th { background: #eee !important; color: black !important; border: 1px solid #999 !important; }
    .ref-table td { border: 1px solid #999 !important; }
    .ref-formula-block, .formula-card { background: #f5f5f5 !important; border: 1px solid #999 !important; }

    /* drug reference page */
    .drug-search-bar, .drug-card-footer, .filter-chip, .drug-count { display: none !important; }
    .drug-grid { display: block; }
    .drug-card { page-break-inside: avoid; margin-bottom: 10px; box-shadow: none; border: 1px solid #ccc; }
    .drug-card-header { background: white !important; color: black !important; border-bottom: 2px solid black; }
    .drug-card-header h3 { color: black !important; }
    .drug-class-tag { background: #eee !important; color: black !important; }

    /* crisis-algorithms page */
    .btn-print-small, .crisis-cross-link { display: none !important; }
    .crisis-step { border: 1px solid #999 !important; background: white !important; page-break-inside: avoid; }
    .crisis-step-num { background: black !important; color: white !important; }
    .crisis-intro { background: white !important; border: 2px solid #000 !important; color: black !important; }
    .crisis-intro strong, .crisis-list li strong, .crisis-list li::before { color: black !important; }
    section.ref-section[id$="-print"] { page-break-before: always; }
    section.ref-section[id$="-print"]:first-of-type { page-break-before: auto; }

    @page { margin: 1.5cm; }
}

/* Algorithm-only printing (body.printing-algorithm set by modal.js) */
@media print {
    body.printing-algorithm * { visibility: hidden; }
    body.printing-algorithm .mh-algorithm,
    body.printing-algorithm .mh-algorithm * { visibility: visible; }
    body.printing-algorithm .mh-algorithm { position: absolute; left: 0; top: 0; width: 100%; margin: 0; padding: 0; }
    body.printing-algorithm .mh-check-list label,
    body.printing-algorithm .mh-step h4 { display: flex !important; }
    body.printing-algorithm .mh-check-list li { display: list-item !important; list-style: none !important; }
    body.printing-algorithm .mh-algo-header { background: white !important; color: black !important; border: 2px solid black !important; }
    body.printing-algorithm .mh-algo-header h3,
    body.printing-algorithm .mh-algo-header p { color: black !important; }
    body.printing-algorithm .mh-step-num { background: black !important; color: white !important; }
}

/* --------------------------------------------
   STICKY NAV
   -------------------------------------------- */
.sticky-nav {
    position: sticky; top: 2px; z-index: 900;
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    padding: 10px 20px; margin: 0.5rem 5.5rem 1.5rem 5.5rem; border-radius: 5px;
}
.sticky-nav-content { display: flex; align-items: center; gap: 20px; max-width: 1300px; margin: 0 auto; flex-wrap: wrap; }
.nav-logo { color: white; font-size: 22px; flex-shrink: 0; display: flex; align-items: center; }
.nav-logo i { color: var(--secondary-color); }
.nav-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.nav-links a {
    color: white; text-decoration: none; font-size: 13.5px; font-weight: 500;
    padding: 7px 12px; border-radius: 6px;
    transition: background-color 0.15s; white-space: nowrap;
}
.nav-links a:hover { background-color: rgba(255,255,255,0.12); }
.nav-links i { margin-right: 5px; color: var(--secondary-color); font-size: 12px; }
.nav-search { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.nav-search select {
    padding: 7px 10px; border: none; border-radius: 20px;
    background-color: rgba(255,255,255,0.15); color: white;
    font-size: 12.5px; outline: none; cursor: pointer; max-width: 140px;
}
.nav-search select option { color: #333; background: white; }
.nav-search input {
    padding: 7px 12px; border: none; border-radius: 20px;
    background-color: rgba(255,255,255,0.15); color: white;
    font-size: 13px; outline: none; width: 180px;
    transition: background-color 0.2s, width 0.2s;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.65); }
.nav-search input:focus { background-color: rgba(255,255,255,0.25); width: 220px; }
.nav-search button { background: none; border: none; color: white; cursor: pointer; font-size: 14px; padding: 6px; }
.nav-search button:hover { color: var(--secondary-color); }

/* --------------------------------------------
   RESPONSIVE
   -------------------------------------------- */
@media (max-width: 900px) {
    .page-header { margin: 0.5rem; }
    .nav-margin { margin: 0.5rem; }
    .nav-search input { width: 130px; }
    .nav-search input:focus { width: 160px; }
    .nav-links a { padding: 6px 8px; font-size: 12.5px; }
}

@media (max-width: 1100px) {
    .page-header { margin: 1rem; }
    .sticky-nav { margin: 1rem; }
}
@media (max-width: 768px) {
    .page-header { margin: 0.3rem; }
    .calculator-categories { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .modal-content { margin: 10px; padding: 20px; }
    .tabs { flex-direction: column; }
    .tab { border-radius: 0; border-bottom: 1px solid #ddd; }
    .tab.active { border-bottom: 2px solid var(--secondary-color); }
    .reference-band { padding: 25px 15px; }
    .reference-band h2 { font-size: 22px; }
}

@media (max-width: 700px) {
    .sticky-nav { margin: 0.3rem;}
    .sticky-nav-content { gap: 12px; }
    .nav-links { order: 2; width: 100%; justify-content: center; gap: 4px; }
    .nav-search { order: 3; width: 100%; margin-left: 0; justify-content: center; }
    .nav-search select, .nav-search input { flex: 1; min-width: 0; }
    .nav-search input, .nav-search input:focus { width: auto; }
    .nav-links a { font-size: 12px; padding: 6px 8px; }
    .nav-links i { display: none; }
}

@media (max-width: 600px) {
    .converter-row { flex-direction: column; align-items: stretch; }
    .converter-arrow { text-align: center; padding: 4px 0; transform: rotate(90deg); }
    .drug-search-bar { padding: 14px 16px; }
    .drug-grid { grid-template-columns: 1fr; }
    .filter-chip { font-size: 12px; padding: 5px 11px; }
}

@media (max-width: 450px) {
    .nav-links a { font-size: 11px; padding: 5px 6px; }
}

/* --------------------------------------------
   FOOT and NAV
   -------------------------------------------- */

foot { display: block; background-color: var(--primary-color); color: white; padding: 10px 0; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 100; border-radius: 8px; }
.foot-content { display: flex; justify-content: space-between; align-items: center; max-width: 1100px; margin: 0 auto; padding: 0 16px; flex-wrap: wrap; gap: 15px; }
.logo { font-size: 24px; font-weight: bold; }
.logo i { margin-right: 10px; }

landing-page v1 nav + quick links 
.top-nav { display: flex; gap: 18px; align-items: center; }
.top-nav a { color: white; text-decoration: none; font-size: 14px; font-weight: 500; opacity: 0.9; transition: opacity 0.2s; }
.top-nav a:hover { opacity: 1; text-decoration: underline; }
.top-nav i { margin-right: 4px; }
.quick-links { display: flex; gap: 15px; flex-wrap: wrap; margin: 20px 0 40px; justify-content: center; }
.quick-btn {
    display: flex; align-items: center; gap: 8px; padding: 12px 20px;
    background: white; border-radius: 8px; text-decoration: none;
    color: var(--dark-color); font-weight: 600; font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid var(--secondary-color);
}
.quick-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.12); }
.quick-btn i { color: var(--secondary-color); font-size: 16px; }
.quick-crisis { border-left-color: #e74c3c; color: #b03a2e; }
.quick-crisis i { color: #e74c3c; }

/* old site footer */
.site-footer { background: var(--primary-color); color: rgba(255,255,255,0.85); text-align: center; padding: 20px 16px; margin-top: 40px; font-size: 14px; line-height: 1.7; }
.site-footer i { color: var(--secondary-color); margin-right: 6px; }
.footer-links { margin-top: 6px; }
.footer-links a { color: rgba(255,255,255,0.9); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: white; }