/* Mini App Kiểm soát nội công trường — chỉ phần khung riêng; thành phần lấy từ Sun Worker DS (sw/tokens.css + sw/bundle.css).
   Quy tắc: chỉ dùng token, cỡ chữ theo .t-*, thành phần theo class .sw-* / .mt-* của DS. Khung giống Mini App Gia Bình và Cây xanh. */
html, body { margin: 0; }
body { background: var(--overlay-barrier); min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
.app { max-width: var(--device-max); margin: 0 auto; min-height: 100dvh; background: var(--material-page-bg); display: flex; flex-direction: column; position: relative; }
body.is-wide .app, body.is-wide .navbar, body.is-wide .view, body.is-wide .sheet { max-width: 760px; }
.app-loading { padding: var(--space-xl); text-align: center; }
.app-body { flex: 1; padding: var(--space-md); padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-smd); }
.app-body .sw-hint, .view .sw-hint, .sheet .sw-hint { margin: 0; }
.app-body .sw-section, .view .sw-section, .sheet .sw-section { margin: var(--space-xs) 0 0; }
button.sw-section__act { border: 0; background: transparent; padding: 0; min-height: 32px; cursor: pointer; font-family: inherit; }
.stack { display: flex; flex-direction: column; gap: var(--space-smd); }
.row-gap { display: flex; gap: var(--space-sm); }
.row-gap > * { flex: 1; min-width: 0; }
.c-warn { color: var(--warning); }
.num { font-variant-numeric: tabular-nums; }
.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.rot180 { transform: rotate(180deg); }

/* Header (theo .sw-header: tiêu đề 18/700 màu primary) */
.app-head { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-smd); padding: calc(var(--space-smd) + env(safe-area-inset-top)) var(--space-md) var(--space-smd); background: var(--surface-elevated); border-bottom: 1px solid var(--outline); }
.app-head__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-head__title { font-size: calc(18px * var(--fs-scale)); font-weight: 700; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.app-head__txt > .t-caption { color: var(--on-surface-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-btn { position: relative; width: 44px; height: 44px; border: 0; padding: 0; border-radius: var(--radius-pill); background: var(--material-soft-primary); color: var(--primary); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.round-btn svg { width: var(--icon-md); height: var(--icon-md); }
.round-btn--ava { background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: calc(14px * var(--fs-scale)); }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--error); color: var(--on-primary); font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; }
.sub-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 0; min-height: 24px; color: var(--on-surface-muted); font-size: calc(12px * var(--fs-scale)); font-weight: 600; cursor: pointer; max-width: 100%; }
.sub-btn svg { width: var(--icon-sm); height: var(--icon-sm); flex-shrink: 0; }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--on-surface-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: var(--radius-sm); flex-shrink: 0; padding: 0; }
.icon-btn svg { width: var(--icon-md); height: var(--icon-md); }
.icon-btn[disabled] { opacity: var(--opacity-disabled); cursor: not-allowed; }

/* Thanh đáy: .sw-nav của DS, cố định đáy màn */
.navbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: var(--device-max); margin: 0 auto; }
.navbar .sw-nav { margin-top: 0; min-height: calc(var(--bottom-nav-height) - 24px); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.navbar .sw-nav__tab { position: relative; border: 0; background: transparent; font-family: inherit; cursor: pointer; padding-top: var(--space-sm); font-size: 11px; }
.navbar .sw-nav__center { flex: 1; border: 0; background: transparent; padding: 0; cursor: pointer; font-family: inherit; }
.navbar .sw-nav__center .lbl { top: auto; bottom: 4px; white-space: nowrap; font-size: 11px; line-height: 1.3; }
.navbar .sw-nav__fab { bottom: 19px; color: var(--on-primary); }
.navbar .sw-nav__fab svg { width: 30px; height: 30px; }
.navbar .badge { top: 0; right: calc(50% - 22px); }

/* Màn đăng nhập / chọn công trường / chọn cổng */
.start { flex: 1; display: flex; flex-direction: column; gap: var(--space-md); padding: calc(var(--space-xl) + env(safe-area-inset-top)) var(--space-md) var(--space-lg); }
.start__logo { display: flex; justify-content: center; padding: var(--space-md) 0 var(--space-xs); }
.start__logo img { height: 40px; }
.start__title { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); text-align: center; }
.start__title--left { align-items: flex-start; text-align: left; }
.start .sw-hint { margin: 0; }
.role-card { display: flex; align-items: center; gap: var(--space-smd); width: 100%; text-align: left; border: 1px solid var(--outline); background: var(--surface-elevated); border-radius: var(--radius-lg); padding: var(--space-md); cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow-card); }
.role-card > svg { width: var(--icon-md); height: var(--icon-md); color: var(--on-surface-subtle); flex-shrink: 0; }
.role-card__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.foot-note { text-align: center; margin-top: auto; }
.demo-acc { display: flex; flex-direction: column; gap: var(--space-sm); }
.form { display: flex; flex-direction: column; gap: var(--space-smd); }

