/* Màn Cloud Phone (Android chạy từ xa): thanh công cụ + chế độ Thẻ / Danh sách. Dùng biến màu của STC; không dùng logo/nhận diện của bên khác. */
#cv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
#cv-toolbar:empty { display: none; }
#cv-toolbar .cv-tb-group { display: inline-flex; gap: 0; }
#cv-toolbar button, .cv-card button, .cv-menu button { font: inherit; color: var(--text-main); background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--stc-r-card); padding: 6px 12px; cursor: pointer; }
#cv-toolbar button:hover, .cv-card button:hover, .cv-menu button:hover { border-color: var(--stc-border-hover); }
#cv-toolbar button[aria-pressed="true"] { border-color: var(--stc-border-hover); color: var(--accent-gold); }
#cv-toolbar button[disabled], .cv-card button[disabled] { opacity: .5; cursor: default; }
#cv-toolbar .cv-tb-group button:first-child { border-radius: 8px 0 0 8px; }
#cv-toolbar .cv-tb-group button:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
#cv-search { min-width: 220px; padding: 6px 10px; border-radius: var(--stc-r-card); border: 1px solid var(--border-subtle); background: var(--bg-input); color: var(--text-main); font: inherit; }
#cv-selcount { color: var(--text-muted); }
#cv-list.cv-view-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
#cv-list.cv-view-card > :not(.cv-card) { grid-column: 1 / -1; }      /* dòng thông báo (chưa có máy / không khớp) trải hết lưới, không bị ép vào ô 230px (QA 14/11) */
.cv-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--stc-r-dlg); border: 1px solid var(--border-card); background: var(--bg-card); }
.cv-card[data-selected="true"] { border-color: var(--stc-border-hover); background: var(--stc-surface-2); }
.cv-card-head { display: flex; align-items: center; gap: 8px; }
.cv-card-name { font-weight: 600; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-subtle); color: var(--text-muted); white-space: nowrap; }
.cv-pill[data-state="running"] { color: var(--stc-ok-text); }
.cv-meta { display: flex; flex-direction: column; gap: 2px; color: var(--text-muted); font-size: 12px; }
.cv-card-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.cv-card-actions .cv-open { flex: 1 1 auto; }
.cv-menu-wrap { position: relative; }
.cv-menu { position: absolute; right: 0; bottom: 100%; margin-bottom: 4px; z-index: 5; min-width: 170px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--bg-modal); }
.cv-menu[hidden] { display: none; }
.cv-menu button { text-align: left; }
/* Chế độ danh sách: mỗi máy một dòng ngang */
#cv-list.cv-view-list { display: flex; flex-direction: column; gap: 8px; }
#cv-list.cv-view-list .cv-card { flex-direction: row; align-items: center; gap: 16px; padding: 10px 14px; border-radius: var(--stc-r-card); }
#cv-list.cv-view-list .cv-card-head { flex: 0 0 280px; }
#cv-list.cv-view-list .cv-meta { flex: 1 1 auto; flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
#cv-list.cv-view-list .cv-card-actions { margin-top: 0; flex: 0 0 auto; }
#cv-list.cv-view-list .cv-card-actions .cv-open { flex: 0 0 auto; }

/* Admin: bảng kết nối hạ tầng + gán chủ */
.cv-panel { display: flex; flex-direction: column; gap: 8px; max-width: 640px; margin: 8px 0 14px; padding: 14px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--bg-card); }
.cv-panel-note { color: var(--text-muted); font-size: 12px; word-break: break-word; }
.cv-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-muted); }
.cv-field input, .cv-panel select { padding: 6px 10px; border-radius: var(--stc-r-card); border: 1px solid var(--border-subtle); background: var(--bg-input); color: var(--text-main); font: inherit; }
.cv-field input:disabled { opacity: .6; }
.cv-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cv-panel button { font: inherit; color: var(--text-main); background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--stc-r-card); padding: 6px 12px; cursor: pointer; }
.cv-panel button:hover { border-color: var(--stc-border-hover); }
.cv-panel button[disabled] { opacity: .5; cursor: default; }
.cv-owner { color: var(--text-muted); font-size: 12px; }
.cv-owner[data-assigned="false"] { color: var(--accent-gold); }

/* sao lưu / khôi phục */
.cv-backup-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0; }
.cv-backup-info { flex: 1 1 200px; }
.cv-restore-confirm { min-width: 160px; }

/* form tạo máy */
.cv-create-form { max-height: 80vh; overflow-y: auto; }
.cv-cf-sec { font-weight: 600; margin-top: 12px; }
.cv-cf-steps { margin: 8px 0; padding-left: 20px; }
.cv-cf-steps li[data-state="ok"] { color: var(--stc-ok-text); }
.cv-cf-steps li[data-state="fail"] { color: var(--stc-err-text); }
.cv-codename, .cv-tagline, .cv-noteline { font-size: 12px; opacity: .8; }

