/* Trang quản trị pdp-api — bám theo shopee_app (views/partials/head.ejs, login.ejs, users.ejs,
   live.ejs): cùng bảng màu, font, navbar/card/table/badge/btn/modal/toast. File tách riêng
   (không inline) để CSP của /admin cấm được inline script/style. */

/* ── Font: tự host (public/app/fonts), KHÔNG tải từ Google Fonts ──
   Để CSP của '/' siết được style-src/font-src về 'self' (xem server.js APP_CSP): bỏ origin bên
   ngoài vừa chặn bề mặt tấn công vừa khỏi lộ IP người dùng cho Google mỗi lần mở trang. */
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/be-vietnam-pro-400-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/be-vietnam-pro-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/be-vietnam-pro-500-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/be-vietnam-pro-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/be-vietnam-pro-600-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/be-vietnam-pro-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/be-vietnam-pro-700-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/be-vietnam-pro-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Token màu: copy nguyên từ shopee_app/views/partials/head.ejs ── */
:root {
  color-scheme: light;
  --primary: #ee4d2d;
  --primary-hover: #d73211;
  --primary-light: rgba(238, 77, 45, 0.08);
  --text-main: #1a1a2e;
  --text-secondary: #6b7280;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --focus-ring: rgba(238, 77, 45, 0.25);
  --input-bg: #f9fafb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: rgba(239, 68, 68, 0.08);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.08);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.08);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.08);
  --purple: #6366f1;
  --success-dark: #065f46;
  --danger-dark: #991b1b;
  --info-dark: #1e40af;
  --warning-dark: #92400e;
  --placeholder: #b0b7c3;
  --border-hover: #d1d5db;
  --live-pulse: #ff3b3b;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  min-height: 100vh;
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: inherit; }
b, strong { font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--text-secondary); }
.icon { width: 1em; height: 1em; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.spinner {
  width: 14px; height: 14px; flex-shrink: 0; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 30px; height: 30px; border-width: 3px; color: var(--primary); }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* ══════════ Đăng nhập (views/login.ejs) ══════════ */
.login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative; overflow: hidden;
}
.login::before {
  content: ''; position: fixed; top: -50%; right: -30%; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(238, 77, 45, 0.04) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}
.login::after {
  content: ''; position: fixed; bottom: -40%; left: -20%; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(238, 77, 45, 0.03) 0%, transparent 70%);
  border-radius: 50%; pointer-events: none;
}
.login-wrapper {
  width: 100%; max-width: 420px; position: relative; z-index: 1;
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.brand { text-align: center; margin-bottom: 32px; }
.brand-icon {
  width: 56px; height: 56px; background: var(--primary); border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(238, 77, 45, 0.3); position: relative;
}
.brand-icon::after {
  content: ''; position: absolute; top: -3px; right: -3px; width: 14px; height: 14px;
  background: var(--live-pulse); border-radius: 50%; border: 2.5px solid var(--bg);
  animation: pulse 2s ease-in-out infinite;
}
.brand-icon svg { width: 28px; height: 28px; color: white; }
.brand-title { font-size: 15px; font-weight: 500; color: var(--text-secondary); letter-spacing: -0.01em; }

.login-card {
  background: var(--card-bg); border-radius: 20px; padding: 40px 36px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 32px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.login-card p.subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.5; }
.login-card .alert { margin-bottom: 20px; }
.login-card .form-field { margin-bottom: 20px; }
.login-card .form-field label { margin-bottom: 8px; letter-spacing: 0.01em; }
.login-card .form-field input { padding: 13px 16px 13px 44px; border-radius: 12px; }
.login-card .form-field input.has-toggle { padding-right: 44px; }
.login-card .form-field input:focus { box-shadow: 0 0 0 3.5px var(--focus-ring); }

.input-wrapper { position: relative; }
.input-wrapper > svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-secondary); transition: color 0.2s;
  pointer-events: none; z-index: 1;
}
.input-wrapper input:focus ~ svg { color: var(--primary); }
.toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px;
  color: var(--text-secondary); transition: color 0.2s; display: flex; align-items: center;
}
.toggle-pw:hover { color: var(--text-main); }
.toggle-pw svg { width: 18px; height: 18px; }

