/* ==========================================================================
   MedGuide — public + admin styles
   No build step. System fonts. Light and dark themes.
   ========================================================================== */

:root {
    --blue: #1a6fb5;
    --blue-dark: #125a96;
    --blue-soft: #eaf3fb;
    --ink: #12202d;
    --ink-2: #2c3e50;
    --muted: #5b6b7b;
    --line: #dfe6ed;
    --line-strong: #c9d4df;
    --bg: #ffffff;
    --bg-soft: #f5f8fb;
    --bg-tint: #eef4f9;
    --green: #177245;
    --green-soft: #e8f6ee;
    --amber: #9a6100;
    --amber-soft: #fdf3e2;
    --red: #b42318;
    --red-soft: #fef3f2;
    --violet: #5b3fa8;
    --violet-soft: #f1edfb;
    --shadow-sm: 0 1px 2px rgba(18, 32, 45, .05);
    --shadow: 0 8px 30px rgba(18, 32, 45, .08);
    --radius: 12px;
    --radius-sm: 8px;
    --wrap: 1160px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
    --blue: #64b0ee;
    --blue-dark: #8cc6f5;
    --blue-soft: #15293c;
    --ink: #e8eef5;
    --ink-2: #c9d6e3;
    --muted: #9aa9b8;
    --line: #24313d;
    --line-strong: #33424f;
    --bg: #0e161e;
    --bg-soft: #131d27;
    --bg-tint: #17232e;
    --green: #6bd39a;
    --green-soft: #123024;
    --amber: #f0b45c;
    --amber-soft: #322514;
    --red: #ff8b80;
    --red-soft: #341716;
    --violet: #b8a6f0;
    --violet-soft: #241d3d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 10px 34px rgba(0, 0, 0, .38);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 3.2vw, 2.7rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.25rem; }

.icon { width: 1.15em; height: 1.15em; vertical-align: -.18em; flex: none; }

.container { width: min(var(--wrap), calc(100% - 40px)); margin-inline: auto; }
.container--narrow { width: min(820px, calc(100% - 40px)); margin-inline: auto; }

.skip-link {
    position: absolute; left: -999px; top: 8px; z-index: 100;
    background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { left: 16px; color: #fff; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ------------------------------------------------------------------ Header */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: grid; grid-template-columns: auto 1fr auto; gap: 22px;
    align-items: center; padding: 12px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.brand:hover { color: var(--ink); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: linear-gradient(145deg, #2b8ad6, #12629f); color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 4px 12px rgba(26,111,181,.28);
}
.brand-mark .icon { width: 21px; height: 21px; }
.brand small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: -2px; }

.header-search { position: relative; max-width: 560px; width: 100%; justify-self: center; }
.search-form { display: flex; align-items: center; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 3px 3px 14px; transition: border-color .15s, box-shadow .15s; }
.search-form:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); background: var(--bg); }
.search-form .icon { color: var(--muted); }
.search-form input {
    flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
    font: inherit; font-size: .95rem; padding: 9px 8px; outline: none;
}
.search-form button {
    border: 0; background: var(--blue); color: #fff; border-radius: 999px;
    padding: 8px 16px; font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer;
}
.search-form button:hover { background: var(--blue-dark); }

.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
    padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2);
    font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.nav-link:hover { background: var(--bg-soft); color: var(--ink); }
.nav-link.is-active { color: var(--blue); background: var(--blue-soft); }
.icon-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px;
    border: 1px solid var(--line); border-radius: 9px; background: transparent;
    color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.menu-toggle { display: none; }

.suggestions {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow); overflow: hidden; display: none;
}
.suggestions.is-open { display: block; }
.suggestion {
    display: flex; gap: 12px; align-items: center; padding: 10px 14px;
    text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line);
}
.suggestion:last-child { border-bottom: 0; }
.suggestion:hover, .suggestion.is-active { background: var(--bg-soft); }
.suggestion strong { font-weight: 650; }
.suggestion span { color: var(--muted); font-size: .82rem; }
.suggestion .icon { color: var(--blue); }
.suggestion-empty { padding: 12px 14px; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------------ Hero */
.hero {
    position: relative; overflow: hidden;
    background:
        radial-gradient(900px 380px at 12% -10%, rgba(52, 145, 214, .16), transparent 60%),
        radial-gradient(700px 340px at 88% 0%, rgba(23, 114, 69, .10), transparent 55%),
        var(--bg-soft);
    border-bottom: 1px solid var(--line);
}
.hero-inner { padding: 54px 0 42px; text-align: center; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
    padding: 5px 12px; font-size: .76rem; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 18px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); margin-bottom: 12px; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--blue); }
