/* ==========================================================================
   STS Browser — BỘ TOKEN MÀU DUY NHẤT (nguồn sự thật) + khung. Nạp SAU style.css; các tệp CSS khác CHỈ dùng var(--stc-*) / var(--dlg-*).
   Chủ đề "Đen-Vàng" (14/11/2026, xem DESIGN.md):
   - Nền tối là ĐEN TRUNG TÍNH (R=G=B, không ám màu). Phân tầng bằng các bậc xám rất gần đen: bg < side < surface < surface-2 < surface-3.
   - Chữ mang màu vàng: thân = ngà vàng nhạt, tiêu đề/nhãn quan trọng = vàng gold, chữ phụ = xám ấm nhẹ.
   - Vàng đặc (--stc-accent) CHỈ cho: nút chính, vòng tiêu điểm, ô tick, chỉ báo đang chọn mảnh. KHÔNG phủ vàng lên nền/hàng/thẻ, không glow, không gradient.
   - Viền 1px một lớp: --stc-line (kẻ hàng) < --stc-border (thẻ/bảng/menu) < --stc-border-strong (rê chuột/đang chọn) ; --stc-border-ctl cho ô nhập/nút phụ (>= 3:1, WCAG 1.4.11).
   - Bo góc: --stc-r-ctl 6px (nút, ô) / --stc-r-card 8px (thẻ, bảng, menu) / --stc-r-dlg 10px (hộp thoại).
   Tương phản đã đo (tests/test_ui_theme_gold.py tính từ chính tệp này, cả hai chủ đề).
   ========================================================================== */
:root, html[data-theme="dark"] {
  /* bề mặt: xám trung tính */
  --stc-bg: #0A0A0A; --stc-side: #0E0E0E; --stc-surface: #121212; --stc-surface-2: #191919; --stc-surface-3: #202020; --stc-input: #0E0E0E;
  /* viền + đường kẻ: trung tính, 1px */
  --stc-line: #1C1C1C; --stc-border: #262626; --stc-border-strong: #3A3A3A; --stc-border-ctl: #6B6B6B; --stc-border-hover: #8C8C8C;
  /* chữ */
  --stc-text: #EDE4CC; --stc-text-strong: #E8C46E; --stc-muted: #A39B8B; --stc-dim: #8A8476;
  /* điểm nhấn vàng */
  --stc-accent: #CFA046; --stc-accent-text: #E0B85C; --stc-accent-ink: #0A0A0A; --stc-accent-dark: #8E6A20; --stc-focus: #CFA046;
  --stc-wave-peak: var(--stc-text);          /* đỉnh làn sóng chữ "Đang …": vàng -> ngà sáng (khác rõ màu chữ vàng) */
  --stc-qr-bg: #FFFFFF; --stc-qr-ink: #000000;  /* ô mã QR thanh toán: nền trắng + chấm đen ở MỌI giao diện (app ngân hàng quét được) */
  /* nền tương tác trung tính (tên --stc-accent-soft giữ cho mã cũ; giá trị KHÔNG còn vàng) */
  --stc-fill-1: rgba(255, 255, 255, 0.04); --stc-fill-2: rgba(255, 255, 255, 0.07); --stc-fill-active: #1C1C1C; --stc-accent-soft: var(--stc-fill-active);
  --stc-row-hover: #171717; --stc-row-selected: #1C1C1C; --stc-selection: rgba(207, 160, 70, 0.32);
  /* trạng thái: dịu cho nền đen */
  --stc-ok: #63B98E; --stc-warn: #E0975A; --stc-err: #E07B72;
  --stc-ok-soft: rgba(99, 185, 142, 0.10); --stc-warn-soft: rgba(224, 151, 90, 0.10); --stc-err-soft: rgba(224, 123, 114, 0.10);
  --stc-err-solid: #A3362F; --stc-on-err-solid: #FFFFFF;   /* dải lỗi đặc (bản cũ phải cập nhật): chữ trắng 6,7:1 */
  --stc-gold-text: #E0B85C; --stc-ok-text: #63B98E; --stc-err-text: #E68A82; --stc-info-text: #7FB2D6; --stc-blue-text: #8DB0E8;
  --stc-purple-text: #BBA0E6; --stc-orange-text: #E59A6A; --stc-rose-text: #E68A9C; --stc-ink-on-solid: #0A0A0A;
  /* lớp phủ + bóng (một lớp, có độ lệch; không quầng màu) */
  --stc-scrim: rgba(0, 0, 0, 0.72); --stc-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); --stc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --stc-scrollbar: #2E2E2E; --stc-scrollbar-hover: #4A4A4A;
  /* thông báo (toast): luôn tối ở CẢ HAI chủ đề */
  --stc-toast-bg: #141414; --stc-toast-border: #2A2A2A; --stc-toast-title: #E8C46E; --stc-toast-text: #EDE4CC; --stc-toast-muted: #C2BAA8;
  /* ô số thứ tự hồ sơ: giống ô số thanh tác vụ, cố định ở cả hai chủ đề */
  --stc-seq-bg: #202124; --stc-seq-text: #FFFFFF;
  /* khung quỹ đạo + biểu ngữ gói (hết hạn/vượt mức giữ sắc hổ phách: đó là TRẠNG THÁI, không trang trí) */
  --stc-orbit-track: #3A3A3A; --stc-orbit-planet: #8E6A20;
  --stc-plan-trial-bg: #121212; --stc-plan-expired-bg: rgba(224, 151, 90, 0.12); --stc-plan-suspended-bg: #191919;
  --stc-plan-trial-edge: #3A3A3A; --stc-plan-expired-edge: rgba(224, 151, 90, 0.45); --stc-plan-suspended-edge: #3A3A3A;
  /* hộp thoại "Tạo/Sửa cửa sổ" (.bit-*) — cùng bậc xám với phần còn lại */
  --dlg-bg: #121212; --dlg-border: #262626; --dlg-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  --dlg-head-bg: #121212; --dlg-rail-bg: #0E0E0E; --dlg-body-bg: #121212; --dlg-field-bg: #0E0E0E; --dlg-field-bg-focus: #0E0E0E;
  --dlg-field-border: #6B6B6B; --dlg-placeholder: #8A8476; --dlg-text: #EDE4CC; --dlg-strong: #E8C46E; --dlg-setting-title: #EDE4CC;
  --dlg-soft: #D9D1BC; --dlg-muted: #A39B8B; --dlg-title: #E8C46E; --dlg-hover-text: #E8C46E; --dlg-iconbtn-bg: #191919; --dlg-iconbtn-border: #3A3A3A;
  --dlg-iconbtn-bg-hover: #202020; --dlg-tint-1: rgba(255, 255, 255, 0.04); --dlg-tint-2: rgba(255, 255, 255, 0.07); --dlg-tag-bg: rgba(255, 255, 255, 0.04);
  --dlg-row-line: #1C1C1C; --dlg-subcard-bg: #161616; --dlg-track: #2E2E2E; --dlg-knob: #A39B8B; --dlg-onaccent: #0A0A0A;
  /* hình học dùng chung */
  --stc-r-ctl: 6px; --stc-r-card: 8px; --stc-r-dlg: 10px;
  color-scheme: dark;
}
html[data-theme="light"] {
  /* Sáng: cùng nhận diện (chữ đen, nhấn vàng), nền trắng/xám trung tính, không ám vàng */
  --stc-bg: #F4F4F4; --stc-side: #ECECEC; --stc-surface: #FFFFFF; --stc-surface-2: #F7F7F7; --stc-surface-3: #EFEFEF; --stc-input: #FFFFFF;
  --stc-line: #ECECEC; --stc-border: #DDDDDD; --stc-border-strong: #C4C4C4; --stc-border-ctl: #7A7A7A; --stc-border-hover: #4F4F4F;
  --stc-text: #1C1A16; --stc-text-strong: #0F0E0B; --stc-muted: #57534A; --stc-dim: #66615A;
  --stc-accent: #CFA046; --stc-accent-text: #7A5A14; --stc-accent-ink: #0F0E0B; --stc-accent-dark: #6A4609; --stc-focus: #7A5A14;
  --stc-wave-peak: var(--stc-accent-text);   /* đỉnh làn sóng chữ: đen -> nâu vàng (6:1 trên nền trắng) */
  --stc-qr-bg: #FFFFFF; --stc-qr-ink: #000000;
  --stc-fill-1: rgba(0, 0, 0, 0.03); --stc-fill-2: rgba(0, 0, 0, 0.055); --stc-fill-active: #E6E6E6; --stc-accent-soft: var(--stc-fill-active);
  --stc-row-hover: #F7F7F7; --stc-row-selected: #F0F0F0; --stc-selection: rgba(207, 160, 70, 0.32);
  --stc-ok: #167048; --stc-warn: #8A4A00; --stc-err: #B3322D;
  --stc-ok-soft: rgba(22, 112, 72, 0.08); --stc-warn-soft: rgba(138, 74, 0, 0.08); --stc-err-soft: rgba(179, 50, 45, 0.08);
  --stc-err-solid: #A3362F; --stc-on-err-solid: #FFFFFF;
  --stc-gold-text: #6A4609; --stc-ok-text: #136342; --stc-err-text: #A82E29; --stc-info-text: #0B5A82; --stc-blue-text: #1D4F9C;
  --stc-purple-text: #6B3FA0; --stc-orange-text: #8F3A08; --stc-rose-text: #A8264A; --stc-ink-on-solid: #FFFFFF;
  --stc-scrim: rgba(15, 14, 11, 0.45); --stc-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); --stc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --stc-scrollbar: #C4C4C4; --stc-scrollbar-hover: #9A9A9A;
  --stc-orbit-track: #C4C4C4; --stc-orbit-planet: #6A4609;
  --stc-plan-trial-bg: #FFFFFF; --stc-plan-expired-bg: #FCEBD5; --stc-plan-suspended-bg: #ECECEC;
  --stc-plan-trial-edge: #C4C4C4; --stc-plan-expired-edge: rgba(138, 74, 0, 0.55); --stc-plan-suspended-edge: #C4C4C4;
  --dlg-bg: #FFFFFF; --dlg-border: var(--stc-border); --dlg-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  --dlg-head-bg: #FFFFFF; --dlg-rail-bg: #F4F4F4; --dlg-body-bg: #FFFFFF; --dlg-field-bg: #FFFFFF; --dlg-field-bg-focus: #FFFFFF;
  --dlg-field-border: var(--stc-border-ctl); --dlg-placeholder: var(--stc-dim); --dlg-text: var(--stc-text); --dlg-strong: var(--stc-text-strong);
  --dlg-setting-title: var(--stc-text-strong); --dlg-soft: var(--stc-text); --dlg-muted: var(--stc-muted); --dlg-title: var(--stc-text-strong);
  --dlg-hover-text: var(--stc-text-strong); --dlg-iconbtn-bg: #F7F7F7; --dlg-iconbtn-border: var(--stc-border-ctl); --dlg-iconbtn-bg-hover: #EFEFEF;
  --dlg-tint-1: rgba(0, 0, 0, 0.04); --dlg-tint-2: rgba(0, 0, 0, 0.07); --dlg-tag-bg: #F7F7F7; --dlg-row-line: var(--stc-border);
  --dlg-subcard-bg: #F7F7F7; --dlg-track: #7A7A7A; --dlg-knob: #FFFFFF; --dlg-onaccent: #0F0E0B;
  color-scheme: light;
}

