/* Cổng hồ sơ BHYT - giao diện nghiệp vụ giám định */
:root {
    --ink: #16324f;
    --ink-2: #23496d;
    --ink-soft: #e8eef4;
    --paper: #f3f6f4;
    --surface: #ffffff;
    --line: #d5ddd9;
    --line-strong: #b9c6c1;
    --text: #18262f;
    --muted: #5b6b66;
    --seal: #0e7c66;
    --seal-soft: #e3f2ed;
    --stamp: #b42318;
    --stamp-soft: #fbeae8;
    --amber: #9a5b06;
    --amber-soft: #fdf3e1;
    --focus: #2f7dd1;
    --radius: 6px;
    --sidebar: 252px;
    --font: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--paper);
}
a { color: var(--ink-2); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .table td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.code { font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- khung trang */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
    background: var(--ink);
    color: #dbe5ee;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 10px 20px; color: #fff; text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 50%;
    border: 2px solid #8fc7b8; display: grid; place-items: center;
    font-weight: 700; font-size: 12px; color: #8fc7b8; flex: none;
}
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #9fb3c6; }
.nav-group { margin: 8px 0 14px; }
.nav-title { font-size: 12px; color: #8ea4b9; padding: 0 10px 6px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--radius);
    color: #dbe5ee; text-decoration: none; font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }
.sidebar-foot .who { color: #fff; font-weight: 500; }
.sidebar-foot form { margin: 0; }
.who-branch { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; color: #dbe5ee; font-weight: 500; }
.who-branch svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: #8fc7b8; }
.sidebar-actions { display: flex; gap: 14px; align-items: center; margin-top: 10px; }
.link-btn { background: none; border: 0; padding: 0; color: #9fd0c2; cursor: pointer; font: inherit; text-decoration: underline; }

.main { min-width: 0; padding: 24px 28px 96px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-toggle { display: none; }

/* ---------------------------------------------------------------- khối nội dung */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head .hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 16px 18px; }
.section { margin-top: 22px; }
.section > h2 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

/* ---------------------------------------------------------------- form */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 14px; align-items: end; }
.filters .wide { grid-column: span 2; }
.filters .actions { display: flex; gap: 8px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input, textarea.input {
    height: 36px; padding: 6px 10px; width: 100%;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: #fff; color: var(--text); font: inherit;
}
textarea.input { height: auto; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(47, 125, 209, .18); }
.input[readonly] { background: var(--paper); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.more-filters summary { cursor: pointer; color: var(--ink-2); font-size: 13px; margin-top: 10px; width: max-content; }
.more-filters[open] summary { margin-bottom: 10px; }

/* ---------------------------------------------------------------- nút */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--radius);
    border: 1px solid var(--ink); background: var(--ink); color: #fff;
    font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--ink-soft); border-color: var(--ink); }
.btn-seal { background: var(--seal); border-color: var(--seal); }
.btn-seal:hover { background: #0a6654; border-color: #0a6654; }
.btn-danger { background: #fff; color: var(--stamp); border-color: #e3b4ae; }
.btn-danger:hover { background: var(--stamp-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- tab */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tabs a {
    padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { font-size: 12px; background: var(--paper); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }

/* ---------------------------------------------------------------- bảng */
.table-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
    position: sticky; top: 0; z-index: 1;
    background: #f7f9f8; text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
    padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td.name { min-width: 170px; }
.table td { padding: 9px 12px; border-bottom: 1px solid #e8edeb; vertical-align: top; }
.table tr:hover td { background: #f8fbfa; }
.table tr.is-selected td { background: var(--seal-soft); }
.table .col-check { width: 36px; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { color: var(--muted); font-size: 12px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }

.pager { display: flex; gap: 4px; align-items: center; }
.pager a, .pager span {
    min-width: 32px; height: 30px; padding: 0 8px; border-radius: var(--radius);
    display: inline-grid; place-items: center; text-decoration: none; color: var(--text); border: 1px solid var(--line);
    background: #fff; font-size: 13px;
}
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .gap { border: 0; background: none; }

/* ---------------------------------------------------------------- trạng thái (dạng con dấu) */
.stamp {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px;
    border: 1.5px solid currentColor; box-shadow: inset 0 0 0 1px #fff, inset 0 0 0 2px currentColor;
    white-space: nowrap; line-height: 1.6;
}
.stamp-ok { color: var(--seal); background: var(--seal-soft); }
.stamp-err { color: var(--stamp); background: var(--stamp-soft); }
.stamp-warn { color: var(--amber); background: var(--amber-soft); }
.stamp-info { color: var(--ink-2); background: var(--ink-soft); }

/* ---------------------------------------------------------------- thông báo */
.alert { border-radius: var(--radius); padding: 10px 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert + .alert { margin-top: 8px; }
.alert-error { background: var(--stamp-soft); border-color: #efc2bc; color: #7a1a12; }
.alert-warning { background: var(--amber-soft); border-color: #efd6a8; color: #6b4004; }
.alert-success { background: var(--seal-soft); border-color: #b5dccf; color: #0a5143; }
.alert-info { background: var(--ink-soft); border-color: #c9d6e3; color: var(--ink); }
.flashes { margin-bottom: 16px; }

#toasts { position: fixed; top: 16px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
#toasts .alert { box-shadow: 0 6px 20px rgba(22, 50, 79, .16); }

/* ---------------------------------------------------------------- số liệu tóm tắt (sổ tổng hợp) */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--line); }
.ledger div { padding: 12px 18px; border-right: 1px solid var(--line); }
.ledger div:last-child { border-right: 0; }
.ledger dt { font-size: 12px; color: var(--muted); }
.ledger dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger dd small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---------------------------------------------------------------- khay xuất (phiếu) */
.tray {
    position: sticky; bottom: 0; z-index: 5; margin: 16px -28px -96px; padding: 14px 28px 18px;
    background: #fffdf7;
    border-top: 2px dashed #c9b98f;
    display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.tray-count { display: flex; align-items: baseline; gap: 8px; min-width: 190px; }
.tray-count strong { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--ink); }
.tray-scope { display: flex; gap: 14px; font-size: 13px; }
.tray-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.tray-group { display: flex; gap: 6px; align-items: center; padding-left: 12px; border-left: 1px solid #e5dcc4; }
.tray-group:first-child { border-left: 0; padding-left: 0; }
.tray-group > span { font-size: 12px; color: var(--muted); margin-right: 2px; }

/* ---------------------------------------------------------------- các bước 09/BH */
.steps { display: flex; gap: 0; margin-bottom: 18px; counter-reset: step; flex-wrap: wrap; }
.steps li {
    list-style: none; counter-increment: step; display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 13px; padding-right: 26px; position: relative;
}
.steps li::before {
    content: counter(step); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    border: 1.5px solid var(--line-strong); font-weight: 600; background: #fff;
}
.steps li::after { content: ""; position: absolute; right: 8px; top: 50%; width: 10px; border-top: 1px solid var(--line-strong); }
.steps li:last-child::after { display: none; }
.steps li.done { color: var(--seal); }
.steps li.done::before { border-color: var(--seal); background: var(--seal); color: #fff; }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li.active::before { border-color: var(--ink); color: var(--ink); }
.steps-wrap { padding: 0; margin: 0 0 18px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }

.dropzone {
    display: block; cursor: pointer;
    border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 22px; text-align: center; background: #fafcfb;
}
.dropzone.is-over { border-color: var(--seal); background: var(--seal-soft); }
.dropzone input[type=file] { margin-top: 10px; }
.file-name { font-weight: 600; margin-top: 6px; }

.hoso-list details { border-bottom: 1px solid var(--line); }
.hoso-list summary {
    display: grid; grid-template-columns: 24px minmax(140px, 1.2fr) minmax(160px, 2fr) 1fr 1fr auto; gap: 12px;
    align-items: center; padding: 10px 18px; cursor: pointer; list-style: none;
}
.hoso-list summary::-webkit-details-marker { display: none; }
.hoso-list summary::before { content: "▸"; color: var(--muted); }
.hoso-list details[open] summary::before { content: "▾"; }
.hoso-list .detail { padding: 4px 18px 16px 54px; }
.hoso-list h4 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); font-weight: 600; }
.hoso-list .table td, .hoso-list .table th { padding: 6px 10px; font-size: 13px; }
.mini { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }

.errors-list { list-style: none; margin: 0; padding: 0; }
.errors-list li { padding: 10px 18px; border-bottom: 1px solid #edf1ef; display: grid; grid-template-columns: 90px 160px 1fr; gap: 12px; align-items: start; }
.errors-list li:last-child { border-bottom: 0; }
.err-group { border-bottom: 1px solid var(--line); }
.err-group > h3 { font-size: 14px; padding: 12px 18px 6px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.err-group ol { margin: 0; padding: 0 18px 12px 40px; }
.err-group li { padding: 3px 0; }

.empty { padding: 40px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.status-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr 70px auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.report-list li:last-child { border-bottom: 0; }
.report-list .fmt { font-size: 12px; color: var(--muted); }
.report-list .report-opt { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text); font-size: 13px; }

.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; }
.flow a { display: block; padding: 16px 18px; text-decoration: none; color: var(--text); border-right: 1px solid var(--line); border-top: 1px solid var(--line); }
.flow a:hover { background: #f8fbfa; }
.flow a strong { display: block; color: var(--ink); margin-bottom: 4px; }
.flow a span { color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- đăng nhập */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.login-art {
    background: var(--ink); color: #dbe5ee; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
    background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(255,255,255,.05) 31px 32px);
}
.login-art h1 { font-size: 34px; color: #fff; font-weight: 650; max-width: 16ch; letter-spacing: -.02em; }
.login-art p { max-width: 46ch; color: #b9c9d8; }
.login-seal {
    width: 120px; height: 120px; border-radius: 50%; border: 3px double #8fc7b8; color: #8fc7b8;
    display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 13px; line-height: 1.3;
    transform: rotate(-8deg);
}
.login-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; background: #fff; }
.login-form h2 { font-size: 20px; margin-bottom: 4px; }
.login-form form { display: grid; gap: 14px; margin-top: 22px; }
.login-form form.login-alt { margin-top: 14px; }
.btn-block { width: 100%; height: 40px; }
.link-btn-dark { color: var(--ink-2); text-decoration: none; }
.link-btn-dark:hover { text-decoration: underline; }
.login-steps { list-style: none; display: flex; gap: 8px; align-items: center; margin: 0 0 26px; padding: 0; font-size: 13px; color: var(--muted); }
.login-steps li { display: flex; align-items: center; gap: 8px; }
.login-steps li + li::before { content: ""; width: 28px; height: 1px; background: var(--line-strong); margin-right: 2px; }
.login-steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; }
.login-steps li[aria-current] { color: var(--ink); font-weight: 600; }
.login-steps li[aria-current] span { background: var(--ink); border-color: var(--ink); color: #fff; }
.login-steps li.done span { background: var(--seal-soft); border-color: var(--seal); color: var(--seal); }

/* chọn chi nhánh */
.branch-form { margin-top: 18px; }
.branch-list { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; max-height: min(52vh, 440px); overflow-y: auto; padding-right: 2px; }
.branch-option {
    display: grid; grid-template-columns: auto 36px 1fr auto; gap: 12px; align-items: center;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
    transition: border-color .12s, background .12s;
}
.branch-option:hover { border-color: var(--line-strong); background: #fafcfb; }
.branch-option:has(input:checked) { border-color: var(--seal); background: var(--seal-soft); box-shadow: inset 3px 0 0 var(--seal); }
.branch-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--seal); }
.branch-mark { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-soft); color: var(--ink); font-size: 12px; font-weight: 700; }
.branch-option:has(input:checked) .branch-mark { background: var(--seal); color: #fff; }
.branch-info { min-width: 0; display: flex; flex-direction: column; }
.branch-title { font-weight: 600; color: var(--ink); }
.branch-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-option .chip { margin: 0; }
.chip-seal { background: var(--seal); border-color: var(--seal); color: #fff; }
.branch-card-wrap { padding: 18px; max-width: 640px; }
.branch-card-wrap .branch-form { margin-top: 0; display: grid; gap: 14px; }
.login-form .branch-form { display: grid; gap: 14px; }

/* ---------------------------------------------------------------- htmx */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.htmx-request.dim, .htmx-request .dim { opacity: .55; transition: opacity .15s; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.print-frame { width: 100%; height: calc(100vh - 170px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---------------------------------------------------------------- màn hình nhỏ */
@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; z-index: 40; }
    .sidebar.open { transform: none; }
    .btn.menu-toggle { display: inline-flex; margin-bottom: 12px; }
    .main { padding: 16px 16px 96px; }
    .tray { margin: 16px -16px -96px; padding: 12px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .filters .wide { grid-column: auto; }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .report-list li, .errors-list li { grid-template-columns: 1fr; gap: 6px; }
    .hoso-list summary { grid-template-columns: 24px 1fr auto; }
    .hoso-list summary .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
@media print {
    .sidebar, .tray, .page-actions, .menu-toggle { display: none !important; }
    .shell { display: block; }
}

.chip { display: inline-block; font-size: 12px; padding: 2px 8px; margin: 0 4px 6px 0; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); }

/* ---------------------------------------------------------------- lịch check-in đẩy cổng */
.checkin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.checkin-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-nav h2 { min-width: 120px; text-align: center; }
.cal { padding: 0 12px 12px; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head div { font-size: 12px; color: var(--muted); padding: 10px 6px 6px; font-weight: 600; }
.cal-week { margin-bottom: 6px; }
.cal-day { border: 1px solid var(--line); border-radius: 6px; padding: 6px; min-height: 92px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.cal-day.is-weekend { background: #fafbfa; }
.cal-day.is-today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-day.is-future { background: #fbfcfb; }
.cal-day.is-blank { border: 0; background: none; }
.cal-date { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-date small { font-weight: 500; color: var(--ink-2); font-size: 11px; }
.cal-row {
    display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 6px; width: 100%;
    font: inherit; font-size: 12px; line-height: 1.35; text-align: left; padding: 3px 6px; border-radius: 4px;
    border: 0; border-left: 3px solid transparent; background: var(--paper); color: var(--text); cursor: pointer;
}
button.cal-row:hover { filter: brightness(.96); }
.cal-row abbr { text-decoration: none; font-weight: 600; color: var(--muted); }
.cal-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.cal-count { justify-self: end; }
.cal-state { grid-column: 1 / -1; font-size: 11px; line-height: 1.25; }
.cal-row.st-ok { border-left-color: var(--seal); background: var(--seal-soft); }
.cal-row.st-ok .cal-state { color: var(--seal); }
.cal-row.st-err { border-left-color: var(--stamp); background: var(--stamp-soft); }
.cal-row.st-err .cal-state { color: var(--stamp); font-weight: 600; }
.cal-row.st-warn { border-left-color: #d08a17; background: var(--amber-soft); }
.cal-row.st-warn .cal-state { color: var(--amber); }
.cal-row.st-info { border-left-color: var(--ink-2); background: var(--ink-soft); }
.cal-row.st-none { cursor: default; background: none; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.cal-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.dot.st-ok { background: var(--seal); } .dot.st-err { background: var(--stamp); } .dot.st-warn { background: #d08a17; } .dot.st-info { background: var(--ink-2); }
.side-title { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.side-list { list-style: none; margin: 0 0 12px; padding: 0; }
.side-list li { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid #edf1ef; }
.side-list li .sub { grid-column: 2; font-size: 12px; }
.side-history { list-style: none; margin: 0; padding: 0; }
.side-history li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 6px 0; align-items: start; font-size: 13px; }

@media (max-width: 1180px) {
    .checkin-layout { grid-template-columns: 1fr; }
    .checkin-side { position: static; max-height: none; }
}
@media (max-width: 720px) {
    .cal-head { display: none; }
    .cal-week { grid-template-columns: 1fr; gap: 6px; }
    .cal-day.is-blank { display: none; }
    .cal-day { min-height: 0; }
}
.branch-option[hidden] { display: none; }

/* ---------------------------------------------------------------- mẫu 09/BH: loại hồ sơ */
.loai-grid { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.loai-option {
    position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; transition: border-color .12s, background .12s;
}
.loai-option:hover { border-color: var(--line-strong); }
.loai-option:has(input:checked) { border-color: var(--seal); background: var(--seal-soft); box-shadow: inset 0 3px 0 var(--seal); }
.loai-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.loai-option input { position: absolute; opacity: 0; pointer-events: none; }
.loai-title { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); line-height: 1.3; }
.loai-no { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--line-strong); color: var(--muted); }
.loai-option:has(input:checked) .loai-no { background: var(--seal); border-color: var(--seal); color: #fff; }
.loai-desc { font-size: 13px; color: var(--muted); }
.loai-xml { display: grid; gap: 3px; font-size: 12px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.loai-xml b { font-weight: 600; color: var(--ink-2); margin-right: 4px; letter-spacing: .01em; }
.loai-xml .on { color: var(--seal); }
.loai-xml .off { color: var(--muted); }
.loai-xml .off b { color: var(--muted); font-weight: 500; }
.loai-links { display: flex; gap: 12px; font-size: 13px; }
.loai-compact .loai-desc, .loai-compact .loai-xml { display: none; }
.loai-compact .loai-option { padding: 10px 12px; }
@media (max-width: 1180px) { .loai-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .loai-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- lịch phân công nhân viên */
.assign-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.assign-stats > div { display: flex; align-items: baseline; gap: 6px; }
.assign-stats strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.text-err { color: var(--stamp); }
.assign-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; border-bottom: 1px solid var(--line); }
.assign-filters .input { max-width: 320px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg-btn { border: 0; background: #fff; color: var(--muted); font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line-strong); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.assign-matrix th.day, .assign-matrix td.day { text-align: center; width: 76px; }
.assign-matrix td.day { white-space: nowrap; }
.assign-matrix tfoot th { position: sticky; bottom: 0; top: auto; border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.assign-matrix .off { color: #b9c6c1; }
.doctor-name { font-weight: 600; text-align: left; padding: 0; }
.shift {
    display: inline-block; min-width: 30px; font-size: 12px; font-weight: 600; line-height: 1.6;
    padding: 0 6px; border-radius: 4px; border: 1px solid transparent; margin: 1px 2px; cursor: default;
}
.shift-s { background: #fdf3e1; color: #8a5205; border-color: #efd6a8; }
.shift-c { background: #e8eef4; color: #23496d; border-color: #c7d5e3; }
.shift-sc { background: var(--seal-soft); color: var(--seal); border-color: #b9dccf; }
.shift-ls { background: #fff; border-style: dashed; }
.chip-off { color: var(--muted); text-decoration: line-through; }
.assign-services td .chip { margin-bottom: 4px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 0; overflow-x: auto; }
.week-col { border-right: 1px solid var(--line); min-width: 150px; }
.week-col:last-child { border-right: 0; }
.week-head { padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7f9f8; display: flex; flex-direction: column; }
.week-head .muted { font-size: 12px; }
.week-col ul { list-style: none; margin: 0; padding: 6px 0; }
.week-col li { padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px dashed #edf1ef; }
.week-col li .doctor-name { font-weight: 500; font-size: 13px; }
.week-shifts .shift { margin-left: 0; }
.assign-other summary { padding: 14px 18px; cursor: pointer; }
.assign-other summary .hint { margin-top: 2px; }
@media (max-width: 900px) { .week-grid { grid-template-columns: repeat(7, 160px); } }
.assign-other .hint { color: var(--muted); font-size: 13px; font-weight: 400; }
[hidden] { display: none !important; }
