:root {
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #e6f4f1;
  --bg: #f7f8f7;
  --surface: #ffffff;
  --surface-subtle: #f0f2f1;
  --border: #e1e5e3;
  --text: #14201d;
  --text-muted: #4b5a56;
  --text-soft: #84918d;
  --warn-soft: #fff6e5;
  --warn: #8a5300;
  --image-bg: #0d1a1e;
  --radius: 14px;
  --shadow: 0 6px 20px -8px rgba(16, 32, 28, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #2dd4bf;
    --primary-strong: #5eead4;
    --primary-soft: #12302c;
    --bg: #0c1110;
    --surface: #141b1a;
    --surface-subtle: #1b2422;
    --border: #2a3533;
    --text: #e8efed;
    --text-muted: #a5b3af;
    --text-soft: #6f7d79;
    --warn-soft: #2d2210;
    --warn: #f0b450;
    --image-bg: #05090a;
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --primary-soft: #12302c;
  --bg: #0c1110;
  --surface: #141b1a;
  --surface-subtle: #1b2422;
  --border: #2a3533;
  --text: #e8efed;
  --text-muted: #a5b3af;
  --text-soft: #6f7d79;
  --warn-soft: #2d2210;
  --warn: #f0b450;
  --image-bg: #05090a;
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
}
a { color: var(--primary); }
button { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1240px; margin: 0 auto; padding: 20px 16px 64px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Tên trang: ô gradient teal + logo răng (như favicon.svg và khung "Vào Làm Việc") */
.brand { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; text-decoration: none; }
.brand-badge {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 16px 6px 8px; border-radius: 14px;
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 55%, #115e59 100%);
  border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: 0 6px 16px -8px rgba(15, 118, 110, 0.8);
}
.brand-logo { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 850; letter-spacing: -0.2px; color: #fff; font-size: 18px; white-space: nowrap; }
.brand-by { font-size: 13px; font-weight: 650; color: var(--text-muted); white-space: nowrap; }
.brand:hover .brand-badge { box-shadow: 0 8px 20px -8px rgba(15, 118, 110, 0.95); }
/* Bản nhỏ nằm trong câu (dòng kêu gọi ở phần mở đầu) */
.brand-badge-sm { gap: 5px; padding: 2px 9px 2px 5px; border-radius: 9px; vertical-align: -0.28em; box-shadow: 0 4px 10px -6px rgba(15, 118, 110, 0.8); }
.brand-badge-sm .brand-logo { width: 18px; height: 18px; }
.brand-badge-sm .brand-name { font-size: 14.5px; }
.page-cta { line-height: 1.75; }
.date-badge { color: var(--primary); background: var(--primary-soft); padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer; display: inline-grid; place-items: center;
}
.icon-btn:hover { border-color: var(--primary); }

/* Khung "Vào Làm Việc": ứng dụng làm bệnh án (app.chinhnhaso.com). Chưa đăng nhập: nút Google;
   đã đăng nhập (assets/work.js): lời chào + nút vào thẳng. Màu cố định (không theo --primary)
   để chữ trắng đủ tương phản ở cả hai giao diện. */
.work-card {
  margin: 0 0 18px; padding: 22px 22px 18px; border-radius: 20px; color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, #14b8a6 0%, rgba(20, 184, 166, 0) 55%),
              linear-gradient(160deg, #0f766e 0%, #115e59 60%, #134e4a 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px -18px rgba(15, 118, 110, 0.75);
}
.work-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: rgba(255, 255, 255, 0.72); }
.work-title { margin: 0 0 16px; font-size: 26px; line-height: 1.2; font-weight: 850; letter-spacing: -0.4px; }
.work-features { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.work-features li { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 650; }
.work-ico {
  flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.22);
}
.work-ico svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.work-ico .thin { stroke-width: 1.3; stroke: rgba(255, 255, 255, 0.85); }
.work-ico .dot { fill: #99f6e4; stroke: none; }
.work-ico .dash { stroke: #99f6e4; stroke-width: 1.5; stroke-dasharray: 1.6 1.7; }
.work-google, .work-enter {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  min-height: 50px; padding: 10px 16px; border-radius: 14px; text-decoration: none;
  font-size: 16px; font-weight: 750; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.work-google { background: #fff; color: #1f2937; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.35); }
.work-g { width: 22px; height: 22px; flex: none; }
.work-enter { background: #fff; color: #0f766e; font-size: 18px; font-weight: 850; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.35); }
.work-enter svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.work-google:hover, .work-enter:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -8px rgba(0, 0, 0, 0.45); }
.work-google:focus-visible, .work-enter:focus-visible, .work-switch:focus-visible { outline: 3px solid #99f6e4; outline-offset: 3px; }
.work-switch { display: block; margin-top: 12px; text-align: center; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85); }
.work-switch:hover { color: #fff; }
.work-card [hidden] { display: none; }
@media (max-width: 960px) {
  /* Điện thoại / máy tính bảng: khung lên đầu (trên tiêu đề), hai ô giới thiệu xuống sau bài báo */
  .layout > aside { display: contents; }
  .work-card { order: -1; }
  .layout > aside > .side-box { order: 1; }
  .work-title { font-size: 23px; margin-bottom: 14px; }
}
/* Phần mở đầu: khung nền teal nhạt, cao ngang khung "Vào Làm Việc" bên phải */
.intro {
  margin-bottom: 26px; padding: 26px 28px 24px; border-radius: 20px; border: 1px solid var(--border);
  background: radial-gradient(90% 120% at 0% 0%, var(--primary-soft) 0%, transparent 70%), var(--surface);
}
.intro-kicker { margin: 0 0 8px; font-size: 12px; font-weight: 750; letter-spacing: 0.7px; text-transform: uppercase; color: var(--primary); }
.page-title { font-size: clamp(26px, 3.6vw, 38px); line-height: 1.15; font-weight: 850; letter-spacing: -0.8px; margin: 0 0 12px; text-wrap: balance; }
.page-cta { margin: -6px 0 16px; font-size: 15.5px; font-weight: 750; color: var(--primary); }
.page-sub { margin: 0 0 16px; max-width: 64ch; color: var(--text-muted); font-size: 15.5px; line-height: 1.6; }
.intro-facts { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.intro-facts li { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; color: var(--text); }
.intro-facts svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.intro-facts .thin { stroke-width: 1.3; }
@media (max-width: 560px) {
  .intro { padding: 20px 18px 18px; }
  .page-sub { font-size: 15px; }
}

.search {
  width: 100%; max-width: 560px; height: 42px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2384918d' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center / 18px 18px;
  color: var(--text); padding: 0 18px 0 44px; font-size: 15px; outline: none;
}
.search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.section { margin-bottom: 36px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 16px;
}
.section-title { font-size: 18px; font-weight: 800; margin: 0; }
.section-count { font-size: 13px; color: var(--text-soft); white-space: nowrap; }

/* Images + ⓘ credit */
.media { position: relative; background: var(--image-bg); overflow: hidden; }
.media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media.contain img { object-fit: contain; }
.media.placeholder { display: grid; place-items: center; color: var(--text-soft); background: var(--surface-subtle); font-size: 28px; }
.credit-btn {
  position: absolute; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 13px; line-height: 24px;
  cursor: pointer; opacity: 0.75; padding: 0;
}
.credit-btn:hover, .credit-btn:focus-visible { opacity: 1; }
.credit-pop {
  position: absolute; right: 8px; bottom: 38px; max-width: min(320px, calc(100% - 16px));
  background: rgba(10, 16, 15, 0.92); color: #f1f5f4; font-size: 12px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; z-index: 2;
}
.credit-pop a { color: #8ff0e0; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 20px;
}
.hero .media { min-height: 300px; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .hero .media { min-height: 0; aspect-ratio: 16 / 10; }
}
.hero-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; }
.hero-title { font-size: clamp(19px, 2.4vw, 23px); line-height: 1.3; margin: 0; font-weight: 800; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card .media { aspect-ratio: 16 / 10; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 16.5px; line-height: 1.38; margin: 0; font-weight: 750; }

.open-link { color: inherit; text-decoration: none; }
.open-link:hover { color: var(--primary); }
.open-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 700; }
.tag { color: var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 2px 8px; }
.tag.study { color: var(--text-muted); background: var(--surface-subtle); }
.title-en { margin: 0; color: var(--text-soft); font-size: 13.5px; line-height: 1.4; }
.card .title-en, .card .point { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card .title-en { -webkit-line-clamp: 2; }
[data-open] { cursor: pointer; }
.point { margin: 0; color: var(--text-muted); font-size: 14.5px; line-height: 1.5; padding-left: 12px; border-left: 3px solid var(--primary); }
.byline { margin: auto 0 0; color: var(--text-soft); font-size: 12.5px; line-height: 1.45; }
.byline strong { color: var(--text-muted); font-weight: 650; }

/* Brief list */
.brief-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.brief-list li { padding: 12px 16px; border-top: 1px solid var(--border); }
.brief-list li:first-child { border-top: 0; }
.brief-list .open-link { font-weight: 650; }

.more-btn {
  display: block; margin: 18px auto 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 20px; font-weight: 650; cursor: pointer;
}
.more-btn:hover { border-color: var(--primary); }
.more-btn[hidden] { display: none; }

.state { text-align: center; color: var(--text-muted); padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* Sidebar */
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.side-box h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 10px; color: var(--text-muted); }
.side-box p { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); }
.journal-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.journal-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.journal-list li:first-child { border-top: 0; }
.journal-list span:last-child { color: var(--text-soft); }

.site-footer { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; font-size: 13.5px; color: var(--text-soft); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }

/* Trang văn bản: điều khoản, quyền riêng tư, nguồn ảnh */
.doc { max-width: 760px; }
.doc h1 { font-size: clamp(24px, 4vw, 30px); line-height: 1.25; margin: 8px 0 4px; }
.doc .updated { color: var(--text-soft); font-size: 14px; margin: 0 0 20px; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc h3 { font-size: 16px; margin: 20px 0 6px; }
.doc p, .doc li { color: var(--text-muted); }
.doc ul { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc .callout { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 12px 16px; }

/* Reader */
.reader {
  width: min(820px, calc(100% - 32px)); max-height: calc(100% - 32px); margin: auto; padding: 0; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.reader::backdrop { background: rgba(8, 14, 13, 0.6); }
@media (max-width: 640px) { .reader { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; } }
.reader-head {
  position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.reader-journal { font-size: 13px; font-weight: 750; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader .media { aspect-ratio: 16 / 9; }
.reader-body { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 640px) { .reader-body { padding: 18px 16px 24px; } }
.reader-title { font-size: clamp(20px, 3vw, 25px); line-height: 1.3; margin: 0; font-weight: 800; }
.reader-title-en { margin: 0; color: var(--text-soft); font-size: 15px; }
.reader-meta { margin: 0; font-size: 14px; color: var(--text-muted); display: grid; gap: 3px; }
.ai-note { margin: 0; background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.reader h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); margin: 6px 0 0; }
.reader p.summary { margin: 0; font-size: 16px; }
.reader ol.points { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.reader details { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.reader details summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.reader details p { font-size: 14.5px; color: var(--text-muted); white-space: pre-line; margin: 10px 0 0; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.btn-primary {
  background: var(--primary); color: #fff; text-decoration: none; border-radius: 999px; padding: 10px 18px; font-weight: 700;
}
:root[data-theme="dark"] .btn-primary { color: #04211d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #04211d; } }
.btn-ghost { border: 1px solid var(--border); text-decoration: none; color: var(--text); border-radius: 999px; padding: 9px 16px; font-weight: 650; }