/* ===== Form tạo máy (khung v2): token --stc-* của STC (sáng/tối), không màu cứng. Không điều khiển trang trí. ===== */
.cv-panel.cv-create-form { max-width: 1460px; width: 100%; padding: 0; gap: 0; background: var(--stc-bg); border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); max-height: 86vh; overflow-y: auto; color: var(--stc-text); font-family: var(--stc-font); position: relative; }
.cv-cf-head { padding: 20px 24px 6px; }
.cv-cf-title { margin: 0; font-size: 28px; line-height: 1.2; color: var(--stc-text-strong); }
.cv-cf-sub { margin: 6px 0 0; color: var(--stc-muted); font-size: 14px; }
.cv-cf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding: 16px 24px 8px; align-items: start; }
.cv-cf-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cv-cf-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 8px; min-width: 0; }
.cv-cf-card { background: var(--stc-surface); border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); }
.cv-cf-card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--stc-border); }
.cv-cf-card-h h3 { margin: 0; font-size: 16px; color: var(--stc-text-strong); flex: 1 1 auto; }
.cv-cf-step { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; border-radius: var(--stc-r-card); background: var(--stc-accent-soft); color: var(--stc-accent-text); font-weight: 600; font-size: 12px; }
.cv-cf-right { color: var(--stc-muted); font-size: 12px; }
.cv-cf-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cv-cf-side .cv-cf-card > :not(.cv-cf-card-h) { margin: 12px 16px; }
.cv-cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.cv-cf-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cv-cf-span { grid-column: 1 / -1; }
.cv-cf-label { font-size: 13px; color: var(--stc-muted); }
.cv-cf-opt { color: var(--stc-muted); font-size: 12px; }
.cv-create-form input:not([type="checkbox"]), .cv-create-form select, .cv-create-form textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-input); color: var(--stc-text); font: inherit; box-sizing: border-box; }
.cv-create-form textarea { min-height: 84px; resize: vertical; }
.cv-create-form input[readonly] { opacity: .85; }
.cv-create-form input:focus-visible, .cv-create-form select:focus-visible, .cv-create-form textarea:focus-visible, .cv-create-form button:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 2px; }
.cv-cf-counted { position: relative; display: flex; align-items: center; }
.cv-cf-counted .cv-cf-count { position: absolute; right: 12px; bottom: 6px; font-size: 11px; color: var(--stc-muted); pointer-events: none; }
.cv-cf-counted > input { padding-right: 64px; }
.cv-cf-counted > textarea { padding-bottom: 22px; }
.cv-cf-counted .cv-cf-eye { position: absolute; right: 6px; min-height: 32px; padding: 2px 10px; border: 0; background: transparent; color: var(--stc-muted); cursor: pointer; }
.cv-cf-checkrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cv-create-form .cv-cf-probebtn, .cv-create-form .cv-cf-retrybtn { min-height: 44px; border-radius: var(--stc-r-card); padding: 0 18px; border: 1px solid var(--stc-accent); background: transparent; color: var(--stc-accent-text); cursor: pointer; font: inherit; width: fit-content; }
.cv-cf-status { font-size: 13px; color: var(--stc-muted); word-break: break-word; }
.cv-cf-warn { font-size: 13px; color: var(--cv-warn); word-break: break-word; }
.cv-cf-warn:empty { display: none; }
.cv-cf-hint { margin: 0; font-size: 12px; color: var(--stc-muted); line-height: 1.5; }
.cv-cf-google { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--stc-r-card); background: var(--stc-accent-soft); border: 1px solid var(--stc-border); }
.cv-cf-google small { color: var(--stc-muted); line-height: 1.5; }
.cv-cf-preview { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cv-cf-missing { font-size: 13px; color: var(--cv-warn); }
.cv-cf-steps { margin: 0; padding-left: 20px; }
.cv-cf-steps li[data-state="ok"] { color: var(--stc-ok); }
.cv-cf-steps li[data-state="fail"] { color: var(--stc-err); }
.cv-cf-pending { border-color: var(--cv-warn); }
.cv-cf-pending[hidden] { display: none; }
.cv-cf-foot { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 12px 24px; background: var(--stc-bg); border-top: 1px solid var(--stc-border); border-radius: 0 0 12px 12px; }
.cv-cf-footmiss { margin-right: auto; font-size: 13px; color: var(--cv-warn); }
.cv-create-form .cv-cf-foot button, .cv-create-form .cv-cf-modal-actions button { min-height: 44px; padding: 0 22px; border-radius: var(--stc-r-card); font: inherit; cursor: pointer; border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text); }
.cv-create-form .cv-cf-gobtn { background: var(--stc-accent); border-color: var(--stc-accent); color: var(--stc-accent-ink); font-weight: 600; }
.cv-create-form .cv-cf-gobtn[disabled] { opacity: .45; cursor: not-allowed; }
.cv-cf-modal { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: var(--stc-scrim); border-radius: var(--stc-r-card); padding: 16px; }
.cv-cf-modal-box { width: min(620px, 100%); max-height: 90%; overflow-y: auto; background: var(--stc-surface); border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--stc-shadow); }
.cv-cf-modal-box h3 { margin: 0; font-size: 18px; color: var(--stc-text-strong); }
.cv-cf-modal-row { display: flex; gap: 12px; font-size: 14px; }
.cv-cf-modal-k { flex: 0 0 150px; color: var(--stc-muted); }
.cv-cf-modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.cv-cf-ack { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--cv-warn); }
.cv-cf-ack input { width: auto !important; min-height: 0 !important; margin-top: 3px; }
@media (max-width: 1100px) { .cv-cf-layout { grid-template-columns: minmax(0, 1fr) 270px; } }
@media (max-width: 820px) { .cv-cf-layout { grid-template-columns: 1fr; } .cv-cf-side { position: static; } }
@media (max-width: 540px) { .cv-cf-grid { grid-template-columns: 1fr; } .cv-cf-head, .cv-cf-layout, .cv-cf-foot { padding-left: 14px; padding-right: 14px; } .cv-cf-modal-row { flex-direction: column; gap: 2px; } }