/* ---- biến cũ (--bg-deep, --text-main, --accent-cyan, ...) là bí danh khai báo ở đầu style.css, trỏ về token trên ---- */
:root { --stc-font: "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; }
html, body, button, input, select, textarea { font-family: var(--stc-font); }
body { background: var(--stc-bg); color: var(--stc-text); box-sizing: border-box; font-size: 14px; }
.cyber-ambient, .ambient-glow, .brand-glow-ring { display: none !important; }
* { text-shadow: none !important; }

/* ---- điều khiển Sáng/Tối + tài khoản: nằm ở CHÂN thanh bên (không còn thanh đầu trang: cửa sổ app chỉ có một lớp khung, khung gốc của cửa sổ) ---- */
.stc-seg { display: inline-flex; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); overflow: hidden; background: var(--stc-surface); }
.stc-seg button { background: transparent; border: 0; color: var(--stc-muted); padding: 7px 12px; font-size: 13px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.stc-seg button[aria-pressed="true"] { background: var(--stc-fill-active); color: var(--stc-text-strong); font-weight: 600; }      /* một viền (của nhóm), không viền vàng lồng bên trong */
.stc-seg button:focus-visible, .stc-btn2:focus-visible, .stc-menu button:focus-visible, .stc-tab:focus-visible, .stc-account > button:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 1px; }
.nav-item:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: -2px; }
.stc-account { position: relative; }
.stc-account > button { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; background: transparent; border: 1px solid transparent; color: var(--stc-text); padding: 5px 8px; border-radius: var(--stc-r-card); cursor: pointer; font-size: 13.5px; text-align: left; }
.stc-account > button:hover, .stc-account > button[aria-expanded="true"] { background: var(--stc-row-hover); border-color: var(--stc-border); }
.stc-avatar { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--stc-accent-soft); color: var(--stc-accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; border: 1px solid var(--stc-border); }
.stc-who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.stc-who-name { color: var(--stc-text-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stc-who-role { color: var(--stc-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stc-account .stc-chev { flex-shrink: 0; color: var(--stc-muted); }

/* ---- sidebar ---- */
.sidebar { width: 232px; min-height: 0; background: var(--stc-side); border-right: 1px solid var(--stc-border); backdrop-filter: none; }
.sidebar .brand, .sidebar .sidebar-stats { display: none !important; }
.stc-side-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 14px 18px 10px; }
.stc-side-brand img { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.stc-side-brand span { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; color: var(--stc-text-strong); white-space: nowrap; }
/* giữa: các mục (tự cuộn khi thấp/dài); đầu + chân luôn ghim */
.nav-menu { display: flex; flex-direction: column; padding: 4px 10px 8px; gap: 2px; overflow-x: hidden; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.nav-sec { font-size: 11px; letter-spacing: 0.8px; color: var(--stc-dim); padding: 14px 10px 6px; text-transform: uppercase; }
.nav-item { border-radius: var(--stc-r-card); color: var(--stc-text); }
.nav-item:hover { background: var(--stc-row-hover); }
.nav-item.active { background: var(--stc-accent-soft); border-color: transparent; color: var(--stc-text-strong); }
.nav-item.active .nav-icon-box { color: var(--stc-accent-text); }
/* hover theo token của chủ đề (trước đây chữ ép màu trắng nên biến mất ở nền sáng; icon bị bao ô viền) */
.nav-item:hover { color: var(--stc-text-strong); }
.nav-item:hover .nav-icon-box { color: var(--stc-text-strong); background: transparent; border-color: transparent; }
.nav-item.active:hover .nav-icon-box { color: var(--stc-accent-text); }
.nav-item.active::before { display: none; }
.nav-label { font-size: 14px; }
.nav-item[data-tab="profiles"] { order: 10; } .nav-item[data-tab="cloudphone"] { order: 11; } .nav-item[data-tab="proxies"] { order: 12; }
.nav-item[data-tab="groups"] { order: 13; } .nav-item[data-tab="extensions"] { order: 14; }
.nav-sec[data-s="tools"] { order: 20; } .nav-item[data-tab="mobile"] { order: 21; } .nav-item[data-tab="ecommerce"] { order: 22; }
.nav-item[data-tab="sync"] { order: 23; } .nav-item[data-tab="warmer"] { order: 24; } .nav-item[data-tab="audit"] { order: 25; }
.nav-sec[data-s="admin"] { order: 30; } .nav-item[data-admin-only] { order: 31; } .nav-item[data-tab="activity"] { order: 32; } .nav-item[data-tab="billing"] { order: 33; }
.nav-item[data-tab="settings"] { order: 90; margin-top: auto; }
/* chân thanh bên: hạn mức + (tài khoản | Sáng/Tối) */
.stc-side-foot { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--stc-border); background: var(--stc-side); }
/* menu tài khoản mở LÊN TRÊN nút (nút nằm sát đáy cửa sổ) */
.stc-sidebar-quota { margin: 0; padding: 8px 12px; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); background: var(--stc-surface); color: var(--stc-text); font-size: 13.5px; display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 10px; }
.stc-sidebar-quota b { font-variant-numeric: tabular-nums; color: var(--stc-text-strong); }

/* ---- vùng nội dung ---- */
.metrics-strip { display: none !important; }
.page-title { font-size: 22px; font-weight: 700; color: var(--stc-text-strong); }
.stc-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 22px 28px 6px; }
.stc-h1 { font-size: 30px; font-weight: 700; margin: 0; color: var(--stc-text-strong); display: flex; align-items: center; gap: 12px; }
.stc-pill-count { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: var(--stc-r-ctl); border: 1px solid var(--stc-border); background: var(--stc-surface); color: var(--stc-text); }
.stc-sub { margin: 4px 0 0; color: var(--stc-muted); font-size: 15px; }
.stc-btn2 { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-surface); color: var(--stc-text); font-size: 14px; cursor: pointer; white-space: nowrap; }
.stc-btn2:hover { border-color: var(--stc-border-hover); }
.stc-btn2[disabled], .stc-menu button[disabled] { opacity: 0.45; cursor: not-allowed; }
.stc-btn2.primary { background: var(--stc-accent); color: var(--stc-accent-ink); border-color: var(--stc-accent); font-weight: 600; }
.stc-btn2.primary:hover { filter: brightness(1.06); }
.stc-btn2.danger { color: var(--stc-err); border-color: var(--stc-err); }
.stc-btn2.sm { padding: 6px 12px; font-size: 13px; }
.stc-tabs { display: flex; gap: 6px; padding: 8px 28px 0; border-bottom: 1px solid var(--stc-border); margin: 0 0 0; }
.stc-tab { background: transparent; border: 0; color: var(--stc-muted); padding: 12px 14px; font-size: 15px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; }
.stc-tab[aria-selected="true"] { color: var(--stc-accent-text); border-bottom-color: var(--stc-accent); font-weight: 600; }
.stc-tab .n { font-size: 12px; padding: 1px 7px; border-radius: var(--stc-r-ctl); background: var(--stc-accent-soft); color: var(--stc-accent-text); border: 1px solid var(--stc-border); }
.stc-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 28px 0; flex-wrap: wrap; }
.stc-toolbar .grow { flex: 1; }
.stc-search { position: relative; min-width: 280px; flex: 1; max-width: 520px; }
.stc-search input { width: 100%; box-sizing: border-box; padding: 10px 12px 10px 34px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-input); color: var(--stc-text); font-size: 14px; }
.stc-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--stc-muted); }
.stc-select { padding: 10px 12px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-input); color: var(--stc-text); font-size: 14px; min-width: 150px; }
.stc-bulk { display: flex; align-items: center; gap: 10px; padding: 12px 28px 0; flex-wrap: wrap; }
.stc-bulk .count { color: var(--stc-text); font-size: 14px; margin-right: 6px; }
.stc-more { position: relative; display: inline-block; }
.stc-more > summary { list-style: none; } .stc-more > summary::-webkit-details-marker { display: none; }
.stc-more[open] > .stc-menu { display: block; }
.stc-os-filter { padding: 8px 28px 0; }
.stc-os-filter summary { cursor: pointer; color: var(--stc-muted); font-size: 13px; }
.stc-table-card { margin: 14px 28px 0; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); background: var(--stc-surface); overflow-x: auto; overflow-y: visible; }
table.stc-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.stc-table th { text-align: left; font-weight: 500; color: var(--stc-muted); padding: 12px 12px; border-bottom: 1px solid var(--stc-border); white-space: nowrap; font-size: 13.5px; }
.stc-table td { padding: 0 12px; height: 46px; border-bottom: 1px solid var(--stc-border); color: var(--stc-text); vertical-align: middle; }
.stc-table tr:last-child td { border-bottom: 0; }
.stc-table tbody tr:hover { background: var(--stc-row-hover); }
.stc-table tbody tr.selected { background: var(--stc-row-selected); }
.stc-table input[type="checkbox"], .stc-bulk input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--stc-accent); cursor: pointer; }
.stc-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stc-tile { width: 28px; height: 28px; border-radius: var(--stc-r-ctl); border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text-strong); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.stc-name .t { font-weight: 500; color: var(--stc-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.stc-chip { display: inline-block; padding: 3px 10px; border-radius: var(--stc-r-ctl); border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text); font-size: 13px; }
/* Số thứ tự hồ sơ: cùng kiểu ô số trên biểu tượng ở thanh tác vụ (nền tối, số trắng) ở cả hai giao diện, để mắt khớp ngay hàng với nút thanh tác vụ. */
.stc-seq { flex-shrink: 0; min-width: 2.4em; padding: 1px 6px; border-radius: var(--stc-r-ctl); border: 1px solid var(--stc-border); background: var(--stc-seq-bg); color: var(--stc-seq-text);
  font-size: 12.5px; font-weight: 600; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.stc-name .stc-seq + .t { margin-left: -4px; }
.stc-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--stc-dim); }
.stc-st { display: inline-flex; align-items: center; white-space: nowrap; }
.stc-st.open { color: var(--stc-ok); } .stc-st.open .stc-dot { background: var(--stc-ok); }
.stc-st.busy { color: var(--stc-warn); } .stc-st.busy .stc-dot { background: var(--stc-warn); }
.stc-st.err { color: var(--stc-err); } .stc-st.err .stc-dot { background: var(--stc-err); }
.stc-st.closed { color: var(--stc-muted); }
.stc-st.held { color: var(--stc-accent-text); max-width: 230px; } .stc-st.held .t { overflow: hidden; text-overflow: ellipsis; }
.stc-btn2[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; } .stc-btn2[aria-disabled="true"]:hover { border-color: var(--stc-border); }
button[aria-disabled="true"]:not(.stc-btn2) { opacity: 0.55; cursor: not-allowed; }      /* nút đang chờ phản hồi nhưng còn giữ tiêu điểm bàn phím (stcOnce) */
.stc-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stc-sync { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--stc-muted); font-size: 13.5px; }
.stc-sync.ok { color: var(--stc-muted); } .stc-sync.pending { color: var(--stc-warn); } .stc-sync.conflict, .stc-sync.err { color: var(--stc-err); }
.stc-sync.lost { color: var(--stc-err); font-weight: 600; } .stc-sync.lost svg { flex-shrink: 0; }
.toast .toast-msg { color: var(--stc-toast-muted); }      /* nền thông báo luôn tối ở cả hai theme: chữ phụ dùng --text-muted (xám xanh) chỉ còn 2,7:1 ở theme sáng => thông báo cảnh báo mất dữ liệu không đọc nổi */
.stc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stc-act { display: flex; align-items: center; gap: 8px; }
.stc-act .main { min-width: 94px; justify-content: center; padding: 6px 12px; font-size: 13.5px; }
.stc-act .main.is-open { color: var(--stc-accent-text); border-color: var(--stc-border-hover); }
.stc-kebab { width: 34px; height: 34px; border-radius: var(--stc-r-card); border: 1px solid transparent; background: transparent; color: var(--stc-text); cursor: pointer; font-size: 18px; line-height: 1; }
.stc-kebab:hover, .stc-kebab[aria-expanded="true"] { background: var(--stc-row-hover); border-color: var(--stc-border); }
.stc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px 18px; flex-wrap: wrap; color: var(--stc-muted); font-size: 14px; }
.stc-foot b { color: var(--stc-text); }
.stc-pager { display: flex; align-items: center; gap: 6px; }
.stc-pager button { min-width: 34px; height: 34px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-surface); color: var(--stc-text); cursor: pointer; }
.stc-pager button[aria-current="page"] { border-color: var(--stc-accent); color: var(--stc-accent-text); font-weight: 700; }
.stc-pager button[disabled] { opacity: 0.4; cursor: not-allowed; }

