:root {
    --bg-1: #cfe6ee;
    --bg-2: #b8dbe6;
    --card-bg: #ffffff;
    --card-border: #e3eef3;
    --dark-card: #0f2447;
    --dark-card-2: #1a3160;
    --primary: #1e88e5;
    --primary-deep: #0d6e8e;
    --primary-soft: #e3f2fd;
    --primary-tint: #e8f4fb;
    --primary-pale: #dceefb;
    --panel-bg: #dff1f7;
    --steel-blue: #5293b6;
    --teal-accent: #3da884;
    --teal-soft: #d4f0e3;
    /* Brand Dark Navy (mirror panel "Kết quả điều trị" của trang chính) */
    --vg-dark-1: #1a3160;       /* navy mid    — alias: --dark-card-2 */
    --vg-dark-2: #0f2447;       /* navy deep   — alias: --dark-card   */
    --vg-on-dark: #cfe6ee;      /* text trên nền navy */
    --vg-on-dark-soft: #9bbbcb; /* text phụ trên nền navy */
    /* Text scale (5 cấp đậm dần) */
    --vg-text-1: #0a2238;
    --vg-text-2: #0d2e44;
    --vg-text-3: #1f2f3d;
    --vg-text-4: #3d4f5e;
    --vg-text-5: #5a6a7a;
    --vg-border: #d8e6ec;
    --vg-border-soft: #bfd9ed;
    --vg-bg-tab-panel: #fafdff;
    --vg-bg-tab-bar: #f0f7fb;
    --text: #1f2937;
    --text-soft: #5a6a7a;
    --text-muted: #8896a6;
    --highlight: #cfe8f3;
    --badge: #f59e0b;
    --badge-bg: #fef3c7;
    --link: #1976d2;
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 8px 22px rgba(15, 36, 71, 0.10), 0 2px 6px rgba(15, 36, 71, 0.06);
    --shadow-lg: 0 14px 34px rgba(15, 36, 71, 0.16), 0 4px 10px rgba(15, 36, 71, 0.08);
    --shadow-surface: 0 10px 26px rgba(15, 36, 71, 0.12), 0 1px 0 rgba(255,255,255,0.90) inset;
    --shadow-nav: 0 18px 36px rgba(15, 36, 71, 0.18), 0 6px 14px rgba(15, 36, 71, 0.10), 0 1px 0 rgba(255,255,255,0.96) inset;
    --shadow-nav-active: 0 20px 42px rgba(15, 36, 71, 0.22), 0 7px 18px rgba(42, 127, 184, 0.16), 0 0 0 2px rgba(42, 127, 184, 0.16) inset, 0 1px 0 rgba(255,255,255,0.98) inset;
    --font-ui: "Segoe UI", "Arial", "Tahoma", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "Cascadia Mono", "Segoe UI Mono", Consolas, "Courier New", monospace;
  }

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

  button,
  input,
  select,
  textarea {
    font-family: var(--font-ui);
  }

  html, body {
    height: 100%;
    font-family: var(--font-ui);
    color: var(--text);
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    font-kerning: normal;
    text-rendering: optimizeLegibility;
  }

  .app {
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 22px 16px;
    gap: 14px;
    overflow: hidden;
  }

  /* ===================== HEADER ===================== */
  .topbar {
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    align-items: center;
    gap: 16px;
    padding: 4px 6px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-radius: 12px;
    padding: 4px 8px 4px 4px;
    transition: background .15s, transform .15s, box-shadow .15s;
    outline: none;
  }
  .brand:hover { background: rgba(255,255,255,0.55); transform: translateY(-1px); }
  .brand:focus-visible { box-shadow: 0 0 0 3px rgba(30,136,229,0.35); }
  .brand:active { transform: translateY(0); }

  .cccd-btn {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #1e88e5;
    background: #ffffff;
    color: #1565c0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, color .15s, transform .15s;
  }
  .cccd-btn[hidden] { display: none !important; }
  .cccd-btn:hover { background: #1e88e5; color: #ffffff; transform: translateY(-1px); }
  .cccd-btn:active { transform: translateY(0); }
  .logo {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: #fff;
    display: grid; place-items: center;
    box-shadow: var(--shadow);
    border: 2px solid #d6e7ee;
    overflow: hidden;
  }
  .logo svg { width: 38px; height: 38px; }
  .brand-text {
    line-height: 1.15;
    font-weight: 800;
    color: #0a2238;
  }
  .brand-text .b1 { font-size: 16px; letter-spacing: .8px; font-weight: 800; }
  .brand-text .b2 { font-size: 22px; color: #0a2238; font-weight: 900; letter-spacing: .5px; }

  .patient-title {
    text-align: center;
    color: #0d2e44;
    max-width: 760px;
    justify-self: center;
  }
  .patient-title .t-sub {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: .8px;
    white-space: nowrap;
    color: #0a2238;
    text-shadow: 0 1px 2px rgba(13, 46, 68, 0.08);
  }
  .patient-title .t-main {
    margin-top: 6px;
    font-size: 26px;
    font-weight: 800;
    color: #0a2238;
    white-space: nowrap;
  }

  .datetime {
    text-align: right;
    color: #0d2e44;
    font-weight: 700;
  }
  .datetime .d { font-size: 16px; }
  .datetime .t { font-size: 26px; font-weight: 800; }

  .narr-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    max-width: 180px;
  }
  .narr-controls .nc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 999px;
    border: 1.5px solid #c44141;
    background: #ffffff;
    color: #b22b2b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0.55;
    transition: background .15s, color .15s, transform .15s, opacity .15s, box-shadow .15s;
  }
  .narr-controls .nc-pause {
    width: 56px;
    height: 56px;
    border-width: 2px;
  }
  .narr-controls .nc-btn:hover { background: #c44141; color: #ffffff; transform: translateY(-1px); }
  .narr-controls .nc-btn:active { transform: translateY(0); }
  .narr-controls .nc-btn:disabled,
  .narr-controls .nc-btn[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
    background: #ffffff;
    color: #b22b2b;
    transform: none;
  }
  .narr-controls.narr-active .nc-btn { opacity: 1; }
  .narr-controls.narr-active .nc-pause {
    background: #c44141;
    color: #ffffff;
    animation: pauseBtnPulse 1.2s ease-in-out infinite;
  }
  .narr-scrub-wrap {
    flex: 0 0 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 14px;
  }
  .narr-scrub {
    width: 142px;
    accent-color: #c44141;
    cursor: pointer;
  }
  .narr-scrub:disabled {
    opacity: 0.28;
    cursor: not-allowed;
  }
  @keyframes pauseBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(196,65,65,0.55); }
    50%      { box-shadow: 0 0 0 8px rgba(196,65,65,0); }
  }

  /* ===================== GRID ===================== */
  .grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    gap: 16px;
    min-height: 0;
  }

  .card {
    background: var(--card-bg);
    border: 1px solid rgba(147, 188, 207, 0.90);
    border-radius: 18px;
    padding: 18px 18px 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .card .card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .4px;
    color: #0d2e44;
    margin-bottom: 14px;
  }
  .card .card-title .ico {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    color: #2a7fb8;
  }
  .card .card-title .card-title-date {
    margin-left: auto;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0;
    color: #5a6a7a;
    font-variant-numeric: tabular-nums;
  }
  .card .card-title .card-title-date:empty { display: none; }

  #col-timeline,
  #col-tasks {
    background: var(--card-bg);
    box-shadow: var(--shadow);
  }

  #current-step {
    display: none;
  }

  /* ===================== TIMELINE (LEFT) ===================== */
  .current-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px 16px;
    font-weight: 600;
    color: #0d2e44;
  }
  .current-step .time {
    color: #5a6a7a;
    font-weight: 600;
    width: 48px;
  }
  .current-step .dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #4ea3d6;
    box-shadow: 0 0 0 4px rgba(78, 163, 214, 0.25);
  }

  .timeline-completed {
    margin: 0 0 12px;
    max-height: min(280px, 42vh);
    overflow: auto;
    padding: 0 2px;
    flex-shrink: 0;
  }
  .timeline-completed:has(#timeline-completed-list:empty) {
    display: none;
    margin: 0;
    padding: 0;
  }
  #timeline-completed-list {
    list-style: none;
    padding: 0 4px;
  }

  .upcoming {
    border: 1px solid rgba(188, 214, 226, 0.95);
    border-radius: 14px;
    padding: 10px 8px;
    background: #fbfdfe;
    box-shadow: var(--shadow-surface);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .upcoming-header {
    font-size: 11.5px;
    font-weight: 700;
    color: #6d7e8c;
    letter-spacing: .8px;
    padding: 6px 10px 10px;
  }
  .timeline {
    list-style: none;
    overflow: auto;
    padding: 0 4px;
  }
  .timeline li {
    display: grid;
    grid-template-columns: 56px 18px 1fr;
    align-items: center;
    gap: 6px;
    padding: 8px 8px;
    border-radius: 10px;
    font-size: 14px;
    color: #2a3e4f;
  }
  .timeline li.active {
    background: var(--highlight);
    box-shadow: inset 0 0 0 1.5px #9bccdf;
  }
  .timeline li .time { font-weight: 600; color: #4a5b6c; }
  .timeline li .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #c5d3dd;
  }
  .timeline li.active .dot {
    background: #4ea3d6;
    box-shadow: 0 0 0 3px rgba(78,163,214,.25);
  }

  /* ===================== TASKS (CENTER) ===================== */
  #tasks-pane {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .tasks {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    padding-right: 4px;
  }
  .task {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 14px;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(203, 221, 231, 0.98);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: var(--shadow-surface);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    cursor: pointer;
  }
  .task:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(139, 187, 211, 0.95);
  }
  .task-ico {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: #f1f7fb;
    display: grid; place-items: center;
    color: #2a7fb8;
  }
  /* Card overview (intro) — nổi nhẹ, viền đậm hơn một chút */
  .task.task-overview {
    background: linear-gradient(135deg, #eef5fb 0%, #ffffff 60%);
    border-color: #c5d8e6;
  }
  .task.task-overview .task-ico {
    background: #4472C4;
    color: #ffffff;
  }
  .task.task-overview .task-body h3 {
    color: #4472C4;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 8px;
  }
  .task.task-overview .task-body h3 #task-todo-count {
    color: #ef4444;
    font-weight: 900;
    font-size: 1.55em;
    line-height: 1;
    margin: 0 3px;
    display: inline-block;
    vertical-align: -2px;
  }
  /* Cụm "X việc bạn cần làm ngay" giữ tĩnh; mũi tên chevron flow phía sau dẫn mắt
     xuống danh sách công việc */
  @keyframes attnPulseBadge {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245,158,11,0); background: #fff3bf; }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(245,158,11,0.30); background: #ffe066; }
  }
  .task-todo-phrase {
    display: inline-block;
  }
  .badge.attn-pulse {
    animation: attnPulseBadge 1.2s ease-in-out infinite;
  }
  .task-todo-arrow {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    color: #ef4444;
    line-height: 0.55;
    font-size: 35px;
    font-weight: 900;
  }
  .task-todo-arrow > span {
    opacity: 0.3;
    animation: arrowFlowDown 3.6s ease-in-out infinite;
  }
  .task-todo-arrow > span:nth-child(1) { animation-delay: 0s; }
  .task-todo-arrow > span:nth-child(2) { animation-delay: 0.55s; }
  .task-todo-arrow > span:nth-child(3) { animation-delay: 1.1s; }
  @keyframes arrowFlowDown {
    0%   { opacity: 0.3; transform: translateY(-3px); }
    20%  { opacity: 1;   transform: translateY(0); }
    45%  { opacity: 0.7; transform: translateY(3px); }
    70%  { opacity: 0.45; transform: translateY(1px); }
    100% { opacity: 0.3; transform: translateY(-3px); }
  }
  /* Intro narration — column highlight (nhấp nháy liên tục cho tới khi đọc xong intro cột) */
  @keyframes introColBlink {
    0%, 100% { box-shadow: 0 1px 3px rgba(15,36,71,0.06); transform: scale(1); }
    50%      { box-shadow: 0 0 0 6px rgba(68,114,196,0.45), 0 8px 24px rgba(68,114,196,0.30); transform: scale(1.015); }
  }
  .intro-col-blink {
    animation: introColBlink 0.9s ease-in-out infinite;
    position: relative;
    z-index: 2;
  }
  /* Intro narration — item/element highlight (nháy liên tục trong khi chunk đang đọc) */
  @keyframes introItemBlink {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(245,158,11,0);
      outline-color: rgba(245,158,11,0);
      background-color: transparent;
    }
    50% {
      box-shadow: 0 0 0 5px rgba(245,158,11,0.40), 0 8px 20px rgba(15,36,71,0.10);
      outline-color: rgba(245,158,11,0.95);
      background-color: rgba(255,243,191,0.62);
    }
  }
  .intro-item-blink {
    animation: introItemBlink 0.7s ease-in-out infinite;
    border-radius: 10px;
    outline: 2px solid transparent;
    outline-offset: 2px;
    position: relative;
    z-index: 3;
  }
  .patient-title.intro-item-blink,
  .card-title.intro-item-blink,
  .task-body.intro-item-blink,
  .result h4.intro-item-blink,
  .result-viz.intro-item-blink,
  .result-label.intro-item-blink {
    padding: 3px 6px;
    margin-inline: -6px;
  }
  .acute-row.intro-item-blink,
  .acute-none-row.intro-item-blink {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
  }
  .task.intro-item-blink,
  .result.intro-item-blink,
  .current-step.intro-item-blink {
    background: #fff7d6 !important;
    border-color: #f59e0b !important;
  }
  .badge.intro-item-blink {
    background: #ffe066 !important;
    color: #7c3f00;
  }
  /* Khi 1 timeline <li> blink — đậm hơn vì viền nhỏ */
  #timeline-list li.intro-item-blink {
    background: #fff3bf !important;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.55), 0 2px 8px rgba(245,158,11,0.25) !important;
  }

  /* Step "tạm cần chú ý" — highlight pulse riêng (không xung đột với intro-item-blink) */
  @keyframes stepAttention {
    0%, 100% { box-shadow: 0 0 0 0 rgba(30,136,229,0.55), 0 2px 6px rgba(30,136,229,0.15); background: #e3f2fd; }
    50%      { box-shadow: 0 0 0 6px rgba(30,136,229,0), 0 2px 6px rgba(30,136,229,0.10); background: #ffffff; }
  }
  #timeline-list li.step-attention {
    animation: stepAttention 1.6s ease-in-out infinite;
    border-radius: 8px;
  }
  /* Trong khi intro đang đọc — TẠM DỪNG pulse "Đang có N việc…" và các badge
     để không tranh hiệu ứng với hiệu ứng nhấp nháy intro */
  body.intro-running .task-todo-phrase,
  body.intro-running .task-todo-arrow > span,
  body.intro-running .badge.attn-pulse {
    animation-play-state: paused !important;
    transform: none !important;
    box-shadow: none !important;
  }
  body.intro-running .badge.attn-pulse {
    background: #fff3bf !important;
  }

  /* CCCD scan overlay — hiện khi narration đọc chunk "quét mã căn cước công dân" */
  .cccd-scan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 36, 71, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: cccdOverlayFadeIn 0.35s ease-out;
  }
  .cccd-scan-overlay[hidden] { display: none; }
  @keyframes cccdOverlayFadeIn {
    from { opacity: 0; backdrop-filter: blur(0); }
    to   { opacity: 1; backdrop-filter: blur(2px); }
  }
  .cccd-scan-card {
    background: linear-gradient(135deg, #ffffff 0%, #f1f7fb 100%);
    border: 3px solid #1e88e5;
    border-radius: 18px;
    padding: 26px 36px 22px;
    box-shadow: 0 20px 60px rgba(15, 36, 71, 0.45);
    text-align: center;
    animation: cccdCardPulse 1.1s ease-in-out infinite;
  }
  @keyframes cccdCardPulse {
    0%, 100% {
      transform: scale(1);
      box-shadow: 0 20px 60px rgba(15,36,71,0.45), 0 0 0 0 rgba(255, 56, 56, 0);
      border-color: #1e88e5;
    }
    50% {
      transform: scale(1.035);
      box-shadow: 0 20px 60px rgba(15,36,71,0.45), 0 0 0 18px rgba(255, 56, 56, 0.18);
      border-color: #ff3838;
    }
  }
  .cccd-scan-card svg {
    display: block;
    width: 480px;
    max-width: 70vw;
    height: auto;
  }
  @keyframes cccdScanBeamMove {
    0%   { transform: translateX(0); opacity: 1; }
    50%  { transform: translateX(15px); opacity: 0.5; }
    100% { transform: translateX(0); opacity: 1; }
  }
  .cccd-scan-card .cccd-scan-beam {
    animation: cccdScanBeamMove 0.8s ease-in-out infinite;
  }
  .cccd-scan-label {
    font-size: 18px;
    font-weight: 800;
    color: #0d2e44;
    margin-top: 10px;
    letter-spacing: 0.3px;
  }
  .task-body h3 {
    font-size: 17px;
    font-weight: 800;
    color: #0d2e44;
    margin-bottom: 4px;
  }
  .task-body p {
    font-size: 13.5px;
    color: #5a6a7a;
    line-height: 1.45;
  }
  .task-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 90px;
  }
  .task-meta a {
    color: var(--link);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
  }
  .task-meta a:hover { text-decoration: underline; }
  .badge {
    background: var(--badge-bg);
    color: #b45309;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--badge);
  }

  /* ===================== RESULTS (RIGHT, LIGHT) ===================== */
  .results {
    background: var(--panel-bg);
    color: var(--vg-dark-2);
    border: 1px solid rgba(147, 188, 207, 0.90);
  }
  .results .card-title { color: var(--vg-dark-2); }
  .results .card-title .ico { color: var(--vg-dark-2); }

  .result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding-right: 4px;
  }
  .result {
    background: #ffffff;
    border: 1px solid rgba(203, 221, 231, 0.98);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow-surface);
  }
  .result h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--vg-dark-2);
    margin-bottom: 10px;
  }
  .result-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    align-items: center;
    gap: 12px;
  }
  .result-icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    color: var(--vg-dark-2);
  }
  .result-viz { position: relative; min-height: 56px; }
  .result-label {
    font-size: 11px;
    color: var(--vg-dark-2);
    margin-top: 4px;
    opacity: .75;
  }

  /* Gout meter */
  .meter {
    position: relative;
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(90deg, #ef4444 0%, #f59e0b 35%, #10b981 60%, #3b82f6 100%);
    overflow: visible;
  }
  .meter::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 18%;
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid var(--vg-dark-2);
  }

  /* Kidney ring */
  .ring-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
  .ring {
    --p: 85;
    width: 66px; height: 66px;
    border-radius: 50%;
    background:
      conic-gradient(#3aa776 calc(var(--p) * 1%), #e3eef3 0);
    display: grid; place-items: center;
    position: relative;
  }
  .ring::after {
    content: "";
    position: absolute;
    inset: 7px;
    background: #ffffff;
    border-radius: 50%;
  }
  .ring span {
    position: relative;
    z-index: 1;
    font-weight: 800;
    font-size: 14px;
    color: var(--vg-dark-2);
  }

  /* Heart line chart */
  .heart-line { width: 100%; height: 56px; }

  /* Liver bars */
  .bars {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 6px;
    height: 56px;
    padding-right: 4px;
  }
  .bars div {
    width: 14px;
    background: linear-gradient(180deg, #1a3160, #0f2447);
    border-radius: 3px 3px 0 0;
  }

  /* ===================== VITAL SIGNS MODAL ===================== */
  #vs-modal { z-index: 1200; }
  .vs-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    padding: 18px 22px;
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    overflow: hidden;
  }
  .vs-col {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: hidden;
  }
  /* Both columns now use plain white with a soft border */
  .vs-col.vs-input  { background: #ffffff; }
  .vs-col.vs-output { background: #ffffff; }
  .vs-col-title {
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--vg-dark-2);
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    letter-spacing: 0.3px;
    text-transform: uppercase;
  }
  .vs-col-body {
    flex: 1;
    overflow: auto;
    padding: 14px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .vs-section {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 14px 14px;
  }
  /* LEFT (data entry): transparent sections with soft outline only */
  .vs-input .vs-section {
    background: transparent;
    border: 1px solid rgba(15, 36, 71, 0.10);
  }
  /* RIGHT (medical record view): plain white sections, faint border */
  .vs-output .vs-section { background: #ffffff; border-color: var(--card-border); }
  .vs-output .vs-readonly { background: #ffffff; border-color: var(--card-border); }
  .vs-output .vs-table-wrap { background: #ffffff; border-color: var(--card-border); }
  .vs-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--vg-dark-2);
    margin: 0 0 10px;
  }
  .vs-section-ico {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    color: var(--vg-dark-2);
  }
  .vs-fields {
    display: grid;
    gap: 10px 14px;
  }
  .vs-fields.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .vs-fields.cols-2 { grid-template-columns: 1fr 1fr; }
  .vs-fields.cols-1 { grid-template-columns: 1fr; }
  .vs-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }
  .vs-field label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--vg-text-3, #4a5b6c);
    line-height: 1.3;
  }
  .vs-field label .req { color: #b91c1c; margin-left: 2px; }
  .vs-input,
  .vs-select {
    width: 100%;
    padding: 8px 11px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--vg-dark-2);
    border: 1.5px solid var(--vg-border);
    border-radius: 8px;
    background: #ffffff;
    transition: border-color .15s, box-shadow .15s;
  }
  .vs-input::placeholder { color: var(--vg-text-5, #98a4b1); font-weight: 500; }
  .vs-input:focus,
  .vs-select:focus {
    outline: none;
    border-color: var(--primary, #0f2447);
    box-shadow: 0 0 0 3px rgba(15,36,71,.08);
  }
  .vs-radio-row {
    display: flex;
    gap: 18px;
    padding: 4px 0 2px;
  }
  .vs-radio-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    color: var(--vg-dark-2);
    cursor: pointer;
    font-weight: 600;
  }
  .vs-radio-row input[type="radio"] { accent-color: var(--vg-dark-2); }
  .vs-readonly {
    width: 100%;
    padding: 8px 11px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--vg-dark-2);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #ffffff;
    min-height: 32px;
    line-height: 1.3;
    word-break: break-word;
  }
  .vs-readonly.empty { color: var(--vg-text-5, #98a4b1); font-weight: 400; font-style: italic; }
  .vs-table-wrap {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 12px 12px;
  }
  .vs-table-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--vg-dark-2);
    margin-bottom: 8px;
  }
  table.vs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  table.vs-table th,
  table.vs-table td {
    padding: 6px 8px;
    border: 1px solid var(--card-border);
    text-align: center;
    vertical-align: middle;
  }
  table.vs-table thead th {
    background: #ffffff;
    color: var(--vg-dark-2);
    font-weight: 800;
    font-size: 11.5px;
    letter-spacing: 0.2px;
    border-bottom: 2px solid var(--vg-dark-2);
  }
  table.vs-table tbody td { color: var(--vg-dark-2); background: #ffffff; }
  table.vs-table tbody tr:nth-child(odd) td { background: #fafcfd; }
  table.vs-table .col-note { text-align: left; }
  .vs-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-top: 1px solid var(--card-border);
    background: #fff;
  }
  .vs-btn {
    padding: 9px 22px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 8px;
    border: 1.5px solid var(--vg-border);
    background: #fff;
    color: var(--vg-dark-2);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .vs-btn:hover { background: var(--bg-1); border-color: var(--vg-dark-1); }
  .vs-btn-primary {
    background: var(--vg-dark-2);
    color: #ffffff;
    border-color: var(--vg-dark-2);
  }
  .vs-btn-primary:hover {
    background: var(--vg-dark-1);
    color: #fff;
    border-color: var(--vg-dark-1);
  }
  /* Card "Đo sinh hiệu" trên dashboard mở được */
  .result[data-action="open-vital-signs"] {
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
  }
  .result[data-action="open-vital-signs"]:hover {
    border-color: var(--vg-dark-1);
    box-shadow: 0 6px 16px rgba(15, 36, 71, .12);
  }

  /* ===================== BỆNH ÁN NGOẠI TRÚ (HIS) ===================== */
  .ba-screen {
    position: fixed; inset: 0;
    z-index: 1100;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .ba-screen[hidden] { display: none !important; }

  /* Top nav bar — Viện Gút sky-blue, navy text */
  .ba-topbar {
    flex: none;
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    color: var(--vg-dark-2);
    display: flex;
    align-items: center;
    padding: 0 18px;
    height: 56px;
    gap: 18px;
    border-bottom: 1px solid var(--card-border);
  }
  .ba-logo {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 16px;
    color: #166534;
    white-space: nowrap;
  }
  .ba-logo-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #166534;
    color: #ffffff;
    font-weight: 900;
    display: grid; place-items: center;
    font-size: 15px;
    letter-spacing: 0.5px;
  }
  .ba-nav {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    font-size: 13.5px;
    font-weight: 600;
  }
  .ba-nav a {
    color: var(--vg-dark-2);
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
  }
  .ba-nav a:hover { background: rgba(65,124,149,0.15); }
  .ba-nav a.active {
    background: #417C95;
    color: #ffffff;
    font-weight: 800;
  }
  .ba-top-right {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px;
  }
  .ba-top-link { color: var(--vg-dark-2); cursor: pointer; opacity: .85; }
  .ba-top-link:hover { opacity: 1; text-decoration: underline; }
  .ba-back-btn {
    background: #417C95;
    border: 1px solid #417C95;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
  }
  .ba-back-btn:hover { background: #2d5a6f; border-color: #2d5a6f; color: #ffffff; }
  .ba-user-chip {
    display: flex; align-items: center; gap: 6px;
    background: #ffffff;
    color: var(--vg-dark-2);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid var(--card-border);
  }

  /* Body grid: left | main | right */
  .ba-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 230px 1fr 230px;
    gap: 12px;
    padding: 12px;
    overflow: hidden;
  }
  .ba-col {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Patient card */
  .ba-pt-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 12px;
    font-size: 12.5px;
    color: #2b3a4a;
  }
  .ba-pt-photo {
    width: 64px; height: 80px;
    border-radius: 8px;
    background: linear-gradient(180deg, #c5d8e8, #98b8d4);
    margin: 0 auto 8px;
    display: grid; place-items: center;
    color: #ffffff; font-size: 24px;
  }
  .ba-pt-name { font-weight: 800; color: #0f2447; font-size: 13px; }
  .ba-pt-msbn {
    display: inline-block;
    background: #dcecf3;
    color: #3a6878;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    margin: 4px 0;
  }
  .ba-pt-line {
    display: flex; align-items: flex-start; gap: 6px;
    margin-top: 4px; line-height: 1.35;
  }
  .ba-pt-line .ico {
    flex: none; width: 14px; height: 14px;
    margin-top: 2px;
    color: #6b7a8c;
  }
  .ba-pt-distance {
    color: #2b6df0;
    font-size: 11px;
    font-weight: 600;
    padding-left: 20px;
  }

  /* Left + right menu sections */
  .ba-menu {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 8px 10px 10px;
  }
  .ba-menu-title {
    display: flex; align-items: center; justify-content: space-between;
    color: #0f2447;
    font-weight: 800;
    font-size: 13px;
    padding: 4px 2px 6px;
    border-bottom: 1px solid #eaeef2;
  }
  .ba-menu-title .ico { color: #417C95; }
  .ba-menu-list { padding: 6px 4px 0; }
  .ba-menu-list a {
    display: block;
    padding: 5px 8px;
    color: #2b3a4a;
    font-size: 12.5px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
  }
  .ba-menu-list a:hover { background: #f1f5f9; color: #0f2447; }
  .ba-menu-list a.active { background: #e6f0f5; color: #3a6878; font-weight: 700; }

  /* Action buttons (right side coloured) */
  .ba-act {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,.08);
  }
  .ba-act.toa     { background: #f59e0b; }
  .ba-act.tlbn    { background: #7c3aed; }
  .ba-act.tlng    { background: #417C95; }
  .ba-act.ai      { background: #ef4444; }
  .ba-act.cd      { background: #417C95; }
  .ba-act.lsk     { background: #dc2626; }

  /* Main content */
  .ba-main-col {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    overflow: auto;
    display: flex;
    flex-direction: column;
  }
  .ba-bcrumb-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid #eaeef2;
    font-size: 12.5px;
    color: #5a6a7a;
  }
  .ba-bcrumb-row .crumb { color: #5a6a7a; }
  .ba-bcrumb-row .crumb b { color: #0f2447; font-weight: 700; }
  .ba-bcrumb-right { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }
  .ba-bcrumb-right select { padding: 4px 8px; font-size: 12px; }
  .ba-bcrumb-right a { color: #2b6df0; font-weight: 700; cursor: pointer; }

  .ba-tabs-row {
    display: flex;
    border-bottom: 1px solid #eaeef2;
    padding: 0 12px;
    gap: 6px;
    overflow-x: auto;
  }
  .ba-tab {
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 700;
    color: #5a6a7a;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.3px;
  }
  .ba-tab.active {
    color: #417C95;
    border-bottom-color: #417C95;
  }
  .ba-tab:hover { color: #0f2447; }

  .ba-form {
    padding: 20px 24px 28px;
    flex: 1;
    overflow: auto;
  }
  .ba-clinic-head {
    display: grid;
    grid-template-columns: 80px 1fr 1fr;
    gap: 16px;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid #eaeef2;
    margin-bottom: 16px;
  }
  .ba-clinic-logo {
    width: 72px; height: 72px;
    border-radius: 10px;
    background: linear-gradient(135deg, #417C95, #2d5a6f);
    color: #ffffff;
    display: grid; place-items: center;
    font-weight: 900; font-size: 32px;
    letter-spacing: 1px;
  }
  .ba-clinic-info { font-size: 11.5px; color: #2b3a4a; line-height: 1.4; }
  .ba-clinic-info strong { display: block; font-size: 13px; color: #0f2447; }
  .ba-clinic-info p { margin: 2px 0 0; }
  .ba-doc-title {
    text-align: right;
    font-size: 22px;
    font-weight: 900;
    color: #0f2447;
    letter-spacing: 0.5px;
  }

  .ba-summary-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 18px;
    font-size: 13px;
  }
  .ba-sum-item { display: flex; align-items: center; gap: 6px; color: #2b3a4a; }
  .ba-sum-item .ico { color: #417C95; flex: none; }
  .ba-sum-item b { color: #0f2447; font-weight: 700; }

  .ba-section-title {
    color: #417C95;
    font-weight: 800;
    font-size: 15px;
    margin: 18px 0 10px;
  }

  .ba-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px 18px;
    font-size: 13px;
    color: #2b3a4a;
  }
  .ba-fields .span-2 { grid-column: span 2; }
  .ba-fields .span-3 { grid-column: span 3; }
  .ba-fields .lbl { font-weight: 700; color: #2b3a4a; }
  .ba-fields .val { color: #0f2447; }
  .ba-fields .chk-row { display: flex; gap: 14px; align-items: center; }
  .ba-fields .chk-row label { display: flex; align-items: center; gap: 4px; color: #2b3a4a; }
  .ba-pad-block {
    background: #f4f7fa;
    border: 1px dashed #cdd6df;
    border-radius: 8px;
    padding: 10px 14px;
    min-height: 90px;
    color: #5a6a7a;
    font-size: 12.5px;
  }

  /* Vital signs row (within bệnh án) */
  .ba-vital-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px 12px;
    margin: 10px 0 14px;
  }
  .ba-vital-card {
    display: flex; align-items: center; gap: 8px;
    background: #f8fafc;
    border: 1px solid #eaeef2;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
  }
  .ba-vital-card .ico { color: #417C95; flex: none; }
  .ba-vital-card .lbl { color: #5a6a7a; font-weight: 600; }
  .ba-vital-card .val { color: #0f2447; font-weight: 800; margin-left: auto; }

  .ba-ha-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
  }
  .ba-ha-table th, .ba-ha-table td {
    border: 1px solid #eaeef2;
    padding: 6px 10px;
    text-align: left;
  }
  .ba-ha-table thead th { background: #f4f7fa; color: #2b3a4a; font-weight: 700; }
  .ba-ha-table tbody td { color: #0f2447; }

  .ba-add-history-btn {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 8px;
    background: #ffffff;
    border: 1px dashed #2b6df0;
    color: #2b6df0;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
  }
  .ba-add-history-btn:hover { background: #eaf2fe; }

  .ba-section-major {
    margin-top: 22px;
    font-size: 17px;
    font-weight: 800;
    color: #0f2447;
    border-top: 1px solid #eaeef2;
    padding-top: 14px;
  }
  .ba-section-major-u { text-decoration: underline; }

  /* HA history rows */
  .ba-ha-table-history .ha-group-row td {
    background: #f8fafc;
    color: #0f2447;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
  }
  .ba-ha-table-history .ha-group-tbody.ha-open .ha-group-row td { background: #eef4f9; }
  .ba-ha-table-history .ha-meas-row td { padding-left: 28px; background: #ffffff; }
  .ba-ha-table-history .ha-group-tbody:not(.ha-open) .ha-meas-row { display: none; }
  .ba-ha-table-history:not(.history-shown) .ha-history { display: none; }
  .ha-arrow { display: inline-block; width: 14px; color: #5a6a7a; }

  /* Document-style rows for clinical sections */
  .ba-doc-section { padding: 6px 0 10px; border-bottom: 1px solid #eaeef2; }
  .ba-doc-section:last-child { border-bottom: none; }
  .ba-doc-h {
    font-size: 14px;
    font-weight: 800;
    color: #0f2447;
    margin: 6px 0 6px;
  }
  .ba-doc-row {
    font-size: 13.5px;
    color: #0f2447;
    line-height: 1.55;
    padding: 4px 0;
  }
  .ba-doc-row b { font-weight: 700; }

  /* Right column section headings */
  .ba-right-section-title {
    color: #0f2447;
    font-weight: 800;
    font-size: 13px;
    padding: 4px 2px 6px;
    border-bottom: 1px solid #eaeef2;
    display: flex; align-items: center; gap: 6px;
  }
  .ba-result-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 4px;
    font-size: 12.5px;
    color: #2b3a4a;
    border-bottom: 1px solid #f1f5f9;
  }
  .ba-result-row:last-child { border-bottom: none; }
  .ba-result-row .dl { color: #5a6a7a; cursor: pointer; }
  .ba-result-pill {
    background: #ffffff;
    border-radius: 6px;
  }
  .ba-result-toolbar {
    display: flex; justify-content: flex-end; gap: 6px;
    font-size: 12px;
    color: #5a6a7a;
    padding: 2px 4px 4px;
  }

  /* Vital signs grid */
  .vital-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    align-items: center;
  }
  .vital-item {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }
  .vital-label {
    font-size: 10.5px;
    color: var(--vg-text-5, #8898ac);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
  }
  .vital-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--vg-dark-2);
    font-variant-numeric: tabular-nums;
  }
  .vital-unit {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--vg-text-5, #8898ac);
    margin-left: 2px;
    letter-spacing: 0;
  }

  /* ===================== BOTTOM NAV ===================== */
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 4px;
  }
  .nav-item {
    background: #fff;
    border: 1px solid rgba(178, 207, 221, 0.98);
    border-radius: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: #0d2e44;
    text-decoration: none;
    box-shadow: var(--shadow-nav);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .2s ease;
    font-size: 15px;
  }
  .nav-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 44px rgba(15, 36, 71, 0.22), 0 8px 18px rgba(15, 36, 71, 0.12), 0 1px 0 rgba(255,255,255,0.98) inset;
    border-color: rgba(139, 187, 211, 0.95);
  }
  .nav-item.active {
    background: #ffffff;
    border-color: #2a7fb8;
    box-shadow: var(--shadow-nav-active);
  }
  .nav-item .nv-ico {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    color: #2a7fb8;
  }

  /* Scrollbars */
  .timeline::-webkit-scrollbar,
  .tasks::-webkit-scrollbar,
  .result-list::-webkit-scrollbar { width: 8px; }
  .timeline::-webkit-scrollbar-thumb,
  .tasks::-webkit-scrollbar-thumb { background: #cdd9e0; border-radius: 8px; }
  .result-list::-webkit-scrollbar-thumb { background: #2a3e60; border-radius: 8px; }

  /* ===================== Timeline states & demo controls ===================== */
  .upcoming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px 10px;
  }
  .upcoming-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #6d7e8c;
    letter-spacing: .8px;
  }
  .demo-controls { display: none; }
  .dc-btn {
    font-size: 10.5px;
    padding: 3px 9px;
    border: 1px solid #cdd9e0;
    background: #fff;
    border-radius: 999px;
    cursor: pointer;
    color: #5a6a7a;
    font-weight: 700;
    letter-spacing: .2px;
    transition: all .15s ease;
  }
  .dc-btn:hover { border-color: #9bccdf; color: #2a7fb8; }
  .dc-btn.on {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }

  .timeline li {
    transition: background-color .25s ease, color .25s ease,
                opacity .25s ease, box-shadow .25s ease;
  }
  .timeline li .dot {
    transition: background-color .25s ease, box-shadow .25s ease;
  }

  /* Đã hoàn thành */
  .timeline li.completed { color: #9aa9b6; opacity: .7; }
  .timeline li.completed .time { color: #aab7c2; }
  .timeline li.completed .dot {
    background: #10b981;
    position: relative;
  }
  .timeline li.completed .dot::after {
    content: "";
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 7'/></svg>");
    background-size: 70% 70%;
    background-position: center;
    background-repeat: no-repeat;
  }

  /* Đang thực hiện */
  .timeline li.active {
    background: var(--highlight);
    box-shadow: inset 0 0 0 1.5px #9bccdf;
    color: #0d2e44;
    font-weight: 700;
  }
  .timeline li.active .dot {
    background: #4ea3d6;
    animation: pulse 1.6s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(78,163,214,.30); }
    50%      { box-shadow: 0 0 0 8px rgba(78,163,214,.08); }
  }

  /* Kế tiếp */
  .timeline li.next {
    background: #f1f7fb;
    box-shadow: inset 0 0 0 1px #d8e6ec;
  }
  .timeline li.next .dot { background: #6cb6d9; }

  /* Current step ở trên cùng */
  .current-step { transition: opacity .25s ease; }
  .current-step .step-name { font-weight: 700; flex: 1; }
  .current-step .dot { animation: pulse 1.6s ease-in-out infinite; }
  .current-step.empty { opacity: .55; font-style: italic; }
  .current-step.empty .dot {
    background: #c5d3dd !important;
    box-shadow: none !important;
    animation: none;
  }
  .current-step.done .dot {
    background: #10b981 !important;
    animation: none;
  }

  /* ===================== Responsive ===================== */
  @media (max-width: 1200px) {
    .app {
      height: auto;
      min-height: 100vh;
      overflow: visible;
    }
    .grid { grid-template-columns: 1fr 1fr; }
    .results { grid-column: 1 / -1; }
    .topbar { grid-template-columns: 1fr; text-align: center; }
    .patient-title { transform: none; max-width: 100%; }
    .datetime { text-align: center; }
    .brand { justify-content: center; }
  }
  @media (max-width: 760px) {
    .grid { grid-template-columns: 1fr; }
    .bottom-nav { grid-template-columns: 1fr 1fr; }
    .patient-title .t-sub,
    .patient-title .t-main { white-space: normal; }
    .patient-title .t-main { font-size: 20px; }
  }
  /* ======================================================== */
  /* Modal: Tự khai bệnh (ACR/EULAR 2015 + chẩn đoán phân biệt) */
  /* ======================================================== */
  .modal[hidden] { display: none !important; }
  .modal {
    position: fixed; inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
  }
  .modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 36, 71, 0.55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: pointer;
  }
  .modal-card {
    position: relative;
    background: #fff;
    border-radius: 18px;
    width: min(1900px, calc(100vw - 16px));
    height: min(1100px, calc(100vh - 16px));
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(15,36,71,.35);
    overflow: hidden;
    animation: modalIn .25s ease;
  }
  @keyframes modalIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }

  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--bg-2);
    background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  }
  .modal-header h2 {
    font-size: 20px;
    color: var(--vg-dark-2);
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.2px;
  }
  .modal-header h2 .sr-pt {
    color: var(--vg-dark-1);
    font-weight: 800;
  }
  .modal-header .subtitle {
    font-size: 12.5px;
    color: #5a6a7a;
    font-weight: 500;
    margin-top: 3px;
  }
  .close-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--vg-border-soft);
    background: #ffffff;
    cursor: pointer;
    display: grid; place-items: center;
    font-size: 22px; line-height: 1;
    color: var(--vg-dark-2);
    transition: background .15s, color .15s, border-color .15s;
  }
  .close-btn:hover {
    background: var(--bg-1);
    color: var(--vg-dark-2);
    border-color: var(--vg-dark-1);
  }
  .sr-test-reset-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px dashed #f59e0b;
    background: #fffbeb;
    color: #92400e;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    margin-right: 8px;
    transition: background .15s, color .15s, border-color .15s;
  }
  .sr-test-reset-btn:hover {
    background: #fde68a;
    border-color: #d97706;
    color: #78350f;
  }

  .modal-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto 1fr;
    flex: 1;
    min-height: 0;
  }
  /* HTMX swap target — display:contents giữ tab/nav/aside là con trực tiếp của grid */
  #sr-workspace-inner {
    display: contents;
  }
  /* Hàng 1: Tabs full width (chiếm cả 2 cột) */
  .modal-body .sr-tabs {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  /* Hàng 2 cột trái: main content (tab panels) */
  .modal-body .sr-tabs-wrap {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
  }
  /* Hàng 2 cột phải: panel ghi nhận */
  .modal-body .record-aside {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
    flex-direction: column;
    border-left: 1px solid var(--vg-border);
    border-top: 0;
    max-height: none;
  }
  .modal-body .record-aside .record-header {
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--vg-border);
    min-width: 0;
    background: var(--bg-1);
    padding: 12px 16px;
  }
  .modal-body .record-aside .record-header > div { flex: 1 1 auto; }
  .modal-body .record-aside .record-header .record-count {
    align-self: center;
    margin-top: 0;
  }
  .modal-body .record-aside .record-body {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 14px 16px;
    gap: 0;
  }
  .modal-body .record-aside .record-tip { display: flex; }
  .modal-body .record-aside .record-group {
    margin-bottom: 14px;
    min-width: 0;
    max-width: none;
    flex: none;
  }
  .modal-body .record-aside .record-group ul {
    max-height: none;
    overflow: visible;
  }
  .modal-body .record-aside .record-empty {
    flex-direction: column;
    padding: 28px 14px;
  }
  /* Tab 3 (Tự khai kết quả điều trị tại Viện Gút) — chia 2 cột bằng nhau */
  .modal-body[data-active-tab="3"] {
    grid-template-columns: 1fr 1fr;
  }
  /* Tab 2 (Tự khai bệnh trước khi đến Viện Gút) — chia 2 cột bằng nhau */
  .modal-body[data-active-tab="2"] {
    grid-template-columns: 1fr 1fr;
  }
  /* Tab 0 (Năng lực tự khai bệnh) + Tab 1 (Tự khai lý do đến khám)
     — cột phải ngang bằng độ rộng 1 tab header (~25%) */
  .modal-body[data-active-tab="0"],
  .modal-body[data-active-tab="1"] {
    grid-template-columns: 3fr 1fr;
  }
  /* Conclusion banner trong panel ghi nhận năng lực */
  .record-aside .conc-banner {
    margin-bottom: 12px;
    border-radius: 9px;
    padding: 10px 12px;
    border: 1.5px solid;
    background: #fafdff;
  }
  .conc-banner .conc-label {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
  }
  .conc-banner .conc-value {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
  }
  .conc-banner-self { border-color: var(--teal-accent); background: var(--teal-soft); }
  .conc-banner-self .conc-label, .conc-banner-self .conc-value { color: #047857; }
  .conc-banner-self_helped { border-color: var(--primary); background: var(--primary-tint); }
  .conc-banner-self_helped .conc-label, .conc-banner-self_helped .conc-value { color: var(--primary-deep); }
  .conc-banner-family { border-color: #f59e0b; background: #fef3c7; }
  .conc-banner-family .conc-label, .conc-banner-family .conc-value { color: #854d0e; }
  .conc-banner-staff { border-color: #f59e0b; background: #ffedd5; }
  .conc-banner-staff .conc-label, .conc-banner-staff .conc-value { color: #9a3412; }
  .conc-banner-medical { border-color: #ef4444; background: #fee2e2; }
  .conc-banner-medical .conc-label, .conc-banner-medical .conc-value { color: #991b1b; }
  /* History record — progress bar mini cho mỗi item */
  .hx-record-item {
    background: #fff;
    border: 1px solid var(--vg-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 12px;
  }
  .hx-record-item.complete { border-color: var(--teal-accent); background: var(--teal-soft); }
  .hx-record-item .hx-rec-title {
    font-weight: 700;
    color: var(--vg-text-2);
    margin-bottom: 4px;
    line-height: 1.3;
  }
  .hx-record-item .hx-rec-kind {
    font-size: 10.5px;
    color: var(--primary-deep);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }
  .hx-record-item.complete .hx-rec-title { color: #047857; }
  .hx-record-item .hx-rec-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--vg-text-5);
  }
  .hx-record-item.complete .hx-rec-progress { color: #047857; font-weight: 700; }
  .hx-rec-progress .bar {
    flex: 1;
    height: 5px;
    background: #e1e9ee;
    border-radius: 999px;
    overflow: hidden;
  }
  .hx-rec-progress .bar .fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .2s;
  }
  .hx-record-item.complete .hx-rec-progress .bar .fill { background: var(--teal-accent); }

  /* ===== Ghi nhận tự khai bệnh — grouped layout ===== */
  .hx-rec-group {
    margin-bottom: 10px;
  }
  .hx-rec-group:last-child { margin-bottom: 0; }
  .hx-rec-group-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-deep);
    margin: 0 0 5px 2px;
  }
  .hx-rec-group-symptom .hx-rec-group-title { color: #047857; }
  .hx-rec-group-acute   .hx-rec-group-title { color: #b45309; }
  .hx-rec-group-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .hx-rec-row {
    background: #fff;
    border: 1px solid var(--vg-border);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.35;
    display: flex;
    gap: 6px;
    align-items: flex-start;
    color: var(--vg-text-2);
  }
  .hx-rec-num {
    flex: none;
    font-weight: 700;
    color: var(--vg-text-3);
    font-variant-numeric: tabular-nums;
  }
  .hx-rec-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }
  .hx-rec-name {
    font-weight: 700;
    color: var(--vg-dark-2);
  }
  .hx-rec-answer {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
  }
  .hx-rec-x {
    flex: none;
    margin-left: auto;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid var(--vg-border);
    background: #fff;
    color: var(--vg-text-5);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s, color .15s, border-color .15s;
    padding: 0;
  }
  .hx-rec-x:hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
  }
  /* Bottom-strip layout cho panel "Ghi nhận lý do đến khám" */
  .record-aside.record-aside-bottom {
    flex-direction: row;
    border-left: 0;
    border-top: 1px solid var(--vg-border);
    max-height: 180px;
    min-height: 130px;
  }
  .record-aside-bottom .record-header {
    flex-direction: column;
    align-items: flex-start;
    border-bottom: 0;
    border-right: 1px solid var(--vg-border);
    min-width: 260px;
    flex: none;
    background: linear-gradient(135deg, #f6fbfd, #ffffff);
    padding: 12px 16px;
  }
  .record-aside-bottom .record-header > div { flex: 1; }
  .record-aside-bottom .record-header .record-count {
    align-self: stretch;
    text-align: center;
    margin-top: 8px;
  }
  .record-aside-bottom .record-body {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: row;
    gap: 14px;
  }
  .record-aside-bottom .record-tip { display: none; }
  .record-aside-bottom .record-group {
    margin-bottom: 0;
    min-width: 220px;
    max-width: 320px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
  }
  .record-aside-bottom .record-group ul {
    flex: 1;
    overflow-y: auto;
    max-height: 110px;
  }
  .record-aside-bottom .record-empty {
    flex: 1;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .record-aside-bottom .record-empty .ic { margin: 0 0 6px; }
  /* Cột phải — Ghi nhận lý do đến khám */
  .record-aside {
    background: #ffffff;
    border-left: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .record-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    background: var(--bg-1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .record-header h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--vg-dark-2);
    margin: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }
  .record-header .live-clock { display: none !important; }
  /* Zalo-style date pill — appears at top of record body when user starts selecting */
  .record-date-pill {
    align-self: center;
    background: #e5eaf0;
    color: #5a6a7a;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    margin: 8px auto 10px;
    display: inline-block;
    font-variant-numeric: tabular-nums;
  }
  .record-body { background: #ffffff; }
  .record-header .live-clock .live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22,163,74,0.55);
    animation: livePulse 1.6s ease-out infinite;
    flex: none;
  }
  @keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.55); }
    70%  { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
    100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
  }
  .record-count {
    font-size: 11px;
    font-weight: 800;
    background: var(--primary);
    color: #fff;
    padding: 3px 11px;
    border-radius: 999px;
    min-width: 32px;
    text-align: center;
    transition: background .2s;
  }
  .record-count.empty { background: #cfdbe2; color: #5a6a7a; }
  .record-body {
    flex: 1;
    overflow: auto;
    padding: 12px 14px 16px;
  }
  .record-empty {
    text-align: center;
    color: #8a99a6;
    font-size: 12px;
    padding: 28px 14px;
    line-height: 1.55;
  }
  .record-empty .ic {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #eef5f8;
    color: #9bbbcb;
    margin: 0 auto 10px;
    display: grid; place-items: center;
  }
  .record-group { margin-bottom: 14px; }
  .record-group:last-child { margin-bottom: 0; }
  .record-group-title {
    font-size: 10.5px;
    font-weight: 800;
    color: #0a6e8e;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .record-group-title .cnt {
    margin-left: auto;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 999px;
    letter-spacing: 0;
  }
  .record-group ul {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .record-group li {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #d8e6ec;
    border-left: 3px solid var(--primary);
    border-radius: 7px;
    padding: 6px 8px 6px 9px;
    font-size: 11.5px;
    color: #2a3e4f;
    line-height: 1.35;
    animation: recIn .2s ease;
  }
  .record-group[data-id="visit_symptoms"] li { border-left-color: #0a8e6c; }
  .record-group[data-id="has_current_pain"] li { border-left-color: #b45309; }
  .record-group li::before {
    content: "✓";
    color: var(--success);
    font-weight: 800;
    font-size: 12px;
    flex: none;
    line-height: 1.35;
  }
  .rec-remove {
    flex: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid #e1e9ee;
    background: #fff;
    color: #8a99a6;
    cursor: pointer;
    display: grid; place-items: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    transition: all .15s ease;
    font-family: inherit;
  }
  .rec-remove:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
    transform: scale(1.08);
  }
  .record-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #6d7e8c;
    background: #fff8e8;
    border: 1px solid #ffe4a8;
    border-radius: 7px;
    padding: 6px 9px;
    margin-bottom: 10px;
    line-height: 1.4;
  }
  .record-tip::before {
    content: "ⓘ";
    color: #b45309;
    font-weight: 800;
    flex: none;
  }
  .rec-text { flex: 1; min-width: 0; }
  /* Mốc giờ kiểu Zalo: 1 mốc duy nhất ở cuối mỗi nhóm (giờ chốt cuối cùng) */
  .record-group-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 5px;
    font-size: 10px;
    font-weight: 600;
    color: #8a99a6;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
  }
  .record-group-time::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #c5d3da;
  }
  @keyframes recIn {
    from { opacity: 0; transform: translateX(6px); }
    to { opacity: 1; transform: none; }
  }
  @media (max-width: 900px) {
    .modal-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .record-aside {
      border-left: none;
      border-top: 1px solid var(--card-border);
      max-height: 240px;
    }
  }

  /* ============================================================
     3-TAB LAYOUT (Tự khai bệnh)
     Tab 1: Tự khai lý do đến khám
     Tab 2: Tự khai quá trình bị bệnh (per-disease)
     Tab 3: Tự theo dõi diễn biến bệnh (summary timeline)
     ============================================================ */
  .sr-tabs-wrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .sr-tabs-wrap > .sr-tab-panel.active {
    flex: 0 1 auto;
    min-height: 0;
  }
  .sr-tabs {
    display: flex;
    border-bottom: 1px solid var(--vg-border);
    background: var(--vg-bg-tab-bar);
    padding: 12px 18px;
    gap: 10px;
    flex: none;
  }
  .sr-tab {
    flex: 1;
    background: #fff;
    border: 2px solid #d8e6ec;
    border-radius: 11px;
    padding: 12px 18px;
    font-size: 14.5px;
    font-weight: 700;
    color: #6d7e8c;
    cursor: pointer;
    transition: all .15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 11px;
    white-space: nowrap;
    min-height: 52px;
    letter-spacing: -0.1px;
  }
  .sr-tab:hover {
    border-color: #9bccdf;
    color: #2a3e4f;
    transform: translateY(-1px);
  }
  .sr-tab.active {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-pale) 0%, #ffffff 85%);
    color: var(--primary-deep);
    box-shadow: 0 4px 12px rgba(13, 110, 142, 0.18);
    transform: translateY(-1px);
    font-weight: 800;
  }
  .sr-tab .num {
    display: inline-grid;
    place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #e3edf2;
    color: #6d7e8c;
    font-size: 13px;
    font-weight: 800;
    flex: none;
    transition: all .15s ease;
  }
  .sr-tab.active .num {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 142, 0.15);
  }
  .sr-tab.completed .num { background: var(--success); color: #fff; }
  @media (max-width: 900px) {
    .sr-tabs { padding: 10px 14px; gap: 8px; }
    .sr-tab { padding: 10px 14px; font-size: 13px; min-height: 46px; }
    .sr-tab .num { width: 24px; height: 24px; font-size: 11.5px; }
  }
  .sr-tab-panel {
    display: none;
    flex: 0 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 20px 26px 12px;
    background: var(--vg-bg-tab-panel);
  }
  /* Khi có card đang mở (Tab 2 step 1), tab pane phải fill hết chiều cao
     để khung chi tiết bên phải kéo xuống tận đáy thay vì để khoảng trắng */
  .sr-tabs-wrap > .sr-tab-panel.active:has(.specialty-card.expanded),
  .sr-tab-panel:has(.specialty-card.expanded) {
    flex: 1 1 auto;
  }
  .tab1-step-pane:has(.specialty-card.expanded) > .q {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .tab1-step-pane:has(.specialty-card.expanded) > .q > .specialty-list {
    flex: 1 1 auto;
    min-height: 0;
  }
  .sr-tab-panel.active { display: block; }
  .sr-tab-panel[data-sr-panel="1"] {
    overflow: hidden;
  }
  .sr-tab-panel[data-sr-panel="1"] > #sr-content {
    height: 100%;
    min-height: 0;
  }
  /* Tab 2 — Quá trình bị bệnh (per-disease list) */
  .history-empty {
    text-align: center;
    color: #6d7e8c;
    font-size: 14px;
    padding: 60px 20px;
    line-height: 1.6;
  }
  .history-empty .ic {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #eef5f8;
    color: #9bbbcb;
    margin: 0 auto 14px;
    display: grid; place-items: center;
  }
  .history-disease-block {
    border: 1.5px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
  }
  .history-disease-block > h3 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(180deg, #f3fbff, #ffffff);
    border-bottom: 1px solid var(--card-border);
    border-left: 4px solid var(--primary);
    font-size: 16px;
    color: #0d2e44;
    font-weight: 800;
  }
  .history-disease-block > .body { padding: 12px 16px 14px; }
  /* ===== Tab 1 — Năng lực tự khai bệnh ===== */
  .cap-intro {
    background: var(--bg-1);
    border: 1px solid var(--bg-2);
    border-left: 4px solid var(--vg-dark-2);
    border-radius: 10px;
    padding: 13px 18px;
    margin-bottom: 14px;
    font-size: 14.5px;
    color: var(--vg-dark-2);
    line-height: 1.55;
    font-weight: 500;
  }
  .cap-conclusion {
    border: 1.5px solid var(--vg-border);
    border-radius: 11px;
    padding: 12px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
  }
  .cap-conclusion-label {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--vg-text-4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: none;
    min-width: 160px;
  }
  .cap-conclusion-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--vg-dark-2);
    flex: 1;
  }
  .cap-conclusion-self { border-color: var(--teal-accent); background: var(--teal-soft); }
  .cap-conclusion-self .cap-conclusion-value { color: #047857; }
  .cap-conclusion-self_helped { border-color: var(--primary); background: var(--primary-tint); }
  .cap-conclusion-self_helped .cap-conclusion-value { color: var(--primary-deep); }
  .cap-conclusion-family { border-color: #f59e0b; background: #fef3c7; }
  .cap-conclusion-family .cap-conclusion-value { color: #854d0e; }
  .cap-conclusion-staff { border-color: #f59e0b; background: #ffedd5; }
  .cap-conclusion-staff .cap-conclusion-value { color: #9a3412; }
  .cap-conclusion-medical { border-color: #ef4444; background: #fee2e2; }
  .cap-conclusion-medical .cap-conclusion-value { color: #991b1b; }
  .cap-conclusion-pending { border-style: dashed; background: #fafdff; }
  .cap-conclusion-pending .cap-conclusion-value {
    color: var(--vg-text-4);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
  }
  .cap-stages {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .cap-stage {
    background: #ffffff;
    border: 1.5px solid rgba(130, 170, 190, 0.28);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15,36,71,0.08);
    overflow: hidden;
  }
  .cap-stage-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    background: transparent;
    border-bottom: none;
  }
  .cap-stage-num {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: transparent;
    color: #4472C4;
    font-size: 20px;
    font-weight: 800;
    display: grid; place-items: center;
    flex: none;
    box-shadow: none;
  }
  .cap-stage-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--vg-dark-2);
    line-height: 1.3;
  }
  .cap-stage-intro {
    padding: 10px 18px 0;
    font-size: 13.5px;
    color: var(--vg-text-4);
    line-height: 1.5;
  }
  .cap-stage-body {
    padding: 14px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .cap-stage-body .q { margin: 0; padding: 0; border: 0; background: transparent; }
  .cap-stage-body .q-label {
    font-size: 15.5px;
    color: var(--vg-text-1);
    font-weight: 700;
    margin-bottom: 7px;
    line-height: 1.4;
  }
  .cap-stage-body .q-hint {
    font-size: 12.5px;
    color: var(--vg-text-4);
    margin-bottom: 7px;
    line-height: 1.4;
    font-weight: 500;
  }
  .cap-stage-body .opt {
    padding: 10px 14px;
    font-size: 14.5px;
    color: var(--vg-text-3);
    font-weight: 500;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .cap-stage-body .opt input {
    display: inline-block !important;
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--vg-dark-2);
    cursor: pointer;
  }
  .cap-stage-body .opt > span { flex: 1; min-width: 0; }
  .cap-stage-body .opt:hover:not(:has(input:checked)) {
    border-color: #9bccdf;
    background: #f1f7fb;
  }
  .cap-stage-body .opt.checked,
  .cap-stage-body .opt:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-pale);
    color: #053047;
    font-weight: 700;
  }
  .cap-stage-body .opt:has(input:checked):hover {
    border-color: var(--primary);
    background: var(--primary-pale);
  }
  .cap-stage-footer {
    padding: 14px 18px;
    background: transparent;
    border-top: none;
    font-size: 16px;
    color: var(--vg-dark-2);
    font-weight: 700;
    line-height: 1.55;
    letter-spacing: 0.1px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .cap-stage-footer::before {
    content: "🔊";
    font-size: 22px;
    flex: none;
  }
  .cap-footer-link {
    display: inline-block;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(13, 110, 142, 0.25);
    transition: all .15s;
    margin: 0 2px;
  }
  .cap-footer-link:hover {
    background: var(--primary-deep);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(13, 110, 142, 0.35);
  }

  /* ===== Tab 2 — Numbered history blocks ===== */
  .history-intro {
    background: var(--bg-1);
    border: 1px solid var(--bg-2);
    border-left: 4px solid var(--vg-dark-2);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: 15.5px;
    color: var(--vg-dark-2);
    line-height: 1.55;
    font-weight: 500;
  }
  .history-intro strong {
    color: var(--vg-dark-2);
    font-weight: 800;
    font-size: 16.5px;
  }
  .history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .history-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
  }
  .history-row-num {
    flex: none;
    min-width: 28px;
    color: var(--vg-text-3);
    font-weight: 700;
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }
  .history-row-title {
    color: var(--vg-dark-2);
    font-weight: 700;
    font-size: 17px;
    line-height: 1.4;
  }

  /* ===== Gout questionnaire (Tab 3 sequential script) ===== */
  .gout-script-wrap { display: flex; flex-direction: column; gap: 14px; }
  .gout-script-header {
    background: linear-gradient(135deg, #D2E4EC, #EEF5F8);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px 20px;
  }
  .gout-script-stage {
    font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px;
    color: #4472C4; text-transform: uppercase;
  }
  .gout-script-title {
    margin: 4px 0 6px;
    font-size: 22px; font-weight: 800; color: #4472C4;
  }
  .gout-script-intro {
    margin: 0 0 12px;
    font-size: 14px; color: #4472C4; line-height: 1.5;
    font-style: italic;
  }
  .gout-script-progress {
    display: flex; align-items: center; gap: 10px;
    font-size: 12.5px; color: #4472C4; font-weight: 700;
  }
  .gout-script-bar {
    flex: 1; height: 6px; background: rgba(68,114,196,0.18); border-radius: 999px; overflow: hidden;
  }
  .gout-script-bar > div {
    height: 100%; background: #4472C4;
    border-radius: 999px; transition: width .25s ease;
  }
  .gout-script-section {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 18px 16px;
  }
  .gout-script-section.done {
    background: #f8fafc;
    border-color: #e1e9ee;
  }
  .gout-script-section.warning {
    background: #fef3c7;
    border-color: #fde68a;
  }
  .gs-sec-title {
    margin: 0 0 12px;
    font-size: 16px; font-weight: 800; color: var(--vg-dark-2);
    letter-spacing: 0.2px;
  }
  .gout-script-section.warning .gs-sec-title { color: #92400e; }
  .gs-sec-body { display: flex; flex-direction: column; gap: 14px; }
  .gs-q { display: flex; flex-direction: column; gap: 8px; }
  .gs-q-label {
    font-size: 14.5px; font-weight: 700; color: var(--vg-dark-2);
    line-height: 1.4;
  }
  .gs-q-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }
  .gs-q-opts.multi { grid-template-columns: 1fr 1fr; }
  @media (max-width: 720px) {
    .gs-q-opts, .gs-q-opts.multi { grid-template-columns: 1fr; }
  }
  .gs-opt {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border: 1.5px solid var(--vg-border);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--vg-dark-2);
    line-height: 1.35;
    transition: background .12s, border-color .12s;
  }
  .gs-opt input { margin: 0; flex-shrink: 0; accent-color: var(--vg-dark-2); }
  .gs-opt:hover { background: #f1f5f9; border-color: #9bccdf; }
  .gs-opt.checked {
    background: #eaf2fe;
    border-color: var(--vg-dark-2);
    font-weight: 700;
  }
  .gout-script-section.done .gs-opt {
    background: transparent;
    border-color: transparent;
    padding: 4px 0;
    cursor: default;
  }
  .gout-script-section.done .gs-opt:not(.checked) { display: none; }
  .gout-script-section.done .gs-opt.checked {
    background: transparent; border-color: transparent;
    color: #166534; font-weight: 700;
  }
  .gout-script-section.done .gs-opt.checked::before {
    content: "✓ "; color: #166534;
  }
  .gout-script-section.done .gs-opt input { display: none; }
  .gout-script-stage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
  }
  .gout-reset-btn {
    border: 1px solid #fca5a5;
    background: #fff5f5;
    color: #b91c1c;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
  }
  .gout-reset-btn:hover { background: #fee2e2; }
  .gout-script-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
  }
  .gout-script-nav-right {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
  }
  .gs-btn-skip {
    background: #ffffff;
    color: #5a6a7a;
    border: 1.5px solid #cdd6df;
  }
  .gs-btn-skip:hover { background: #f1f5f9; color: var(--vg-dark-2); border-color: var(--vg-dark-2); }
  .gs-btn {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1.5px solid var(--vg-border);
    background: #ffffff;
    color: var(--vg-dark-2);
    font-size: 13.5px; font-weight: 700;
    cursor: pointer;
  }
  .gs-btn:hover { background: var(--bg-1); }
  .gs-btn-next {
    background: var(--vg-dark-2);
    color: #ffffff;
    border-color: var(--vg-dark-2);
    margin-left: auto;
  }
  .gs-btn-next:hover { background: var(--vg-dark-1); }
  .gs-btn-done {
    background: #166534;
    color: #ffffff;
    border-color: #166534;
    margin-left: auto;
  }
  .gs-btn-done:hover { background: #0f5a2c; }
  .gs-section-edit {
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    background: #ffffff;
    color: #4472C4;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
  }
  .gs-section-edit:hover { background: var(--bg-1); }

  /* Gout mirror panel (right column on Tab 2) */
  .gx-branch-tag {
    display: inline-block;
    background: var(--vg-dark-2);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 0.3px;
  }
  .gx-section {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .gx-section-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--vg-dark-2);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
  }
  .gx-row {
    padding: 6px 0;
    border-top: 1px solid #f1f5f9;
  }
  .gx-row:first-of-type { border-top: 0; padding-top: 2px; }
  .gx-q {
    font-size: 12px;
    color: var(--vg-text-3, #4a5b6c);
    line-height: 1.4;
    margin-bottom: 3px;
    font-weight: 600;
  }
  .gx-a {
    font-size: 13px;
    color: var(--vg-dark-2);
    font-weight: 700;
    line-height: 1.35;
  }
  .gx-empty .gx-a {
    color: var(--vg-text-5, #98a4b1);
    font-weight: 400;
    font-style: italic;
  }
  /* Tái khám badge for follow-up sections */
  .gs-sec-followup-badge {
    display: inline-block;
    background: #ecfdf5;
    color: #047857;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    letter-spacing: 0.3px;
  }
  .gout-script-section.followup {
    border-color: #a7f3d0;
    background: #f0fdf6;
  }
  .gout-script-section.followup.done { background: #ecfdf5; }
  /* Visit-type toggle */
  .gout-visit-toggle {
    display: inline-flex;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(15,36,71,0.12);
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 10px;
    gap: 4px;
  }
  .gv-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    color: #4472C4;
    cursor: pointer;
  }
  .gv-btn.active {
    background: #4472C4;
    color: #ffffff;
  }
  .gv-btn:not(.active):hover { background: rgba(68,114,196,0.10); }

  /* Question-step layout */
  .gq-section-context {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #4472C4;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .gout-script-section.tracking {
    border-color: #fde68a;
    background: #fffbeb;
  }
  .gout-script-section.tracking .gq-section-context { color: #b45309; }
  .gout-done-banner {
    background: linear-gradient(135deg, #d1fae5, #ecfdf5);
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 16px;
    font-weight: 700;
    padding: 14px 18px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 14px;
  }
  .gout-tracking-intro {
    background: #fffbeb;
    border: 1px dashed #fde68a;
    border-radius: 10px;
    padding: 14px 18px;
    color: #92400e;
    font-size: 14px;
    line-height: 1.55;
  }
  .gout-tracking-intro p { margin: 0 0 8px; }
  .gout-tracking-intro p strong { color: #78350f; }
  .gout-tracking-intro ul { margin: 4px 0 10px 18px; padding: 0; }
  .gout-tracking-intro ul li { margin-bottom: 4px; }
  .gout-tracking-intro .hint { font-style: italic; color: #b45309; font-size: 13px; }
  .gs-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
  }
  .gs-btn-next[disabled] { background: #94a3b8; border-color: #94a3b8; }
  .gout-script-section.banner-step {
    background: #ffffff;
    border-color: var(--card-border);
  }
  .gout-script-notice {
    background: linear-gradient(135deg, #eaf2fe, #f1f5f9);
    border: 1px solid #cdd6df;
    border-radius: 12px;
    padding: 18px 22px;
  }
  .gsn-eyebrow {
    font-size: 11.5px; font-weight: 800;
    letter-spacing: 0.5px;
    color: #4472C4;
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .gsn-headline {
    font-size: 17px; font-weight: 700;
    color: var(--vg-dark-2);
    line-height: 1.45;
    margin-bottom: 10px;
  }
  .gsn-headline strong { color: #4472C4; }
  .gsn-body {
    font-size: 14px; color: var(--vg-dark-2);
    line-height: 1.55; margin: 6px 0 0;
  }

  .task-assistant { transition: all 0.15s; }
  .task-assistant:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(68,114,196,0.18);
    border-color: #4472c4;
  }
  .task-assistant:focus-visible { outline: 2px solid #4472c4; outline-offset: 2px; }

  /* Trợ lý ảo (mobile-style overlay) */
  .assistant-screen {
    position: fixed; inset: 0; z-index: 1200;
    display: flex; align-items: center; justify-content: center;
    background: rgba(20, 33, 58, 0.55);
    backdrop-filter: blur(2px);
  }
  .assistant-screen[hidden] { display: none !important; }
  .assistant-backdrop {
    position: absolute; inset: 0; cursor: pointer;
  }
  .assistant-frame {
    position: relative;
    width: 420px; max-width: 96vw;
    height: min(820px, 92vh);
    display: flex; flex-direction: column;
    border-radius: 28px; overflow: hidden;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    box-shadow: 0 30px 80px rgba(0,0,0,0.35), 0 8px 24px rgba(0,0,0,0.18);
    border: 1.5px solid #c9d4e0;
  }
  .assistant-top {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: #fff; border-bottom: 1px solid #e6edf3;
    flex: none;
  }
  .assistant-back, .assistant-close {
    background: transparent; border: none; cursor: pointer;
    font-size: 20px; color: #1f3a5f; padding: 4px 8px;
    border-radius: 8px;
  }
  .assistant-back:hover, .assistant-close:hover { background: #f0f4f8; }
  .assistant-title {
    flex: 1; margin: 0; font-size: 14.5px; font-weight: 700;
    color: #1f3a5f; line-height: 1.3;
  }
  .assistant-title .assistant-pt-name { color: #4472c4; }
  .assistant-brand {
    flex: 1; display: flex; align-items: center; gap: 10px;
  }
  .assistant-logo {
    flex: none; width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #4472c4, #355aa3);
    color: #fff; font-weight: 800; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(68,114,196,0.3);
  }
  .assistant-brand-text { line-height: 1.15; }
  .assistant-brand-sub { font-size: 10px; font-weight: 700; color: #5a6a7a; letter-spacing: 0.4px; }
  .assistant-brand-main { font-size: 16px; font-weight: 800; color: #1f3a5f; letter-spacing: 0.3px; }
  .assistant-greeting {
    padding: 14px 18px 10px; background: rgba(255,255,255,0.55);
    border-bottom: 1px solid rgba(207, 230, 238, 0.6);
    flex: none;
  }
  .assistant-hello { font-size: 16px; color: #1f2937; }
  .assistant-hello strong { color: #1f3a5f; }
  .assistant-prompt {
    margin-top: 4px; font-size: 14px; color: #1f3a5f; font-weight: 600;
  }
  .assistant-sub { margin-top: 4px; font-size: 12.5px; color: #5a6a7a; }
  .assistant-body {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 16px; background: transparent;
  }
  .assistant-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  }
  .assistant-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 22px 12px; min-height: 96px;
    background: #fff; border: 1.5px solid #d4dee9;
    border-radius: 16px; cursor: pointer; transition: all 0.15s;
    font-size: 13.5px; font-weight: 700; color: #1f3a5f;
    text-align: center; line-height: 1.3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .assistant-btn:hover { border-color: #4472c4; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(68,114,196,0.18); }
  .assistant-btn .assistant-btn-icon { font-size: 26px; line-height: 1; }
  .assistant-btn-staff { background: #4472c4; color: #fff; border-color: #4472c4; }
  .assistant-btn-staff:hover { background: #355aa3; border-color: #355aa3; }
  .assistant-sub-question {
    background: #fff; border-radius: 14px; padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 14px;
  }
  .assistant-sub-question-label {
    font-size: 15px; font-weight: 700; color: #1f3a5f;
    margin-bottom: 12px; line-height: 1.4;
  }
  .assistant-sub-opts { display: flex; flex-direction: column; gap: 8px; }
  .assistant-opt {
    padding: 12px 14px; border: 1.5px solid #d4dee9; border-radius: 10px;
    background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 600;
    color: #1f3a5f; text-align: left; transition: all 0.12s;
  }
  .assistant-opt:hover { border-color: #4472c4; background: #f5f9fd; }
  .assistant-staff-row {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 16px; background: #dc2626; color: #fff;
    border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 700;
    margin-top: 16px; border: none;
  }
  .assistant-staff-row:hover { background: #b91c1c; }
  .assistant-confirm {
    margin-top: 12px; padding: 12px 14px;
    background: #ecfdf5; border-left: 4px solid #10b981; border-radius: 10px;
    color: #065f46; font-size: 13.5px; line-height: 1.5;
  }
  .assistant-sched-card {
    background: #fff; border-radius: 14px; padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  }
  .assistant-sched-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 800; color: #1f3a5f;
    letter-spacing: 0.3px; padding-bottom: 10px;
    border-bottom: 2px solid #4472c4;
  }
  .assistant-sched-stamp {
    font-size: 11px; font-weight: 700; color: #5a6a7a;
    letter-spacing: 0.4px; text-transform: uppercase;
    margin-top: 10px; margin-bottom: 4px;
  }
  .assistant-sched-list { display: flex; flex-direction: column; }
  .assistant-sched-row {
    display: grid; grid-template-columns: 56px 24px 1fr;
    align-items: center; gap: 8px;
    padding: 9px 4px; border-bottom: 1px solid #eef1f4;
    font-size: 13.5px; color: #1f2937;
  }
  .assistant-sched-row:last-child { border-bottom: none; }
  .assistant-sched-time { font-weight: 600; color: #5a6a7a; font-variant-numeric: tabular-nums; }
  .assistant-sched-dot { text-align: center; color: #c9d4e0; font-size: 14px; }
  .assistant-sched-row.done { opacity: 0.55; }
  .assistant-sched-row.done .assistant-sched-dot { color: #10b981; }
  .assistant-sched-row.active { background: #eaf2fa; border-radius: 8px; }
  .assistant-sched-row.active .assistant-sched-dot { color: #4472c4; font-size: 18px; }
  .assistant-sched-row.active .assistant-sched-name { font-weight: 700; color: #1f3a5f; }
  .assistant-status {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: #fef3c7; border-top: 1px solid #fde68a;
    font-size: 12.5px; color: #92400e; flex: none;
  }
  .assistant-status-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #f59e0b;
    animation: dpCountBlink 1.2s ease-in-out infinite;
  }
  .assistant-composer {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; background: #fff; border-top: 1px solid #e6edf3;
    flex: none;
  }
  .assistant-input {
    flex: 1; height: 38px; padding: 0 12px;
    border: 1.5px solid #d4dee9; border-radius: 19px;
    font-size: 13.5px; outline: none;
  }
  .assistant-input:focus { border-color: #4472c4; }
  .assistant-tool, .assistant-send {
    height: 38px; border-radius: 19px; border: none;
    font-size: 14px; cursor: pointer; padding: 0 12px;
    flex: none;
  }
  .assistant-tool { background: #f0f4f8; color: #1f3a5f; }
  .assistant-tool:hover { background: #e2eaf2; }
  .assistant-send { background: #4472c4; color: #fff; font-weight: 700; padding: 0 16px; }
  .assistant-send:hover { background: #355aa3; }
  .assistant-tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: #fff; border-top: 1px solid #e6edf3;
    flex: none;
  }
  .assistant-tab {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 8px 4px; background: transparent; border: none;
    cursor: pointer; font-size: 11.5px; font-weight: 600; color: #5a6a7a;
  }
  .assistant-tab-icon { font-size: 18px; line-height: 1; }
  .assistant-tab.active { color: #4472c4; }
  .assistant-tab.active .assistant-tab-icon { transform: scale(1.1); }
  .assistant-footer-note {
    padding: 8px 14px; background: #f5f9fd; border-top: 1px solid #e6edf3;
    font-size: 11.5px; color: #5a6a7a; text-align: center; line-height: 1.4;
    flex: none;
  }

  /* Quản trị Hệ thống view */
  .ba-qths-view {
    display: flex; flex-direction: column;
    min-height: calc(100vh - 70px);
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    padding: 24px 36px 20px;
  }
  .ba-qths-view[hidden] { display: none !important; }
  .ba-qths-header {
    display: grid; grid-template-columns: 1fr 2fr 1fr;
    align-items: center; padding-bottom: 18px;
  }
  .ba-qths-brand { display: flex; align-items: center; gap: 12px; }
  .ba-qths-logo {
    flex: none; width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #4472c4, #355aa3);
    color: #fff; font-weight: 800; font-size: 26px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(68,114,196,0.3);
  }
  .ba-qths-brand-text { line-height: 1.15; }
  .ba-qths-brand-sub { font-size: 12px; font-weight: 700; color: #5a6a7a; letter-spacing: 0.4px; }
  .ba-qths-brand-main { font-size: 20px; font-weight: 800; color: #1f3a5f; letter-spacing: 0.3px; }
  .ba-qths-title {
    margin: 0; text-align: center;
    font-size: 26px; font-weight: 800; color: #1f3a5f;
    letter-spacing: 0.5px;
  }
  .ba-qths-spacer { display: flex; justify-content: flex-end; }
  .ba-qths-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px;
    background: #fff; border: 1.5px solid #c9d4e0;
    font-size: 13.5px; font-weight: 700; color: #1f3a5f;
    cursor: pointer; transition: all 0.15s;
  }
  .ba-qths-back:hover { background: #4472c4; color: #fff; border-color: #4472c4; }
  .ba-qths-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
    flex: 1; min-height: 0;
    margin-bottom: 18px;
  }
  @media (max-width: 1400px) {
    .ba-qths-grid { gap: 10px; }
    .ba-qths-col { padding: 12px 14px; }
    .ba-qths-col-head h3 { font-size: 14px; }
    .ba-qths-item { padding: 12px 14px; font-size: 13.5px; }
  }
  .ba-qths-col {
    background: rgba(255,255,255,0.55);
    border: 1.5px solid #c9d4e0; border-radius: 18px;
    padding: 16px 18px; display: flex; flex-direction: column;
    backdrop-filter: blur(2px);
  }
  .ba-qths-col-head {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 12px; margin-bottom: 12px;
    border-bottom: 2px solid #4472c4;
  }
  .ba-qths-col-icon { font-size: 22px; }
  .ba-qths-col-head h3 {
    margin: 0; font-size: 16px; font-weight: 800;
    color: #1f3a5f; letter-spacing: 0.3px;
  }
  .ba-qths-col-body {
    flex: 1; display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
  }
  .ba-qths-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 16px;
    background: #fff; border: 1.5px solid #e6edf3; border-radius: 12px;
    cursor: pointer; transition: all 0.15s;
    font-size: 15px; font-weight: 700; color: #1f3a5f;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .ba-qths-item:hover {
    border-color: #4472c4; transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(68,114,196,0.18);
  }
  .ba-qths-item-arrow { color: #4472c4; font-size: 18px; }
  .ba-qths-footer {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px;
  }
  .ba-qths-foot-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 16px; background: #fff;
    border: 1.5px solid #c9d4e0; border-radius: 14px;
    font-size: 14px; font-weight: 700; color: #1f3a5f;
    cursor: pointer; transition: all 0.15s;
  }
  .ba-qths-foot-btn span { font-size: 18px; }
  .ba-qths-foot-btn:hover { border-color: #4472c4; }
  .ba-qths-foot-btn.active {
    background: linear-gradient(135deg, #4472c4, #355aa3); color: #fff;
    border-color: #355aa3;
  }

  /* Điều phối view */
  .ba-nav a[data-ba-view] { cursor: pointer; }
  .ba-dieuphoi-view {
    padding: 32px 48px;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    min-height: calc(100vh - 70px);
  }
  .ba-dieuphoi-card {
    background: #fff; border-radius: 14px; padding: 36px 44px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    max-width: 980px; margin: 0 auto;
  }
  .ba-dieuphoi-title {
    font-size: 18px; font-weight: 800; color: #1f3a5f;
    margin: 0 0 24px; letter-spacing: 0.4px;
  }
  .ba-dieuphoi-list {
    counter-reset: dpitem; list-style: none; padding: 0; margin: 0;
  }
  .ba-dieuphoi-list li {
    counter-increment: dpitem;
    padding: 14px 0 14px 48px;
    font-size: 15.5px; font-weight: 700; color: #1f2937;
    line-height: 1.5; position: relative;
    border-bottom: 1px solid #eef1f4;
  }
  .ba-dieuphoi-list li:last-child { border-bottom: none; }
  .ba-dieuphoi-list li::before {
    content: counter(dpitem) ".";
    position: absolute; left: 0; top: 14px;
    font-weight: 800; color: #1f3a5f; min-width: 36px;
  }
  .ba-dieuphoi-list li[data-dp-item] {
    cursor: pointer; transition: all 0.15s;
    border-radius: 6px; padding-right: 16px;
  }
  .ba-dieuphoi-list li[data-dp-item]:hover {
    background: rgba(68, 114, 196, 0.06);
    color: #1f3a5f;
    padding-left: 56px;
  }
  .ba-dieuphoi-list li[data-dp-item] {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
  }
  .dp-count {
    flex: none; min-width: 28px; height: 28px; padding: 0 10px;
    border-radius: 14px; background: #dc2626; color: #fff;
    font-size: 14px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6);
    animation: dpCountBlink 1s ease-in-out infinite;
  }
  @keyframes dpCountBlink {
    0%, 100% {
      transform: scale(1);
      box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
      background: #dc2626;
    }
    50% {
      transform: scale(1.15);
      box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
      background: #ef4444;
    }
  }
  .ba-dpdetail-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; margin-bottom: 18px;
    background: #fff; border: 1.5px solid #c9d4e0; border-radius: 8px;
    font-size: 13.5px; font-weight: 600; color: #1f3a5f; cursor: pointer;
    transition: all 0.15s;
  }
  .ba-dpdetail-back:hover { border-color: #1f3a5f; background: #f5f7fa; }
  .ba-dpdetail-empty {
    text-align: center; padding: 60px 20px;
    color: #5a6a7a;
  }
  .ba-dpdetail-empty svg { color: #c9d4e0; margin-bottom: 12px; }
  .ba-dpdetail-empty p { margin: 6px 0; font-size: 14.5px; }
  .ba-dpdetail-empty .ba-dpdetail-hint { font-size: 13px; color: #7a8898; }
  .ba-dp-table {
    width: 100%; border-collapse: collapse; margin-top: 16px;
    font-size: 13.5px;
  }
  .ba-dp-table th, .ba-dp-table td {
    padding: 12px 14px; border-bottom: 1px solid #e8ecf0; text-align: left;
    vertical-align: top;
  }
  .ba-dp-table th {
    background: #f5f7fa; color: #1f3a5f; font-weight: 800;
    text-transform: uppercase; font-size: 12px; letter-spacing: 0.3px;
  }
  .ba-dp-table tbody tr:hover { background: rgba(68, 114, 196, 0.04); }
  .ba-dp-table td.col-stt { width: 50px; font-weight: 700; color: #1f3a5f; }
  .ba-dp-table td.col-name { font-weight: 700; color: #1f2937; }
  .ba-dp-table td.col-time { color: #5a6a7a; white-space: nowrap; }
  .ba-dp-urgent-tag {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 700;
  }
  .ba-dp-urgent-tag.urgent { background: #dc2626; color: #fff; }
  .ba-dp-urgent-tag.not-urgent { background: #4472c4; color: #fff; }

  /* Chỉ định CLS view */
  .ba-cls-wrap { max-width: 1600px; margin: 0 auto; padding: 0 8px; }
  .ba-cls-single-col { display: grid; grid-template-columns: 1fr; gap: 18px; }
  .ba-cls-split {
    display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
    align-items: start;
  }
  .ba-cls-title-row {
    display: flex; align-items: center; gap: 16px; margin-bottom: 18px;
  }
  .ba-cls-title-row .ba-dieuphoi-title { margin: 0; }
  .ba-cls-link-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px;
    background: #4472c4; color: #fff;
    border: none; cursor: pointer;
    font-size: 13.5px; font-weight: 700;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(68, 114, 196, 0.3);
  }
  .ba-cls-link-btn:hover { background: #355aa3; transform: translateY(-1px); }
  .ba-cls-link-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 7px;
    border-radius: 11px; background: #fff; color: #4472c4;
    font-size: 12px; font-weight: 800;
  }
  .ba-cls-sel-remove {
    flex: none; padding: 3px 8px;
    border: 1.5px solid #dc2626; background: #fff; color: #dc2626;
    border-radius: 6px; font-size: 11.5px; font-weight: 700;
    cursor: pointer; transition: all 0.12s;
  }
  .ba-cls-sel-remove:hover { background: #dc2626; color: #fff; }
  .ba-cls-col {
    background: #fff; border-radius: 14px; padding: 18px 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  }
  .ba-cls-col-header {
    font-size: 13.5px; font-weight: 800; color: #1f3a5f;
    text-transform: uppercase; letter-spacing: 0.4px;
    padding-bottom: 10px; margin-bottom: 14px;
    border-bottom: 2px solid #4472c4;
  }
  .ba-cls-frame {
    border: 1.5px solid #d8e0ea; border-radius: 10px;
    padding: 14px 16px; margin-bottom: 12px; background: #fafbfd;
  }
  .ba-cls-frame:last-child { margin-bottom: 0; }
  .ba-cls-frame-title {
    font-size: 13.5px; font-weight: 800; color: #1f3a5f;
    margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.3px;
  }
  .ba-cls-frame-single { padding: 12px 16px; }
  .ba-cls-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 8px 0; cursor: pointer;
    border-bottom: 1px solid #eef1f4;
    font-size: 13.5px; color: #1f2937;
  }
  .ba-cls-item:last-child { border-bottom: none; }
  .ba-cls-item:hover { color: #1f3a5f; }
  .ba-cls-item input { width: 18px; height: 18px; flex: none; cursor: pointer; }
  .ba-cls-item-single { font-weight: 700; padding: 4px 0; border-bottom: none; }
  .ba-cls-empty {
    text-align: center; padding: 40px 12px; color: #7a8898;
    font-size: 13.5px;
  }
  .ba-cls-sel-frame {
    margin-bottom: 14px;
    padding: 12px 14px; border-radius: 10px;
    background: #f5f9fc; border: 1px solid #d8e6ec;
  }
  .ba-cls-sel-frame:last-child { margin-bottom: 0; }
  .ba-cls-sel-frame-title {
    font-size: 12.5px; font-weight: 800; color: #1f3a5f;
    text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px;
  }
  .ba-cls-sel-row {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 0; font-size: 13.5px; color: #1f2937;
  }
  .ba-cls-sel-num {
    flex: none; width: 22px; height: 22px; border-radius: 50%;
    background: #4472c4; color: #fff; font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
  .ba-cls-sel-name { flex: 1; }
  /* Suggestion table */
  #ba-cls-selected {
    max-height: calc(100vh - 180px); overflow-y: auto;
    border-radius: 8px; padding-right: 6px;
  }
  .ba-cls-tabs {
    display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
  }
  .ba-cls-tab-btn {
    padding: 8px 14px; border-radius: 8px;
    border: 1.5px solid #d8e0ea; background: #fff;
    font-size: 13px; font-weight: 700; color: #5a6a7a;
    cursor: pointer; transition: all 0.15s;
  }
  .ba-cls-tab-btn:hover { border-color: #4472c4; color: #4472c4; }
  .ba-cls-tab-btn.active { background: #4472c4; color: #fff; border-color: #4472c4; }
  .ba-cls-tbl-scroll {
    max-height: calc(100vh - 220px); overflow-y: auto;
    border-radius: 8px;
  }
  /* When a tab has tier frames, the outer wrapper does NOT scroll —
     each frame scrolls on its own so Thường quy + Mở rộng stay visible. */
  .ba-cls-tbl-scroll:has(.ba-cls-tier-frame) { overflow-y: visible; max-height: none; }
  .ba-cls-tier-frame {
    border: 1.5px solid #d8e0ea; border-radius: 10px;
    padding: 12px; margin-bottom: 14px; background: #fafbfd;
    max-height: 65vh; overflow-y: auto;
    display: flex; flex-direction: column;
  }
  .ba-cls-tier-frame:last-child { margin-bottom: 0; }
  .ba-cls-tier-frame .ba-cls-suggest-tbl thead { background: #fafbfd; }
  .ba-cls-tier-title {
    font-size: 12.5px; font-weight: 800; color: #1f3a5f;
    text-transform: uppercase; letter-spacing: 0.4px;
    padding: 0 0 8px; margin-bottom: 8px;
    border-bottom: 2px solid #4472c4;
  }
  .ba-cls-tier-frame .ba-cls-suggest-tbl { background: #fff; border-radius: 6px; }
  /* Bảng giá xét nghiệm — one shared scrollbar across all 3 frames */
  .ba-cls-pricelist-scroll {
    max-height: calc(100vh - 240px); overflow-y: auto;
    border-radius: 8px;
  }
  .ba-cls-pricelist-scroll .ba-cls-tier-frame {
    max-height: none; overflow-y: visible;
  }
  .ba-cls-suggest-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
  .ba-cls-suggest-tbl thead { position: sticky; top: 0; z-index: 2; }
  .ba-cls-suggest-tbl th, .ba-cls-suggest-tbl td {
    border: 1px solid #d8e0ea; padding: 8px 10px; text-align: center;
    vertical-align: middle;
  }
  .ba-cls-suggest-tbl thead th {
    background: #f5f9fc; color: #1f3a5f; font-weight: 800;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px;
  }
  .ba-cls-suggest-tbl thead th.col-source-group { background: #eaf2fa; }
  .ba-cls-suggest-tbl tbody td.col-stt { width: 50px; font-weight: 700; color: #1f3a5f; }
  .ba-cls-suggest-tbl tbody td.col-name { text-align: left; font-weight: 600; color: #1f2937; }
  .ba-cls-suggest-tbl tbody tr.group-row td {
    background: #f5f9fc; font-weight: 800; color: #1f3a5f;
    text-align: left; text-transform: uppercase; font-size: 12px;
    letter-spacing: 0.3px; padding: 8px 12px;
  }
  .ba-cls-suggest-tbl tbody tr:not(.group-row):hover td { background: rgba(68,114,196,0.04); }
  .ba-cls-suggest-tbl td.col-source { width: 80px; }
  .ba-cls-suggest-tbl td.col-total { width: 70px; font-weight: 800; color: #1f3a5f; }
  .ba-cls-suggest-tbl td.col-pick { width: 60px; }
  .ba-cls-suggest-tbl td.col-pick input { width: 18px; height: 18px; cursor: pointer; }
  .ba-cls-source-tick { color: #16a34a; font-weight: 800; font-size: 16px; }

  /* Acute symptoms matrix (Tab 2 step 1) */
  .acute-none-row {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border: 1.5px solid var(--vg-border);
    border-radius: 10px; background: #fff; cursor: pointer;
    margin-bottom: 12px; font-size: 14px; line-height: 1.45;
    transition: all 0.15s; font-weight: 600;
  }
  .acute-none-row .acute-row-label { flex: none; }
  .acute-none-row input { width: 18px; height: 18px; flex: none; cursor: pointer; margin-left: 1cm; }
  .acute-row-num {
    flex: none; font-weight: 700; color: var(--vg-text-3);
    font-size: 13.5px; min-width: 22px;
  }
  .acute-none-row:hover { border-color: var(--primary); }
  .acute-none-row.checked { background: #ecfdf5; border-color: #10b981; color: #065f46; }
  .acute-matrix { display: flex; flex-direction: column; gap: 8px; }
  .acute-row {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 14px; border: 1.5px solid var(--vg-border);
    border-radius: 10px; background: #fff; transition: all 0.15s;
    flex-wrap: wrap;
  }
  .acute-row.warn { border-left: 4px solid #dc2626; }
  .acute-row.is-urgent { background: #fef2f2; border-color: #dc2626; }
  .acute-row-label {
    flex: 1; min-width: 200px;
    font-size: 13.5px; color: var(--vg-dark-2); line-height: 1.45;
  }
  .acute-row-label strong { color: var(--vg-dark-1); }
  .acute-row-choices { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
  .acute-choice {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border: 1.5px solid var(--vg-border);
    border-radius: 8px; background: #fff; cursor: pointer;
    font-size: 12.5px; font-weight: 600; color: var(--vg-text-3);
    transition: all 0.15s; white-space: nowrap;
  }
  .acute-choice input { width: 14px; height: 14px; cursor: pointer; }
  .acute-choice:hover { border-color: var(--primary); color: var(--primary); }
  .acute-choice-urgent.checked {
    background: #dc2626; border-color: #dc2626; color: #fff;
  }
  .acute-choice-not.checked {
    background: var(--primary); border-color: var(--primary); color: #fff;
  }

  /* Gout Q&A log panel (Tab 3 right column) */
  .gout-history-split { min-height: 0; }
  .gout-log-panel { display: flex; flex-direction: column; height: 100%; }
  .gout-log-warning {
    background: #fff3cd; border-left: 4px solid #f0ad4e;
    padding: 10px 14px; font-size: 12.5px; flex: none;
    color: #664d03; line-height: 1.45;
  }
  .gout-log-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1.5px solid var(--vg-border);
    flex: none; background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
    gap: 8px; flex-wrap: wrap;
  }
  .gout-log-tabs { display: flex; gap: 4px; }
  .glt-tab-btn {
    padding: 5px 12px; border-radius: 6px; border: 1.5px solid var(--vg-border);
    background: #fff; font-size: 12px; font-weight: 600;
    color: var(--vg-text-3); cursor: pointer; transition: all 0.15s;
  }
  .glt-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
  .glt-restart-btn {
    padding: 4px 9px; border-radius: 6px; border: 1.5px solid var(--vg-border);
    background: #fff; font-size: 11.5px; color: var(--vg-text-3);
    cursor: pointer; white-space: nowrap; transition: all 0.15s;
  }
  .glt-restart-btn:hover { border-color: var(--primary); color: var(--primary); }
  .gout-log-view { flex: 1; overflow-y: auto; padding: 12px 14px; }
  .gout-log-view.hidden { display: none; }
  .gout-log-empty {
    color: var(--vg-text-3); font-size: 13px; text-align: center;
    padding: 36px 16px; line-height: 1.6;
  }
  .gout-log-list { display: flex; flex-direction: column; gap: 0; }
  .gout-log-entry {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--vg-border);
  }
  .gout-log-entry:last-child { border-bottom: none; }
  .glt-seq {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); color: #fff; font-size: 11.5px;
    font-weight: 800; display: flex; align-items: center;
    justify-content: center; margin-top: 2px;
  }
  .glt-body { flex: 1; min-width: 0; }
  .glt-question {
    font-size: 12px; color: var(--vg-text-2); font-weight: 600;
    line-height: 1.4; margin-bottom: 4px;
  }
  .glt-answers { margin: 0; padding-left: 14px; }
  .glt-answers li { font-size: 12.5px; color: var(--vg-dark-2); line-height: 1.5; }
  .glt-edit-btn {
    flex: none; padding: 3px 8px; border-radius: 5px;
    border: 1.5px solid var(--primary); background: #fff;
    color: var(--primary); font-size: 11px; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: all 0.12s;
  }
  .glt-edit-btn:hover { background: var(--primary); color: #fff; }
  .gout-log-summary-wrap { padding-bottom: 16px; }

  /* Tab 4 placeholder — kịch bản đang được cập nhật */
  .tab4-placeholder {
    display: flex; align-items: center; justify-content: center;
    min-height: 360px;
    padding: 24px;
  }
  .tab4-placeholder-card {
    background: linear-gradient(135deg, #f7f9fc, #eef2f7);
    border: 1px dashed #cdd6df;
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 560px;
    text-align: center;
  }
  .tab4-placeholder-eyebrow {
    font-size: 11.5px; font-weight: 800;
    letter-spacing: 0.6px;
    color: #4472C4;
    text-transform: uppercase;
    margin-bottom: 10px;
  }
  .tab4-placeholder-title {
    font-size: 18px; font-weight: 700;
    color: var(--vg-dark-2);
    margin: 0 0 12px;
  }
  .tab4-placeholder-body {
    font-size: 14.5px; color: var(--vg-dark-2);
    line-height: 1.55; margin: 6px 0 0;
  }

  /* Tab 1 intro — hướng dẫn vì sao cần khai đúng & đủ lý do đến khám */
  .tab1-intro-wrap {
    padding: 18px 6px 24px;
    max-width: 820px;
    margin: 0 auto;
  }
  .tab1-intro-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    border: 1px solid #d9e2ef;
    border-radius: 14px;
    padding: 26px 30px 22px;
    box-shadow: 0 2px 8px rgba(15,36,71,0.05);
  }
  .tab1-intro-eyebrow {
    display: inline-block;
    font-size: 11.5px; font-weight: 800;
    letter-spacing: 0.6px;
    color: #4472C4;
    text-transform: uppercase;
    background: #eaf2fe;
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 14px;
  }
  .tab1-intro-title {
    font-size: 18px; font-weight: 700;
    color: var(--vg-dark-2);
    margin: 0 0 14px;
    line-height: 1.4;
  }
  .tab1-intro-body { margin: 0; }
  .tab1-intro-body p,
  .tab1-intro-body li {
    font-size: 15.5px;
    color: var(--vg-dark-2);
    line-height: 1.65;
    margin: 8px 0;
  }
  .tab1-intro-body ul,
  .tab1-intro-body ol {
    margin: 6px 0 10px;
    padding-left: 24px;
  }
  .tab1-intro-body li { margin: 6px 0; }
  /* Karaoke chunks */
  .tab1-narr-chunk {
    transition: background-color 0.25s ease, color 0.25s ease;
    border-radius: 4px;
    padding: 0 2px;
  }
  .tab1-narr-chunk.is-active {
    background: #fff3bf;
    color: #1f2937;
    font-weight: 600;
  }
  .tab1-narr-chunk.is-done {
    color: #475569;
  }
  /* Controls */
  .tab1-intro-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px dashed #d9e2ef;
  }
  .tab1-intro-progress {
    display: flex; align-items: center; gap: 10px;
    font-size: 12.5px; color: #64748b;
    flex: 1;
    min-width: 260px;
  }
  .tab1-intro-progress .bar {
    width: 180px; height: 5px;
    background: #e5e9f0; border-radius: 3px;
    overflow: hidden;
  }
  .tab1-intro-progress .bar > div {
    height: 100%;
    background: linear-gradient(90deg, #4472C4, #6ea8fe);
    width: 0;
    transition: width 0.2s linear;
  }
  .tab1-narr-scrub {
    width: 190px;
    accent-color: #4472C4;
    cursor: pointer;
  }
  .tab1-narr-scrub:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  .tab1-intro-btns { display: flex; align-items: center; gap: 10px; }
  .tab1-narr-seek-controls { display: inline-flex; align-items: center; gap: 6px; }
  .tab1-narr-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid #cdd6df;
    background: #ffffff;
    color: #4472C4;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
  }
  .tab1-narr-icon-btn:hover { background: #eef4ff; border-color: #4472C4; }
  .tab1-narr-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
  .tab1-intro-btn {
    border: 1px solid #cdd6df;
    background: #ffffff;
    color: var(--vg-dark-2);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
  }
  .tab1-intro-btn:hover { background: #f6f8fa; }
  .tab1-intro-btn.primary {
    background: #4472C4;
    border-color: #4472C4;
    color: #ffffff;
  }
  .tab1-intro-btn.primary:hover { background: #365fa8; }
  /* Hint sentences ở cuối — kiểu chữ dịu hơn, đặt trước nút */
  .tab1-narr-hint {
    margin-top: 14px !important;
    padding-top: 12px;
    border-top: 1px dashed #d9e2ef;
    color: #475569 !important;
    font-size: 14.5px !important;
    line-height: 1.55 !important;
  }
  .tab1-narr-hint .tab1-narr-chunk { font-style: italic; }
  .tab1-narr-hint .tab1-narr-chunk.is-active { font-style: normal; }
  /* Pulse nút khi câu hướng dẫn về nút đang được đọc */
  @keyframes tab1NarrPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(68,114,196,0.55); }
    50%      { box-shadow: 0 0 0 8px rgba(68,114,196,0); }
  }
  .tab1-intro-btn.narr-target {
    animation: tab1NarrPulse 1.1s ease-out infinite;
    border-color: #4472C4;
  }
  .tab1-intro-btn.primary.narr-target {
    background: #365fa8;
  }

  /* Dim frame — list of remaining reasons to address after the current questionnaire */
  .next-reasons-frame {
    background: #f6f8fa;
    border: 1px dashed #cdd6df;
    border-radius: 10px;
    padding: 12px 16px 14px;
    opacity: 0.85;
  }
  .next-reasons-title {
    font-size: 12.5px;
    font-weight: 800;
    color: #5a6a7a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
  }
  .next-reason-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    color: #4a5b6c;
    font-size: 13.5px;
  }
  .next-num {
    flex: none;
    min-width: 22px;
    font-weight: 700;
    color: #7d8a99;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }
  .next-name { color: #4a5b6c; }

  /* Toggle bar: Q+A vs Bản tóm tắt */
  .gout-panel-toggle {
    display: flex;
    gap: 4px;
    background: rgba(15,36,71,0.06);
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 10px;
  }
  .gtm-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--vg-dark-2);
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.2;
  }
  .gtm-btn.active {
    background: #ffffff;
    color: var(--vg-dark-2);
    box-shadow: 0 1px 3px rgba(15,36,71,0.10);
  }
  .gtm-btn:not(.active):hover { background: rgba(15,36,71,0.06); }

  /* Narrative summary for doctor */
  .gout-summary { display: flex; flex-direction: column; gap: 10px; }
  .gout-summary-flag {
    border-radius: 10px;
    padding: 10px 12px;
    border-left: 4px solid;
    background: #fff;
  }
  .gout-summary-flag.gsf-danger {
    background: #fef2f2;
    border-color: #b91c1c;
  }
  .gout-summary-flag.gsf-attention {
    background: #fffbeb;
    border-color: #b45309;
  }
  .gsf-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--vg-dark-2);
    margin-bottom: 4px;
  }
  .gout-summary-flag.gsf-danger .gsf-title { color: #b91c1c; }
  .gout-summary-flag.gsf-attention .gsf-title { color: #92400e; }
  .gsf-text {
    font-size: 12.5px;
    color: var(--vg-dark-2);
    line-height: 1.4;
  }
  .gout-summary-section {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
  }
  .gout-summary-heading {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--vg-dark-2);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
  }
  .gout-summary-body {
    font-size: 13px;
    color: var(--vg-dark-2);
    line-height: 1.55;
    text-align: justify;
  }

  /* "Ghi nhận tự khai bệnh" — section header (số thứ tự + tên bệnh) */
  .hx-rec-section-header {
    font-size: 14px;
    font-weight: 800;
    color: var(--vg-dark-2);
    background: var(--bg-1);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 4px 0 10px;
    letter-spacing: 0.1px;
  }
  /* "Ghi nhận tự khai bệnh" — mỗi dòng có cả câu hỏi (xám) + câu trả lời (navy đậm) */
  .hx-rec-qa {
    padding: 8px 10px;
    border: 1px solid var(--vg-border);
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 6px;
  }
  .hx-rec-qa-q {
    display: flex;
    gap: 6px;
    align-items: baseline;
    font-size: 12px;
    color: var(--vg-text-3, #4a5b6c);
    line-height: 1.4;
    margin-bottom: 4px;
    font-weight: 600;
  }
  .hx-rec-qa-q .hx-rec-num {
    flex: none;
    color: var(--vg-text-3, #4a5b6c);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .hx-rec-qa-q-label { flex: 1; }
  .hx-rec-qa-a {
    font-size: 13.5px;
    color: var(--vg-dark-2);
    font-weight: 700;
    line-height: 1.4;
    padding-left: 18px;
  }
  .history-questions {
    padding: 16px 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .history-questions .hq-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--vg-text-1);
    margin-bottom: 9px;
    line-height: 1.4;
  }
  .history-questions .opts {
    gap: 7px;
  }
  .history-questions .opts.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  @media (max-width: 900px) {
    .history-questions .opts.cols-4 { grid-template-columns: repeat(2, 1fr); }
  }
  .history-questions .opt {
    padding: 10px 14px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--vg-text-3);
    font-weight: 500;
    border-radius: 9px;
    border: 1.5px solid var(--vg-border);
  }
  .history-questions .opt:hover {
    border-color: #9bccdf;
    background: var(--primary-tint);
    color: var(--vg-text-1);
  }
  .history-questions .opt.checked {
    border-color: var(--primary);
    background: var(--primary-pale);
    color: #053047;
    font-weight: 700;
  }
  .history-questions textarea {
    width: 100%;
    border: 1.5px solid var(--vg-border);
    border-radius: 9px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    color: var(--vg-text-3);
    line-height: 1.45;
    resize: vertical;
    min-height: 72px;
    font-weight: 500;
  }
  .history-questions textarea::placeholder {
    color: var(--vg-text-5);
    font-style: italic;
    font-weight: 400;
  }
  .history-questions textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
    color: var(--vg-text-1);
  }
  /* ===== Detailed disease block (gout) — sub-sections theo guideline ===== */
  .history-item-detailed .history-questions {
    gap: 18px;
    padding: 16px 20px 20px;
  }
  .history-ref-banner {
    background: linear-gradient(180deg, var(--primary-tint), #ffffff 90%);
    border-bottom: 1px solid var(--vg-border);
    padding: 9px 20px;
    font-size: 12.5px;
    color: var(--vg-text-2);
    line-height: 1.45;
  }
  .history-ref-banner strong {
    color: var(--primary-deep);
    font-weight: 800;
    margin-right: 4px;
  }
  .hx-section {
    background: #fafdff;
    border: 1px solid var(--vg-border);
    border-radius: 10px;
    overflow: hidden;
  }
  .hx-section-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 14px 10px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--bg-2);
  }
  .hx-section-num {
    flex: none;
    width: 36px;
    padding: 3px 0;
    text-align: center;
    background: var(--vg-dark-2);
    color: #fff;
    font-size: 13.5px;
    font-weight: 800;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    letter-spacing: 0.3px;
  }
  .hx-section-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }
  .hx-section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--vg-dark-2);
    line-height: 1.3;
  }
  .hx-section-ref {
    font-size: 11.5px;
    color: var(--primary-deep);
    font-weight: 600;
    line-height: 1.35;
  }
  .hx-section-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 13px;
  }
  .hx-section-body .q {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .hx-section-body .q-label {
    font-size: 14.5px;
    color: var(--vg-text-1);
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
  }
  .hx-section-body .q-hint {
    font-size: 12px;
    color: var(--vg-text-4);
    margin-bottom: 7px;
    line-height: 1.4;
    font-weight: 500;
  }
  .hx-section-body .opts.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .hx-section-body .opt {
    padding: 8px 11px;
    font-size: 13.5px;
    color: var(--vg-text-3);
    font-weight: 500;
    border-radius: 8px;
  }
  .hx-section-body .opt:hover {
    border-color: #9bccdf;
    background: var(--primary-tint);
    color: var(--vg-text-1);
  }
  .hx-section-body .opt.checked {
    border-color: var(--primary);
    background: var(--primary-pale);
    color: #053047;
    font-weight: 700;
  }
  @media (max-width: 900px) {
    .hx-section-body .opts.cols-4 { grid-template-columns: repeat(2, 1fr); }
  }
  /* Tab 3 — Diễn biến bệnh: chia 2 cột full chiều cao panel */
  .sr-tab-panel.active[data-sr-panel="3"] {
    display: flex;
    flex-direction: column;
  }
  .sr-tab-panel[data-sr-panel="3"] > #sr-summary {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .progress-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
  }
  .progress-col {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1.5px solid var(--vg-border);
    border-radius: 12px;
    overflow: hidden;
    min-height: 0;
  }
  .progress-col-header {
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
    border-bottom: 2px solid var(--primary);
    flex: none;
  }
  .progress-col-left .progress-col-header {
    border-bottom-color: var(--vg-dark-2);
  }
  .progress-col-right .progress-col-header {
    border-bottom-color: var(--teal-accent);
  }
  .progress-col-header h3 {
    margin: 0 0 4px;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--vg-dark-2);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1.3;
  }
  .progress-col-stamp {
    font-size: 12.5px;
    color: var(--vg-text-3);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
  }
  .progress-col-stamp strong {
    color: var(--primary-deep);
    font-weight: 800;
  }
  .progress-col-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px 18px;
  }
  .progress-col-body .progress-section { margin-bottom: 14px; }
  .progress-col-body .progress-section:last-child { margin-bottom: 0; }
  .progress-col-body h4 {
    font-size: 14px;
    color: var(--vg-dark-2);
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1.5px solid var(--vg-border);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .progress-col-body h4::before {
    content: "";
    width: 4px; height: 16px;
    background: var(--primary);
    border-radius: 2px;
  }
  .progress-col-body .lbl {
    font-size: 12.5px;
    margin-bottom: 4px;
    color: var(--vg-text-4);
    font-weight: 700;
  }
  .progress-followup-empty {
    text-align: center;
    padding: 30px 20px 20px;
    color: var(--vg-text-4);
  }
  .progress-followup-empty .ic {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--teal-soft);
    color: var(--teal-accent);
    margin: 0 auto 14px;
    display: grid; place-items: center;
  }
  .progress-followup-empty strong {
    display: block;
    font-size: 16px;
    color: var(--vg-dark-2);
    margin-bottom: 8px;
  }
  .progress-followup-empty p {
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0 0 14px;
  }
  .progress-followup-empty p em {
    color: var(--primary-deep);
    font-style: normal;
    font-weight: 700;
  }
  .progress-followup-hint {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #7c2d12;
    line-height: 1.5;
    text-align: left;
  }
  @media (max-width: 1100px) {
    .progress-split { grid-template-columns: 1fr; }
  }
  /* Banner cũ (giữ cho tương thích, có thể xoá nếu không dùng) */
  .progress-banner {
    background: linear-gradient(135deg, #eaf6fb, #f3fbff);
    border: 1.5px solid #c6e2ee;
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 16px;
  }
  .progress-banner .stamp {
    font-size: 13px;
    color: #0a6e8e;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
  }
  .progress-banner .summary-lead {
    font-size: 14.5px;
    color: #0d2e44;
    font-weight: 700;
    line-height: 1.45;
  }
  .progress-section { margin-bottom: 18px; }
  .progress-section h3 {
    font-size: 15px;
    color: #0d2e44;
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1.5px solid #d8e6ec;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .progress-section h3::before {
    content: "";
    width: 4px; height: 18px;
    background: var(--primary);
    border-radius: 2px;
  }
  .progress-list {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .progress-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fafdff;
    border: 1px solid #d8e6ec;
    border-left: 3px solid var(--primary);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    color: #2a3e4f;
    line-height: 1.4;
  }
  .progress-list li::before {
    content: "✓";
    color: var(--success);
    font-weight: 800;
    flex: none;
  }
  .progress-list .lbl {
    color: #6d7e8c;
    font-weight: 600;
    margin-right: 4px;
  }
  .progress-empty {
    color: #8a99a6;
    font-size: 12.5px;
    font-style: italic;
    padding: 6px 0;
  }
  /* Cũ — sec-content giữ để tương thích nhưng không dùng nữa */
  .sec-content {
    overflow: auto;
    padding: 20px 26px 8px;
  }
  .sec { display: none; animation: fadeIn .2s ease; }
  .sec.show { display: block; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
  }
  .sec h3 {
    font-size: 18px;
    color: #0d2e44;
    margin: 0 0 4px;
    font-weight: 800;
  }
  .sec-help {
    color: #5a6a7a;
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
  }

  .q {
    margin-bottom: 12px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 13px 15px;
    background: #fafdff;
  }
  .q-label {
    font-size: 14.5px;
    font-weight: 700;
    color: #0d2e44;
    margin-bottom: 6px;
    line-height: 1.45;
  }
  .q-required { color: #ef4444; margin-left: 3px; }
  .q-hint {
    font-size: 12.5px;
    color: #6d7e8c;
    font-weight: 500;
    margin-bottom: 10px;
  }
  .opts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 6px;
  }
  .opts.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .opts.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .opts.cols-1 { grid-template-columns: 1fr; }
  .opts.chips  { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  @media (max-width: 900px) {
    .opts.cols-3 { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 620px) {
    .opts.cols-3 { grid-template-columns: 1fr; }
  }
  /* Khối câu hỏi nổi bật cho “Lý do đến khám” */
  .q.q-feature {
    background: #ffffff;
    border: 1px solid var(--vg-border);
    border-radius: 12px;
    padding: 0 18px 16px;
    overflow: hidden;
  }
  .q.q-feature .q-label {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 19px;
    font-weight: 800;
    color: var(--vg-dark-2);
    background: var(--bg-1);
    padding: 12px 18px;
    margin: 0 -18px 14px;
    letter-spacing: 0.1px;
    border-bottom: 1px solid var(--bg-2);
  }
  .q.q-feature .q-label::before {
    content: "";
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, var(--vg-dark-1), var(--vg-dark-2));
    border-radius: 2px;
    flex: none;
  }
  /* Tab "Năng lực tự khai bệnh" — toàn bộ text đổi sang xanh */
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-title,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-intro,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt > span,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .q-label,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .q-hint,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-footer {
    color: #4472C4 !important;
  }
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt.checked,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt:has(input:checked),
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt.checked > span,
  .sr-tab-panel[data-sr-panel="0"] .cap-stage-body .opt:has(input:checked) > span {
    color: #1f4585 !important;
  }

  /* Tab "Tự khai lý do đến khám" — toàn bộ text đổi sang xanh */
  .sr-tab-panel[data-sr-panel="1"] .specialty-title,
  .sr-tab-panel[data-sr-panel="1"] .sub-group-title,
  .sr-tab-panel[data-sr-panel="1"] .opt,
  .sr-tab-panel[data-sr-panel="1"] .opt > span,
  .sr-tab-panel[data-sr-panel="1"] .opt-tag,
  .sr-tab-panel[data-sr-panel="1"] .specialty-toggle,
  .sr-tab-panel[data-sr-panel="1"] .specialty-toggle .tg-text,
  .sr-tab-panel[data-sr-panel="1"] .specialty-toggle .arrow,
  .sr-tab-panel[data-sr-panel="1"] .q-counter,
  .sr-tab-panel[data-sr-panel="1"] .q-label,
  .sr-tab-panel[data-sr-panel="1"] .q-hint,
  .sr-tab-panel[data-sr-panel="1"] .gout-block-hint,
  .sr-tab-panel[data-sr-panel="1"] .radio-group-hint,
  .sr-tab-panel[data-sr-panel="1"] .extra-section-title,
  .sr-tab-panel[data-sr-panel="1"] .opt-more,
  .sr-tab-panel[data-sr-panel="1"] .more-label,
  .sr-tab-panel[data-sr-panel="1"] .sec h3,
  .sr-tab-panel[data-sr-panel="1"] .sec h4,
  .sr-tab-panel[data-sr-panel="1"] .sec-help {
    color: #4472C4 !important;
  }
  .sr-tab-panel[data-sr-panel="1"] .opt.checked,
  .sr-tab-panel[data-sr-panel="1"] .opt:has(input:checked),
  .sr-tab-panel[data-sr-panel="1"] .opt.checked > span,
  .sr-tab-panel[data-sr-panel="1"] .opt:has(input:checked) > span {
    color: #1f4585 !important;
  }

  /* Per-question frames — bỏ background, viền + đổ bóng nhẹ làm nổi cả khối */
  .q.q-feature.q-label-framed {
    background: transparent;
    border: 1.5px solid #d8e6ec;
    box-shadow: 0 4px 14px rgba(13, 46, 68, 0.10), 0 2px 4px rgba(13, 46, 68, 0.06);
  }

  /* Header strip — transparent, blue title, no underline */
  .sec.sec-compact .q.q-feature.q-label-framed .q-label,
  .q.q-feature.q-label-framed .q-label {
    background: transparent;
    color: #4472C4;
    border-bottom: none;
  }
  .q.q-feature.q-label-framed .q-label::before {
    background: #4472C4;
  }
  .q.q-feature.q-label-framed .q-hint {
    color: #4472C4;
    font-style: italic;
  }
  .q.q-feature.q-label-framed .q-counter {
    background: #ffffff;
    color: var(--vg-dark-2);
    border-color: rgba(255,255,255,0.6);
  }
  .q.q-feature.q-label-framed .q-counter.empty {
    background: rgba(255,255,255,0.75);
    color: var(--vg-dark-2);
    border-color: rgba(255,255,255,0.45);
  }
  /* Options inside the acute checkbox group (Q3) — white opts + visible checkbox */
  .q.q-feature.q-acute-matrix .opt {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--vg-dark-2);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .q.q-feature.q-acute-matrix .opt:hover {
    background: #f1f5f9;
    border-color: var(--vg-dark-2);
    color: var(--vg-dark-2);
  }
  .q.q-feature.q-acute-matrix .opt.checked {
    background: #ffffff;
    border-color: var(--vg-dark-2);
    color: var(--vg-dark-2);
  }
  .q.q-feature.q-acute-matrix .opt input {
    display: inline-block;
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--vg-dark-2);
    cursor: pointer;
  }
  .q.q-feature.q-acute-matrix .opt > span {
    flex: 1;
    min-width: 0;
  }
  /* Visible markers inside specialty cards of "visit_diseases":
     - <input type="checkbox"> renders as ô vuông
     - <input type="radio"> renders as ô tròn (browser native) */
  .q.q-feature.q-specialty-list .specialty-body .opt {
    display: flex;
    align-items: center;
    gap: 9px;
  }
  .q.q-feature.q-specialty-list .specialty-body .opt input {
    display: inline-block !important;
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #4472C4;
    cursor: pointer;
  }
  .q.q-feature.q-specialty-list .specialty-body .opt > span {
    flex: 1;
    min-width: 0;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-parent-options,
  .q.q-feature.q-specialty-list .specialty-body .specialty-child-questions {
    grid-column: 1 / -1;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-child-questions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-child-questions > .q {
    margin: 0;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-questionnaire {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-questionnaire[hidden],
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-questionnaire.is-hidden {
    display: none !important;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-questionnaire + .specialty-linked-questionnaire {
    border-top: 2px solid rgba(68, 114, 196, 0.9);
    margin-top: 4px;
    padding-top: 14px;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-questionnaire-title {
    color: #2e6e8d;
    font-size: 15.5px;
    font-weight: 850;
    line-height: 1.25;
    padding: 0 2px 4px;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-question-options {
    grid-column: 1 / -1;
    gap: 8px;
  }
  .q.q-feature.q-specialty-list .specialty-body .specialty-linked-question-hint {
    margin: -2px 2px 0;
  }
  .q.q-feature .q-counter {
    background: #ffffff;
    color: var(--vg-dark-2);
    border-color: var(--vg-border-soft);
  }
  .q.q-feature .q-counter.empty {
    background: rgba(255,255,255,0.55);
    color: var(--vg-text-5);
    border-color: var(--vg-border);
  }
  .q-counter {
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary-deep);
    background: var(--primary-pale);
    border: 1px solid var(--vg-border-soft);
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0;
  }
  .q-counter.empty { background: #f3f7f9; color: var(--vg-text-5); border-color: #e1e9ee; }
  .lead-banner {
    display: flex; align-items: center; gap: 12px;
    background: linear-gradient(90deg, #eaf6fb, #f7fcfe);
    border: 1px solid #c6e2ee;
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
  }
  .lead-banner .ic {
    width: 36px; height: 36px; flex: none;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #c6e2ee;
    display: grid; place-items: center;
    color: var(--primary);
  }
  .lead-banner .lead-text strong {
    display: block;
    font-size: 14px;
    color: #0d2e44;
    margin-bottom: 2px;
  }
  .lead-banner .lead-text span {
    font-size: 12.5px;
    color: #5a6a7a;
    line-height: 1.45;
  }
  /* Section ép gọn — hiển thị toàn bộ "Lý do đến khám" trên 1 khung */
  .sec.sec-compact { padding-top: 4px; }
  /* Tab 2 — stepper 3 ship: header strip ngang phía trên + nội dung ship đang mở bên dưới */
  .sec.sec-stepper {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 14px 14px 12px;
    background: transparent;
    border: 1.5px solid #d8e6ec;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(13, 46, 68, 0.10), 0 2px 4px rgba(13, 46, 68, 0.06);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  /* Ship đang mở nằm BÊN TRONG khung stepper → bỏ shadow/border phụ để chỉ 1 khung chung,
     vẫn giữ transparent bg và bố cục bên trong */
  .sec.sec-stepper .q.q-feature.q-label-framed {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
  }
  .tab1-steps-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  .tab1-step-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid #d8e6ec;
    background: #f4f8fb;
    color: #5a6a7a;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
  }
  .tab1-step-btn:hover:not(:disabled) { border-color: #9bccdf; background: #ffffff; transform: translateY(-1px); }
  .tab1-step-btn.active {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-pale) 0%, #ffffff 85%);
    color: var(--primary-deep);
    box-shadow: 0 4px 12px rgba(13, 110, 142, 0.18);
    transform: translateY(-1px);
    font-weight: 800;
  }
  .tab1-step-btn.locked,
  .tab1-step-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f4f8fb;
  }
  .tab1-step-num {
    flex: 0 0 26px;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: #ffffff;
    color: #1e88e5;
    font-weight: 800;
    font-size: 14px;
    border: 1.5px solid #d8e6ec;
  }
  .tab1-step-btn.active .tab1-step-num {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 142, 0.15);
  }
  .tab1-step-title { font-size: 14px; font-weight: 700; line-height: 1.2; }
  .tab1-step-pane {
    min-height: 0;
    overflow: visible;
  }
  .tab1-step-pane > .sr-block-form:has(.q-specialty-list),
  .tab1-step-pane > .sr-block-form > #sr-question-interaction:has(.q-specialty-list) {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .tab1-step-pane > .q {
    margin: 0;
    height: 100%;
    min-height: 0;
    overflow: visible;
  }
  .tab1-step-pane > .sr-block-form > #sr-question-interaction > .q.q-specialty-list {
    margin: 0;
    height: 100%;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }
  .tab1-step-pane > .q.q-feature {
    display: flex;
    flex-direction: column;
  }
  .tab1-step-pane > .q .q-label { display: none; }
  .tab1-step-pane > .tab1-step-question-list {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
  }
  .tab1-step-question-list > .q {
    flex: none;
    height: auto;
    margin: 0;
    overflow: visible;
  }
  .tab1-step-question-list > .q.q-feature {
    display: flex;
    flex-direction: column;
  }
  .tab1-step-question-list > .q.q-feature .q-label {
    display: none;
  }
  /* Trong stepper: bỏ checkbox nhóm bệnh, thay bằng số thứ tự 1..7 */
  .tab1-step-pane .specialty-list { counter-reset: spec; }
  .tab1-step-pane .specialty-list > .specialty-card { counter-increment: spec; }
  .tab1-step-pane .specialty-check input { display: none; }
  .tab1-step-pane .specialty-check {
    pointer-events: none;
  }
  .tab1-step-pane .specialty-check::before {
    content: counter(spec);
    display: inline-grid;
    place-items: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #e3edf2;
    color: #5a6a7a;
    font-weight: 800;
    font-size: 13.5px;
  }
  .tab1-step-pane .specialty-card.expanded .specialty-check::before {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(13, 110, 142, 0.15);
  }
  /* Ép specialty list xuống 1 cột dọc (8 hàng) trong stepper khi CHƯA chọn nhóm nào */
  .tab1-step-pane .specialty-list,
  .tab1-step-pane .opts.cols-2,
  .tab1-step-pane .opts.cols-3,
  .tab1-step-pane .opts.cols-4 {
    grid-template-columns: 1fr !important;
  }
  .tab1-step-pane .specialty-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  /* Khi BN chọn 1 nhóm bệnh → bo khung đồng bộ với Tab 2 (sr-tab.active style):
       border xanh đậm, background gradient pale→white, shadow nâng cao */
  .tab1-step-pane .specialty-card.expanded {
    border-color: var(--primary) !important;
    background: linear-gradient(180deg, var(--primary-pale) 0%, #ffffff 85%) !important;
    box-shadow: 0 4px 12px rgba(13, 110, 142, 0.18) !important;
    display: flex;
    flex-direction: column;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .tab1-step-pane .specialty-card.expanded .specialty-body {
    background: transparent;
    border-top-color: var(--primary);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* Khi BN chọn 1 nhóm bệnh → split 2 cột:
       Cột trái = nhóm đang mở (kéo full diseases dạng dọc)
       Cột phải = 7 nhóm còn lại (chọn để chuyển focus) */
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) {
    position: relative;
    grid-template-columns: minmax(0, 1fr) !important;
    align-content: start;
    align-items: start;
    padding-right: calc(50% + 8px);
    gap: 8px;
    min-height: 100%;
    overflow: visible !important;
  }
  .tab1-step-pane > .sr-block-form > #sr-question-interaction > .q.q-specialty-list > .specialty-list:has(.specialty-card.expanded) {
    min-height: 0;
  }
  /* Active tile stays inline in left column with primary highlight (đồng bộ với tab/step active) */
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card.expanded {
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    grid-column: 1;
    align-self: start;
    overflow: visible;
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-pale) 0%, #ffffff 85%);
    box-shadow: 0 4px 12px rgba(13, 110, 142, 0.18);
  }
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card:not(.expanded) {
    grid-column: 1;
    align-self: start;
  }
  /* Body của card đang mở teleport sang nửa phải, kéo xuống bằng cột trái.
     Khi sub-options chưa được tiết lộ → khoảng trống bên dưới là vùng "chờ tương tác",
     khi BN chọn sẽ tự fill. Scrollbar chỉ kích hoạt nếu nội dung vượt khung. */
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card.expanded > .specialty-body {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: calc(50% - 8px);
    height: auto;
    max-height: min(100%, calc(100dvh - 360px));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #fff;
    border: 1.5px solid var(--primary) !important;
    border-radius: 12px;
    padding: 14px;
    box-sizing: border-box;
  }
  /* Header trong panel phải = tên đầy đủ của nhóm bệnh (đồng bộ với tile bên trái) */
  .specialty-body-title { display: none; }
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card.expanded > .specialty-body {
    grid-template-rows: auto 1fr !important;
    align-content: start;
  }
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card.expanded > .specialty-body > .specialty-body-title {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-deep);
    line-height: 1.3;
    padding: 6px 10px 10px;
    margin: -14px -14px 10px;
    background: var(--primary-pale);
    border-bottom: 1.5px solid var(--primary);
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
    align-self: start;
  }
  /* Khi đã có nhóm đang mở → ẩn nút "Chọn bệnh cụ thể" ở các nhóm còn lại
     (BN đã hiểu affordance, không cần lặp lại trên 7 tile) */
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card:not(.expanded) .specialty-toggle {
    display: none;
  }
  /* Ẩn tiêu đề "1.1. ..." của sub-group đầu tiên — đã có header nhóm phía trên */
  .tab1-step-pane .specialty-list:has(.specialty-card.expanded) > .specialty-card.expanded > .specialty-body > .specialty-body-title + .sub-group > .sub-group-title {
    display: none;
  }
  /* Đảm bảo body của card mở show full danh sách bệnh dọc, 1 bệnh / 1 hàng
     — override mọi cấu trúc 2 cột nội bộ (media query 1500px/1700px) */
  .tab1-step-pane .specialty-card.expanded .specialty-body,
  .tab1-step-pane .specialty-card.expanded .specialty-body .opts,
  .tab1-step-pane .specialty-card.expanded .specialty-body .opts.cols-2,
  .tab1-step-pane .specialty-card.expanded .specialty-body .opts.cols-3,
  .tab1-step-pane .specialty-card.expanded .specialty-body .opts.cols-4,
  .tab1-step-pane .specialty-card.expanded .specialty-body .sub-group-items {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  .tab1-step-pane .specialty-card.expanded .specialty-body .opt,
  .tab1-step-pane .specialty-card.expanded .specialty-body .sub-group-items > .opt {
    width: 100%;
  }
  .tab1-step-pane .specialty-card.expanded .gout-sub-block .opts {
    grid-template-columns: 1fr !important;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] {
    gap: 8px;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact {
    padding: 10px;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .sub-group-title {
    margin-bottom: 8px;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .sub-group-items,
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .gout-radio-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .gout-sub-block .opts {
    grid-template-columns: 1fr !important;
    gap: 5px !important;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .opt {
    min-height: 36px;
    padding: 8px 10px;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .gout-radio-wrap > .opt {
    width: 100%;
  }
  .tab1-step-pane .specialty-body[data-progressive-subgroups] .sub-group.progressive-subgroup-compact .gout-sub-block {
    grid-column: 1 / -1;
  }
  .tab1-step-pane .specialty-card.expanded .specialty-body .sub-group.sub-group-hidden-step {
    display: none !important;
  }
  .tab1-step-pane .specialty-card.expanded .specialty-body .sub-group.sub-group-focus-step {
    animation: introItemBlink 0.7s ease-in-out 4;
    border-color: rgba(245, 158, 11, 0.55);
    background: #fff8e1;
  }
  .tab1-step-pane .progressive-edit-btn {
    align-self: flex-start;
    border: 1px solid #b9d7e3;
    background: #ffffff;
    color: #0d5f7a;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
  }
  .tab1-step-pane .progressive-edit-btn:hover {
    border-color: var(--primary);
    background: #f2fbff;
  }
  .tab1-step-pane .progressive-edit-btn[hidden] {
    display: none !important;
  }
  .patient-audio-controls {
    position: sticky;
    bottom: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    padding: 6px 0 4px;
    border-top: 1px dashed #d8e6ee;
    background: rgba(248, 252, 255, 0.96);
    backdrop-filter: blur(4px);
    flex-wrap: nowrap;
  }
  .patient-audio-status {
    flex: 0 0 54px;
    color: #667895;
    font-size: 13px;
    line-height: 1.15;
  }
  .patient-audio-controls .patient-audio-bar {
    flex: 0 1 300px;
    min-width: 180px;
    max-width: 300px;
    accent-color: #4472c4;
  }
  .patient-audio-controls .patient-audio-btn {
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
    font-family: var(--font-ui);
    font-size: 14px;
    border-radius: 999px;
    border: 1px solid #d8e2ef;
    background: #ffffff;
    color: #5d76b9;
    font-weight: 900;
    cursor: pointer;
  }
  .patient-audio-controls .patient-audio-btn.replay {
    flex: 0 0 auto;
    width: auto;
    min-width: 112px;
    padding: 0 14px;
    border-radius: 8px;
    color: #14203d;
  }
  .patient-audio-controls .patient-audio-btn.continue {
    flex: 0 0 auto;
    width: auto;
    min-width: 104px;
    padding: 0 18px;
    border-radius: 8px;
    border-color: #5a76c7;
    background: #5a76c7;
    color: #ffffff;
  }
  .patient-audio-controls.narr-active .patient-audio-btn.pause {
    background: #eef4ff;
    border-color: #8aa8dc;
  }
  .patient-audio-controls .patient-audio-btn:disabled,
  .patient-audio-controls .patient-audio-bar:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
  @keyframes capContinuePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(68, 114, 196, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(68, 114, 196, 0); }
  }
  @keyframes patientContinueBlueBlink {
    0%, 100% {
      box-shadow: 0 0 0 0 rgba(68, 114, 196, 0.42);
      outline-color: rgba(68, 114, 196, 0);
      background: #5a76c7;
      border-color: #5a76c7;
      color: #ffffff;
    }
    50% {
      box-shadow: 0 0 0 5px rgba(68, 114, 196, 0.34), 0 8px 18px rgba(68, 114, 196, 0.18);
      outline-color: rgba(68, 114, 196, 0.85);
      background: #5a76c7;
      border-color: #4472c4;
      color: #ffffff;
    }
  }
  .patient-audio-controls .patient-audio-btn.continue:focus,
  .patient-audio-controls .patient-audio-btn.continue:focus-visible {
    outline: 2px solid #4472c4;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(68, 114, 196, 0.22);
  }
  .patient-audio-controls .patient-audio-btn.continue.intro-item-blink,
  .patient-audio-controls .patient-audio-btn.continue.cap-continue-pulse {
    animation: patientContinueBlueBlink 0.85s ease-in-out infinite;
    outline: 2px solid transparent;
    outline-offset: 2px;
    background: #5a76c7 !important;
    border-color: #5a76c7 !important;
    color: #ffffff !important;
  }
  .patient-audio-controls .patient-audio-btn.continue.intro-item-blink:disabled,
  .patient-audio-controls .patient-audio-btn.continue.cap-continue-pulse:disabled {
    opacity: 1;
  }
  .tab1-step-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
  }
  .tab1-step-next {
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    background: #1e88e5;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .15s;
  }
  .tab1-step-next:hover { background: #1565c0; transform: translateY(-1px); }
  .tab1-step-next:active { transform: translateY(0); }
  .tab1-step-next.done { background: #10b981; }
  .tab1-step-next.done:hover { background: #059669; }
  .sec.sec-compact h3 { font-size: 21px; margin-bottom: 8px; }
  .sec.sec-compact .sec-help { font-size: 14px; margin-bottom: 12px; color: #4a5a68; }
  .sec.sec-compact .q {
    margin-bottom: 12px;
    padding: 13px 15px;
  }
  .sec.sec-compact .q.q-feature {
    padding: 0 16px 14px;
    margin-bottom: 12px;
  }
  .sec.sec-compact .q-label {
    font-size: 16px;
    margin-bottom: 6px;
    line-height: 1.4;
    color: var(--vg-text-1);
  }
  .sec.sec-compact .q.q-feature .q-label {
    font-size: 18px;
    padding: 11px 16px;
    margin: 0 -16px 12px;
    gap: 10px;
    color: var(--vg-dark-2);
    background: var(--bg-1);
    border-bottom: 1px solid var(--bg-2);
  }
  .sec.sec-compact .q.q-feature .q-label::before {
    width: 4px;
    height: 22px;
  }
  .sec.sec-compact .q-hint {
    font-size: 13.5px;
    margin-bottom: 9px;
    line-height: 1.5;
    color: var(--vg-text-4);
    font-weight: 500;
  }
  .sec.sec-compact .q-counter {
    font-size: 12.5px;
    padding: 3px 10px;
  }
  .sec.sec-compact .opts { gap: 6px; }
  .sec.sec-compact .opt {
    padding: 9px 13px;
    font-size: 14.5px;
    line-height: 1.4;
    border-radius: 9px;
    border-width: 1.5px;
    gap: 8px;
    color: #1f2f3d;
    font-weight: 500;
  }
  .sec.sec-compact .opt:hover { color: #0d2e44; }
  .sec.sec-compact .opt.checked { font-weight: 700; color: #0a2238; }
  .sec.sec-compact .opt-tag {
    font-size: 11.5px;
    padding: 2px 7px;
    margin-left: 5px;
  }
  /* ============================================================
     2-LAYER SPECIALTY CARDS (Layer 1 = chuyên khoa, Layer 2 = bệnh cụ thể)
     ============================================================ */
  .specialty-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
    margin-top: 4px;
    align-items: stretch;
  }
  @media (max-width: 700px) {
    .specialty-list { grid-template-columns: 1fr; }
  }
  /* Mục dự phòng (.opt độc lập, vd. "Nhiều triệu chứng chưa biết khám bệnh gì")
     khi nằm trong lưới specialty-list — style giống mini-card cam */
  .specialty-list > .opt {
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 11px;
    padding: 12px 14px;
    align-self: stretch;
    align-items: center;
    justify-content: flex-start;
    color: #7c2d12;
    font-weight: 700;
    line-height: 1.35;
  }
  .specialty-list > .opt:hover {
    background: #ffedd5;
    border-color: #fdba74;
  }
  .specialty-list > .opt.checked {
    background: #fed7aa;
    border-color: #b45309;
    color: #7c2d12;
  }
  .specialty-list > .opt .opt-tag {
    background: #fff;
    border-color: #fdba74;
  }
  .specialty-card {
    border: 1.5px solid #d8e6ec;
    border-radius: 11px;
    background: #fff;
    overflow: hidden;
    transition: border-color .15s, background .15s, box-shadow .15s;
  }
  .specialty-card:hover { border-color: #9bccdf; }
  .specialty-card.layer1-checked {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-tint) 0, #fff 60%);
    box-shadow: 0 0 0 2px rgba(13, 110, 142, 0.10);
  }
  .specialty-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
  }
  .specialty-check {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 4px;
    margin: -4px;
    border-radius: 6px;
    transition: background .15s;
  }
  .specialty-check:hover { background: rgba(13, 110, 142, 0.08); }
  .specialty-check input[type="checkbox"] {
    width: 20px; height: 20px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
  }
  .specialty-clickable {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    font-family: inherit;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .specialty-clickable:hover .specialty-title { color: var(--primary); }
  .specialty-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
  }
  .specialty-title {
    font-size: 14.5px;
    font-weight: 500;
    color: #0d2e44;
    line-height: 1.3;
    transition: color .15s;
  }
  .specialty-flagship { display: none; }
  .specialty-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f0f4f8;
    border: 1px solid var(--vg-border);
    border-radius: 999px;
    padding: 5px 11px 5px 13px;
    font-size: 11.5px;
    color: var(--vg-text-4);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    white-space: nowrap;
  }
  .specialty-toggle:hover {
    background: var(--primary-pale);
    border-color: var(--primary);
    color: var(--primary-deep);
  }
  .specialty-toggle .tg-text { letter-spacing: 0.1px; }
  .specialty-toggle .cnt-pill {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }
  .specialty-toggle .cnt-pill.zero {
    background: #cfdbe2;
    color: #5a6a7a;
  }
  .specialty-toggle .arrow {
    font-size: 10px;
    line-height: 1;
    transition: transform .2s;
  }
  .specialty-card.expanded .specialty-toggle .arrow { transform: rotate(180deg); }
  .specialty-body {
    padding: 8px 12px 12px;
    border-top: 1px dashed #d8e6ec;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    background: #fafdff;
    animation: extraIn .25s ease;
  }
  .specialty-body[hidden] { display: none; }
  .specialty-body-fieldset {
    border: 0;
    margin: 0;
    min-width: 0;
    padding: 0;
    display: grid;
    gap: 4px;
  }
  .specialty-body-fieldset:disabled {
    opacity: 1;
  }
  /* Khi nhiều cột grid (card rộng) → có thể chia 2 cột nội bộ */
  @media (min-width: 1700px) {
    .specialty-body { grid-template-columns: 1fr 1fr; }
  }
  /* Gout severity radio block (1.1 Bệnh gút — 3 chọn 1 + 5 checkbox phụ) */
  .gout-block-hint {
    font-size: 12.5px;
    color: var(--vg-text-4);
    font-weight: 600;
    margin-bottom: 6px;
    font-style: italic;
  }
  .gout-radio-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
  }
  .gout-sub-block {
    padding: 10px 14px 12px;
    background: var(--primary-pale);
    border: 1.5px solid var(--primary);
    border-top: 0;
    border-radius: 0 0 10px 10px;
    margin: -6px 0 6px;
    animation: extraIn .25s ease;
  }
  .gout-sub-block[hidden] { display: none; }
  /* Sub-block sau 1 option radio (vd. stage_end → chạy thận / chưa chạy thận) */
  .radio-sub-block {
    padding: 10px 14px 12px;
    background: var(--primary-pale);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin: -2px 0 6px 18px;
    animation: extraIn .25s ease;
  }
  .radio-sub-block[hidden] { display: none; }
  .radio-sub-hint {
    font-size: 13px;
    color: var(--primary-deep);
    font-weight: 700;
    margin-bottom: 8px;
  }
  .gout-sub-hint {
    font-size: 13px;
    color: var(--primary-deep);
    font-weight: 700;
    margin-bottom: 8px;
  }
  .gout-sub-block .opts.cols-2 {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  /* Sub-group có customType (vd. gout_severity_block) — luôn dùng 1 cột full width */
  .specialty-body .sub-group.sub-group-stack .sub-group-items {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
  }
  .sub-group-stack .gout-radio-wrap { width: 100%; }
  .sub-group-stack .gout-radio-wrap > .opt { width: 100%; }
  /* Radio group block (vd. mức suy thận, loại tiểu đường, mức xơ gan) */
  .radio-group-block {
    background: linear-gradient(180deg, var(--bg-1), #fafdff);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  .radio-group-hint {
    font-size: 13px;
    color: var(--primary-deep);
    font-weight: 700;
    margin-bottom: 8px;
  }
  .radio-group-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .radio-group-items .opt { width: 100%; }
  /* 3-layer: sub-group bên trong specialty body */
  .specialty-body .sub-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .specialty-body .sub-group + .sub-group { margin-top: 10px; }
  .specialty-body .sub-group-title {
    margin: 0 0 4px;
    padding: 6px 10px;
    background: var(--bg-1);
    border-left: 3px solid var(--vg-dark-2);
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--vg-dark-2);
    letter-spacing: 0.2px;
  }
  .specialty-body .sub-group-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  @media (min-width: 1500px) {
    .specialty-body .sub-group-items {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 4px;
    }
  }
  /* Compact override */
  .sec.sec-compact .specialty-list { gap: 8px; }
  .sec.sec-compact .specialty-header { padding: 12px 14px; gap: 12px; }
  .sec.sec-compact .specialty-title {
    font-size: 15.5px;
    color: #0a2238;
    font-weight: 500;
  }
  .sec.sec-compact .specialty-flagship { font-size: 12px; }
  .sec.sec-compact .specialty-check input[type="checkbox"] { width: 22px; height: 22px; }
  .sec.sec-compact .specialty-toggle {
    font-size: 12.5px;
    padding: 5px 11px 5px 13px;
    gap: 7px;
    color: #2a3e4f;
  }
  .sec.sec-compact .specialty-toggle .cnt-pill {
    font-size: 11px;
    padding: 1px 7px;
    min-width: 18px;
  }
  .sec.sec-compact .specialty-body { padding: 8px 14px 14px; gap: 6px; }
  .sec.sec-compact .specialty-list > .opt {
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 700;
  }
  /* Q-feature ép gọn hơn để fit 2 nhóm trên 1 màn hình */
  .sec.sec-compact .q.q-feature { padding: 11px 13px 12px; margin-bottom: 9px; }
  .sec.sec-compact .q.q-feature .q-label {
    font-size: 16px;
    padding-bottom: 7px;
    margin-bottom: 9px;
    gap: 9px;
  }
  .sec.sec-compact .q.q-feature .q-label::before {
    width: 4px;
    height: 19px;
  }

  /* Mở rộng — nút "Khác" + phần extra */
  .opts-extra {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    animation: extraIn .25s ease;
  }
  .opts-extra[hidden] { display: none; }
  @keyframes extraIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
  }
  .extra-section-title {
    font-size: 11px;
    font-weight: 800;
    color: #0a6e8e;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 6px 0 -2px;
    padding-top: 7px;
    border-top: 1px dashed #c6e2ee;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .extra-section-title::before {
    content: "";
    width: 5px; height: 5px; border-radius: 50%;
    background: #0a6e8e;
    flex: none;
  }
  .extra-section-title:first-child { border-top: none; padding-top: 0; }
  .opt-more-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
  }
  .opt-more {
    background: var(--primary);
    border: 1.5px solid var(--primary);
    color: #fff;
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all .15s ease;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(13, 46, 68, 0.12);
  }
  .opt-more::before {
    content: "+";
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    display: grid; place-items: center;
  }
  .opt-more:hover {
    background: #0a6e8e;
    border-color: #0a6e8e;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(13, 46, 68, 0.2);
  }
  .opt-more.expanded {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
  }
  .opt-more.expanded::before {
    content: "−";
    font-size: 20px;
    background: var(--primary-soft);
    color: var(--primary);
  }
  /* Compact override */
  .sec.sec-compact .extra-section-title {
    font-size: 12.5px;
    margin: 7px 0 1px;
    padding-top: 8px;
    gap: 7px;
  }
  .sec.sec-compact .extra-section-title::before {
    width: 6px; height: 6px;
  }
  .sec.sec-compact .opt-more-row { margin-top: 12px; }
  .sec.sec-compact .opt-more {
    font-size: 13.5px;
    padding: 8px 18px;
    gap: 8px;
  }
  .sec.sec-compact .opt-more::before {
    font-size: 16px;
    width: 16px; height: 16px;
  }
  .sec.sec-compact .opt-more.expanded::before { font-size: 19px; }
  .sec.sec-compact .opts-extra { gap: 6px; }
  .opt {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #d8e6ec;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #2a3e4f;
    transition: all .12s ease;
    user-select: none;
    line-height: 1.35;
  }
  .opt:hover:not(:has(input:checked)) { border-color: #9bccdf; background: #f1f7fb; }
  .opt.checked,
  .opt:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-pale);
    color: #053047;
    font-weight: 700;
  }
  .opt input { display: none; }
  .opt-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    background: #fef3c7;
    color: #854d0e;
    border: 1px solid #fde68a;
    white-space: nowrap;
  }
  /* Tag y khoa — phân biệt mức độ nghiêm trọng */
  .opt-tag.tag-good { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
  .opt:has(input[value*="acute_chest"]) .opt-tag,
  .opt:has(input[value*="acute_dyspnea"]) .opt-tag,
  .opt:has(input[value*="acute_weakness"]) .opt-tag,
  .opt-tag.tag-warn {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
  }
  .opt-icd {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 5px;
    background: #f0f4f8;
    color: #4a5a68;
    border: 1px solid #d8e6ec;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    font-family: var(--font-mono);
    white-space: nowrap;
    vertical-align: middle;
  }
  .sec.sec-compact .opt-icd {
    font-size: 9.5px;
    padding: 1px 5px;
    margin-left: 4px;
  }
  .opt-tag.tag-warn { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

  .region-group { margin-bottom: 10px; }
  .region-title {
    font-size: 11px;
    font-weight: 800;
    color: #6d7e8c;
    letter-spacing: .8px;
    margin-bottom: 6px;
    text-transform: uppercase;
  }

  .slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 4px 0;
  }
  .slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ef4444 100%);
    outline: none;
  }
  .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
  }
  .slider::-moz-range-thumb {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    cursor: pointer;
  }
  .slider-current {
    font-weight: 800;
    font-size: 22px;
    color: var(--primary);
    text-align: center;
  }
  .slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6d7e8c;
  }

  .sr-tabs-wrap > .modal-footer {
    flex: none;
    position: static;
    margin-top: 0;
    align-self: stretch;
  }
  .modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px 26px 14px;
    border-top: 1px solid var(--vg-border);
    background: var(--vg-bg-tab-panel);
  }
  .modal-footer .patient-audio-controls {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(760px, 100%);
    margin: 0 0 0 auto;
    padding: 0;
    border-top: 0;
    background: transparent;
    backdrop-filter: none;
    justify-content: flex-end;
  }
  .modal-footer .patient-audio-controls .patient-audio-bar {
    flex: 0 1 260px;
    min-width: 150px;
    max-width: 260px;
  }
  .modal-footer .patient-audio-controls .patient-audio-btn:not(.replay):not(.continue) {
    flex-basis: 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
  }
  .modal-footer .patient-audio-controls .patient-audio-btn.continue {
    height: 38px;
    min-width: 112px;
  }
  .modal-footer:has(.patient-audio-controls) #sr-next,
  .modal-footer #sr-next.sr-footer-next-hidden {
    display: none !important;
  }
  .btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1.5px solid var(--card-border);
    background: #fff;
    font-family: var(--font-ui);
    color: #2a3e4f;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s ease;
  }
  .btn:hover { border-color: #9bccdf; }
  .btn[disabled] { opacity: .4; cursor: not-allowed; }
  .btn-primary  { background: var(--primary); border-color: var(--primary); color: #fff; }
  .btn-primary:hover  { background: #1565c0; border-color: #1565c0; }
  .btn-success  { background: var(--success); border-color: var(--success); color: #fff; }
  .btn-success:hover  { background: #059669; border-color: #059669; }
  .progress-text {
    font-size: 13px;
    color: #5a6a7a;
    font-weight: 700;
    min-width: 56px;
    text-align: center;
  }
  .progress-bar {
    flex: 1;
    height: 6px;
    background: #e3edf2;
    border-radius: 999px;
    overflow: hidden;
    max-width: 360px;
  }
  .progress-bar > div {
    height: 100%;
    background: linear-gradient(90deg, #4ea3d6, var(--primary));
    border-radius: 999px;
    transition: width .25s ease;
  }

  .toast {
    position: fixed;
    bottom: 30px; left: 50%;
    transform: translateX(-50%);
    background: #0d2e44;
    color: #fff;
    padding: 14px 22px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    animation: toastIn .3s ease;
  }
  @keyframes toastIn {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to   { transform: translate(-50%, 0); opacity: 1; }
  }