.hero-sub { font-size: 1.08rem; color: var(--muted); max-width: 620px; margin: 0 auto 26px; }
.hero-search { max-width: 640px; margin: 0 auto; }
.hero-search .search-form { padding: 5px 5px 5px 18px; box-shadow: var(--shadow); border-color: transparent; }
.hero-search .search-form input { font-size: 1.02rem; padding: 11px 10px; }
.hero-search .search-form button { padding: 11px 22px; }
.hero-links { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: .85rem; color: var(--muted); }
.hero-links a { color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; text-decoration: none; }
.hero-links a:hover { border-color: var(--blue); color: var(--blue); }
.hero-stats { display: flex; justify-content: center; gap: 34px; margin-top: 30px; }
.hero-stat strong { display: block; font-size: 1.4rem; letter-spacing: -.02em; }
.hero-stat span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }

/* ------------------------------------------------------------------ Sections */
.section { padding: 44px 0; }
.section--tight { padding: 30px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.section-link { font-size: .88rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.section-link:hover { text-decoration: underline; }

/* A-Z */
.az-bar { display: grid; grid-template-columns: repeat(27, minmax(0, 1fr)); gap: 4px; }
.az-letter {
    display: grid; place-items: center; height: 40px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
    text-decoration: none; font-weight: 650; font-size: .9rem;
}
.az-letter:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.az-letter.is-empty { color: var(--muted); opacity: .45; pointer-events: none; }
.az-letter.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow-sm);
}
.card--link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card--link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-2px); color: inherit; }
.card h3 { margin-bottom: 6px; }
.card p:last-child { margin-bottom: 0; }

.condition-card { display: flex; flex-direction: column; gap: 4px; }
.condition-card .count { font-size: .78rem; color: var(--muted); font-weight: 600; }
.condition-card .icon { color: var(--blue); margin-bottom: 8px; }

.class-card { display: flex; align-items: center; gap: 12px; }
.class-card .num { font-size: .78rem; color: var(--muted); }

.drug-card { display: flex; flex-direction: column; gap: 6px; }
.drug-card .name { font-weight: 700; font-size: 1.02rem; }
.drug-card .generic { color: var(--muted); font-size: .86rem; }

/* Drug list rows */
.drug-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.drug-row {
    display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
    padding: 13px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.drug-row:last-child { border-bottom: 0; }
.drug-row:hover { background: var(--bg-soft); }
.drug-row .name { font-weight: 650; }
.drug-row .generic { color: var(--muted); font-size: .84rem; }
.drug-row .meta { color: var(--muted); font-size: .78rem; text-align: right; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700;
    letter-spacing: .02em; text-transform: uppercase; white-space: nowrap;
}
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--violet { background: var(--violet-soft); color: var(--violet); }
.badge--slate { background: var(--bg-tint); color: var(--muted); }

/* Breadcrumbs */
.breadcrumbs { padding: 16px 0 0; font-size: .82rem; color: var(--muted); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: 6px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); text-decoration: underline; }
.breadcrumbs .sep { opacity: .5; }