/* Ô biểu tượng */
.ic-box { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--material-soft-primary); color: var(--primary); }
.ic-box svg { width: var(--icon-md); height: var(--icon-md); }
.ic-box--n { background: var(--surface); color: var(--on-surface-muted); }
.ic-box--ok { background: var(--success-light); color: var(--success); }
.ic-box--warn { background: var(--warning-light); color: var(--warning); }
.ic-box--err { background: var(--error-light); color: var(--error); }
.card-head { display: flex; align-items: center; gap: var(--space-smd); }
.card-head__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* Danh sách: khung chứa các .mt-row của DS */
.list { background: var(--surface-elevated); border: 1px solid var(--outline); border-radius: var(--radius-lg); overflow: hidden; }
.list--flat { border-radius: var(--radius-md); }
button.mt-row { width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; font-family: inherit; color: inherit; cursor: pointer; }
.mt-row__top .t-body-strong { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.mt-row__main .t-caption { color: var(--on-surface-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-xs); }
.mt-row > svg.chev { width: var(--icon-sm); height: var(--icon-sm); color: var(--on-surface-subtle); flex-shrink: 0; }
.mt-row.is-off { opacity: var(--opacity-disabled); }
.mt-row.is-off .mt-plate { text-decoration: line-through; }
.mt-row.is-new { background: var(--warning-light); }
.row-main { flex: 1; min-width: 0; display: flex; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.ava { width: 40px; height: 40px; border-radius: var(--radius-pill); background: var(--material-soft-primary); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; font-weight: 700; font-size: calc(13px * var(--fs-scale)); }
.pill-row { display: flex; flex-wrap: wrap; gap: var(--space-xs); }

/* Ô số liệu: .mt-tiles/.mt-tile của DS */
.tiles-card { padding: var(--space-smd); display: flex; flex-direction: column; gap: var(--space-sm); }
.mt-tile { min-width: 0; }
.mt-tile .t-caption { color: inherit; }
.mt-tile__s { font-size: calc(11px * var(--fs-scale)); color: var(--on-surface-subtle); }
button.mt-tile { border: 0; font-family: inherit; cursor: pointer; }

/* Bộ lọc chip cuộn ngang */
.chips { display: flex; gap: var(--space-sm); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--space-md)); padding: 0 var(--space-md); }
.chips::-webkit-scrollbar { display: none; }
.chips--wrap { flex-wrap: wrap; }
.sw-choice__chip { cursor: pointer; font-family: inherit; flex-shrink: 0; }
.sw-choice__chip b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.sw-choice__chip.is-static { cursor: default; }
.sw-choice__chip.is-muted { color: var(--on-surface-subtle); border-style: dashed; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm); }
.filters .sw-input { min-width: 0; }
.day-bar { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.day-bar .chips { margin: 0; padding: 0; }
.date-in { flex: 1; min-width: 150px; }

/* Ô nhập (theo .sw-input của DS) */
.sw-input input, .sw-input select, .sw-input textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--on-surface); height: 42px; padding: 0; font-size: max(16px, calc(14px * var(--fs-scale))); }
.sw-input textarea { height: auto; min-height: 84px; padding: var(--space-sm) 0; resize: vertical; }
.sw-input--multi { align-items: stretch; }
.sw-input select { appearance: none; -webkit-appearance: none; }
.sw-input input[type="date"], .sw-input input[type="datetime-local"] { -webkit-appearance: none; appearance: none; min-width: 0; line-height: 40px; }
.sw-input input[type="date"]::-webkit-date-and-time-value, .sw-input input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; line-height: 40px; }
.sw-input:focus-within { border-color: var(--primary); }
.sw-input input::placeholder, .sw-input textarea::placeholder { color: var(--on-surface-subtle); }
.sw-input .unit { color: var(--on-surface-muted); font-weight: 600; }
.input-row { display: flex; gap: var(--space-sm); align-items: stretch; }
.input-row > .sw-input { flex: 1; min-width: 0; }
.input-plate { min-height: 56px; }
.input-plate input { height: 54px; text-align: center; font-size: calc(22px * var(--fs-scale)); font-weight: 700; letter-spacing: 0.04em; color: var(--ink); text-transform: uppercase; }
.scan-btn { min-width: 56px; padding: 0 var(--space-smd); }
.scan-btn svg { width: var(--icon-lg); height: var(--icon-lg); }
.rp-range { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-sm); }

