/* IELTS Universe · Điều hành — giao diện sáng: thanh trên nền trắng, mỗi module một màu nhận diện. */
:root {
  color-scheme: light;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ink: #121a2e;
  --dim: #48536d;
  --faint: #6a748c;

  --primary: #1c3faa;
  --primary-hover: #173490;
  --primary-soft: #e2e8fa;
  --primary-ink: #1c3faa;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --good-ink: #15803d;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --bad-ink: #b91c1c;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --warn-ink: #92400e;
  --info: #0284c7;
  --info-soft: #e0f2fe;
  --info-ink: #075985;
  --violet: #9333ea;
  --violet-soft: #f3e8ff;
  --violet-ink: #7e22ce;

  /* màu nhận diện từng khu vực (khớp shared/modules.js) */
  --c-ov: #3b82f6;
  --c-cv: #f59e0b;
  --c-crm: #06b6d4;
  --c-bh: #10b981;
  --c-tc: #8b5cf6;
  --c-admin: #ec4899;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
  /* Phông của thiết kế (Be Vietnam Pro, tải từ Google Fonts); mất mạng thì rơi về phông hệ thống. */
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Số / mã: cùng font chữ, chữ số đều nhau để thẳng cột (tabular-nums). */
  --mono: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --code: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--primary-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code.snippet, pre { font-family: var(--code); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------------------------------------------------------- khởi động */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; color: var(--dim); background: var(--bg);
}
.boot-spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-error { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; color: var(--ink); max-width: 360px; padding: 20px; }
.boot-error span { color: var(--dim); }
/* Trang đang tải mã / dữ liệu (khung đã hiện, nội dung trang chưa) */
.page-loading { display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; min-height: 50vh; color: var(--dim); }
.page-loading .boot-error { margin: 0 auto; }

/* ---------------------------------------------------------------- nút & trường nhập */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-ink); background: #f5f9ff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--bad-ink); }
.btn.danger { color: var(--bad-ink); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); background: #fff5f5; color: var(--bad-ink); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.field > span, .field-label {
  font-size: 12px; font-weight: 600; color: var(--dim);
}
.field-label { display: block; margin: 16px 0 8px; }
.field input, .field select, .field textarea, .input {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-size: 14px; min-width: 0;
}
.field input::placeholder, .input::placeholder { color: #94a3b8; }
.field input:focus, .field select:focus, .input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input:disabled, .field select:disabled { background: var(--surface-3); color: var(--faint); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--faint); margin: 4px 0 10px; line-height: 1.5; }
.form-error { color: var(--bad-ink); background: var(--bad-soft); border-radius: 9px; padding: 8px 11px; font-size: 13px; margin: 6px 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 56px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--primary-ink); padding: 4px 6px;
}
.caps-warn { font-size: 12px; color: var(--warn-ink); margin: -6px 0 8px; }

.notice { background: var(--info-soft); color: var(--info-ink); border-radius: 10px; padding: 10px 13px; font-size: 13px; margin: 0 0 14px; line-height: 1.55; }
.notice-warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice-ok { background: var(--good-soft); color: var(--good-ink); }

/* ---------------------------------------------------------------- màn hình đăng nhập */
.auth {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background:
    radial-gradient(circle at 10% 12%, rgba(59, 130, 246, 0.2), transparent 40%),
    radial-gradient(circle at 92% 18%, rgba(245, 158, 11, 0.16), transparent 36%),
    radial-gradient(circle at 85% 90%, rgba(16, 185, 129, 0.18), transparent 42%),
    radial-gradient(circle at 15% 92%, rgba(6, 182, 212, 0.14), transparent 38%),
    #f4f7fc;
  color: var(--ink);
}
.auth.auth-overlay { z-index: 1000; background: rgba(15, 23, 42, 0.35); backdrop-filter: blur(6px); }
.auth-card {
  width: 100%; max-width: 420px; margin: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 30px 28px; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}