/* ------------------------------------------------------------------ Drug page */
.drug-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; padding: 18px 0 56px; }
.drug-main { min-width: 0; }
.drug-hero { border-bottom: 1px solid var(--line); padding-bottom: 22px; margin-bottom: 26px; }
.drug-hero h1 { margin-bottom: 6px; }
.drug-generic { color: var(--muted); font-size: 1rem; margin-bottom: 12px; }
.drug-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: .84rem; color: var(--muted); }
.drug-meta .divider { width: 1px; height: 14px; background: var(--line-strong); }
.drug-meta a { color: inherit; }
.drug-reviewed { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.drug-reviewed .icon { color: var(--green); }
.drug-brandline { margin-top: 10px; font-size: .86rem; color: var(--ink-2); }

.toc { position: sticky; top: 84px; align-self: start; }
.toc-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 750; margin-bottom: 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc-list a {
    display: block; padding: 7px 10px; border-left: 2px solid transparent;
    color: var(--ink-2); text-decoration: none; font-size: .87rem; border-radius: 0 6px 6px 0;
}
.toc-list a:hover { background: var(--bg-soft); color: var(--ink); }
.toc-list a.is-active { border-left-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.toc-note { margin-top: 18px; padding: 14px; border-radius: 10px; background: var(--bg-soft); font-size: .8rem; color: var(--muted); }

.content-section { padding: 6px 0 22px; scroll-margin-top: 90px; }
.content-section h2 {
    font-size: 1.32rem; padding-bottom: 10px; margin-bottom: 14px;
    border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
}
.content-section h2 .icon { color: var(--blue); }
.prose { font-size: 1rem; color: var(--ink-2); }
.prose > p:last-child { margin-bottom: 0; }
.prose h3 { margin-top: 22px; color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose strong { color: var(--ink); }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-soft); font-weight: 650; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; border-radius: 10px; }

.notice {
    border: 1px solid var(--line); border-left: 3px solid var(--amber);
    background: var(--amber-soft); border-radius: 8px; padding: 14px 16px;
    font-size: .9rem; margin-bottom: 22px;
}
.notice strong { color: var(--ink); }

.faq-list { display: grid; gap: 10px; }
.faq-item { border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0 16px; }
.faq-item summary { cursor: pointer; padding: 14px 0; font-weight: 650; display: flex; justify-content: space-between; gap: 12px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--blue); font-weight: 700; }
.faq-item[open] summary::after { content: "–"; }
.faq-item .answer { padding: 0 0 14px; color: var(--ink-2); font-size: .95rem; }

.sidebar-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg); margin-bottom: 16px; }
.sidebar-card h3 { font-size: .92rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; }
.sidebar-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sidebar-links a { font-size: .9rem; text-decoration: none; }
.sidebar-links a:hover { text-decoration: underline; }

.trust-strip { display: flex; flex-wrap: wrap; gap: 18px 30px; padding: 18px 0; border-top: 1px solid var(--line); margin-top: 10px; font-size: .8rem; color: var(--muted); }
.trust-strip span { display: inline-flex; align-items: center; gap: 7px; }
.trust-strip .icon { color: var(--green); }

/* ------------------------------------------------------------------ Article */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding: 20px 0 56px; }
.article-head { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 24px; }
.article-head h1 { font-size: clamp(1.9rem, 3vw, 2.5rem); }
.article-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 10px; }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; border: 1px solid var(--line); }

/* ------------------------------------------------------------------ Contact */
.contact-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; padding: 24px 0 56px; }
.contact-side { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; align-self: start; }

/* ------------------------------------------------------------------ Forms (public) */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-size: .84rem; font-weight: 650; margin-bottom: 6px; color: var(--ink); }
.input, .textarea, select.input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--bg); color: var(--ink); font: inherit; font-size: .95rem;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus, select.input:focus {
    outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}
.field-error { color: var(--red); font-size: .8rem; margin-top: 5px; }
.help { color: var(--muted); font-size: .78rem; margin-top: 5px; }

/* ------------------------------------------------------------------ Alerts */
.alert { border-radius: 10px; padding: 12px 15px; font-size: .9rem; margin-bottom: 16px; border: 1px solid var(--line); background: var(--bg-soft); }
.alert-success { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 32%, var(--line)); color: var(--green); }
.alert-error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 32%, var(--line)); color: var(--red); }
.alert-info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, var(--line)); color: var(--blue); }
.alert-warning { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, var(--line)); color: var(--amber); }
.alert a { color: inherit; font-weight: 650; }

/* ------------------------------------------------------------------ Pagination */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 26px; }
.pagination a, .pagination span {
    display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: .88rem;
}
.pagination a:hover { border-color: var(--blue); color: var(--blue); }
.pagination .is-current { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 650; }
.pagination .is-disabled { opacity: .4; }