/* Gợi ý: .sw-hint của DS + biến thể trạng thái */
.sw-hint.is-warn { background: var(--warning-light); color: var(--warning); }
.sw-hint.is-err { background: var(--error-light); color: var(--error); }
.sw-hint.is-ok { background: var(--success-light); color: var(--success); }
.sw-hint > span:last-child { line-height: 1.45; }

/* Trang chủ Bảo vệ: hai nút lớn Xe vào / Xe ra */
.gate-acts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-smd); }
.gate-act { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-xs); min-height: 128px; padding: var(--space-md); border-radius: var(--radius-lg); border: 0; background: var(--primary); color: var(--on-primary); text-align: left; cursor: pointer; box-shadow: var(--shadow-checkin); }
.gate-act .t-caption { opacity: 0.85; }
.gate-act__ic { width: 44px; height: 44px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center; margin-bottom: auto; }
.gate-act__ic svg { width: var(--icon-lg); height: var(--icon-lg); }
.gate-act--out { background: var(--surface-elevated); color: var(--primary); border: 1.5px solid var(--primary); box-shadow: var(--shadow-card); }
.gate-act--out .gate-act__ic { background: var(--material-soft-primary); }
.gate-act--out .t-caption { color: var(--on-surface-muted); opacity: 1; }
.gate-acts > .gate-act:only-child { grid-column: 1 / -1; min-height: 96px; }
.alert-row { display: flex; align-items: center; gap: var(--space-smd); width: 100%; padding: var(--space-smd) var(--space-md); border-radius: var(--radius-lg); border: 1px solid var(--error); background: var(--error-light); color: var(--error); text-align: left; cursor: pointer; font: inherit; }
.alert-row .t-caption { color: var(--on-surface-muted); white-space: normal; }
.alert-row .t-body-strong { color: var(--error); }
.alert-row > svg { width: var(--icon-sm); height: var(--icon-sm); flex-shrink: 0; }

/* Màn phủ toàn màn (form, kết quả): như các màn con của Sun Worker */
.view { position: fixed; inset: 0; z-index: 50; max-width: var(--device-max); margin: 0 auto; background: var(--material-page-bg); overflow-y: auto; display: flex; flex-direction: column; overscroll-behavior: contain; }
.view__body { flex: 1; padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-smd); }
.view__bar { position: sticky; bottom: 0; z-index: 5; padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); }

/* Thẻ bước (như form Nạp đất / Đổ đất Gia Bình) */
.step-card { display: flex; flex-direction: column; gap: var(--space-smd); }
.step-head { display: flex; align-items: center; gap: var(--space-sm); }
.step-no { width: calc(24px * var(--fs-scale)); height: calc(24px * var(--fs-scale)); border-radius: var(--radius-pill); background: var(--primary); color: var(--on-primary); display: inline-flex; align-items: center; justify-content: center; font-size: calc(12px * var(--fs-scale)); font-weight: 700; flex-shrink: 0; }
.step-head .t-headline { color: var(--ink); flex: 1; }

