/* ===== RESET TOÀN DIỆN ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  width: 100%; height: 100%;
  font-size: 14px;
}

body {
  width: 100vw; height: 100vh;
  overflow: hidden;
  font-family: 'Be Vietnam Pro', sans-serif;
  background: #f0f4f8;
  color: #0f172a;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --surface3: #f1f5f9;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-light: #dcfce7;
  --green-dark: #15803d;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --orange-dark: #c2410c;
  --red: #dc2626;
  --red-light: #fee2e2;
  --red-dark: #b91c1c;
  --yellow: #ca8a04;
  --yellow-light: #fef9c3;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --sidebar-w: 220px;
}

/* ===== LOGIN ===== */
#login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  z-index: 50;
}
.login-box {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 44px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo { font-size: 52px; text-align: center; }
.login-title { font-size: 24px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; }
.login-box input {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: all 0.2s; width: 100%;
}
.login-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff; }
#login-error { color: var(--red); font-size: 12px; min-height: 16px; text-align: center; }
#login-btn {
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius); padding: 13px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}
#login-btn:hover { background: var(--blue-dark); transform: translateY(-1px); }
#register-btn {
  background: transparent; color: var(--text-muted);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 11px; font-size: 13px; font-family: inherit; cursor: pointer; transition: all 0.2s;
}
#register-btn:hover { color: var(--blue); border-color: var(--blue); }

/* ===== APP — FULLSCREEN LAYOUT ===== */
#app-screen {
  display: none;
  position: fixed;
  inset: 0;                   /* 0,0 → full viewport, không gap */
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 10;
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon { font-size: 24px; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--text); }
.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; padding: 10px 8px; overflow-y: auto;
}
.tab-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: transparent; border: none; border-radius: var(--radius);
  color: var(--text-muted); font-size: 13.5px; font-family: inherit;
  font-weight: 500; cursor: pointer; text-align: left;
  transition: all 0.15s; width: 100%;
}
.tab-btn:hover { background: var(--surface2); color: var(--text); }
.tab-btn.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.nav-icon { font-size: 16px; flex-shrink: 0; }
.logout-btn {
  margin: 8px;
  background: transparent; border: 1.5px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted);
  padding: 10px 12px; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all 0.2s; text-align: left; flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); border-color: var(--red); background: var(--red-light); }

/* ===== MAIN CONTENT ===== */
.main-content {
  position: absolute;
  top: 0; left: var(--sidebar-w); right: 0; bottom: 0;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header span { color: var(--text-muted); font-size: 13px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { font-size: 28px; flex-shrink: 0; }
.stat-num { font-size: 17px; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-bottom: 2px; }
.stat-label { font-size: 11px; color: var(--text-muted); }
.card-blue   { border-top: 3px solid var(--blue); }   .card-blue .stat-num   { color: var(--blue); }
.card-green  { border-top: 3px solid var(--green); }  .card-green .stat-num  { color: var(--green); }
.card-orange { border-top: 3px solid var(--orange); } .card-orange .stat-num { color: var(--orange); }
.card-red    { border-top: 3px solid var(--red); }    .card-red .stat-num    { color: var(--red); }
.card-purple { border-top: 3px solid var(--purple); } .card-purple .stat-num { color: var(--purple); }

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 12px;
}

/* ===== ALERT LIST ===== */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.alert-item.alert-red    { border-left: 4px solid var(--red); background: #fff5f5; }
.alert-item.alert-yellow { border-left: 4px solid var(--yellow); background: #fffbeb; }
.alert-name { font-weight: 600; font-size: 14px; }
.alert-info { font-size: 12px; color: var(--text-muted); }
.alert-amount { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--red); }
.no-data { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* ===== CARD LIST ===== */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.customer-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.15s; box-shadow: var(--shadow-sm);
}
.customer-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 20px rgba(37,99,235,0.1);
  transform: translateY(-1px);
}
.card-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0; position: relative;
}
.card-info { flex: 1; min-width: 0; }
.card-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta { font-size: 12px; color: var(--text-muted); }
.card-stats { display: flex; gap: 20px; flex-shrink: 0; }
.card-stat { text-align: right; }
.card-stat-val { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; }
.card-stat-label { font-size: 11px; color: var(--text-muted); }
.card-badge {
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; flex-shrink: 0; white-space: nowrap;
}
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-icon {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.btn-icon:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.btn-icon.danger:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }
.avatar-badge {
  position: absolute; bottom: -2px; right: -2px;
  font-size: 10px; background: #fff; border-radius: 50%;
  width: 17px; height: 17px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.status-icon { font-size: 12px; }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius); padding: 9px 18px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface2); color: var(--text-muted);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 9px 18px; font-size: 13.5px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--border2); }