/* ------------------------------------------------------------------ Footer */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 40px 0 28px; }
.footer-col h4 { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 12px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer-col a { color: var(--ink-2); text-decoration: none; font-size: .88rem; }
.footer-col a:hover { color: var(--blue); text-decoration: underline; }
.footer-about p { font-size: .86rem; color: var(--muted); max-width: 320px; }
.footer-bottom { border-top: 1px solid var(--line); padding: 16px 0 30px; font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-disclaimer { font-size: .74rem; color: var(--muted); max-width: 820px; margin-top: 6px; }

/* ------------------------------------------------------------------ Empty state */
.empty-state { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg-soft); }
.empty-state .icon { width: 38px; height: 38px; color: var(--muted); margin-bottom: 10px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin: 0 auto; max-width: 420px; }

/* ------------------------------------------------------------------ Admin */
.admin-body { background: var(--bg-soft); }
.admin-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.admin-sidebar {
    background: #0d1d2b; color: #c9d8e6; padding: 18px 14px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
[data-theme="dark"] .admin-sidebar { background: #0a1219; }
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.admin-brand:hover { color: #fff; }
.admin-brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.admin-nav { display: grid; gap: 2px; }
.admin-nav .group { font-size: .66rem; letter-spacing: .13em; text-transform: uppercase; color: #6e8297; padding: 16px 10px 6px; font-weight: 700; }
.admin-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
    color: #c9d8e6; text-decoration: none; font-size: .88rem; font-weight: 550;
}
.admin-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav a.is-active { background: rgba(100,176,238,.16); color: #fff; }
.admin-nav a .icon { width: 17px; height: 17px; opacity: .8; }
.admin-nav .count { margin-left: auto; background: rgba(255,255,255,.12); border-radius: 999px; padding: 1px 7px; font-size: .7rem; }
.admin-sidebar .spacer { flex: 1; }
.admin-user { border-top: 1px solid rgba(255,255,255,.1); padding-top: 14px; margin-top: 14px; font-size: .8rem; }
.admin-user strong { display: block; color: #fff; font-size: .86rem; }
.admin-user form { margin-top: 8px; }

.admin-main { min-width: 0; }
.admin-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 28px; background: var(--bg); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
}
.admin-topbar h1 { font-size: 1.2rem; margin: 0; }
.admin-topbar .sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.admin-content { padding: 26px 28px 60px; max-width: 1320px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.stat-card .value { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.stat-card .hint { font-size: .76rem; color: var(--muted); margin-top: 5px; }
.stat-card .icon { color: var(--blue); width: 18px; height: 18px; float: right; opacity: .7; }

.admin-panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.admin-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.admin-panel__head h2 { font-size: 1rem; margin: 0; }
.admin-panel__body { padding: 18px; }
.admin-panel__body--flush { padding: 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.data-table th {
    text-align: left; padding: 10px 14px; background: var(--bg-soft); color: var(--muted);
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* Bulk selection bar above a table */
.bulk-bar {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 14px;
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
}
.bulk-bar .spacer { flex: 1; }
.bulk-bar .check { margin: 0; }
.data-table .actions { display: flex; gap: 6px; justify-content: flex-end; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { max-width: 260px; }
.toolbar .spacer { flex: 1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line-strong);
    background: var(--bg); color: var(--ink); font: inherit; font-size: .87rem; font-weight: 650;
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); color: var(--ink); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn-danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .79rem; border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; font-size: .88rem; font-weight: 550; }
.check input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { padding: 0 8px; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }

.progress { height: 7px; background: var(--bg-tint); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; transition: width .3s; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 9px 14px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .89rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.log-box {
    background: #0c1a25; color: #c9d8e6; border-radius: 10px; padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem;
    line-height: 1.6; max-height: 300px; overflow-y: auto; white-space: pre-wrap;
}
.log-line--ok { color: #7fe0a8; }
.log-line--err { color: #ff9e96; }
.log-line--info { color: #8fc8f5; }

.section-editor { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.section-editor__head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--bg-soft); }
.section-editor__head .title { flex: 1; min-width: 0; }
.section-editor__head input { width: 100%; border: 1px solid transparent; background: transparent; font: inherit; font-weight: 650; padding: 4px 6px; border-radius: 6px; color: var(--ink); }
.section-editor__head input:hover { border-color: var(--line); }
.section-editor__head input:focus { border-color: var(--blue); background: var(--bg); outline: none; }
.section-editor__body { padding: 12px 14px 14px; display: none; }
.section-editor.is-open .section-editor__body { display: block; }
.section-editor textarea { min-height: 140px; }
.section-editor .section-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

.spin-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.spin-row:last-child { border-bottom: 0; }
.spin-row .name { flex: 1; min-width: 0; }
.spin-row .status { font-size: .76rem; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: .87rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 1180px) {
    .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
    .header-inner { grid-template-columns: auto 1fr auto; gap: 12px; }
    .header-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
    .header-nav .nav-link { display: none; }
    .header-nav .nav-link.keep { display: inline-flex; }
    .menu-toggle { display: inline-grid; }
    .drug-layout { grid-template-columns: 1fr; gap: 24px; }
    .toc { position: static; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--bg-soft); }
    .toc-list { grid-template-columns: 1fr 1fr; display: grid; }
    .article-layout, .contact-layout { grid-template-columns: 1fr; }
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 80; transform: translateX(-100%); transition: transform .2s; }
    .admin-sidebar.is-open { transform: translateX(0); }
    .admin-content { padding: 20px 16px 60px; }
    .admin-topbar { padding: 12px 16px; }
}

@media (max-width: 700px) {
    body { font-size: 15px; }
    .container, .container--narrow { width: calc(100% - 28px); }
    .hero-inner { padding: 36px 0 30px; }
    .hero-stats { gap: 22px; }
    .az-bar { grid-template-columns: repeat(9, 1fr); }
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .drug-row { grid-template-columns: 1fr; gap: 4px; }
    .drug-row .meta { text-align: left; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .section { padding: 30px 0; }
    .section-head { flex-direction: column; align-items: flex-start; }
    .toc-list { grid-template-columns: 1fr; }
    .data-table { font-size: .82rem; }
    .data-table th, .data-table td { padding: 9px 10px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
    .site-header, .site-footer, .toc, .breadcrumbs, .header-search, .trust-strip, .pagination { display: none !important; }
    .drug-layout { display: block; }
    body { font-size: 12pt; }
    .content-section { break-inside: avoid-page; }
    a { color: #000; text-decoration: none; }
}

/* ------------------------------------------------------------------ Extra components */
.mobile-menu { display: none; border-top: 1px solid var(--line); background: var(--bg); padding: 10px 0 18px; }
.mobile-menu.is-open { display: block; }
.mobile-menu .nav-link { display: block; padding: 11px 4px; }
.hero-search { position: relative; }
.hero-search + .suggestions { position: absolute; left: 50%; transform: translateX(-50%); width: min(640px, 100%); z-index: 60; }
.section-editor.is-open .section-editor__head > .icon { transform: rotate(90deg); }
.section-editor__head > .icon { transition: transform .15s; }
.admin-sidebar.is-open { box-shadow: 0 20px 60px rgba(0,0,0,.4); }

[hidden] { display: none !important; }
input[type="color"] { height: 42px; padding: 3px; cursor: pointer; }

/* Mobile table of contents */
.toc-mobile { display: none; }
@media (max-width: 980px) {
    .toc { display: none; }
    .toc-mobile {
        display: block; margin-bottom: 20px; border: 1px solid var(--line);
        border-radius: var(--radius); background: var(--bg-soft); padding: 0 16px;
    }
    .toc-mobile summary {
        cursor: pointer; padding: 13px 0; font-weight: 700; font-size: .92rem;
        list-style: none; display: flex; justify-content: space-between; align-items: center;
    }
    .toc-mobile summary::-webkit-details-marker { display: none; }
    .toc-mobile summary::after { content: "+"; color: var(--blue); font-weight: 700; }
    .toc-mobile[open] summary::after { content: "–"; }
    .toc-mobile .toc-list { padding-bottom: 12px; }
}

/* Admin language switch */
.lang-switch { display:inline-flex; align-items:center; border:1px solid var(--line); border-radius:8px; overflow:hidden; background:var(--bg); }
.lang-switch button { border:0; background:transparent; color:var(--muted); font:inherit; font-size:.72rem; font-weight:750; letter-spacing:.04em; padding:7px 9px; cursor:pointer; }
.lang-switch button:hover { background:var(--bg-soft); color:var(--ink); }
.lang-switch button.is-active { background:var(--blue-soft); color:var(--blue); }