/* Chip chọn một (ChoiceChips) bị khoá theo cổng */
.sw-choice__chip[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Ô chọn có tìm kiếm (combo box) + bảng chọn */
.combo { width: 100%; cursor: pointer; font: inherit; text-align: left; color: var(--on-surface); }
.combo__val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: max(16px, calc(14px * var(--fs-scale))); line-height: 42px; }
.combo__val.is-ph { color: var(--on-surface-subtle); }
.picker-scrim { z-index: 65; }
.picker-scrim .sheet { height: 88dvh; }
.picker__search { padding: 0 var(--space-md) var(--space-sm); flex-shrink: 0; }
.picker__search input[type="search"] { -webkit-appearance: none; appearance: none; }
.picker__body .sw-section { margin: var(--space-xs) 0 0; }
.picker__more { text-align: center; padding: var(--space-sm) 0; }
.pick-row.is-on { background: var(--info-light); }
.pick-row .pick-ok { width: var(--icon-md); height: var(--icon-md); color: var(--primary); flex-shrink: 0; }

/* Chuyến xe */
.trip-row .row-main { gap: var(--space-smd); align-items: center; }
.trip-blk { display: flex; flex-direction: column; gap: var(--space-sm); }
.trip-blk.is-off { opacity: var(--opacity-disabled); }
.trip-blk .sw-btn--sm { align-self: flex-start; }
.list--err { border-color: var(--error); }
.list--warn { border-color: var(--warning); }
.attn-sub { margin-top: calc(-1 * var(--space-sm)); }
.alert-row.is-warn { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }
.alert-row.is-warn .t-body-strong { color: var(--warning); }

/* Thẻ thông tin xe sau khi quét */
.veh-card { border-radius: var(--radius-md); border: 1px solid var(--outline); padding: var(--space-smd); display: flex; flex-direction: column; gap: var(--space-xs); }
.veh-card__top { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.veh-card__top > svg { width: var(--icon-md); height: var(--icon-md); flex-shrink: 0; }
.veh-card__top .t-headline { flex: 1; min-width: 0; }
.veh-card.is-ok { background: var(--success-light); border-color: var(--success); }
.veh-card.is-ok .veh-card__top { color: var(--success); }
.veh-card.is-err { background: var(--error-light); border-color: var(--error); }
.veh-card.is-err .veh-card__top { color: var(--error); }
.veh-card.is-info { background: var(--info-light); border-color: transparent; }
.veh-card.is-info .veh-card__top { color: var(--primary); }
.veh-card .kv > div { padding: 6px 0; border-color: rgba(0, 0, 0, 0.06); }
.veh-card > .t-body, .veh-card > .t-caption { color: var(--on-surface); }

/* Ảnh chụp */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.shot { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-md); overflow: hidden; background: var(--surface); border: 1.5px dashed var(--outline-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--on-surface-muted); font-family: inherit; cursor: pointer; padding: 0; width: 100%; }
.shot svg { width: var(--icon-lg); height: var(--icon-lg); }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot.has-img { border-style: solid; border-color: var(--outline); }
.shot__lbl { position: absolute; left: 6px; top: 6px; background: var(--overlay-status-pill); color: var(--on-primary); border-radius: var(--radius-sm); padding: 2px 6px; z-index: 1; }
.shot:not(.has-img) .shot__lbl { position: static; background: transparent; color: var(--on-surface-muted); font-weight: 600; }
.shot-wrap { position: relative; }
.shot__x { position: absolute; right: 6px; top: 6px; z-index: 2; width: 28px; height: 28px; border-radius: var(--radius-pill); border: 0; background: var(--overlay-close); color: var(--on-primary); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.shot__x svg { width: 16px; height: 16px; }
.full-img { width: 100%; border-radius: var(--radius-md); display: block; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); padding: var(--space-smd); border: 1px solid var(--outline); border-radius: var(--radius-lg); }
.qr-box canvas { width: 180px; height: 180px; image-rendering: pixelated; }