.stc-col-hide { display: none !important; }

/* ---- menu popover (ba chấm / tài khoản / thêm) ---- */
.stc-menu { display: none; position: fixed; z-index: 99800; min-width: 250px; max-width: 320px; padding: 6px; border-radius: var(--stc-r-card); background: var(--stc-surface); border: 1px solid var(--stc-border); box-shadow: var(--stc-shadow); }
.stc-menu.open { display: block; }
.stc-more > .stc-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 800; }
.stc-menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: var(--stc-r-ctl); background: transparent; color: var(--stc-text); font-size: 14px; text-align: left; cursor: pointer; }
.stc-menu button:hover:not([disabled]) { background: var(--stc-row-hover); }
.stc-menu button.danger { color: var(--stc-err); }
.stc-menu button svg { flex-shrink: 0; opacity: 0.85; }
.stc-menu .sep { height: 1px; margin: 5px 4px; background: var(--stc-border); }
.stc-menu .tag { margin-left: auto; font-size: 11px; color: var(--stc-dim); }

/* ---- hộp thoại ---- */
.stc-modal-bg { position: fixed; inset: 0; z-index: 99700; background: var(--stc-scrim); display: flex; align-items: center; justify-content: center; }
.stc-modal { width: min(640px, 94vw); max-height: 90vh; overflow: auto; background: var(--stc-surface); color: var(--stc-text); border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); padding: 20px; box-shadow: var(--stc-shadow); }
.stc-modal h3 { margin: 0 0 12px; font-size: 18px; color: var(--stc-text-strong); }
.stc-modal .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.stc-modal textarea, .stc-modal input:is([type="text"], [type="password"], [type="number"], [type="email"], [type="search"], [type="url"]), .stc-modal select { width: 100%; box-sizing: border-box; padding: 9px 10px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-input); color: var(--stc-text); font-size: 13.5px; }
.stc-modal textarea { min-height: 150px; font-family: Consolas, "Cascadia Mono", monospace; }
.stc-modal .muted { color: var(--stc-muted); font-size: 13px; }
.stc-modal .err { color: var(--stc-err); font-size: 13px; } .stc-modal .ok { color: var(--stc-ok); font-size: 13px; }
.stc-modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.stc-seg2 { display: inline-flex; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); overflow: hidden; }
.stc-seg2 button { background: transparent; border: 0; padding: 7px 12px; color: var(--stc-muted); cursor: pointer; font-size: 13px; }
.stc-seg2 button[aria-pressed="true"] { background: var(--stc-accent-soft); color: var(--stc-text-strong); }