.auth-card-wide { max-width: 570px; }
/* Biểu tượng IELTS Universe (logo/mark.svg). */
.auth-brand { margin-bottom: 22px; }
.auth-logo {
  width: 56px; height: 56px; margin-bottom: 16px;
  background: url(logo/mark.svg) center / contain no-repeat;
}
.auth-brand-name { font-weight: 700; font-size: 17px; }
.auth-brand-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
.auth .btn-primary { margin-top: 6px; padding: 11px 16px; font-size: 14px; }
.auth-foot { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--faint); text-align: center; }
.auth-foot a { color: var(--primary-ink); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- khung chính */
.shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  position: relative; z-index: 5;
  flex-shrink: 0; height: 66px; display: flex; align-items: stretch;
  background: var(--surface); border-bottom: 1px solid var(--border); color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 18px; flex-shrink: 0;
  border-right: 1px solid var(--border); color: var(--ink); text-decoration: none;
}
.brand .mark {
  width: 36px; height: 36px; flex-shrink: 0;
  background: url(logo/mark.svg) center / contain no-repeat;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 14px; }
.brand-text small { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.05em; }
.brand.disabled { pointer-events: none; }

.tabs { display: flex; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 0 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  --tab-color: #3b82f6;
  position: relative; display: flex; align-items: center; gap: 10px; padding: 0 14px; margin: 8px 2px; flex-shrink: 0;
  border-radius: 12px; color: var(--dim); text-decoration: none; transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--ink); background: color-mix(in srgb, var(--tab-color) 7%, white); }
.tab-icon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--tab-color) 15%, white);
  color: color-mix(in srgb, var(--tab-color) 78%, black);
  transition: background 0.15s, color 0.15s;
}
.tab-icon svg { width: 18px; height: 18px; }
.tab-text { display: flex; flex-direction: column; line-height: 1.25; }
.tab-text b { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; color: var(--ink); }
.tab-text small { font-size: 11.5px; color: var(--faint); }
.tab.active { background: color-mix(in srgb, var(--tab-color) 12%, white); }
.tab.active .tab-icon { background: var(--tab-color); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--tab-color) 40%, transparent); }
.tab.active .tab-text small { color: color-mix(in srgb, var(--tab-color) 70%, black); }
.tab.active::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -9px; height: 3px; border-radius: 3px 3px 0 0; background: var(--tab-color); }
.ro-badge {
  font-style: normal; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 5px; background: var(--info-soft); color: var(--info-ink);
}
.tab-badge {
  position: absolute; top: 2px; left: 36px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; border-left: 1px solid var(--border); padding: 0 10px 0 14px; }
