/* ==========================================================================
   STCBrowser — design tokens + shell. Nạp SAU style.css: ánh xạ các biến cũ sang token mới nên các màn chưa dựng lại bố cục
   (Mobile, E-Commerce, Đồng bộ, Nuôi nick, Soi danh tính, Cài đặt, Cloud Phone) cũng đổi màu theo theme.
   Dark là mặc định; Light là lựa chọn ngang hàng ([data-theme="light"]). Không neon/glow. Font hệ thống (không tải font qua Internet).
   ========================================================================== */
:root, html[data-theme="dark"] {
  --stc-bg: #0B0F14; --stc-side: #090C10; --stc-surface: #151B23; --stc-surface-2: #1B232D; --stc-input: #0F151C;
  --stc-border: #2B3440; --stc-text: #E8EDF3; --stc-text-strong: #FFFFFF; --stc-muted: #A1ACBA; --stc-dim: #7D8896;
  --stc-accent: #D0AC67; --stc-accent-text: #D0AC67; --stc-accent-ink: #17110A; --stc-accent-soft: rgba(208, 172, 103, 0.13);
  --stc-ok: #3FB27F; --stc-warn: #E0A93B; --stc-err: #E5645F; --stc-row-hover: rgba(255, 255, 255, 0.035);
  --stc-row-selected: rgba(208, 172, 103, 0.10); --stc-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
html[data-theme="light"] {
  --stc-bg: #E7EBF0; --stc-side: #DCE2E9; --stc-surface: #FFFFFF; --stc-surface-2: #F3F6F9; --stc-input: #FFFFFF;
  --stc-border: #CBD3DD; --stc-text: #14263A; --stc-text-strong: #0B1A2B; --stc-muted: #4A5D74; --stc-dim: #6B7C91;
  --stc-accent: #D0AC67; --stc-accent-text: #8A6420; --stc-accent-ink: #1D1507; --stc-accent-soft: rgba(184, 137, 58, 0.14);
  --stc-ok: #1B8A5A; --stc-warn: #A8700A; --stc-err: #C23B36; --stc-row-hover: rgba(15, 30, 46, 0.04);
  --stc-row-selected: rgba(184, 137, 58, 0.14); --stc-shadow: 0 12px 28px rgba(20, 38, 58, 0.18);
  color-scheme: light;
}

/* ---- ánh xạ biến cũ -> token mới ---- */
:root {
  --bg-deep: var(--stc-bg); --bg-surface: var(--stc-surface); --bg-sidebar: var(--stc-side);
  --bg-card: var(--stc-surface); --bg-card-hover: var(--stc-surface-2);
  --bg-input: var(--stc-input); --bg-input-focus: var(--stc-input); --bg-modal: var(--stc-surface);
  --border-subtle: var(--stc-border); --border-card: var(--stc-border); --border-hover: var(--stc-accent);
  --border-active: var(--stc-accent); --border-neon-cyan: var(--stc-border);
  --text-main: var(--stc-text); --text-muted: var(--stc-muted); --text-dim: var(--stc-dim); --text-bright: var(--stc-text-strong);
  --accent-indigo: var(--stc-accent-text); --accent-indigo-light: var(--stc-accent-text); --accent-cyan: var(--stc-accent-text);
  --accent-cyan-bright: var(--stc-accent-text); --accent-purple: var(--stc-accent-text); --accent-gold: var(--stc-accent-text);
  --accent-emerald: var(--stc-ok); --accent-emerald-bright: var(--stc-ok); --accent-rose: var(--stc-err); --accent-amber: var(--stc-warn);
  --shadow-glow-cyan: none; --shadow-glow-indigo: none; --shadow-glow-emerald: none;
  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.08); --shadow-card-hover: 0 1px 0 rgba(0, 0, 0, 0.08);
  --gradient-brand: var(--stc-accent);
  --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); padding-top: 56px; box-sizing: border-box; font-size: 14px; }
.cyber-ambient, .ambient-glow, .brand-glow-ring { display: none !important; }
* { text-shadow: none !important; }