/* ---- màn đăng nhập ---- */
#stc-login-overlay { background: var(--stc-bg) !important; }
#stc-login-overlay .card { width: min(400px, 92vw); background: var(--stc-surface); border: 1px solid var(--stc-border); border-radius: var(--stc-r-dlg); padding: 28px; box-shadow: var(--stc-shadow); }
#stc-login-overlay .card img { width: 64px; height: 64px; display: block; margin: 0 auto 8px; }
#stc-login-overlay .card h1 { font-size: 24px; text-align: center; margin: 0; color: var(--stc-text-strong); font-weight: 700; }
#stc-login-overlay .card p { text-align: center; margin: 4px 0 16px; color: var(--stc-muted); font-size: 13px; }
#stc-login-overlay input { width: 100%; box-sizing: border-box; padding: 11px 12px; margin-bottom: 10px; border-radius: var(--stc-r-card); border: 1px solid var(--stc-border); background: var(--stc-input); color: var(--stc-text); font-size: 14px; }
#stc-login-overlay #login-btn { width: 100%; padding: 11px; border: 0; border-radius: var(--stc-r-card); background: var(--stc-accent); color: var(--stc-accent-ink); font-weight: 700; font-size: 14px; cursor: pointer; }
#stc-login-overlay .theme-row { display: flex; justify-content: center; margin-top: 14px; }

