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

:root {
  --blue: #0f4be9;
  --blue-hover: #0d40c7;
  --blue-bg: #eff4ff;
  --orange: #fd9e0f;
  --orange-bg: #fff6ea;
  --black: #111111;
  --white: #ffffff;
  --bg-gray: #f7f7f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --green: #0e9f6e;
  --green-hover: #057a55;
  --green-bg: #def7ec;
  --red: #e02424;
  --red-hover: #c81e1e;
  --red-bg: #fdf2f2;
  --purple: #6875f5;
  --purple-hover: #5850ec;
  --purple-bg: #e5edff;
  --r: 4px; /* Slightly sharper corners */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg-gray);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; font-weight: 500; transition: color 0.2s; }
a:hover { color: var(--blue-hover); }

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  outline: none;
  font-size: 13px;
  transition: all 0.2s ease;
}

input, select, textarea {
  font-family: var(--font);
  outline: none;
  font-size: 13px;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  background: var(--white);
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-bg);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- LOGIN --- */
#login { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-gray); }
.login-card { background: var(--white); border: 1px solid var(--border); padding: 40px; width: 380px; border-radius: 12px; box-shadow: var(--shadow-sm); text-align: center; }
.login-card .brand { font-size: 20px; font-weight: 700; color: var(--black); margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-card .brand svg { width: 28px; height: 28px; stroke: var(--blue) !important; fill: none; stroke-width: 2.5; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; padding: 10px; background: var(--blue); color: var(--white); border-radius: 6px; font-weight: 600; box-shadow: var(--shadow-sm); }
.login-card .btn-primary:hover { background: var(--blue-hover); }
.login-card .err { color: var(--red); font-size: 12px; margin-top: 12px; min-height: 16px; }

/* --- APP LAYOUT --- */
#app { display: flex; height: 100vh; overflow: hidden; flex-direction: column; background: var(--bg-gray); }

/* Header */
#header {
  height: 56px; background: var(--blue); border-bottom: none;
  display: flex; align-items: center; padding: 0 20px; gap: 16px; flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(15, 75, 233, 0.15);
}
.header-logo { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 200px; color: var(--white); }
.header-logo svg { width: 24px; height: 24px; stroke: var(--white) !important; fill: none; stroke-width: 2.5; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
/* Bộ lọc nâng cao (tab Người dùng) */
.adv-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 14px; margin: 10px 0; background: #eff4ff; border: 1px solid #cddffb; border-radius: 8px; }
.adv-field { display: flex; flex-direction: column; gap: 4px; }
.adv-field label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.adv-field select, .adv-field input { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 6px; font-size: 13px; background: var(--white); }
/* Hamburger (chỉ hiện ở mobile) + lớp phủ khi mở menu */
.hamburger { display: none; width: 40px; height: 40px; align-items: center; justify-content: center; background: rgba(255,255,255,0.14); color: var(--white); border-radius: 8px; flex-shrink: 0; }
.hamburger:hover { background: rgba(255,255,255,0.24); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 89; display: none; }
.sidebar-overlay.show { display: block; }
.chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.1); color: var(--white); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.chip.warn { background: var(--orange); color: var(--white); border-color: transparent; }
.chip.pay { background: var(--white); color: var(--blue); border-color: transparent; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); filter: brightness(1.1); }
.chip .cdot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; opacity: 0.8; }
.user-btn { padding: 6px 12px; background: transparent; border: none; border-radius: 4px; color: var(--white); font-weight: 500; transition: all 0.2s; display: inline-flex; align-items: center; }
.user-btn:hover { background: rgba(255,255,255,0.15); }

/* Layout Grid */
.layout { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: 240px; background: var(--black); 
  padding: 20px 12px; display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.nav-section { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; padding: 16px 12px 8px; }
.nav-section:first-child { padding-top: 0; }
.nav-item {
  padding: 6px 12px; color: #d1d5db; font-size: 13px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; gap: 12px; border-radius: 4px; margin-bottom: 6px;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: var(--blue); color: var(--white); font-weight: 600; box-shadow: 0 2px 4px rgba(15, 75, 233, 0.3); }
.nav-item svg { width: 18px; height: 18px; opacity: 0.8; }
.nav-item.active svg { opacity: 1; }
.nav-item .badge-count { margin-left: auto; background: rgba(255,255,255,0.2); color: var(--white); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 12px; }

/* Main Content */
.main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-gray); }
#content { flex: 1; overflow-y: auto; padding: 32px; }
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb span { color: var(--text-main); font-weight: 500; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; color: var(--black); letter-spacing: -0.5px; }
.page-actions { display: flex; gap: 10px; }