.btn-submit {
  width: 100%; padding: 14px; font-size: 15px; font-weight: 600; color: white;
  background: var(--primary); border: none; border-radius: 12px; cursor: pointer;
  transition: all 0.2s ease; margin-top: 8px; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-submit:hover:not(:disabled) {
  background: var(--primary-hover); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(238, 77, 45, 0.35);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 8px rgba(238, 77, 45, 0.25); }
.btn-submit:disabled { opacity: 0.75; cursor: progress; }
.login-footer { text-align: center; margin-top: 24px; font-size: 13px; color: var(--text-secondary); }

/* ══════════ Navbar (views/partials/head.ejs) ══════════ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.nav-brand { display: flex; align-items: center; gap: 10px; margin-right: 32px; flex-shrink: 0; }
.nav-brand-icon {
  width: 34px; height: 34px; background: var(--primary); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.nav-brand-icon::after {
  content: ''; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px;
  background: var(--live-pulse); border-radius: 50%; border: 2px solid var(--card-bg);
  animation: pulse 2s ease-in-out infinite;
}
.nav-brand-icon svg { width: 18px; height: 18px; color: white; }
.nav-brand-text { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a {
  text-decoration: none; font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
  padding: 8px 14px; border-radius: 8px; transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-light); }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.nav-user-name { font-size: 13px; color: var(--text-secondary); }
.nav-user-name strong { color: var(--text-main); font-weight: 600; }
.btn-logout {
  font-size: 13px; font-weight: 500; color: var(--text-secondary); background: var(--input-bg);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 8px; cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); background: rgba(239, 68, 68, 0.06); }

/* ══════════ Nội dung (views/users.ejs) ══════════ */
.main { max-width: 1320px; margin: 0 auto; padding: 84px 24px 48px; }
.page-header {
  margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ── Alerts (views/live.ejs) ── */
.alert {
  border-radius: 12px; padding: 12px 18px; font-size: 13.5px; line-height: 1.6; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert > .icon { width: 18px; height: 18px; margin-top: 2px; }
.alert-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert-info { background: var(--info-light); border: 1px solid rgba(59, 130, 246, 0.18); color: var(--info-dark); }
.alert-info > .icon { color: var(--info); }
.alert-danger { background: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.18); color: var(--danger-dark); }
.alert-danger > .icon { color: var(--danger); }
.alert .btn { margin-left: 8px; }

/* ── Ô số liệu ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--card-bg); border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-val { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.warn .stat-val { color: var(--warning-dark); }

/* ── Card ── */
.card {
  background: var(--card-bg); border-radius: 16px; padding: 28px; margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.01em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.card-head .card-title { margin-bottom: 0; }

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: flex; flex-direction: column; }
.form-field label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field select {
  font-size: 14px; color: var(--text-main); background: var(--input-bg);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 14px;
  outline: none; transition: all 0.2s; width: 100%;
}
.form-field input::placeholder { color: var(--placeholder); }
.form-field input:hover, .form-field select:hover { border-color: var(--border-hover); }
.form-field input:focus, .form-field select:focus {
  border-color: var(--primary); background: white; box-shadow: 0 0 0 3px var(--focus-ring);
}
.form-field input.invalid { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-error { color: var(--danger-dark); font-size: 13px; line-height: 1.5; margin-top: 12px; }
.form-error:empty { display: none; }
#login-error { margin: -6px 0 6px; }

.search-input {
  width: 220px; max-width: 100%; padding: 7px 12px; font-size: 13px; color: var(--text-main);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input::placeholder { color: var(--placeholder); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ── Buttons (views/users.ejs) ── */
.btn {
  font-size: 13.5px; font-weight: 600; border: none; border-radius: 10px; padding: 10px 20px;
  cursor: pointer; transition: all 0.15s; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; line-height: 1; white-space: nowrap;
}
.btn-primary { color: white; background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(238, 77, 45, 0.3); }
.btn-danger { color: white; background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.btn-ghost { color: var(--text-secondary); background: var(--input-bg); border: 1.5px solid var(--border); }
.btn-ghost:hover { color: var(--text-main); border-color: var(--border-hover); background: white; }
.btn-sm { font-size: 12.5px; padding: 7px 14px; border-radius: 8px; }
.btn-danger-soft { color: var(--danger); background: var(--input-bg); border: 1.5px solid var(--border); }
.btn-danger-soft:hover { border-color: var(--danger); background: white; }

/* Tab Cookie */
.cookie-status { display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; }
.ck-row { display: flex; gap: 10px; align-items: baseline; }
.ck-row > span:first-child { min-width: 78px; color: var(--text-secondary); flex: 0 0 auto; }
.ck-row code { font-size: 11.5px; word-break: break-all; color: var(--text-main); }
.field-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin: 10px 0 6px; }
.cookie-input, .cookie-ua { width: 100%; box-sizing: border-box; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text-main); resize: vertical; }
.cookie-input:focus, .cookie-ua:focus { outline: none; border-color: var(--primary); }
.cookie-actions { display: flex; gap: 10px; margin-top: 14px; }
.cookie-msg { margin-top: 10px; font-size: 12.5px; color: var(--danger); min-height: 1em; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-edit-sm, .btn-danger-sm, .btn-plain-sm, .btn-success-sm {
  font-size: 12.5px; font-weight: 500; border-radius: 8px; padding: 7px 12px; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.btn-edit-sm { color: var(--primary); background: var(--primary-light); border: 1px solid rgba(238, 77, 45, 0.12); }
.btn-edit-sm:hover { background: rgba(238, 77, 45, 0.14); border-color: rgba(238, 77, 45, 0.25); }
.btn-danger-sm { color: var(--danger); background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.15); }
.btn-danger-sm:hover { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.3); }
.btn-success-sm { color: var(--success-dark); background: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.15); }
.btn-success-sm:hover { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.3); }
.btn-plain-sm { color: var(--text-secondary); background: var(--input-bg); border: 1px solid var(--border); }
.btn-plain-sm:hover { color: var(--text-main); background: white; border-color: var(--border-hover); }
.btn-edit-sm:disabled, .btn-danger-sm:disabled, .btn-plain-sm:disabled, .btn-success-sm:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
table thead th {
  font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.04em; padding: 12px 16px; border-bottom: 1.5px solid var(--border);
  text-align: left; white-space: nowrap;
}
table tbody td {
  font-size: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-main); vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--input-bg); }