/* ---- nút/badge cũ ở các màn chưa dựng lại: bỏ gradient/neon ---- */
.btn-primary { background: var(--stc-accent) !important; color: var(--stc-accent-ink) !important; border-color: var(--stc-accent) !important; box-shadow: none !important; }
.btn-secondary { background: var(--stc-surface) !important; color: var(--stc-text) !important; border: 1px solid var(--stc-border) !important; box-shadow: none !important; }
.table-card, .modal-content, .modal { background: var(--stc-surface); border-color: var(--stc-border); }

/* ---- theme sáng: các màu inline "cứng" (tối) trong HTML/JS cũ ---- */
html[data-theme="light"] [style*="color:#fff"], html[data-theme="light"] [style*="color: #fff"], html[data-theme="light"] [style*="color:#ffffff"],
html[data-theme="light"] [style*="color: #ffffff"], html[data-theme="light"] [style*="color:#f1f5f9"], html[data-theme="light"] [style*="color:#e2e8f0"],
html[data-theme="light"] [style*="color: #e2e8f0"] { color: var(--stc-text-strong) !important; }
html[data-theme="light"] [style*="color:#cbd5e1"], html[data-theme="light"] [style*="color: #cbd5e1"], html[data-theme="light"] [style*="color:#94a3b8"],
html[data-theme="light"] [style*="color: #94a3b8"] { color: var(--stc-muted) !important; }
html[data-theme="light"] [style*="color:#64748b"], html[data-theme="light"] [style*="color: #64748b"] { color: var(--stc-dim) !important; }
html[data-theme="light"] [style*="color:#a5b4fc"], html[data-theme="light"] [style*="color:#6366f1"], html[data-theme="light"] [style*="color:#38bdf8"] { color: var(--stc-accent-text) !important; }
html[data-theme="light"] [style*="background:#0f172a"], html[data-theme="light"] [style*="background:#0e1526"], html[data-theme="light"] [style*="background:#141b2e"],
html[data-theme="light"] [style*="background:#0b1020"], html[data-theme="light"] [style*="background: #0f172a"] { background: var(--stc-surface) !important; }
html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { color: var(--stc-text); }

@media (max-width: 1100px) { .sidebar { width: 200px; } .stc-page-head, .stc-tabs, .stc-toolbar, .stc-bulk, .stc-foot { padding-left: 16px; padding-right: 16px; } .stc-table-card { margin-left: 16px; margin-right: 16px; } }
@media (max-width: 900px) {
  .sidebar { width: 64px; } .nav-label, .nav-sec, .stc-sidebar-quota span:first-child, .stc-side-brand span, .stc-who, .stc-account .stc-chev { display: none; }
  .stc-side-brand { justify-content: center; padding: 14px 0 10px; }
  .stc-side-foot { padding: 8px 6px 10px; }
  .stc-sidebar-quota { justify-content: center; padding: 6px 2px; font-size: 10.5px; line-height: 1.25; text-align: center; overflow: hidden; }
  .stc-sidebar-quota b { overflow-wrap: anywhere; }
}

/* Cloud Phone: ui/static/css/cloudphone.css */

/* ---- Thùng rác hồ sơ (tab "Thùng rác" ở màn Hồ sơ trình duyệt; trash_view.js) ---- */
.stc-trash[hidden] { display: none; }
.stc-trash .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stc-trash-note { margin: 0; padding: 14px 28px 0; color: var(--stc-muted); font-size: 14px; line-height: 1.5; max-width: 90ch; }
#view-profiles.trash-mode > .stc-toolbar, #view-profiles.trash-mode > .stc-os-filter, #view-profiles.trash-mode > .stc-bulk.batch-controls,
#view-profiles.trash-mode > .stc-table-card, #view-profiles.trash-mode > .stc-foot { display: none; }
.stc-trash-card .stc-name .t { max-width: 320px; }
.stc-trash-left { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--stc-text); }
.stc-trash-left.soon { color: var(--stc-warn); font-weight: 600; }
.stc-trash-act { display: flex; gap: 8px; }
.stc-trash-empty td { height: 140px; text-align: center; color: var(--stc-muted); line-height: 1.6; }
.stc-trash-empty b { color: var(--stc-text-strong); font-weight: 600; }
.stc-trash .stc-btn2.sm[disabled] { cursor: not-allowed; }
.stc-trash input[type="checkbox"]:focus-visible, .stc-trash .stc-btn2:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 2px; }
/* Dọn dữ liệu mồ côi (thư mục trình duyệt của hồ sơ đã xóa hẳn) — dải dưới bảng thùng rác + hộp xem trước */
.stc-disk[hidden] { display: none; }
.stc-disk { display: flex; align-items: center; gap: 16px; margin: 14px 28px 0; padding: 14px 16px; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); background: var(--stc-surface); }
.stc-disk-text { margin: 0; flex: 1; min-width: 0; color: var(--stc-muted); font-size: 13.5px; line-height: 1.5; max-width: 90ch; }
.stc-disk-text b { display: block; color: var(--stc-text-strong); font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.stc-disk .stc-btn2[aria-busy="true"] { cursor: progress; }
.stc-disk-sumline { margin: 0 0 10px; color: var(--stc-text); font-size: 14px; line-height: 1.55; }
.stc-disk-sumline b { color: var(--stc-text-strong); font-variant-numeric: tabular-nums; }
.stc-disk-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); }
.stc-disk-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 12px; border-top: 1px solid var(--stc-border); font-size: 13px; }
.stc-disk-list li:first-child { border-top: 0; }
.stc-disk-list label { display: contents; cursor: pointer; }
.stc-disk-list .nm { font-family: Consolas, "Cascadia Mono", monospace; color: var(--stc-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stc-disk-list .nm small { font-family: var(--stc-font); color: var(--stc-muted); margin-left: 8px; }
.stc-disk-list .sz { font-variant-numeric: tabular-nums; color: var(--stc-text); white-space: nowrap; }
.stc-disk-list input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--stc-accent); }
.stc-disk-kept { margin-top: 10px; font-size: 13px; color: var(--stc-muted); }
.stc-disk-kept summary { cursor: pointer; color: var(--stc-text); }
.stc-disk-kept ul { margin: 6px 0 0; padding-left: 18px; max-height: 24vh; overflow: auto; line-height: 1.6; }
.stc-disk-list input[type="checkbox"]:focus-visible, .stc-disk-kept summary:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 2px; }
html[data-theme="light"] .stc-disk-list input[type="checkbox"] { accent-color: var(--stc-accent-text); }
html[data-theme="light"] :is(.stc-disk-list input[type="checkbox"], .stc-disk-kept summary):focus-visible { outline-color: var(--stc-accent-text); }
@media (max-width: 1100px) { .stc-disk { margin-left: 16px; margin-right: 16px; } }
@media (max-width: 640px) { .stc-disk { flex-direction: column; align-items: stretch; } }