.btn-green { background: var(--green) !important; } .btn-green:hover { background: var(--green-dark) !important; }
.btn-red   { background: var(--red) !important; }   .btn-red:hover   { background: var(--red-dark) !important; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.35);
  backdrop-filter: blur(4px);
  z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-xl); width: 100%;
  max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp 0.2s ease;
}
.modal-large { max-width: 740px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-header button {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 16px; cursor: pointer;
  padding: 3px 8px; border-radius: 8px; transition: all 0.15s; line-height: 1;
}
.modal-header button:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ===== FORM ===== */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 10px 13px;
  color: var(--text); font-size: 14px; font-family: inherit;
  outline: none; transition: all 0.2s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== DETAIL ===== */
.detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.detail-info-item { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; }
.detail-info-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.detail-info-value { font-size: 13px; font-weight: 600; }
.detail-info-value.money { font-family: 'JetBrains Mono', monospace; color: var(--green); }
.detail-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.summary-box { border-radius: var(--radius); padding: 12px; text-align: center; }
.summary-box.box-green  { background: var(--green-light);  border: 1px solid #bbf7d0; }
.summary-box.box-red    { background: var(--red-light);    border: 1px solid #fecaca; }
.summary-box.box-yellow { background: var(--yellow-light); border: 1px solid #fde68a; }
.summary-box.box-blue   { background: var(--blue-light);   border: 1px solid #bfdbfe; }
.summary-box.box-orange { background: var(--orange-light); border: 1px solid #fed7aa; }
.summary-val { font-size: 16px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.box-green .summary-val  { color: var(--green); }
.box-red .summary-val    { color: var(--red); }
.box-yellow .summary-val { color: var(--yellow); }
.box-blue .summary-val   { color: var(--blue); }
.box-orange .summary-val { color: var(--orange); }
.summary-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== TABLE ===== */
.payment-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.payment-table th {
  background: var(--surface3); padding: 9px 12px; text-align: left;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}
.payment-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.payment-table tr:last-child td { border-bottom: none; }
.payment-table tbody tr:hover td { background: var(--surface2); }
.status-v { color: var(--green); font-weight: 700; }
.status-x { color: var(--red); font-weight: 700; }
.status-n { color: var(--yellow); font-weight: 700; }
.status-select {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 7px; color: var(--text); padding: 4px 8px;
  font-size: 12px; font-family: inherit; cursor: pointer; outline: none;
}
.input-small {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 7px; color: var(--text); padding: 4px 8px;
  font-size: 12px; font-family: 'JetBrains Mono', monospace; width: 115px; outline: none;
}
.input-small:focus, .status-select:focus { border-color: var(--blue); }

/* ===== TX FORM ===== */
.tx-form {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; margin-bottom: 16px;
}
.tx-form .form-group { flex: 1; min-width: 110px; }

/* ===== THỐNG KÊ ===== */
.tk-section {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
}
.tk-chart-wrap { position: relative; height: 220px; }
.tk-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.legend-item { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

/* ===== CREDIT ===== */
.credit-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm); transition: all 0.15s;
}
.credit-card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.credit-score-ring {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0; border: 3px solid;
}
.credit-info { flex: 1; }
.credit-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.credit-meta { font-size: 12px; color: var(--text-muted); }
.credit-bar-wrap { flex: 1; min-width: 100px; }
.credit-bar-bg { background: var(--surface3); border-radius: 5px; height: 7px; overflow: hidden; margin-bottom: 4px; }
.credit-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }
.credit-bar-label { font-size: 11px; color: var(--text-muted); }
.score-excellent { color: var(--green);  border-color: var(--green);  background: var(--green-light); }
.score-good      { color: var(--blue);   border-color: var(--blue);   background: var(--blue-light); }
.score-medium    { color: var(--yellow); border-color: var(--yellow); background: var(--yellow-light); }
.score-weak      { color: var(--orange); border-color: var(--orange); background: var(--orange-light); }
.score-bad       { color: var(--red);    border-color: var(--red);    background: var(--red-light); }
.bar-excellent { background: var(--green); }
.bar-good      { background: var(--blue); }
.bar-medium    { background: var(--yellow); }
.bar-weak      { background: var(--orange); }
.bar-bad       { background: var(--red); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 20px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  z-index: 999; opacity: 0; transform: translateY(10px);
  transition: all 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 4px solid var(--green); color: var(--green); }
.toast.error   { border-left: 4px solid var(--red);   color: var(--red); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  :root { --sidebar-w: 60px; }
  .logo-text { display: none; }
  .sidebar-logo { justify-content: center; padding: 16px 0; }
  .tab-btn span:not(.nav-icon) { display: none; }
  .tab-btn { justify-content: center; padding: 12px 0; }
  .logout-btn { text-align: center; font-size: 0; padding: 12px 0; }
  .logout-btn::before { content: '⬅️'; font-size: 18px; }
  .main-content { padding: 20px 18px; }
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-stats { display: none; }
  .detail-info { grid-template-columns: 1fr; }
  .detail-summary { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 16px 12px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== MAIN WRAPPER (bao topbar + content) ===== */
.main-wrapper {
  position: absolute;
  top: 0; left: var(--sidebar-w); right: 0; bottom: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  gap: 16px;
  position: relative;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 14px;
  width: 320px; transition: all 0.2s;
}
.topbar-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff; }
.topbar-search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13.5px; color: var(--text); width: 100%; }
.topbar-search input::placeholder { color: var(--text-muted); }
.search-icon { font-size: 14px; color: var(--text-muted); flex-shrink: 0; }

.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--blue-light); border-color: var(--blue); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 8px;
  cursor: pointer; transition: all 0.15s;
  border: 1px solid transparent;
}
.topbar-user:hover { background: var(--surface2); border-color: var(--border); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* User dropdown */
.user-dropdown {
  display: none; position: absolute; top: 46px; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  min-width: 180px; z-index: 200; overflow: hidden;
  animation: slideUp 0.15s ease;
}
.user-dropdown.open { display: block; }
.dropdown-item {
  padding: 11px 16px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.dropdown-item:hover { background: var(--surface2); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-light); }
.dropdown-divider { height: 1px; background: var(--border); }

/* Notification panel */
.notif-panel {
  display: none; position: fixed; top: 60px; right: 16px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 320px; max-height: 400px; overflow-y: auto;
  z-index: 200;
}
.notif-panel.open { display: block; animation: slideUp 0.15s ease; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; position: sticky; top: 0; background: #fff;
}
.notif-header button { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; }
.notif-list { padding: 8px; }
.notif-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background 0.15s; border-left: 3px solid var(--border); margin-bottom: 6px; }
.notif-item:hover { background: var(--surface2); }
.notif-item.warn { border-left-color: var(--red); background: #fff5f5; }
.notif-item-title { font-size: 13px; font-weight: 600; }
.notif-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== MAIN CONTENT (dưới topbar) ===== */
.main-content {
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex; align-items: flex-end; gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.filter-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 12px; flex: 1; min-width: 200px;
  transition: all 0.2s;
}
.filter-search:focus-within { border-color: var(--blue); background: #fff; }
.filter-search input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 13px; color: var(--text); width: 100%; }
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.filter-group input, .filter-group select, .filter-select {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 7px 11px;
  color: var(--text); font-size: 13px; font-family: inherit;
  outline: none; transition: all 0.2s; cursor: pointer;
}
.filter-group input:focus, .filter-group select:focus { border-color: var(--blue); background: #fff; }
.filter-select { padding: 8px 12px; }
.btn-filter {
  background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 8px 16px; font-size: 13px;
  font-family: inherit; font-weight: 600; cursor: pointer;
  transition: all 0.2s; align-self: flex-end;
  box-shadow: 0 2px 6px rgba(37,99,235,0.2);
}
.btn-filter:hover { background: var(--blue-dark); }
.btn-filter-reset {
  background: var(--surface2); color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 13px;
  font-family: inherit; cursor: pointer; transition: all 0.2s; align-self: flex-end;
}
.btn-filter-reset:hover { color: var(--text); border-color: var(--border2); }

/* ===== DATA TABLE ===== */
.table-wrap {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.data-table thead tr { background: var(--surface3); }
.data-table th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table th:first-child { width: 44px; text-align: center; }
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table td:first-child { text-align: center; color: var(--text-muted); font-size: 12px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8faff; cursor: pointer; }
.data-table tbody tr.selected td { background: var(--blue-light); }
.table-empty { padding: 48px; text-align: center; color: var(--text-muted); font-size: 13px; background: #fff; }

/* Cell styles */
.cell-name { font-weight: 600; color: var(--text); }
.cell-phone { color: var(--text-muted); font-size: 12px; }
.cell-money { font-family: 'JetBrains Mono', monospace; font-weight: 600; }
.cell-green { color: var(--green); }
.cell-red { color: var(--red); }
.cell-orange { color: var(--orange); }
.cell-actions { display: flex; gap: 6px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #fff; border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 13px;
}
.pagination-info { color: var(--text-muted); }
.pagination-btns { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 32px; height: 32px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text-muted); font-size: 13px; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; padding: 0 8px;
}
.page-btn:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue); }
.page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 600; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== BUTTON OUTLINE ===== */
.btn-outline {
  background: #fff; color: var(--green);
  border: 1.5px solid var(--green);
  border-radius: var(--radius); padding: 8px 16px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.2s;
}
.btn-outline:hover { background: var(--green-light); }

/* ===== GLOBAL SEARCH RESULTS ===== */
.search-results-panel {
  display: none; position: fixed;
  top: 56px; left: calc(var(--sidebar-w) + 16px);
  width: 400px; max-height: 400px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 100;
}
.search-results-panel.open { display: block; }
.search-result-item {
  padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background 0.15s; display: flex; align-items: center; gap: 12px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface2); }
.search-result-icon { font-size: 18px; flex-shrink: 0; }
.search-result-name { font-weight: 600; font-size: 13px; }
.search-result-sub { font-size: 12px; color: var(--text-muted); }
.search-results-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== OVERRIDE: main-content khi có topbar ===== */
.main-wrapper .main-content {
  position: static;
  flex: 1; overflow-y: auto;
  padding: 24px 28px;
}