table thead th, table tbody td { padding-left: 12px; padding-right: 12px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
.col-idx { width: 44px; color: var(--text-secondary); }
.user-cell { white-space: nowrap; }
.td-actions { display: flex; flex-wrap: wrap; gap: 6px; }   /* wrap: màn hẹp không được giấu nút ra ngoài bảng */
.table-empty { text-align: center; padding: 36px 16px; color: var(--text-secondary); font-size: 14px; }
.table-empty .spinner { color: var(--primary); margin-right: 8px; vertical-align: -2px; }

.badge { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px; display: inline-block; white-space: nowrap; }
.badge-admin { color: var(--primary); background: var(--primary-light); }
.badge-user { color: var(--purple); background: rgba(99, 102, 241, 0.08); }
.badge-success { color: var(--success-dark); background: var(--success-light); }
.badge-danger { color: var(--danger-dark); background: var(--danger-light); }
.badge-info { color: var(--info-dark); background: var(--info-light); }
.badge-self { color: var(--text-secondary); background: var(--bg); margin-left: 6px; }

/* ── Phân trang (views/billing.ejs) ── */
.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 20px;
}
.page-info { font-size: 13px; color: var(--text-secondary); }
.paging { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.paging button, .paging span {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; border: 1px solid var(--border);
  color: var(--text-main); background: var(--card-bg); font-variant-numeric: tabular-nums;
}
.paging button { cursor: pointer; transition: all 0.15s; }
.paging button:hover:not(:disabled):not(.active) { background: var(--input-bg); }
.paging button.active { background: var(--primary); color: white; border-color: var(--primary); cursor: default; }
.paging button:disabled { opacity: 0.4; cursor: not-allowed; }
.paging span.gap { border: none; background: none; padding: 8px 2px; color: var(--text-secondary); }

/* ══════════ Modal (views/live.ejs) — <dialog> để có sẵn Esc + giữ focus ══════════ */
dialog.modal {
  border: none; padding: 0; margin: auto; overflow: hidden;
  background: var(--card-bg); color: var(--text-main); border-radius: 16px;
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
dialog.modal[open] { animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 6px; }
.modal-header h5 { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px;
  border-radius: 6px; transition: all 0.15s; display: flex;
}
.modal-close:hover { background: var(--input-bg); color: var(--text-main); }
.modal-body { padding: 8px 22px 6px; }
.modal-body .form-field { margin-top: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.confirm-text { font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.confirm-text b { color: var(--text-main); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ══════════ Toast (views/live.ejs) ══════════ */
#toast-stack {
  position: fixed; right: 18px; bottom: 18px; left: auto; top: auto; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px));
  pointer-events: none;
  /* reset style mặc định của [popover] */
  height: auto; margin: 0; padding: 0; border: none; background: transparent; overflow: visible;
}
.toast {
  display: flex; gap: 11px; padding: 13px 15px; border-radius: 12px; pointer-events: auto;
  background: var(--card-bg); border: 1.5px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  animation: toastIn 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.toast.hide { animation: toastOut 0.18s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
.toast-icon {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; line-height: 1;
}
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13.5px; font-weight: 700; margin-bottom: 3px; }
.toast-text { font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); overflow-wrap: anywhere; }
.toast-text:empty { display: none; }
.toast-text b { color: var(--text-main); font-weight: 600; }
.toast-close {
  background: none; border: none; cursor: pointer; padding: 0 2px; align-self: flex-start;
  font-size: 17px; line-height: 1; color: var(--text-secondary);
}
.toast.ok { border-color: #86efac; }
.toast.ok .toast-icon { background: #dcfce7; color: #166534; }
.toast.err { border-color: #fca5a5; }
.toast.err .toast-icon { background: #fee2e2; color: #991b1b; }

/* ══════════ Responsive ══════════ */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav-user-name { display: none; }
  .navbar { padding: 0 16px; }
  .main { padding: 76px 16px 32px; }
  .card { padding: 20px; }
  .search-input { width: 100%; }
  #toast-stack { left: 10px; right: 10px; bottom: 10px; width: auto; }
}
@media (max-width: 480px) {
  .login-card { padding: 32px 24px; border-radius: 16px; }
  .login-card h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .spinner { animation-duration: 0.7s !important; animation-iteration-count: infinite !important; }
}

/* ===== pdp web app (bổ sung ngoài admin.css) ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1 1 auto; }

.chip-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.info-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1.4;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: white;
  color: var(--text-secondary); cursor: default;
}
.info-chip b { color: var(--text-main); font-weight: 600; }
.info-chip.ok { color: var(--success-dark); background: var(--success-light); border-color: rgba(16,185,129,.2); }
.info-chip.off { color: var(--text-secondary); }
.info-chip.live { color: var(--success-dark); background: var(--success-light); border-color: rgba(16,185,129,.2); }
.info-chip.act { cursor: pointer; }
.info-chip.act:hover { border-color: var(--border-hover); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--placeholder); flex: 0 0 auto; }
.dot.g { background: var(--success); } .dot.r { background: var(--danger); } .dot.y { background: var(--warning); }

.links-area { width: 100%; min-height: 120px; resize: vertical; font: inherit; font-size: 14px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--input-bg);
  color: var(--text-main); outline: none; line-height: 1.6; }
.links-area:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3.5px var(--focus-ring); }
.links-hint { font-size: 12.5px; color: var(--text-secondary); margin-top: 8px; min-height: 18px; }
.links-hint .bad { color: var(--danger-dark); font-weight: 600; } .links-hint .good { color: var(--success-dark); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-btn { font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text-secondary); white-space: nowrap; }
.filter-btn:hover { border-color: var(--border-hover); color: var(--text-main); }
.filter-btn.active { color: var(--primary); background: var(--primary-light); border-color: rgba(238,77,45,.25); }

.count-btn { font-size: 12.5px; font-weight: 700; border-radius: 8px; padding: 5px 9px; min-width: 40px;
  cursor: default; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid transparent; }
.count-live { color: var(--success-dark); background: var(--success-light); border-color: rgba(16,185,129,.2); }
.count-live-other { color: var(--danger-dark); background: var(--danger-light); border-color: rgba(239,68,68,.2); }
.count-live-skip { color: var(--info-dark); background: var(--info-light); border-color: rgba(59,130,246,.18); }
.count-video { color: var(--primary); background: var(--primary-light); border-color: rgba(238,77,45,.12); }
.count-zero { color: var(--placeholder); }
button.count-btn { cursor: pointer; }
button.count-btn:hover { filter: brightness(0.97); }
.bdot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.bdot.g { background: var(--success); } .bdot.r { background: var(--danger); } .bdot.b { background: var(--info-dark); }

.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-cell img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--input-bg); flex: 0 0 auto; }
.prod-cell .t { min-width: 0; }
.prod-cell .t a { font-weight: 600; color: var(--text-main); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.prod-cell .t a:hover { color: var(--primary); text-decoration: underline; }
.prod-cell .t .sub { font-size: 12px; color: var(--text-secondary); }
.prod-cell .t .sub .price { color: var(--text-main); font-weight: 600; }

.proxy-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.proxy-row select, .proxy-row input { font: inherit; font-size: 14px; padding: 9px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; background: var(--input-bg); color: var(--text-main); outline: none; }
.proxy-row input { flex: 1 1 260px; min-width: 0; }
.proxy-row input:focus, .proxy-row select:focus { border-color: var(--primary); background: white; }
.proxy-msg { font-size: 13px; margin-top: 10px; } .proxy-msg.ok { color: var(--success-dark); } .proxy-msg.err { color: var(--danger-dark); }
.muted { color: var(--text-secondary); }
.mt12 { margin-top: 12px; }
.toolbar.m0 { margin: 0; }
#proxy-state { font-weight: 400; }
details.proxy-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
details.proxy-card > summary::-webkit-details-marker { display: none; }
details.proxy-card > summary::before { content: '▸'; color: var(--text-secondary); font-size: 12px; transition: transform .15s; }
details.proxy-card[open] > summary::before { transform: rotate(90deg); }
details.proxy-card > *:not(summary) { margin-top: 12px; }
.pgsize { font-size: 12.5px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.pgsize select { font: inherit; font-size: 12.5px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text-main); }
.rating { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rating .star { color: var(--warning); } .rating small { color: var(--text-secondary); }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { font-size: 14px; font-weight: 500; color: var(--text-secondary); background: none; border: none;
  padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 5px; }
.count-btn .pico { width: 11px; height: 11px; vertical-align: -1px; }
.hist-link { color: var(--primary); cursor: pointer; font-weight: 500; }
.hist-link:hover { text-decoration: underline; }

/* ── Modal chi tiết video/live ── */
.detail-modal { max-width: 560px; width: 92vw; padding: 0; }
.detail-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.dtab { font-size: 13px; font-weight: 500; color: var(--text-secondary); background: none; border: none; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dtab.active { color: var(--primary); border-bottom-color: var(--primary); }
.dtab:hover { color: var(--text-main); }
#detail-body { max-height: 60vh; overflow-y: auto; padding: 0; }
.detail-empty { text-align: center; color: var(--text-secondary); padding: 28px 16px; font-size: 14px; }
.media-card { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.media-card:last-child { border-bottom: none; }
.media-card.mine { background: var(--success-light); }
.media-cover { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--input-bg); flex: 0 0 auto; display: inline-block; }
.media-body { min-width: 0; flex: 1 1 auto; }
.media-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.4; }
.media-stats { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.media-actions { margin-top: 8px; }

/* ── Khối kết quả: thanh tiến trình + dòng phụ (bám theo extension side panel) ── */
.results-head { margin-bottom: 16px; }
.results-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.results-title h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.results-title .spacer { flex: 1 1 auto; }
.results-progress { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.progress { height: 5px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width 0.35s ease; }
.progress.done > span { background: var(--success); }
.progress.halt > span { background: var(--border-hover); }
.progress.wait > span { background: var(--warning); }
.results-sub { font-size: 12px; color: var(--text-secondary); margin-top: 7px; line-height: 1.5; }
.results-sub:empty { display: none; }
.results-sub .note { color: var(--warning-dark); font-weight: 600; }

/* ── Empty-state hướng dẫn khi chưa có lượt nào ── */
.empty {
  text-align: left; padding: 20px 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.7;
  border: 1.5px dashed var(--border-hover); border-radius: 14px; background: var(--card-bg);
}
.empty-title { font-size: 14px; font-weight: 700; color: var(--text-main); margin-bottom: 6px; }
.empty ol { padding-left: 20px; margin-top: 4px; }
.empty b { color: var(--text-main); }

/* Cột "Phiên live" (session id) — chỉ hiện màn rộng */
.sid { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-secondary); }
.sid-mine { color: var(--success-dark); font-weight: 600; }
.sid-other { color: var(--danger-dark); }
.sid-btn { background: none; border: none; padding: 0; cursor: pointer; }
.sid-btn:hover .sid { text-decoration: underline; }
@media (max-width: 1100px) { .col-sid { display: none; } }