/* ==========================================================================
   Theme SÁNG — tương phản (WCAG AA: chữ >= 4,5:1, chữ lớn/viền ô nhập >= 3:1). Mọi giá trị đi qua token --stc-* / --dlg-* ở đầu tệp;
   các luật dưới đây chỉ nối các thành phần cũ (viết cứng màu tối) vào token. KHÔNG có luật nào áp cho theme tối.
   Đo bằng tests/test_ui_light_contrast.py (computed style thật, cả hai theme).
   ========================================================================== */

/* ---- viền ô nhập / nút phụ: >= 3:1 so với nền (viền nhạt #CBD3DD chỉ còn 1,3:1). Đường kẻ hàng/thẻ vẫn nhạt (trang trí). ---- */
html[data-theme="light"] .stc-btn2:not(.primary):not(.danger), html[data-theme="light"] .stc-select, html[data-theme="light"] .stc-search input,
html[data-theme="light"] .stc-modal textarea, html[data-theme="light"] .stc-modal input:is([type="text"], [type="password"], [type="number"], [type="email"], [type="search"], [type="url"]), html[data-theme="light"] .stc-modal select,
html[data-theme="light"] #stc-login-overlay input, html[data-theme="light"] .form-control, html[data-theme="light"] .stc-pager button,
html[data-theme="light"] .btn-secondary, html[data-theme="light"] .stc-seg, html[data-theme="light"] .stc-seg2 { border-color: var(--stc-border-ctl) !important; }
html[data-theme="light"] .stc-btn2.danger { border-color: var(--stc-err) !important; }
html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color: var(--stc-dim); opacity: 1; }

/* ---- hộp thoại cũ (.modal-overlay): nền mờ, đầu hộp, nút đóng theo token ---- */
html[data-theme="light"] .modal-overlay { background: var(--stc-scrim); backdrop-filter: none; }
html[data-theme="light"] .modal-content { box-shadow: var(--stc-shadow); }
html[data-theme="light"] .modal-header { background: var(--stc-surface-2); }
html[data-theme="light"] .modal-header h3 { color: var(--stc-text-strong); }
html[data-theme="light"] .modal-close:hover, html[data-theme="light"] .bit-modal-close:hover { color: var(--stc-text-strong); }

/* ---- "Tạo/Sửa cửa sổ": nút chính/phụ ở chân hộp bỏ gradient indigo->vàng (chữ trắng trên vàng = 2,1:1) ---- */
html[data-theme="light"] .bit-btn-confirm, html[data-theme="light"] .bit-btn-random-all { background: var(--stc-accent); color: var(--stc-accent-ink); box-shadow: none; }
html[data-theme="light"] .bit-btn-confirm:hover, html[data-theme="light"] .bit-btn-random-all:hover { filter: brightness(1.06); box-shadow: none; }
html[data-theme="light"] .bit-sidebar-tab.active::before { box-shadow: none; }

/* ---- nút chức năng cũ ---- */
html[data-theme="light"] .btn-success { background: var(--stc-ok) !important; color: var(--stc-ink-on-solid) !important; box-shadow: none !important; }
html[data-theme="light"] .btn-danger { background: var(--stc-err) !important; color: var(--stc-ink-on-solid) !important; box-shadow: none !important; }
html[data-theme="light"] .pills-group { background: var(--stc-surface-2); backdrop-filter: none; }
html[data-theme="light"] .pill-btn:hover { color: var(--stc-text-strong); background: var(--stc-row-hover); }
html[data-theme="light"] .pill-btn.active { color: var(--stc-text-strong); background: var(--stc-accent-soft); border-color: var(--stc-border-hover); box-shadow: none; }
html[data-theme="light"] .pill-btn.active .pill-count { background: var(--stc-accent-text); color: var(--stc-ink-on-solid); }
html[data-theme="light"] .pill-count { background: var(--stc-border); color: var(--stc-text); }
html[data-theme="light"] .btn-action-group .btn-secondary.btn-sm { color: var(--stc-muted); background: var(--stc-surface-2); }
html[data-theme="light"] .btn-action-group .btn-secondary.btn-sm:hover { color: var(--stc-text-strong); background: var(--stc-row-hover); }
/* nút .stc-btn (bảng nhân viên): nền chàm nhạt + chữ #c7d2fe (1,2:1 trên trắng) => vàng nhạt theo token */
html[data-theme="light"] .stc-btn { background: var(--stc-accent-soft); border-color: var(--stc-border-ctl); color: var(--stc-accent-text); }
html[data-theme="light"] .stc-btn:hover { background: var(--stc-surface-3); color: var(--stc-text-strong); }

/* ---- nhãn/huy hiệu màu: chữ đậm đủ tương phản trên nền tint của chính nó ---- */
html[data-theme="light"] .section-tag-pill.gold { color: var(--stc-gold-text); }
html[data-theme="light"] .section-tag-pill.purple { color: var(--stc-purple-text); }
html[data-theme="light"] .section-tag-pill.green { color: var(--stc-ok-text); }
html[data-theme="light"] .section-tag-pill.orange { color: var(--stc-orange-text); }
html[data-theme="light"] .badge-win { color: var(--stc-blue-text); }
html[data-theme="light"] .badge-mac { color: var(--stc-purple-text); }
html[data-theme="light"] .badge-android, html[data-theme="light"] .badge-running { color: var(--stc-ok-text); }
html[data-theme="light"] .badge-ios { color: var(--stc-rose-text); }
html[data-theme="light"] .badge-linux { color: var(--stc-gold-text); }
html[data-theme="light"] .badge-running { box-shadow: none; }

/* ---- tiêu đề viết cứng #fff trong các màn cũ (Đồng bộ / Soi danh tính / Thiết bị Mobile): biến mất trên nền trắng ---- */
html[data-theme="light"] .feature-info h4, html[data-theme="light"] .audit-card h4, html[data-theme="light"] .audit-picker-title,
html[data-theme="light"] .mobile-name, html[data-theme="light"] .metric-value { color: var(--stc-text-strong); }
html[data-theme="light"] .feature-box { background: var(--stc-surface-2); }