/* Khoá – giá trị */
.kv { display: flex; flex-direction: column; }
.kv > div { display: flex; justify-content: space-between; gap: var(--space-smd); padding: 10px 0; border-bottom: 1px solid var(--outline); }
.kv > div:last-child { border-bottom: 0; }
.kv > div > span:first-child { color: var(--on-surface-muted); flex-shrink: 0; max-width: 45%; }
.kv > div > span:last-child { text-align: right; color: var(--ink); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kv .sw-link svg { width: var(--icon-sm); height: var(--icon-sm); }

/* Kết quả lưu phiếu */
.result-top { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); text-align: center; padding: var(--space-sm) 0; }
.result-top .sw-empty__badge { width: calc(64px * var(--fs-scale)); height: calc(64px * var(--fs-scale)); }
.result-top .sw-empty__badge svg { width: calc(36px * var(--fs-scale)); height: calc(36px * var(--fs-scale)); }
.badge-ok { background: var(--success-light); color: var(--success); }
.badge-warn { background: var(--warning-light); color: var(--warning); }
.sw-ticket__vol.is-warn { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.sw-ticket__head { display: flex; flex-direction: column; gap: 2px; }

/* Ô ký tên */
.sig { position: relative; height: 150px; border: 1.5px dashed var(--outline-strong); border-radius: var(--radius-md); background: var(--surface-elevated); }
.sig canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig__ph { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--on-surface-subtle); pointer-events: none; }
.sig.is-signed .sig__ph { display: none; }
.sig.is-signed { border-style: solid; border-color: var(--primary); }
.sig__clear { position: absolute; right: 4px; top: 4px; min-height: 32px; }

/* Biên bản */
.doc { border: 1px solid var(--outline-strong); border-radius: var(--radius-md); padding: var(--space-md); display: flex; flex-direction: column; gap: var(--space-smd); background: var(--surface-elevated); }
.doc__head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding-bottom: var(--space-smd); border-bottom: 2px dashed var(--outline); }
.doc__sigs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-smd); }
.doc__sig { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); text-align: center; min-height: 110px; }
.doc__sig img { width: 100%; max-height: 90px; object-fit: contain; }
.doc__sigtxt { font-style: italic; font-weight: 700; color: var(--primary); font-size: calc(20px * var(--fs-scale)); margin-top: var(--space-md); }
.doc-link { display: flex; align-items: center; gap: var(--space-smd); width: 100%; padding: var(--space-smd); border-radius: var(--radius-md); border: 1px solid var(--success); background: var(--success-light); color: var(--success); text-align: left; cursor: pointer; font: inherit; }
.doc-link > svg { width: var(--icon-md); height: var(--icon-md); flex-shrink: 0; }