/* ---- top bar ---- */
#stc-topbar { position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 900; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; background: var(--stc-side); border-bottom: 1px solid var(--stc-border); }
#stc-topbar .stc-brand { display: flex; align-items: center; gap: 10px; min-width: 232px; }
#stc-topbar .stc-brand img { width: 34px; height: 34px; object-fit: contain; }
#stc-topbar .stc-brand span { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; color: var(--stc-text-strong); }
#stc-topbar .stc-spacer { flex: 1; }
.stc-seg { display: inline-flex; border: 1px solid var(--stc-border); border-radius: 8px; 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-accent-soft); color: var(--stc-text-strong); box-shadow: inset 0 0 0 1px var(--stc-accent); }
.stc-seg button:focus-visible, .stc-btn2:focus-visible, .stc-menu button:focus-visible, .stc-tab:focus-visible { outline: 2px solid var(--stc-accent); outline-offset: 1px; }
.stc-account { position: relative; }
.stc-account > button { display: flex; align-items: center; gap: 8px; background: transparent; border: 1px solid transparent; color: var(--stc-text); padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.stc-account > button:hover { background: var(--stc-row-hover); }
.stc-avatar { width: 28px; height: 28px; 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); }

/* ---- sidebar ---- */
.sidebar { width: 232px; background: var(--stc-side); border-right: 1px solid var(--stc-border); backdrop-filter: none; }
.sidebar .brand, .sidebar .sidebar-stats { display: none !important; }
.nav-menu { display: flex; flex-direction: column; padding: 10px 10px 4px; gap: 2px; overflow-y: auto; flex: 1; }
.nav-sec { font-size: 11px; letter-spacing: 0.8px; color: var(--stc-dim); padding: 14px 10px 6px; text-transform: uppercase; }
.nav-item { border-radius: 8px; color: var(--stc-text); }
.nav-item:hover { background: var(--stc-row-hover); }
.nav-item.active { background: var(--stc-accent-soft); box-shadow: inset 3px 0 0 var(--stc-accent); color: var(--stc-text-strong); }
.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-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="settings"] { order: 90; margin-top: auto; }
.nav-item.stc-logout { order: 91; }
.stc-sidebar-quota { margin: 8px 12px 14px; padding: 12px 14px; border: 1px solid var(--stc-border); border-radius: 10px; background: var(--stc-surface); color: var(--stc-text); font-size: 14px; display: flex; justify-content: space-between; 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; }
.topbar { background: transparent; border: 0; padding: 14px 24px 0; }
body[data-view="profiles"] .topbar { display: none; }
.topbar .topbar-center, .topbar .breadcrumb-strip, .topbar .search-kbd-hint { 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: 7px; 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: 8px; 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-accent); }
.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: 6px; 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: 8px; 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: 8px; 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: 10px; 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: 7px; 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: 6px; border: 1px solid var(--stc-border); background: var(--stc-surface-2); color: var(--stc-text); font-size: 13px; }
.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-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-act { display: flex; align-items: center; gap: 8px; }
.stc-act .main { min-width: 68px; justify-content: center; padding: 6px 12px; font-size: 13.5px; }
.stc-act .main.is-open { color: var(--stc-accent-text); border-color: var(--stc-accent); }
.stc-kebab { width: 34px; height: 34px; border-radius: 8px; 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: 8px; 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: 10px; 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: 7px; 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: rgba(0, 0, 0, 0.55); 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: 12px; 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[type="text"], .stc-modal select { width: 100%; box-sizing: border-box; padding: 9px 10px; border-radius: 8px; 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: 8px; 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: 14px; 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: 8px; 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: 8px; 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); }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(20, 38, 58, 0.25); }
html[data-theme="light"] ::-webkit-scrollbar-track { background: rgba(20, 38, 58, 0.05); }

@media (max-width: 1100px) { #stc-topbar .stc-brand { min-width: 0; } .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 { display: none; } .stc-sidebar-quota { justify-content: center; } }