/* Trang danh sách: nút chính + thu gọn phần danh mục */
#cv-toolbar button.cv-primary { background: var(--stc-accent); border-color: var(--stc-accent); color: var(--stc-accent-ink); border-radius: var(--stc-r-card); min-height: 40px; padding: 7px 18px; font-weight: 600; }
#cv-toolbar button.cv-primary:hover { filter: brightness(1.06); }
.cv-pill[data-state="running"] { background: var(--stc-fill-2); }
.cv-card-actions .cv-open { background: var(--stc-accent); border-color: var(--stc-accent); color: var(--stc-accent-ink); border-radius: var(--stc-r-card); font-weight: 600; }
.cv-fold { margin-top: 18px; border-top: 1px solid var(--stc-border); padding-top: 8px; }
.cv-fold > summary { cursor: pointer; color: var(--text-muted); padding: 6px 0; }

/* v2: breadcrumb của form toàn trang, dòng kiểm kỹ thuật, banner dữ liệu cũ */
.cv-cf-crumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 24px 0; font-size: 13px; color: var(--stc-muted); }
.cv-cf-crumb .cv-cf-backlist { margin-left: auto; min-height: 36px; padding: 0 14px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text); cursor: pointer; font: inherit; }
.cv-checkline { font-size: 12px; color: var(--stc-muted); }
.cv-stale { margin: 8px 0; padding: 10px 14px; border-radius: var(--stc-r-card); border: 1px solid var(--cv-warn); color: var(--cv-warn); background: var(--stc-surface); font-size: 13px; }
.cv-stale[hidden] { display: none; }
#cv-list[hidden], #cv-toolbar[hidden], #cv-fold[hidden] { display: none !important; }
.cv-create-form, .cv-stale, .cv-cf-pending { --cv-warn: var(--stc-warn); }

/* Huy hiệu bảo vệ, dòng phiên xem, Chi tiết máy. Chữ nhỏ dùng màu muted đã đạt tương phản; huy hiệu dùng --cv-warn. */
.cv-prot { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--cv-warn); color: var(--cv-warn); white-space: nowrap; }
.cv-sessline { font-size: 12px; color: var(--stc-muted); }
.cv-detail { display: flex; flex-direction: column; gap: 10px; max-width: 880px; padding-bottom: 24px; }
.cv-dt-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 24px; border-bottom: 1px solid var(--stc-border); }
.cv-dt-tab { min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-bottom: 2px solid transparent; background: none; color: var(--stc-muted); font: inherit; cursor: pointer; border-radius: 8px 8px 0 0; }
.cv-dt-tab[aria-selected="true"] { color: var(--stc-text); border-bottom-color: var(--border-active); }
.cv-dt-tab:focus-visible { outline: 2px solid var(--border-active); outline-offset: 1px; }
.cv-dt-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 24px; }
.cv-dt-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--stc-border); }
.cv-dt-k { flex: 0 0 140px; color: var(--stc-muted); }
.cv-dt-v { flex: 1 1 auto; word-break: break-word; }
.cv-dt-line { color: var(--stc-text); }
.cv-dt-ops { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-dt-ops button, .cv-detail .cv-panel-actions button, .cv-dt-verify, .cv-detail .cv-cf-backlist { min-height: 40px; padding: 0 14px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text); font: inherit; cursor: pointer; }
.cv-dt-ops button[disabled] { opacity: .55; cursor: not-allowed; }