/* ---- Mẫu thương mại (thẻ + hộp) ---- */
html[data-theme="light"] .ecommerce-proxy-tip { background: var(--stc-surface-2); border: 1px solid var(--stc-border); }
html[data-theme="light"] .ecommerce-card:hover { box-shadow: none; border-color: var(--stc-border-hover); }
html[data-theme="light"] .ecommerce-card-icon { background: var(--stc-accent-soft); border-color: var(--stc-border); }

/* ---- màu viết cứng trong style="…" của HTML/JS cũ (cả dạng có và không có dấu cách sau dấu hai chấm) ---- */
html[data-theme="light"] [style*="color:#fbbf24"], html[data-theme="light"] [style*="color: #fbbf24"], html[data-theme="light"] [style*="color:#f59e0b"],
html[data-theme="light"] [style*="color: #f59e0b"] { color: var(--stc-gold-text) !important; }
html[data-theme="light"] [style*="color:#34d399"], html[data-theme="light"] [style*="color: #34d399"], html[data-theme="light"] [style*="color:#10b981"],
html[data-theme="light"] [style*="color: #10b981"], html[data-theme="light"] [style*="color:#22c55e"], html[data-theme="light"] [style*="color: #22c55e"] { color: var(--stc-ok-text) !important; }
html[data-theme="light"] [style*="color:#f87171"], html[data-theme="light"] [style*="color: #f87171"], html[data-theme="light"] [style*="color:#f43f5e"],
html[data-theme="light"] [style*="color: #f43f5e"] { color: var(--stc-err-text) !important; }
html[data-theme="light"] [style*="color: #38bdf8"], html[data-theme="light"] [style*="color:#06b6d4"], html[data-theme="light"] [style*="color: #06b6d4"],
html[data-theme="light"] [style*="color:#60a5fa"], html[data-theme="light"] [style*="color: #60a5fa"], html[data-theme="light"] [style*="color:#3b82f6"],
html[data-theme="light"] [style*="color: #3b82f6"] { color: var(--stc-info-text) !important; }
html[data-theme="light"] [style*="color: #a5b4fc"], html[data-theme="light"] [style*="color: #6366f1"] { color: var(--stc-accent-text) !important; }
html[data-theme="light"] [style*="color:#475569"], html[data-theme="light"] [style*="color: #475569"] { color: var(--stc-dim) !important; }
html[data-theme="light"] [style*="color: #f1f5f9"] { color: var(--stc-text-strong) !important; }
html[data-theme="light"] [style*="background: #0f172a"], html[data-theme="light"] [style*="background: #0e1526"], html[data-theme="light"] [style*="background:#0e1526"],
html[data-theme="light"] [style*="background:rgba(15, 23, 42"], html[data-theme="light"] [style*="background: rgba(15, 23, 42"], html[data-theme="light"] [style*="background:rgba(15,23,42"],
html[data-theme="light"] [style*="background: rgba(30, 41, 59"] { background: var(--stc-surface-2) !important; }

/* ---- "đảo tối": thành phần tối ở CẢ HAI theme (toast, hộp xác nhận, terminal nuôi nick). Trả token về giá trị tối để mọi chữ bên trong
   (token + màu inline được ánh xạ ở trên) đọc được trên nền tối, thay vì bị đổi sang màu của theme sáng. ---- */
html[data-theme="light"] .toast, html[data-theme="light"] .confirm-dialog-box, html[data-theme="light"] #warmer-terminal {
  --stc-text: #EDE4CC; --stc-text-strong: #E8C46E; --stc-muted: #A39B8B; --stc-dim: #8A8476; --stc-accent-text: #E0B85C; --stc-border: #2A2A2A;
  --stc-ok-text: #63B98E; --stc-err-text: #E68A82; --stc-gold-text: #E0B85C; --stc-info-text: #7FB2D6;
  --stc-ok: #63B98E; --stc-warn: #E0975A; --stc-err: #E07B72; --stc-surface: #141414; --stc-surface-2: #191919;
  /* bí danh cũ phải khai báo lại ở đây (biến lồng biến được tính tại phần tử khai báo) */
  --text-main: var(--stc-text); --text: var(--stc-text); --text-bright: var(--stc-text-strong); --text-muted: var(--stc-muted); --text-dim: var(--stc-dim); --border-subtle: var(--stc-border);
  --accent-emerald: var(--stc-ok); --accent-rose: var(--stc-err); --accent-amber: var(--stc-warn); --accent-cyan: var(--stc-accent-text); --accent-gold: var(--stc-accent-text);
  color: var(--stc-text);
}
html[data-theme="light"] .confirm-dialog-title { color: var(--stc-toast-title); }