/* Biểu đồ cột theo giờ (vào: primary, ra: info) */
.hbars { display: grid; grid-template-columns: repeat(17, 1fr); gap: 3px; align-items: end; height: 120px; }
.hbars__col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.hbars__pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 1px; }
.hbars__pair i { display: block; width: 45%; min-height: 1px; border-radius: 2px 2px 0 0; }
.hbars__pair i.is-in { background: var(--primary); }
.hbars__pair i.is-out { background: var(--info); }
.hbars__col span { font-size: 10px; color: var(--on-surface-subtle); height: 12px; line-height: 12px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-smd); margin-top: var(--space-sm); font-size: calc(12px * var(--fs-scale)); color: var(--on-surface-muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .lg-in { background: var(--primary); }
.legend .lg-out { background: var(--info); }

/* Bảng số liệu nhỏ */
.tbl { background: var(--surface-elevated); border: 1px solid var(--outline); border-radius: var(--radius-lg); overflow: hidden; }
.tbl__row { display: grid; grid-template-columns: var(--cols); gap: var(--space-sm); padding: 10px var(--space-md); border-bottom: 1px solid var(--outline); align-items: center; font-size: calc(13px * var(--fs-scale)); color: var(--ink); }
.tbl__row:last-child { border-bottom: 0; }
.tbl__row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.tbl__row > span.num { text-align: right; }
.tbl__head { background: var(--surface); color: var(--on-surface-muted); font-size: calc(11px * var(--fs-scale)); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.tbl__head > span:not(:first-child) { text-align: right; }
.tbl__foot { background: var(--surface); font-weight: 700; }

/* Bottom sheet (theo .sw-sheet: thanh kéo + tiêu đề primary căn giữa); chân là .sw-actionbar */
.sheet-scrim { position: fixed; inset: 0; z-index: 60; background: var(--overlay-barrier); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: var(--device-max); max-height: 92dvh; background: var(--surface-elevated); border-radius: var(--radius-xl) var(--radius-xl) 0 0; display: flex; flex-direction: column; animation: sheet-in 0.18s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet .sw-sheet__grip { margin: var(--space-sm) auto 0; flex-shrink: 0; }
.sheet__head { position: relative; padding: var(--space-sm) 56px var(--space-smd); flex-shrink: 0; }
.sheet__head .sw-sheet__title { margin: 0; }
.sheet__head .round-btn { position: absolute; right: var(--space-sm); top: 0; background: transparent; }
.sheet__body { overflow-y: auto; padding: 0 var(--space-md) var(--space-md); display: flex; flex-direction: column; gap: var(--space-smd); }
/* Nội dung dài thì cuộn, không bóp nhỏ từng khối (khối có overflow hidden sẽ bị cắt) */
.sheet__body > *, .view__body > *, .app-body > * { flex-shrink: 0; }
.sheet .sw-actionbar { flex-shrink: 0; padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.sheet .sw-actionbar .sw-btn { min-width: 0; }
.dlg-scrim { position: fixed; inset: 0; z-index: 70; background: var(--overlay-barrier); display: flex; align-items: center; justify-content: center; padding: var(--space-lg); }
.dlg-scrim .sw-dialog .sw-btn { flex: 1; }

/* Toast: nâng lên trên thanh đáy / thanh nút */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-nav-height) + var(--space-md) + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); pointer-events: none; padding: 0 var(--space-md); }
.toast-host .sw-toast { animation: sheet-in 0.18s ease-out; max-width: 360px; text-align: center; }

/* Công tắc, dòng cài đặt */
button.sw-switch { border: 0; cursor: pointer; }
.sw-setting { cursor: default; }
.sw-setting.is-btn { cursor: pointer; width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; font-family: inherit; text-align: left; }
.sw-setting.is-flat { padding: 0; border-bottom: 0; min-height: 44px; }
.sw-setting__txt { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: var(--space-sm) 0; }
.sw-setting svg.chev { width: var(--icon-sm); height: var(--icon-sm); color: var(--on-surface-subtle); }
.sw-setting__ic svg { width: var(--icon-md); height: var(--icon-md); }
.sw-identity { margin-bottom: var(--space-xs); }
.me-ava { font-size: calc(22px * var(--fs-scale)); font-weight: 800; color: var(--primary); }
.me-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* Quét xe: ScanScreen của DS phủ toàn màn */
.scan-full { position: fixed; inset: 0; z-index: 80; width: auto; min-height: 0; border-radius: 0; max-width: var(--device-max); margin: 0 auto; padding: calc(var(--space-md) + env(safe-area-inset-top)) var(--space-md) calc(var(--space-md) + env(safe-area-inset-bottom)); }
.scan-full video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.scan-full > *:not(video) { position: relative; z-index: 1; }
.scan-full .sw-scan__frame { background: transparent; box-shadow: 0 0 0 9999px var(--overlay-camera-dim); }
.scan-full .sw-scan__torch, .scan-full .sw-flow__round { border: 0; cursor: pointer; font-family: inherit; }
.scan-full .sw-scan__torch { background: transparent; color: var(--on-primary); min-height: 44px; }
.plate-frame { width: min(84vw, 340px); height: min(52vw, 210px); margin-top: 12vh; }
.plate-frame.is-read { border-color: var(--success); }
#pc-status { background: var(--overlay-status-pill); align-self: center; white-space: normal; max-width: calc(100% - 32px); text-align: center; }
#pc-status.is-ok { background: var(--success); }
.plate-cam-bar { margin-top: auto; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-smd); }
.plate-cam-bar .sw-btn--scan-alt { margin-top: 0; }
.plate-shot { border: 0; cursor: pointer; width: 64px; height: 64px; }
.plate-shot svg { width: 28px; height: 28px; }

/* Quản trị */
.site-card { display: flex; flex-direction: column; gap: var(--space-smd); }
.cat-row { display: flex; gap: var(--space-xs); align-items: center; }
.cat-row .sw-input { flex: 1; min-width: 0; }
.link-txt { white-space: normal !important; overflow-wrap: anywhere; }

@media (max-width: 360px) {
  .filters { grid-template-columns: 1fr; }
  .gate-act { min-height: 112px; }
}