/* Buttons */
.btn { padding: 6px 12px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 4px; font-size: 13px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--blue); color: var(--white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--blue-hover); color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { background: var(--green-hover); color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-hover); color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-orange { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: #e38902; color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-purple { background: var(--purple); color: var(--white); }
.btn-purple:hover { background: var(--purple-hover); color: var(--white); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--white); border: 1px solid var(--border-strong); color: var(--text-main); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: #f9fafb; border-color: #c1c7d0; color: var(--text-main); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.ico { flex-shrink: 0; }

/* Stat Cards (Dashboard) */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-sm); margin-bottom: 32px; overflow: hidden; }
.stat-card { background: var(--white); padding: 24px 20px; transition: background 0.2s; display: flex; flex-direction: column; justify-content: center; }
.stat-card.clickable { cursor: pointer; }
.stat-card.clickable:hover { background: #f9fafb; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--black); letter-spacing: -0.5px; }

/* Panels */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-sm); margin-bottom: 24px; overflow: hidden; }
.panel-title { font-size: 13px; font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #fafafa; color: var(--black); }

/* Charts (minimalist override) */
/* Charts */
.chart-sub { font-size: 13px; margin-bottom: 12px; color: var(--text-muted); }
.chart-toggle { display: inline-flex; background: #f3f4f6; border-radius: 8px; padding: 4px; }
.chart-tab { padding: 6px 12px; border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 500; border-radius: 6px; }
.chart-tab.active { background: var(--white); color: var(--black); box-shadow: var(--shadow-sm); font-weight: 600; }

/* Mini bar chart (same as web admin) */
.dash-chart-area { height: 120px; display: flex; align-items: flex-end; gap: 2px; padding: 0; }
.dash-chart-bar { flex: 1; min-width: 0; border-radius: 3px 3px 0 0; transition: height .4s ease, opacity .2s; cursor: pointer; position: relative; }
.dash-chart-bar:hover { opacity: .75; }
.dash-chart-bar[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; font-size: 10px; padding: 3px 7px; border-radius: 4px; white-space: nowrap; z-index: 10; pointer-events: none; margin-bottom: 4px; }

/* Pie chart */
.pie-wrap { display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap; padding: 10px 0; }
.pie-svg { width: 180px; height: 180px; }
.pie-center-num { font-size: 32px; font-weight: 700; fill: var(--black); }
.pie-center-lbl { font-size: 12px; fill: var(--text-muted); }
.pie-legend { display: flex; flex-direction: column; gap: 12px; min-width: 220px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-lbl { flex: 1; color: var(--text-muted); }
.legend-val { font-weight: 600; color: var(--black); }

/* Tables */
.table-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-tabs { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.filter-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--white); color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 6px; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.filter-tab:hover { background: #f9fafb; color: var(--text-main); }
.filter-tab.active { background: var(--blue-bg); color: var(--blue); box-shadow: 0 2px 4px rgba(15, 75, 233, 0.1); font-weight: 600; }
.tab-badge { background: #f3f4f6; color: var(--blue); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 12px; line-height: 1; }
.filter-tab.active .tab-badge { background: var(--white); color: var(--blue); box-shadow: var(--shadow-sm); }
.activity-filter { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.activity-filter input, .activity-filter select { border: 1px solid var(--border-strong); padding: 8px 12px; font-size: 13px; border-radius: 6px; box-shadow: var(--shadow-sm); }
.activity-filter input[type="text"] { width: 500px; max-width: 100%; }
.activity-filter .af-date { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }

.tbl-wrap { border: 1px solid var(--border); background: var(--white); border-radius: 6px; overflow-x: auto; box-shadow: var(--shadow-sm); position: relative; }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
table.dt { width: 100%; border-collapse: collapse; text-align: left; }
table.dt thead th { padding: 6px 12px; font-size: 12px; font-weight: 600; color: #ffffff; border-bottom: none; background: var(--blue); white-space: nowrap; }
table.dt tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; animation: fadeSlideUp 0.3s ease-out forwards; }
table.dt tbody tr:last-child { border-bottom: none; }
table.dt tbody tr:hover { background: #f9fafb; }
table.dt td { padding: 6px 12px; font-size: 14px; line-height: 1.2; color: var(--text-main); white-space: nowrap; }
.wrap-2l { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; white-space: normal; max-width: 340px; line-height: 1.4; }

.mono { font-family: var(--mono); font-size: 12px; }
.badge-mono { font-family: var(--mono); font-size: 12px; color: var(--text-main); background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }
.muted { color: var(--text-muted); }

/* Badges (Soft modern pills) */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 12px; font-weight: 500; border-radius: 8px; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; }
.badge-1 { background: #f1f5f9; color: #475569; } .badge-1::before { background: #94a3b8; }
.badge-2 { background: var(--blue-bg); color: var(--blue); } .badge-2::before { background: var(--blue); }
.badge-3 { background: var(--purple-bg); color: var(--purple); } .badge-3::before { background: var(--purple); }
.badge-4 { background: var(--green-bg); color: var(--green); } .badge-4::before { background: var(--green); }
.badge-5 { background: #f1f5f9; color: #475569; } .badge-5::before { background: #94a3b8; }
.badge-6 { background: var(--orange-bg); color: var(--orange); } .badge-6::before { background: var(--orange); }
.badge-7 { background: var(--green-bg); color: var(--green); } .badge-7::before { background: var(--green); }
.badge-8 { background: var(--orange-bg); color: var(--orange); } .badge-8::before { background: var(--orange); }
.badge-9 { background: var(--red-bg); color: var(--red); } .badge-9::before { background: var(--red); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.pg-btns { display: flex; gap: 4px; }
.pg-btn { padding: 6px 12px; background: var(--white); border: 1px solid var(--border-strong); border-radius: 6px; font-weight: 500; color: var(--text-main); }
.pg-btn:hover { background: #f9fafb; }
.pg-btn.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* Copyable */
.copyable { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn { width: 26px; height: 26px; background: var(--white); border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.copy-btn:hover { background: #f3f4f6; color: var(--text-main); }
.copy-btn.ok { background: var(--green-bg); color: var(--green); border-color: var(--green); }

/* --- DRAWER (Fullscreen Detail) --- */
@keyframes drawerSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes drawerSlideOut { from { transform: translateX(0); } to { transform: translateX(100%); } }
.detail-fullscreen { position: fixed; inset: 0; z-index: 200; background: var(--white); display: flex; flex-direction: column; animation: drawerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.detail-fullscreen.closing { animation: drawerSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; pointer-events: none; }
.detail-fs-head { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--blue); flex-shrink: 0; }
.detail-fs-title { font-size: 16px; font-weight: 700; color: var(--white); margin-right: auto; }
.detail-fs-head .back-btn { font-weight: 600; border: none; box-shadow: none; padding-left: 0; color: var(--white); background: transparent; }
.detail-fs-head .back-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); }

.detail-fs-body { flex: 1; overflow: hidden; padding: 0; display: flex; }
.drawer-cols { flex: 1; display: grid; grid-template-columns: 2fr 1fr; gap: 0; min-height: 0; width: 100%; }
.drawer-col-main { padding: 24px 32px; overflow-y: auto; background: var(--white); }
.drawer-col-side { padding: 32px; display: flex; flex-direction: column; background: var(--blue-bg); border-left: 1px solid var(--border); overflow-y: auto; }

/* Modal Fallback */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); display: none; z-index: 100; }
.drawer-overlay.show { display: block; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 680px; max-width: 90vw; max-height: 85vh; background: var(--white); border-radius: 0; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1); z-index: 101; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--white); }
.modal-head h2 { font-size: 16px; font-weight: 600; color: var(--black); }
.modal-body { padding: 20px; overflow-y: auto; }
.drawer-close { width: 32px; height: 32px; background: #f3f4f6; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: 0.2s; border-radius: 0; }
.drawer-close:hover { background: #e5e7eb; color: var(--text-main); }

/* Detail Sections (Compact 2-Column Grid) */
/* Detail Sections (Compact Layout) */
.detail-section { margin-bottom: 24px; }
.detail-section:last-child { margin-bottom: 0; }
.ds-title { font-size: 13px; font-weight: 700; text-transform: uppercase; color: var(--black); margin: 0 0 12px 0; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.ds-title.red { color: var(--red); border-bottom-color: #fca5a5; }

/* Stat Bar (Dense, Perfectly Aligned Grid) */
.stat-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; background: #eff6ff; padding: 16px; border-radius: 8px; margin-bottom: 24px; }
.stat-item { display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.stat-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; flex-shrink: 0; }
.stat-val { font-size: 13px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val.big { font-size: 14px; font-weight: 700; color: var(--blue); }
.stat-val.green { color: var(--green); font-weight: 700; }

/* Detail Grid (for remaining sections like Nội dung Giao dịch) */
.detail-grid { display: flex; flex-direction: column; gap: 12px; }
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.detail-val { font-size: 14px; font-weight: 500; color: var(--text-main); word-break: break-word; line-height: 1.4; }
.detail-val.red { color: var(--red); font-weight: 600; }
.detail-val.orange { color: var(--orange); font-weight: 600; }

.evidence-img { border: 1px solid var(--border); max-width: 100%; max-height: 180px; margin-top: 8px; cursor: zoom-in; }

/* Timeline & Messages (Clean) */
.msg-form { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 24px; }
.msg-form h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--black); margin-bottom: 12px; }
.timeline-box { display: flex; flex-direction: column; flex: 1; }
.timeline-box h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--black); margin-bottom: 16px; letter-spacing: 0.5px; }
.timeline { display: flex; flex-direction: column; gap: 0; overflow-y: visible; }
.tl-item { background: transparent; padding: 0 0 24px 20px; border: none; border-left: 2px solid var(--border-strong); position: relative; }
.tl-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--white); border: 2px solid var(--blue); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; margin-top: -2px; }
.tl-label { font-size: 13px; font-weight: 600; color: var(--black); }
.tl-ts { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.tl-detail { font-size: 13px; color: var(--text-main); margin-top: 4px; line-height: 1.4; }
.msg-form textarea { width: 100%; height: 64px; border: 1px solid var(--border); padding: 8px 12px; margin-bottom: 12px; font-size: 13px; resize: vertical; border-radius: 4px; }
.msg-row { display: flex; gap: 8px; }
.msg-row select { padding: 6px 10px; border: 1px solid var(--border); font-size: 13px; font-weight: 500; border-radius: 4px; background: var(--white); }

/* --- SETTINGS --- */
.settings-layout { display: flex; gap: 32px; align-items: flex-start; max-width: 1040px; }
.settings-nav { width: 240px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 32px; }
.settings-nav-item { padding: 10px 14px; font-size: 13px; font-weight: 500; color: var(--text-muted); border-radius: 8px; text-align: left; transition: 0.2s; background: transparent; border: 1px solid transparent; }
.settings-nav-item:hover { background: #f3f4f6; color: var(--text-main); }
.settings-nav-item.active { background: var(--white); color: var(--blue); font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.settings-content { flex: 1; }
.settings-panel { background: var(--white); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 24px; box-shadow: var(--shadow-sm); overflow: hidden; }
.settings-panel .panel-head { padding: 20px 24px; border-bottom: 1px solid var(--border); background: #fafafa; }
.settings-panel .panel-head h3 { font-size: 16px; font-weight: 600; color: var(--black); }
.settings-panel .panel-head p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.settings-panel .panel-body { padding: 24px; }
.settings-panel .panel-foot { padding: 16px 24px; border-top: 1px solid var(--border); background: #fafafa; display: flex; gap: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-main); margin-bottom: 8px; }
.form-group input { width: 100%; border: 1px solid var(--border-strong); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.rules-editor { width: 100%; padding: 16px; border: 1px solid var(--border-strong); border-radius: 8px; font-family: var(--mono); font-size: 13px; line-height: 1.6; min-height: 240px; }
.toggle-row { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; color: var(--text-main); cursor: pointer; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }

/* --- UTILITIES --- */
.log-action { font-weight: 600; font-size: 12px; font-family: var(--mono); color: var(--black); }
.la-LOGIN, .la-RELEASE, .la-PAY, .la-AUTO_VERIFY { color: var(--green); }
.la-LOGIN_FAIL, .la-REFUND, .la-PASSWORD_CHANGE { color: var(--red); }
.la-VERIFY { color: var(--blue); }
.la-DISPUTE, .la-RESOLVE { color: var(--orange); }

/* Toast */
.toast { position: fixed; bottom: 32px; right: 32px; background: var(--black); color: var(--white); padding: 14px 24px; font-size: 13px; font-weight: 500; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); display: none; z-index: 9999; }
.toast.show { display: block; animation: slideUp 0.3s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.toast.error { background: var(--red); }

/* Tablet nhỏ: thu gọn nội dung */
@media (max-width: 1024px) {
  #content { padding: 20px; }
  .stats-row { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}

/* ═══════════════ MOBILE (≤ 768px) — layout gọn, sidebar → hamburger ═══════════════ */
@media (max-width: 768px) {
  /* Header compact + hiện hamburger */
  #header { height: 52px; padding: 0 10px; gap: 8px; }
  .hamburger { display: inline-flex; }
  .header-logo { min-width: 0; }
  .header-logo img { height: 28px !important; }
  .header-right { gap: 6px; }
  .chip { padding: 5px 8px; font-size: 11px; border-radius: 8px; }
  .user-btn { flex-shrink: 0; }

  /* Sidebar → drawer trượt từ trái, ẩn mặc định */
  #sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 236px; z-index: 90;
    padding: 16px 12px; transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #sidebar.open { transform: translateX(0); box-shadow: 6px 0 28px rgba(0,0,0,0.35); }
  .nav-section { display: block; }
  .nav-item { justify-content: flex-start; padding: 12px 14px; font-size: 14px; margin-bottom: 4px; }
  .nav-item span { display: inline-flex; }

  /* Nội dung */
  #content { padding: 12px; }
  .breadcrumb { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 18px; }
  .page-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .page-actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Thẻ thống kê: 2 cột, gọn */
  .stats-row { grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  /* Biểu đồ Dashboard xếp dọc */
  .dash-charts { grid-template-columns: 1fr !important; }

  /* Bảng: cuộn ngang mượt, dày vừa phải */
  .tbl-wrap { -webkit-overflow-scrolling: touch; border-radius: 6px; }
  table.dt td { padding: 8px 10px; font-size: 13px; }
  table.dt thead th { padding: 8px 10px; font-size: 11px; }

  /* Bộ lọc / tìm kiếm / bulk xuống dòng */
  .activity-filter { flex-direction: column; align-items: stretch; gap: 8px; }
  .activity-filter .af-date { flex-wrap: wrap; }
  .bulk-bar { gap: 6px; padding: 8px 10px; }
  .bulk-bar select, .bulk-bar .btn { flex: 1 1 auto; }

  /* Phân trang xếp dọc, nút to dễ bấm */
  .pagination { flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
  .pagination .pg-btns { justify-content: center; flex-wrap: wrap; }
  .pg-btn { padding: 8px 12px; }

  /* Chi tiết GD (fullscreen) → 1 cột */
  .detail-fs-head { height: 52px; padding: 0 12px; gap: 10px; }
  .detail-fs-title { font-size: 14px; }
  .detail-fs-body { display: block; overflow-y: auto; }
  .drawer-cols { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .drawer-col-main { padding: 16px; overflow-y: visible; }
  .drawer-col-side { padding: 16px; border-left: none; border-top: 1px solid var(--border); overflow-y: visible; }
  .stat-bar { grid-template-columns: 1fr 1fr; padding: 12px; gap: 8px 12px; }

  /* Modal full-width */
  .modal { width: 96vw; max-width: 96vw; max-height: 92vh; }
  .modal-body { padding: 14px; }

  /* Cài đặt xếp dọc */
  .settings-layout { flex-direction: column; gap: 16px; }
  .settings-nav { width: 100%; flex-direction: row; flex-wrap: wrap; position: static; gap: 6px; }
  .settings-nav-item { flex: 1 1 auto; text-align: center; }
  .settings-panel .panel-foot { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }

  /* Toast full-width dưới đáy */
  .toast { left: 12px; right: 12px; bottom: 16px; text-align: center; }
}

/* Điện thoại nhỏ (≤ 400px): thẻ thống kê 1 cột */
@media (max-width: 400px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-bar { grid-template-columns: 1fr; }
}

/* ── Thanh thao tác hàng loạt (bulk) cho bảng giao dịch ── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: #eef4ff;
  border: 1px solid #cddffb;
  border-radius: 10px;
}
.bulk-bar .bulk-count { font-size: 13px; color: var(--text-main); }
.bulk-bar select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--white);
  font-size: 13px;
  color: var(--text-main);
}
.dt tr.row-sel td { background: #eef4ff; }
