:root {
  --navy-950: #071722;
  --navy-900: #0b2030;
  --navy-800: #123247;
  --ink: #17242d;
  --muted: #677680;
  --line: #dfe6e8;
  --paper: #f4f6f5;
  --white: #fff;
  --red: #e30620;
  --red-dark: #b9041a;
  --teal: #5d8d8e;
  --radius: 18px;
  --shadow: 0 20px 55px rgba(9, 31, 44, .1);
  --sidebar-rail: max(310px, 30vw);
  --sidebar-content: 250px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.6; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 1000; top: -80px; left: 1rem; padding: .7rem 1rem; background: white; color: var(--navy-950); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.site-shell { min-height: 100vh; }
.site-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-rail); z-index: 20;
  display: flex; flex-direction: column; align-items: flex-end; padding: 46px 26px 32px;
  color: #eef5f5; background:
    radial-gradient(circle at 18% 0%, rgba(93, 141, 142, .24), transparent 38%),
    linear-gradient(165deg, rgba(12, 43, 60, .75), rgba(7, 23, 34, .92) 72%),
    url("/assets/sidebar-medical.webp") right center / auto 100% no-repeat;
  box-shadow: 16px 0 42px rgba(4, 18, 28, .22), 3px 0 10px rgba(4, 18, 28, .16);
  overflow-y: auto;
}
.site-sidebar > * { width: min(var(--sidebar-content), 100%); }
.brand { display: block; margin: 0 0 44px; }
.brand img { display: block; width: 218px; margin-left: auto; }
.main-nav {
  display: grid; gap: 4px; padding: 10px;
  background: rgba(5, 23, 34, .46);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 17px;
  box-shadow: 0 18px 42px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.06);
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}
.main-nav a { position: relative; display: block; padding: 10px 14px; color: rgba(255,255,255,.84); text-decoration: none; font-size: .92rem; border-radius: 10px; text-shadow: 0 1px 12px rgba(0,0,0,.32); transition: .2s ease; }
.main-nav a::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 0; border-radius: 3px; background: var(--red); transform: translateY(-50%); transition: .2s ease; }
.main-nav a:hover, .main-nav a:focus-visible { color: white; background: rgba(255,255,255,.10); }
.main-nav a.active { color: white; background: rgba(255,255,255,.15); }
.main-nav a.active::before { height: 22px; }
.sidebar-footer { margin-top: auto; padding: 34px 12px 0; color: rgba(255,255,255,.48); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-footer p { margin: 0 0 10px; }
.sidebar-footer a { color: rgba(255,255,255,.65); text-transform: none; letter-spacing: 0; }
.site-main { min-height: 100vh; margin-left: var(--sidebar-rail); padding: 0 clamp(26px, 5vw, 84px); }
.content-wrap { width: min(1060px, 100%); margin: 0 auto; }

.eyebrow { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 18px; color: var(--red); font-weight: 700; font-size: .75rem; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: currentColor; }
.hero { position: relative; min-height: 610px; display: flex; align-items: center; padding: 84px 0 64px; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -180px; top: 80px; border: 1px solid rgba(93,141,142,.24); border-radius: 50%; box-shadow: 0 0 0 70px rgba(93,141,142,.035), 0 0 0 140px rgba(93,141,142,.025); pointer-events: none; }
.hero-copy { position: relative; z-index: 1; max-width: 810px; }
.hero h1 { max-width: 760px; margin: 0; color: var(--navy-950); font-family: var(--serif); font-size: clamp(3rem, 6vw, 6.5rem); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.hero h1 em { color: var(--red); font-style: italic; }
.hero-lead { max-width: 650px; margin: 28px 0 0; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.3rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border: 1px solid transparent; border-radius: 999px; background: var(--red); color: white; font-weight: 700; font-size: .88rem; text-decoration: none; cursor: pointer; transition: .2s ease; }
.button:hover { background: var(--red-dark); transform: translateY(-1px); }
.button.secondary { color: var(--navy-900); background: transparent; border-color: #bfcacc; }
.button.secondary:hover { background: white; border-color: white; }
.button.small { min-height: 38px; padding: 7px 14px; font-size: .8rem; }
.button.danger { background: #a7192c; }

.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.section-heading h2, .page-header h1 { margin: 0; color: var(--navy-950); font-family: var(--serif); font-weight: 400; line-height: 1.08; letter-spacing: -.025em; }
.section-heading h2 { font-size: clamp(2.2rem, 4vw, 3.7rem); }
.section-heading a { color: var(--red); font-weight: 700; font-size: .85rem; text-decoration: none; }
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.article-card { min-width: 0; padding: 26px; background: white; border: 1px solid rgba(15,48,67,.07); border-radius: var(--radius); box-shadow: 0 12px 35px rgba(9,31,44,.055); transition: .25s ease; }
.article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.article-card .meta, .article-meta { color: var(--teal); font-weight: 700; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; }
.article-card h3 { margin: 14px 0 12px; color: var(--navy-950); font-family: var(--serif); font-size: 1.55rem; font-weight: 400; line-height: 1.18; }
.article-card h3 a { text-decoration: none; }
.article-card p { margin: 0; color: var(--muted); font-size: .91rem; }
.article-card .read-more { display: inline-block; margin-top: 20px; color: var(--red); font-weight: 700; font-size: .78rem; text-decoration: none; }
.category-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.category-tile { padding: 26px 28px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; background: rgba(255,255,255,.4); transition: .2s ease; }
.category-tile:hover { background: white; border-color: white; box-shadow: var(--shadow); }
.category-tile strong { display: block; color: var(--navy-900); font-family: var(--serif); font-size: 1.35rem; font-weight: 400; }
.category-tile span { color: var(--muted); font-size: .85rem; }

.page-header { padding: 90px 0 50px; border-bottom: 1px solid var(--line); }
.page-header h1 { max-width: 850px; font-size: clamp(2.8rem, 5vw, 5.6rem); }
.page-header p { max-width: 680px; margin: 20px 0 0; color: var(--muted); font-size: 1.08rem; }
.article-list { display: grid; gap: 16px; }
.article-list .article-card { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: start; }
.article-list.without-dates .article-card { grid-template-columns: 1fr; }
.article-list .article-card .date-block { color: var(--red); font-family: var(--serif); font-size: 1.25rem; }
.article-card-full:hover { transform: none; }
.article-card-full .article-card-content { min-width: 0; }
.article-card-full .prose { max-width: none; font-size: 1rem; }
.article-card-full .prose p { color: #2b3941; font-size: 1rem; }
.article-card-full .prose > :first-child { margin-top: 0; }
.article-card-full .prose > :last-child { margin-bottom: 0; }
.article-detail { padding: 86px 0; }
.article-detail header { max-width: 880px; margin-bottom: 42px; }
.article-detail h1 { margin: 12px 0 22px; color: var(--navy-950); font-family: var(--serif); font-size: clamp(2.7rem, 5vw, 5.2rem); font-weight: 400; line-height: 1.04; letter-spacing: -.035em; }
.prose { max-width: 790px; color: #2b3941; font-size: 1.06rem; }
.prose h2, .prose h3 { margin: 2em 0 .7em; color: var(--navy-950); font-family: var(--serif); font-weight: 400; line-height: 1.2; }
.prose h2 { font-size: 2rem; }
.prose a { color: var(--red-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose img { border-radius: 14px; box-shadow: var(--shadow); }
.prose blockquote { margin: 2rem 0; padding: 3px 0 3px 24px; border-left: 3px solid var(--red); color: var(--navy-800); font-family: var(--serif); font-size: 1.3rem; }
.prose .team { margin: 26px 0 38px; }
.prose .team .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px; }
.prose .team .col { min-width: 0; }
.prose .team .col-sm-12 { grid-column: 1 / -1; }
.prose .team .col-sm-12 .staff { width: min(260px, 100%); margin-inline: auto; }
.prose .staff { height: 100%; padding: 16px; text-align: center; background: white; border: 1px solid rgba(15,48,67,.07); border-radius: 16px; box-shadow: 0 12px 35px rgba(9,31,44,.055); }
.prose .person_image_wrapper { aspect-ratio: 1; margin-bottom: 14px; overflow: hidden; border-radius: 12px; background: #e8edef; }
.prose .person_image_wrapper img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; }
.prose .person_name { margin: 0; color: var(--navy-950); font-family: var(--serif); font-size: 1.18rem; font-weight: 400; line-height: 1.25; }
.prose .position, .prose .profile { display: block; margin-top: 5px; color: var(--muted); font-size: .84rem; line-height: 1.35; }
.empty-state { padding: 42px; text-align: center; border: 1px dashed #bdc9cc; border-radius: var(--radius); color: var(--muted); }
.site-footer { width: min(1060px, 100%); margin: 0 auto; padding: 30px 0 40px; display: flex; justify-content: space-between; gap: 20px; color: #8a969c; border-top: 1px solid var(--line); font-size: .76rem; }
.mobile-menu-button { display: none; }
.menu-overlay { position: fixed; inset: 0; z-index: 15; background: rgba(3,13,20,.58); backdrop-filter: blur(4px); }
body.menu-open { overflow: hidden; }

/* Panel */
.admin-body { background: #eef2f3; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 22px; color: white; background: var(--navy-950); }
.admin-brand { display: block; padding: 8px; margin-bottom: 30px; color: white; text-decoration: none; }
.admin-brand img { display: block; width: 150px; margin-bottom: 12px; }
.admin-brand span { color: rgba(255,255,255,.5); font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a, .admin-logout { width: 100%; padding: 10px 12px; color: rgba(255,255,255,.72); background: transparent; border: 0; border-radius: 8px; text-align: left; text-decoration: none; cursor: pointer; }
.admin-sidebar nav a:hover, .admin-logout:hover { color: white; background: rgba(255,255,255,.07); }
.admin-sidebar form { margin-top: auto; }
.admin-main { min-width: 0; padding: 0 42px 60px; }
.admin-topbar { display: flex; justify-content: end; padding: 20px 0; border-bottom: 1px solid #d9e1e3; }
.admin-topbar div { display: grid; text-align: right; }
.admin-topbar small { color: var(--muted); }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 42px 0 24px; }
.admin-header h1 { margin: 0; color: var(--navy-950); font-family: var(--serif); font-size: 2.6rem; font-weight: 400; }
.admin-header p { margin: 4px 0 0; color: var(--muted); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card, .panel { padding: 24px; background: white; border: 1px solid #e0e6e8; border-radius: 14px; box-shadow: 0 8px 24px rgba(9,31,44,.04); }
.stat-card span { display: block; color: var(--muted); font-size: .8rem; }
.stat-card strong { display: block; margin-top: 6px; color: var(--navy-900); font-family: var(--serif); font-size: 2.5rem; font-weight: 400; }
.panel { margin-top: 18px; overflow-x: auto; }
.article-filter-panel { overflow: visible; }
.article-filters { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(135px, 1fr)); gap: 14px; align-items: end; }
.article-search-field { min-width: 0; }
.article-filter-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.article-result-summary { margin: 18px 0 0; color: var(--muted); font-size: .86rem; }
.article-result-summary strong { color: var(--navy-900); }
.table-sort { color: inherit; text-decoration: none; }
.table-sort:hover, .table-sort:focus-visible { color: var(--navy-900); text-decoration: underline; text-underline-offset: 3px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 12px; border-bottom: 1px solid #e8edef; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
td { font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; justify-content: flex-end; gap: 8px; }
.inline-form { display: inline; }
.text-button { padding: 0; color: var(--red-dark); background: none; border: 0; cursor: pointer; font-weight: 700; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; color: #245d49; background: #dff2e8; font-size: .7rem; font-weight: 700; }
.badge.draft { color: #705b20; background: #f5edce; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.form-stack { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field label, fieldset legend { color: var(--navy-900); font-size: .78rem; font-weight: 700; }
.field input, .field textarea, .field select, .html-source { width: 100%; padding: 11px 13px; color: var(--ink); background: white; border: 1px solid #cbd5d8; border-radius: 8px; outline: none; }
.field input:focus, .field textarea:focus, .field select:focus, .html-source:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(93,141,142,.12); }
.field small { color: var(--muted); }
.checkbox-list { display: grid; gap: 8px; padding: 0; margin: 0; border: 0; }
.checkbox-list label { display: flex; align-items: center; gap: 9px; }
.toggle-field { display: flex; align-items: center; gap: 9px; margin-top: 18px; color: var(--navy-900); font-size: .86rem; font-weight: 700; }
.editor-shell { overflow: hidden; background: white; border: 1px solid #cbd5d8; border-radius: 10px; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: #f3f6f6; border-bottom: 1px solid #dce3e5; }
.editor-toolbar button { min-width: 35px; height: 33px; padding: 3px 9px; color: var(--navy-900); background: white; border: 1px solid #d6dfe1; border-radius: 6px; cursor: pointer; }
.rich-editor { min-height: 370px; padding: 20px; outline: 0; }
.rich-editor:focus { box-shadow: inset 0 0 0 2px rgba(93,141,142,.28); }
.html-source { min-height: 370px; border: 0; border-radius: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .86rem; resize: vertical; }
.form-actions { display: flex; gap: 10px; }
.flash { margin: 20px 0 -10px; padding: 12px 16px; border-radius: 9px; }
.flash.success { color: #1d644b; background: #dff3e9; }
.flash.error { color: #89263a; background: #fae3e7; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 70% 20%, #173f55, var(--navy-950) 55%); }
.login-card { width: min(430px, 100%); padding: 38px; background: white; border-radius: 20px; box-shadow: 0 35px 90px rgba(0,0,0,.3); }
.login-card img { display: block; width: 190px; margin: 0 auto 30px; padding: 12px; background: var(--navy-950); border-radius: 10px; }
.login-card h1 { margin: 0; font-family: var(--serif); font-size: 2.2rem; font-weight: 400; text-align: center; }
.login-card > p { margin: 7px 0 24px; color: var(--muted); text-align: center; }
.login-card .button { width: 100%; margin-top: 8px; }
.login-error { padding: 9px 12px; color: #89263a; background: #fae3e7; border-radius: 8px; }

@media (max-width: 1050px) {
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .article-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-search-field { grid-column: 1 / -1; }
}

@media (max-width: 979px) {
  .mobile-menu-button { position: fixed; z-index: 30; top: 14px; right: 14px; display: grid; grid-template-columns: 20px auto; align-items: center; column-gap: 8px; width: auto; height: 46px; padding: 0 15px; color: white; background: var(--navy-950); border: 0; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
  .mobile-menu-button span { grid-column: 1; display: block; width: 19px; height: 2px; margin: 1px 0; background: white; }
  .mobile-menu-button span:first-child { align-self: end; }
  .mobile-menu-button span:nth-child(3) { align-self: start; }
  .mobile-menu-button b { grid-column: 2; grid-row: 1 / 4; font-size: .74rem; }
  .site-sidebar { width: min(330px, 86vw); align-items: stretch; transform: translateX(-105%); transition: transform .28s ease; box-shadow: 20px 0 55px rgba(0,0,0,.25); }
  .site-sidebar > * { width: 100%; }
  .brand img { margin-inline: auto; }
  .site-sidebar.open { transform: translateX(0); }
  .site-main { margin-left: 0; padding-inline: 22px; }
  .hero { min-height: 580px; padding-top: 110px; }
  .hero::after { right: -300px; }
  .article-grid { grid-template-columns: 1fr; }
  .category-strip { grid-template-columns: 1fr; }
  .article-list .article-card { grid-template-columns: 1fr; gap: 6px; }
  .site-footer { flex-direction: column; }
  .admin-shell { display: block; }
  .admin-sidebar { position: static; width: 100%; height: auto; }
  .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
  .admin-sidebar form { margin-top: 20px; }
  .admin-main { padding: 0 18px 40px; }
  .stats-grid { grid-template-columns: 1fr; }
  .admin-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 700px) {
  .article-admin-table, .article-admin-table tbody, .article-admin-table tr, .article-admin-table td { display: block; width: 100%; }
  .article-admin-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .article-admin-table tbody tr { padding: 14px 0; border-bottom: 1px solid #dfe6e8; }
  .article-admin-table tbody tr:last-child { border-bottom: 0; }
  .article-admin-table td { display: grid; grid-template-columns: minmax(82px, .35fr) minmax(0, 1fr); gap: 12px; padding: 8px 0; border: 0; align-items: start; overflow-wrap: anywhere; }
  .article-admin-table td::before { content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .article-admin-table .table-actions { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .site-sidebar { padding: 34px 24px 26px; }
  .brand { margin-bottom: 28px; }
  .hero h1 { font-size: 3.3rem; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .section { padding: 54px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .article-card { padding: 22px; }
  .page-header { padding-top: 100px; }
  .article-detail { padding-top: 110px; }
  .login-card { padding: 28px 22px; }
  .admin-sidebar nav { grid-template-columns: 1fr; }
  .article-filters { grid-template-columns: 1fr; }
  .article-search-field { grid-column: auto; }
}