.save-status {
  font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; padding: 5px 10px; white-space: nowrap;
  border-radius: 20px; background: var(--good-soft); color: var(--good-ink);
}
.save-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-status.busy { background: var(--warn-soft); color: var(--warn-ink); }
.save-status.busy::before { animation: pulse 1s infinite; }
.save-status.warn, .save-status.err { background: var(--bad-soft); color: var(--bad-ink); }
@keyframes pulse { 50% { opacity: 0.3; } }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 9px; background: none; border: none; color: var(--ink);
  padding: 6px 8px; border-radius: 12px; cursor: pointer;
}
.user-btn:hover { background: var(--surface-3); }
.user-btn .chev { color: var(--faint); }
.user-info { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.user-info b { font-size: 13.5px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info small { font-size: 11px; color: var(--faint); }
.avatar {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #dbeafe, #cffafe); color: var(--primary-ink); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar .online-dot { position: absolute; right: -1px; bottom: -1px; margin: 0; border: 2px solid var(--surface); width: 12px; height: 12px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head small { color: var(--faint); font-size: 12px; }
.menu a, .menu button {
  text-align: left; background: none; border: none; padding: 9px 10px; border-radius: 9px;
  color: var(--ink); text-decoration: none; font-size: 13.5px; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu .danger { color: var(--bad-ink); }

.main { position: relative; flex: 1; min-height: 0; }
.frames { position: absolute; inset: 0; }
.frame-wrap { position: absolute; inset: 0; display: none; flex-direction: column; background: #fff; }
.frame-wrap.active { display: flex; }
.frame-wrap iframe { flex: 1; width: 100%; border: none; display: block; background: #fff; }
.frame-banners:empty { display: none; }
.frame-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--border);
}
.frame-banner.ro { background: var(--info-soft); color: var(--info-ink); }
.frame-banner.stale { background: var(--warn-soft); color: var(--warn-ink); }
.frame-banner-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- trang nội dung */
.page { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); color: var(--ink); }
.page-inner { padding: 26px 28px 72px; } /* toàn màn hình như các module (không giới hạn bề rộng) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.page-head p { margin: 5px 0 0; color: var(--dim); font-size: 14px; }
.muted { color: var(--faint); font-size: 12.5px; }
.sub { color: var(--faint); font-size: 12px; margin-top: 1px; }
.empty-state { max-width: 460px; margin: 80px auto; text-align: center; padding: 0 16px; }
.empty-state h2 { margin: 8px 0; }
.empty-state p { color: var(--dim); }
.empty-icon { font-size: 40px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.card h3 { margin: 0 0 12px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card h4 { margin: 18px 0 8px; font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card-attn { border-color: #fcd34d; background: #fffbeb; }

.subnav { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.subnav a {
  padding: 8px 14px; color: var(--dim); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap; border-radius: 9px;
}
.subnav a:hover { color: var(--ink); background: var(--surface-3); }
.subnav a.active { color: #fff; background: var(--primary); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; flex: 0 1 auto; }
.toolbar input[type=search] { flex: 1 1 260px; max-width: 380px; }
.spacer { flex: 1; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 12px; align-items: end; }
.filters .field { margin-bottom: 10px; }
.filters .grow { grid-column: span 2; }
.filter-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; grid-column: 1 / -1; }

/* bảng */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--faint);
  padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
.table th:first-child { border-top-left-radius: 8px; }
.table th:last-child { border-top-right-radius: 8px; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-hover tbody tr { cursor: pointer; }
.table-hover tbody tr:hover { background: #f5f9ff; }
.table .right { text-align: right; }
.nowrap { white-space: nowrap; }
.wrap { min-width: 220px; max-width: 520px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell b { white-space: nowrap; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 12px; font-size: 13px; color: var(--faint); }

/* nhãn */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap;
  background: var(--surface-3); color: var(--dim); border: 1px solid var(--border);
}
.st-active { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.st-pending { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.st-locked, .st-rejected { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.role-admin { background: var(--violet-soft); color: var(--violet-ink); border-color: transparent; }
.role-marketing { background: var(--info-soft); color: var(--info-ink); border-color: transparent; }
.role-sale { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.perm-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.perm-chip {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 7px; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); color: color-mix(in srgb, var(--c) 65%, black);
  background: color-mix(in srgb, var(--c) 13%, white);
}
.perm-chip.lvl-view { background: #fff; border-style: dashed; }
.perm-chip.lvl-none { border-color: var(--border); color: #94a3b8; background: transparent; text-decoration: line-through; }
.mod-tag { font-size: 11.5px; font-weight: 600; color: var(--dim); background: var(--surface-3); border: 1px solid var(--border); padding: 1px 8px; border-radius: 7px; white-space: nowrap; }
.act { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 7px; white-space: nowrap; background: var(--surface-3); color: var(--dim); }
.act-good { background: var(--good-soft); color: var(--good-ink); }
.act-bad { background: var(--bad-soft); color: var(--bad-ink); }
.act-admin { background: var(--violet-soft); color: var(--violet-ink); }
.act-data { background: var(--primary-soft); color: var(--primary-ink); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; margin-right: 6px; vertical-align: middle; }
.online-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

/* bảng quyền */
.perm-matrix { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.perm-matrix .notice { margin: 12px; }
.perm-matrix .hint { padding: 0 14px 4px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.perm-mod { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.perm-mod i { width: 11px; height: 11px; border-radius: 4px; }
.perm-mod small { color: var(--faint); font-weight: 400; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: var(--dim); border-left: 1px solid var(--border-strong); }
.seg-opt:first-child span { border-left: none; }
.seg-opt:hover span { background: var(--surface-3); }
.seg-opt input:checked + span { background: var(--primary); color: #fff; }
.seg-opt input[value=none]:checked + span { background: #64748b; }
.seg-opt input[value=view]:checked + span { background: var(--info); }
.seg-opt input[value=edit]:checked + span { background: var(--good); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }

/* bảng quyền theo màn hình & nhóm quyền */
.screen-matrix { display: flex; flex-direction: column; gap: 10px; }
.matrix-scroll { max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.sm-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.sm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; background: var(--surface-2); font-weight: 700; border-bottom: 1px solid var(--border); }
.sm-head i { width: 11px; height: 11px; border-radius: 4px; }
.sm-quick { margin-left: auto; display: flex; align-items: center; gap: 4px; font-weight: 500; font-size: 12px; color: var(--faint); }
.sm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sm-row:first-of-type { border-top: none; }
.sm-label { font-size: 13.5px; }
.sm-row.na { opacity: 0.55; }
.sm-row.na .muted { font-size: 12px; }
.sm-row.overridden { background: #fffbeb; }
.sm-row.overridden .sm-label::after { content: 'riêng'; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--warn-ink); background: var(--warn-soft); padding: 1px 6px; border-radius: 6px; }
.seg-opt input[value=inherit]:checked + span { background: #e2e8f0; color: var(--ink); }
.ov-box { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 8px 12px; margin: 4px 0 8px; }
.ov-box summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 4px 0; }
.ov-box[open] summary { margin-bottom: 8px; }
.ov-box .screen-matrix { max-height: 46vh; overflow-y: auto; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.role-card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.rc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15.5px; }
.role-card p { margin: 0; }
.rc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------------------------------------------------------------- tổng quan */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  --k: var(--c-ov);
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--k) 10%, white), #fff 60%);
  border: 1px solid color-mix(in srgb, var(--k) 25%, var(--border)); border-radius: var(--radius);
  padding: 15px 18px; box-shadow: var(--shadow);
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k); }
.kpi:nth-child(4n + 2) { --k: var(--c-bh); }
.kpi:nth-child(4n + 3) { --k: var(--c-cv); }
.kpi:nth-child(4n + 4) { --k: var(--c-tc); }
.kpi-lbl { font-size: 12px; color: var(--dim); font-weight: 600; margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.dash-card {
  --card-c: var(--border);
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--card-c); border-radius: var(--radius);
  padding: 16px 20px 18px; box-shadow: var(--shadow); min-width: 0;
}
.dash-card h3 { margin: 0 0 3px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.dash-card .dot { width: 10px; height: 10px; border-radius: 50%; }
.dash-sub { color: var(--faint); font-size: 12.5px; margin-bottom: 14px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 8px; }
/* Rộng theo số (4.127.184.131đ) rồi mới chia đều — số dài không đè sang ô bên cạnh, thiếu chỗ thì xuống dòng. */
.stat { flex: 1 1 auto; min-width: 118px; }
.stat b { display: block; font-size: 19px; letter-spacing: -0.01em; }
.stat span { font-size: 12px; color: var(--faint); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn { color: var(--warn); }
.trend { display: block; font-size: 12px; font-weight: 700; margin-top: 2px; }
.trend.up { color: var(--good); }
.trend.down { color: var(--bad); }
.trend.flat { color: var(--faint); }
.chart-title, .list-title { font-size: 12px; color: var(--dim); font-weight: 600; margin: 14px 0 6px; }
.dash-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.dash-chart .bar-lbl { font-size: 10px; fill: var(--faint); }
.dash-chart .bar-val { font-size: 9.5px; fill: var(--ink); font-weight: 600; }
.dash-chart .axis { stroke: var(--border-strong); stroke-width: 1; }
.dash-chart rect { transition: opacity 0.15s; }
.dash-chart rect:hover { opacity: 0.8; }
.dash-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.dash-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.dash-list li:first-child { border-top: none; }
.dash-list li > span { min-width: 0; }
.dash-list.activity small { display: block; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dash-list.activity em { font-style: normal; color: var(--faint); font-size: 12px; white-space: nowrap; }
.dash-empty { color: var(--faint); font-size: 13px; font-style: italic; padding: 8px 0; }

/* trợ lý */

.chip { background: var(--surface); border: 1px solid var(--border); color: var(--dim); border-radius: 20px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--primary); color: var(--primary-ink); }

/* ---------------------------------------------------------------- liên thông */
.period-seg button { background: none; border: none; padding: 7px 13px; font-weight: 600; font-size: 13px; color: var(--dim); cursor: pointer; border-left: 1px solid var(--border-strong); }
.period-seg button:first-child { border-left: none; }
.period-seg button.on { background: var(--primary); color: #fff; }
.funnel { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.funnel-step {
  position: relative; padding: 12px 12px 10px; border-radius: 12px; min-width: 0;
  background: color-mix(in srgb, #6366f1 calc(6% + var(--i) * 3%), white); border: 1px solid color-mix(in srgb, #6366f1 20%, var(--border));
}
.fs-val { font-size: 22px; font-weight: 700; }
.fs-lbl { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.fs-hint { font-size: 11.5px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-rate { position: absolute; top: 8px; right: 9px; font-size: 11px; font-weight: 700; color: #4338ca; background: #fff; border-radius: 10px; padding: 1px 6px; }
.sales-strip, .stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.sales-strip b, .stat-strip b { display: block; font-size: 16px; }
.sales-strip span, .stat-strip span { font-size: 12px; color: var(--faint); }
.stat-strip { margin: 4px 0 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }

.issues { display: flex; flex-direction: column; gap: 8px; }
.issue { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 10px; padding: 0 12px; background: var(--surface); }
.issue.lvl-bad { border-left-color: var(--bad); }
.issue.lvl-warn { border-left-color: var(--warn); }
.issue.lvl-info { border-left-color: var(--info); }
.issue summary { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.issue summary::-webkit-details-marker { display: none; }
.issue-count { min-width: 28px; height: 24px; border-radius: 12px; background: var(--surface-3); font-weight: 700; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; }
.issue.lvl-bad .issue-count { background: var(--bad-soft); color: var(--bad-ink); }
.issue.lvl-warn .issue-count { background: var(--warn-soft); color: var(--warn-ink); }
.issue.lvl-info .issue-count { background: var(--info-soft); color: var(--info-ink); }
.issue-title { flex: 1; font-weight: 600; }
.lvl-badge { font-weight: 600; }
.issue[open] { padding-bottom: 12px; }
.issue-items { list-style: none; margin: 0 0 10px; padding: 0; max-height: 280px; overflow: auto; border-top: 1px solid var(--border); }
.issue-items li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.issue-items li small { display: block; color: var(--faint); font-size: 12px; }
.link-tick { display: inline-flex; width: 20px; height: 20px; border-radius: 6px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-right: 3px; }
.link-tick.ok { background: var(--good-soft); color: var(--good-ink); }
.link-tick.no { background: var(--bad-soft); color: var(--bad-ink); }

/* Báo cáo tổng hợp */
.report-nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge.high { background: var(--bad-soft); color: var(--bad-ink); }
.report-nav a.active .nav-badge { background: #fff; color: var(--primary); }
.report-alert a { font-weight: 700; }
.report-period { display: flex; align-items: center; gap: 10px; margin: -6px 0 16px; flex-wrap: wrap; }
.sales-strip.no-top { margin-top: 0; padding-top: 0; border-top: none; }
.head-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tstat { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--dim); }
.tstat.pos { background: var(--good-soft); color: var(--good-ink); }
.tstat.warn { background: var(--warn-soft); color: var(--warn-ink); }
.tstat.neg { background: var(--bad-soft); color: var(--bad-ink); }
.cat-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #fef3c7; color: #92400e; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
.work-table td { vertical-align: top; }
.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-3); min-width: 80px; }
.stackbar .sb-full { background: var(--good); }
.stackbar .sb-partial { background: var(--warn); }
.stackbar .sb-none { background: var(--bad); }
.stackbar .sb-unreported { background: #fca5a5; }
.stackbar .sb-pending { background: #cbd5e1; }
.people-table .group-row th { background: none; padding-bottom: 2px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.people-table th.grp { text-align: center; border-bottom: 3px solid var(--border-strong); }
.people-table th.grp-crm { color: #0891b2; border-bottom-color: #06b6d4; }
.people-table th.grp-cv { color: #b45309; border-bottom-color: #f59e0b; }
.people-table th.grp-bh { color: #047857; border-bottom-color: #10b981; }

.frame-banner.denied { background: var(--bad-soft); color: var(--bad-ink); }

/* ---------------------------------------------------------------- tài khoản & chi tiết */
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.account-grid .span-2 { grid-column: 1 / -1; }
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile b { font-size: 16.5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 12px; font-size: 13.5px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.my-perms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.my-perm { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; }
.my-perm i { width: 10px; height: 10px; border-radius: 4px; flex-shrink: 0; }
.my-perm span { flex: 1; }
.my-perm b { font-size: 12.5px; }
.my-perm.lvl-none { opacity: 0.55; }
.my-perm.lvl-edit { background: #f0fdf4; border-color: #bbf7d0; }
.my-perm.lvl-edit b { color: var(--good-ink); }
.my-perm.lvl-view { background: #f0f9ff; border-color: #bae6fd; }
.my-perm.lvl-view b { color: var(--info-ink); }

.my-screens { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.my-screens li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.my-screens li:first-child { border-top: none; }
.my-screens b.lvl-edit { color: var(--good-ink); }
.my-screens b.lvl-view { color: var(--info-ink); }

.user-detail .ud-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ud-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.tabs-inline { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; padding: 4px; background: var(--surface-3); border-radius: 11px; }
.tabs-inline button {
  flex: 1; background: none; border: none; padding: 8px 12px; font-weight: 600; color: var(--dim); cursor: pointer;
  border-radius: 8px; white-space: nowrap;
}
.tabs-inline button:hover { color: var(--ink); }
.tabs-inline button.active { color: var(--primary-ink); background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }
.action-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.timeline li:first-child { border-top: none; }
.tl-time { color: var(--faint); font-size: 12px; }
.tl-body small { display: block; color: var(--faint); margin-top: 3px; }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f5f9ff; border: 1px dashed #93c5fd; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.secret-box code { font-size: 20px; font-weight: 700; letter-spacing: 0.06em; user-select: all; color: var(--primary-ink); }
.secret-box code.snippet { font-size: 11.5px; font-weight: 400; letter-spacing: 0; word-break: break-all; line-height: 1.5; color: var(--ink); }
.steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.65; font-size: 13.5px; }
/* Quản trị → Dữ liệu: Sao lưu tự động → đẩy lên Google Drive (admin.js driveHtml) */
.bk-drive { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.bk-drive h4 { margin: 0 0 6px; font-size: 14px; }
.bk-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.bk-row .input { flex: 1 1 320px; min-width: 0; }
.bk-script { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 11.5px; line-height: 1.5; max-height: 260px; overflow: auto; white-space: pre; }
/* Xác thực 2 lớp (two-factor.js): QR nền trắng (app quét được cả khi giao diện tối), mã bí mật gõ tay, mã dự phòng. */
.tfa-steps > li { margin-bottom: 8px; }
.tfa-qr { display: block; width: 180px; height: 180px; margin: 10px 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; image-rendering: pixelated; }
.tfa-open { margin: 10px 0; }
.tfa-key-label { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.secret-box code.tfa-key { font-size: 15px; letter-spacing: 0.04em; word-break: break-all; }
.tfa-more summary { cursor: pointer; font-size: 12.5px; color: var(--faint); }
.tfa-code { font-family: var(--mono); font-size: 20px; letter-spacing: 0.2em; text-align: center; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 12px 0; padding: 12px 16px; background: #f5f9ff; border: 1px dashed #93c5fd; border-radius: 12px; font-size: 15px; font-weight: 600; letter-spacing: 0.05em; }
.diff { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.diff-block { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.diff-line { margin-top: 3px; padding-left: 10px; border-left: 3px solid var(--border-strong); }
.diff-line.add { border-color: var(--good); }
.diff-line.mod { border-color: var(--primary); }
.diff-line.del { border-color: var(--bad); }
.raw-details summary { cursor: pointer; color: var(--faint); font-size: 12.5px; margin: 8px 0; }
.raw-details pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 12px; max-height: 260px; overflow: auto; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* Quản trị → Cài đặt: tài khoản dùng chung cho các module */
.ma-card { margin-bottom: 16px; }
/* Quản trị → Cài đặt: Kết nối Zalo (admin.js zaloCard) */

.ma-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ma-table td { vertical-align: middle; }
.ma-ok { color: var(--good-ink); font-weight: 600; font-size: 13px; }
.ma-warn { color: var(--bad-ink); font-weight: 600; font-size: 13px; }
.ma-off { color: var(--faint); font-size: 13px; }
.ma-locked td { opacity: 0.65; }
.ma-sub { margin: 18px 0 4px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ma-fix { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ma-fix select { max-width: 220px; padding: 5px 8px; }

.toggle { margin: 4px 0 16px; font-weight: 600; }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.link-row small { display: block; color: var(--faint); font-size: 12px; }
.tips { margin: 0; padding-left: 18px; color: var(--dim); font-size: 13.5px; line-height: 1.7; }
.tips b { color: var(--ink); }

/* ---------------------------------------------------------------- hộp thoại & thông báo */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 460px; background: var(--surface); color: var(--ink); border-radius: 18px;
  box-shadow: var(--shadow-lg); animation: pop 0.16s ease-out;
}
.modal-wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 0; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 14px 22px 22px; }
.modal-text { margin: 0 0 12px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; max-width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok { background: var(--good-ink); }
.toast-error { background: var(--bad-ink); }
/* Điện thoại: thông báo hiện ở trên cùng để không che các nút ở đáy hộp thoại. */
@media (max-width: 700px) {
  #toast-root { bottom: auto; top: calc(10px + env(safe-area-inset-top, 0px)); }
  .toast { transform: translateY(-8px); }
}

/* ---------------------------------------------------------------- màn hình nhỏ */
/* 8 tab (thêm phân hệ Kho) + logo + ô tài khoản phải nằm đủ trên 1 hàng — ngưỡng đo thật ở 1024–1920px, không tab nào bị khuất */
@media (max-width: 2100px) {
  .tab-text small { display: none; }
}
@media (max-width: 1720px) {
  .tab { padding: 0 10px; gap: 8px; margin: 8px 1px; }
}
@media (max-width: 1560px) {
  .brand-text { display: none; }
}
@media (max-width: 1400px) {
  .tab { padding: 0 8px; }
  .user-info, .user-btn .chev { display: none; }
  .save-status { font-size: 0; padding: 6px; gap: 0; }
  .save-status::before { width: 9px; height: 9px; }
}
@media (max-width: 1100px) {
  .tab { padding: 0 6px; gap: 6px; }
  .tab-text b { font-size: 12.5px; }
}
@media (max-width: 1080px) {
  .tab-text { display: none; }
  .tab { padding: 0 7px; }
  .tab-badge { top: 0; left: 30px; }
}
@media (max-width: 1180px) {
  .funnel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  
}
@media (max-width: 860px) {
  .settings-grid, .account-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Cần xử lý: tiêu đề dùng cả dòng, nhãn khu vực / mức độ xuống dòng dưới */
  .issue summary { flex-wrap: wrap; row-gap: 4px; }
  .issue-title { flex: 1 1 calc(100% - 40px); }
  .issue summary .badge.soft { margin-left: 38px; }
  .topbar { height: 58px; }
  .brand { display: none; }
  .tab-text { display: none; }
  .tab { padding: 0 3px; margin: 6px 1px; }
  .tab-icon { width: 30px; height: 30px; }
  .user-btn { padding: 4px; }
  .user-btn .avatar { width: 30px; height: 30px; }
  .tab.active::after { bottom: -7px; }
  .tab-badge { top: 0; left: 28px; }
  .topbar-right { padding: 0 6px 0 8px; }
  .page-inner { padding: 18px 16px 72px; }
  .grid-2, .my-perms { grid-template-columns: 1fr; }
  .filters .grow { grid-column: auto; }
  .auth-card { padding: 24px 18px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .table-wrap .table { min-width: 680px; }
  
  
  .perm-row { flex-direction: column; align-items: flex-start; }
}

/* Nhập dữ liệu từ KiotViet (Quản trị → Dữ liệu) */
.modal.kv-modal { max-width: 1040px; }

.kv-h { margin: 18px 0 8px; font-size: 14.5px; }

/* Điện thoại hẹp (≤ 400px): 8 biểu tượng + ô tài khoản vừa 1 hàng */
@media (max-width: 400px) {
  .tab { margin: 6px 0; }
}

/* ================= Giao xe — Sắp xe / Chuyến của tôi (giao-xe.js) ================= */
.btn-success { background: var(--good); color: #fff; border-color: var(--good); }
.btn-success:hover:not(:disabled) { background: var(--good-ink); }

/* Lái xe (điện thoại) */

/* ---------------------------------------------------------------- Tổng quan / Điều hành (overview.js) */
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin-bottom: 6px; }
.ov-tile { display: flex; flex-direction: column; gap: 2px; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.ov-tile[data-go] { cursor: pointer; }
.ov-tile[data-go]:hover, .ov-tile[data-go]:focus-visible { border-color: var(--primary); outline: none; background: var(--primary-soft); }
.ov-lbl { font-size: 12px; color: var(--dim); font-weight: 600; }
.ov-val { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-family: 'Lexend', var(--font); }
.ov-sub { font-size: 11.5px; color: var(--faint); }
.ov-tile.warn .ov-val { color: var(--warn-ink); }
.ov-tile.bad .ov-val { color: var(--bad-ink); }
.ov-open { margin-left: auto; }
.ov-bars { display: grid; gap: 7px; }
.ov-bar { display: grid; grid-template-columns: 116px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 12.5px; }
.ov-bar-track { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.ov-bar-track i { display: block; height: 100%; border-radius: 0 5px 5px 0; }
.ov-bar-val { text-align: right; font-weight: 600; }
.ov-bar-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.ov-cols svg { width: 100%; max-width: 460px; height: auto; display: block; overflow: visible; }
.ov-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ov-filters .input { width: auto; min-width: 150px; }
.ov-axis { stroke: var(--border-strong); stroke-width: 1; }
.ov-col-val { font-size: 10px; fill: var(--ink); font-weight: 600; }
.ov-col-lbl { font-size: 10.5px; fill: var(--faint); }
.ov-col-table { max-width: 320px; margin-bottom: 6px; }
.ov-attn { margin-bottom: 16px; }
.ov-attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ov-attn-list li { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-top: 1px solid var(--border); }
.ov-attn-list li:first-child { border-top: 0; }
.ov-attn-text { flex: 1; min-width: 0; display: grid; }
.ov-attn-text small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-tabs { margin-bottom: 10px; }
.ov-tabs button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; }
.ov-count { font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--dim); border-radius: 20px; padding: 1px 8px; }
.ov-tabs button.active .ov-count { background: var(--primary-soft); color: var(--primary-ink); }
.ov-note { margin: 0 0 12px; color: var(--dim); font-size: 13.5px; }
.ov-table { width: auto; min-width: 640px; max-width: 100%; font-variant-numeric: tabular-nums; background: var(--surface); border-radius: 10px; }
.ov-table th { white-space: normal; vertical-align: bottom; line-height: 1.3; padding: 10px 14px; min-width: 120px; }
.ov-table th:first-child { min-width: 210px; }
.ov-table td { padding: 12px 14px; background: var(--surface); }
.ov-table td.right, .ov-table th.right { text-align: right; }
.ov-table th:first-child, .ov-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.ov-table th:first-child { background: var(--surface-2); }
.ov-table tbody tr:hover td { background: #f5f9ff; }
.ov-table .sub { color: var(--faint); font-size: 12px; font-weight: 400; }
.ov-table tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); background: var(--surface-2); }
.ov-table tfoot td:first-child { background: var(--surface-2); }
.ov-tb { font-size: 11px; font-weight: 600; color: var(--faint); margin-right: 3px; }
.ov-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer; text-align: inherit; }
.ov-sort:hover { color: var(--primary-ink); }
.ov-name { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.ov-name:hover b { color: var(--primary-ink); text-decoration: underline; }
.ov-num { display: block; font-size: 14.5px; }
.ov-zero .ov-num { color: var(--faint); }
.ov-mini { display: block; height: 4px; margin: 5px 0 0 auto; border-radius: 2px; background: #6da7ec; }
.ov-ph { margin: 16px 0 6px; font-size: 13px; color: var(--primary-ink); }
.ov-dl { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 0; }
.ov-dl dt, .ov-dl dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.ov-dl dt { color: var(--dim); }
.ov-dl dd { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ov-table td.bad { color: var(--bad-ink); font-weight: 700; }
.ov-table td.warn { color: var(--warn-ink); font-weight: 700; }