/* ---- ô nhập của Cloud Phone / Change Phone / nhân viên + bảng cũ (.bit-table) ---- */
html[data-theme="light"] :is(.cp-root, #cv-root, .cv-root) :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
html[data-theme="light"] #cv-search, html[data-theme="light"] #sa-search { border-color: var(--stc-border-ctl) !important; }
html[data-theme="light"] .bit-table th { background: var(--stc-surface-2); }
html[data-theme="light"] .bit-table td { border-bottom-color: var(--stc-border); }
html[data-theme="light"] .bit-table tbody tr:hover td { background: var(--stc-row-hover); }

/* ---- tiêu điểm bàn phím + ô tick: vàng #D0AC67 chỉ 2,1:1 trên nền trắng (cần >= 3:1) => dùng màu chữ vàng đậm của theme sáng ---- */
html[data-theme="light"] :is(.stc-seg button, .stc-btn2, .stc-menu button, .stc-tab, .stc-account > button, .stc-trash input[type="checkbox"]):focus-visible { outline-color: var(--stc-accent-text); }
html[data-theme="light"] .nav-item:focus-visible { outline-color: var(--stc-accent-text); }
html[data-theme="light"] :is(.stc-table, .stc-bulk) input[type="checkbox"], html[data-theme="light"] input[type="checkbox"], html[data-theme="light"] input[type="radio"] { accent-color: var(--stc-accent-text); }

/* ---- Lõi trình duyệt bắt buộc (core_required.js): tam giác đỏ cạnh nút Mở, thanh tiến độ tải, danh sách lõi, nhắc tải khi máy chưa có lõi ---- */
.stc-core-warn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; padding: 0; border: 1px solid transparent; border-radius: var(--stc-r-card); background: transparent; color: var(--stc-err); cursor: pointer; }
.stc-core-warn:hover { background: var(--stc-err-soft); border-color: var(--stc-err); }
.stc-core-warn:focus-visible { outline: 2px solid var(--stc-err); outline-offset: 1px; }
.stc-core-prog { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.stc-core-prog[hidden] { display: none; }
.stc-core-bar { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--stc-surface-2); border: 1px solid var(--stc-border); overflow: hidden; }
.stc-core-bar > span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--stc-accent); border-radius: 4px; transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.stc-core-pct { min-width: 9ch; text-align: right; font-size: 12.5px; color: var(--stc-muted); font-variant-numeric: tabular-nums; }
.stc-core-dialog .stc-modal { width: min(520px, 94vw); }
.stc-core-dialog .stc-modal p { line-height: 1.5; margin: 0 0 10px; }
.stc-core-dialog .stc-core-lbl { display: block; margin: 4px 0 6px; font-size: 13px; color: var(--stc-muted); }
.stc-core-h { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--stc-muted); letter-spacing: 0.01em; }
.stc-core-h:first-child { margin-top: 0; }
.stc-core-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); overflow: hidden; }
.stc-core-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 14px; border-top: 1px solid var(--stc-border); }
.stc-core-row:first-child { border-top: 0; }
.stc-core-row .stc-core-prog { flex-basis: 100%; margin: 2px 0 0; }
.stc-core-name { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; color: var(--stc-text); font-size: 14px; }
.stc-core-name b { font-weight: 600; color: var(--stc-text-strong); font-variant-numeric: tabular-nums; }
.stc-core-meta { font-size: 12.5px; color: var(--stc-muted); font-variant-numeric: tabular-nums; }
.stc-core-stable { font-size: 11.5px; padding: 1px 8px; }
.stc-core-empty { list-style: none; padding: 12px 14px; color: var(--stc-muted); font-size: 13px; }
.stc-core-res { margin-top: 10px; font-size: 13px; }
.stc-core-res .err, .stc-cores-panel .err { color: var(--stc-err); }
.stc-core-banner[hidden] { display: none; }
.stc-core-banner { display: flex; align-items: center; gap: 12px; margin: 14px 28px 0; padding: 12px 14px; border: 1px solid var(--stc-border); border-radius: var(--stc-r-card); background: var(--stc-surface); color: var(--stc-text); }      /* cảnh báo do biểu tượng màu --stc-warn báo; nền + viền trung tính */
.stc-core-banner > svg { flex: none; color: var(--stc-warn); }
.stc-core-banner-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; max-width: 90ch; }
.stc-core-banner-text b { color: var(--stc-text-strong); font-weight: 600; }
.stc-core-banner-x { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; border: 0; border-radius: var(--stc-r-ctl); background: transparent; color: var(--stc-muted); cursor: pointer; }
.stc-core-banner-x:hover { color: var(--stc-text); background: var(--stc-row-hover); }
.stc-core-banner-x:focus-visible, .stc-core-banner .stc-btn2:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 1px; }
html[data-theme="light"] .stc-core-banner-x:focus-visible, html[data-theme="light"] .stc-core-banner .stc-btn2:focus-visible { outline-color: var(--stc-accent-text); }
#create-modal .stc-core-prog { margin-top: 8px; }
@media (max-width: 640px) { .stc-core-banner { margin: 12px 16px 0; flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { .stc-core-bar > span { transition: none; } }

/* ---- mất dịch vụ cục bộ: lớp phủ "Đang kết nối lại…" (app.js, STCLink) + thanh báo mất Internet / không tới được máy chủ STC ---- */
#stc-link-overlay { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--stc-scrim); }
#stc-link-overlay[hidden], #stc-net-bar[hidden] { display: none; }
#stc-link-overlay .stc-link-card { width: min(420px, 100%); background: var(--stc-surface); border: 1px solid var(--stc-border); border-radius: var(--stc-r-dlg); padding: 28px; box-shadow: var(--stc-shadow); text-align: center; }
#stc-link-overlay img { width: 56px; height: 56px; display: block; margin: 0 auto 12px; }
#stc-link-overlay .stc-link-card:focus { outline: none; }                     /* thẻ nhận tiêu điểm (alertdialog) khi chưa có nút */
#stc-link-overlay h2 { margin: 0; font-size: 17px; font-weight: 600; color: var(--stc-text-strong); text-wrap: balance; }
#stc-link-overlay p { margin: 8px 0 0; }
#stc-link-overlay p { color: var(--stc-muted); line-height: 1.5; text-wrap: pretty; }
#stc-link-overlay button { margin-top: 20px; font: 600 14px/1 var(--stc-font); padding: 11px 22px; border-radius: var(--stc-r-ctl); border: 1px solid var(--stc-accent); background: var(--stc-accent); color: var(--stc-accent-ink); cursor: pointer; }
#stc-link-overlay button:hover { filter: brightness(1.08); }
#stc-link-overlay button:focus-visible { outline: 2px solid var(--stc-accent-text); outline-offset: 3px; }
#stc-net-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2147482000; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--stc-r-card);
  background: var(--stc-surface); color: var(--stc-text); border: 1px solid var(--stc-border-strong); box-shadow: var(--stc-shadow); font-size: 13px; line-height: 1.45; }
#stc-net-bar::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--stc-warn); vertical-align: 1px; }   /* cảnh báo do chấm màu báo; viền 1px trung tính như toast */
/* Dòng trạng thái "Đang …" (lớp phủ kết nối lại + trang khởi động ui/shell/khoi_dong.html): chữ lần lượt nhô lên rồi hạ xuống như một làn sóng, sáng lên vàng ở đỉnh.
   Chính làn sóng là chỉ báo đang chờ (thay thanh chạy + đoạn giải thích — chủ 14/11: chỉ hiện dòng trạng thái). Tách chữ: STCWave (app.js / khoi_dong.html).
   Từng TỪ không ngắt dòng giữa chừng (.w nowrap); --i = thứ tự chữ (đặt lúc chạy). Ẩn (display:none) => không chạy. */
.stc-wave .w { display: inline-block; white-space: nowrap; }
.stc-wave .c { display: inline-block; animation: stc-wave 1.5s cubic-bezier(0.37, 0, 0.63, 1) infinite; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes stc-wave { 0%, 50%, 100% { transform: translateY(0); color: var(--stc-text-strong); } 20% { transform: translateY(-0.3em); color: var(--stc-wave-peak); } }
@media (prefers-reduced-motion: reduce) {                                    /* bớt chuyển động: không nhô lên, chỉ sáng/tối dần theo lượt */
  .stc-wave .c { animation-name: stc-wave-soft; animation-duration: 2.2s; }
}
@keyframes stc-wave-soft { 0%, 60%, 100% { opacity: 1; } 25% { opacity: .5; } }
/* Chế độ tương phản cao của Windows (forced-colors) bỏ hết box-shadow => các ô nhập/vùng đã tắt outline và chỉ dùng viền/bóng làm vòng tiêu điểm
   sẽ mất dấu tiêu điểm. Trả lại vòng outline màu hệ thống CHỈ trong chế độ đó (giao diện thường không đổi). Theo modern-web-guidance accessibility. */
@media (forced-colors: active) {
  :is(input, select, textarea, button, a, [tabindex]):focus-visible { outline: 2px solid Highlight !important; outline-offset: 1px; }
}
