/* =============================================================
   BIẾN & RESET
============================================================= */
:root {
  --brand: #1e40af;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-soft: #eff4ff;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e5e9f2;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --info: #0891b2;
  --info-soft: #ecfeff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .16);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* =============================================================
   NÚT
============================================================= */
.btn {
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn--primary { background: var(--brand-600); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover:not(:disabled) { background: var(--brand-700); }
.btn--success { background: var(--success); color: #fff; }
.btn--success:hover:not(:disabled) { filter: brightness(.94); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(.94); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); border-color: #cbd5e1; }
.btn--block { width: 100%; justify-content: center; }
.btn--lg { padding: 13px 18px; font-size: 15px; }
.btn--sm { padding: 7px 12px; font-size: 13px; }

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  width: 34px; height: 34px;
  border-radius: 9px;
  font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn--danger:hover { background: var(--danger-soft); }

.link-cust {
  background: none; border: none; padding: 0;
  color: var(--brand-600); font-weight: 600; font-size: 14px;
  text-align: left;
}
.link-cust:hover { text-decoration: underline; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
}
.chip:hover { border-color: var(--brand-600); color: var(--brand-600); }

/* =============================================================
   BỐ CỤC
============================================================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #0f1e40;
  color: #cdd7ee;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
  padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.brand__logo { font-size: 26px; }
.brand__name { font-weight: 700; font-size: 16px; color: #fff; line-height: 1.2; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border: none; background: transparent;
  color: #aebbdb; border-radius: 11px;
  font-size: 14.5px; font-weight: 600; text-align: left;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--brand-600); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.nav-item__ic { font-size: 17px; }

.sidebar__foot { border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px; }
.user-chip__ava {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-600); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-chip__mail { font-size: 12.5px; color: #aebbdb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__foot .btn--ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #cdd7ee; }
.sidebar__foot .btn--ghost:hover { background: rgba(255,255,255,.12); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left .2s ease; }

/* Nút thu gọn menu */
.collapse-btn {
  margin-left: auto; background: rgba(255,255,255,.08); border: none; color: #cdd7ee;
  width: 28px; height: 28px; border-radius: 8px; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.collapse-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.sidebar { transition: width .2s ease, transform .25s ease; }

body.sidebar-collapsed .sidebar { width: 78px; padding-left: 10px; padding-right: 10px; }
body.sidebar-collapsed .main { margin-left: 78px; }
body.sidebar-collapsed .brand { justify-content: center; gap: 0; }
body.sidebar-collapsed .brand__name,
body.sidebar-collapsed .nav-item__label,
body.sidebar-collapsed .user-chip__mail,
body.sidebar-collapsed .btn-label { display: none; }
body.sidebar-collapsed .collapse-btn { position: absolute; top: 16px; right: 8px; margin-left: 0; background: transparent; }
body.sidebar-collapsed .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .nav-item__ic { font-size: 20px; }
body.sidebar-collapsed .user-chip { justify-content: center; }
body.sidebar-collapsed .sidebar__foot .btn { padding-left: 0; padding-right: 0; }

.topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.hamburger { font-size: 22px; background: none; border: none; color: var(--text); width: 40px; }
.topbar__title { font-weight: 700; flex: 1; font-size: 15px; }

.content { padding: 26px 30px 60px; max-width: 1280px; width: 100%; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 35; }

.bottom-nav { display: none; }

/* =============================================================
   TIÊU ĐỀ TRANG / THANH CÔNG CỤ
============================================================= */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.page-sub { color: var(--text-2); margin-top: 2px; font-size: 14px; }

.toolbar { display: flex; gap: 12px; margin-bottom: 18px; align-items: center; }
.toolbar--wrap { flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .6; }
.search-box input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; color: var(--text);
}
.search-box input:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-soft); }

.select {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14px; color: var(--text); font-weight: 500;
}
.select:focus { outline: none; border-color: var(--brand-600); }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg__btn { border: none; background: transparent; padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg__btn:hover { color: var(--text); }
.seg__btn.active { background: var(--brand-soft); color: var(--brand-700); }

/* =============================================================
   THẺ / BẢNG
============================================================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card__head h3 { font-size: 15px; font-weight: 700; }
.card__body { padding: 16px 20px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 13px 16px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.row-paid { opacity: .62; }

.col-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.col-num { text-align: center; width: 60px; }
.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.col-badge { white-space: nowrap; }
.money-owed { color: var(--danger); }
.money-clear { color: var(--success); }

.cust-cell { display: flex; align-items: center; gap: 11px; }
.cust-name { font-weight: 600; }
.cust-meta { font-size: 12.5px; color: var(--text-2); }

.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar--sm { width: 32px; height: 32px; font-size: 12px; }
.avatar--lg { width: 58px; height: 58px; font-size: 20px; }

.cat-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--info { background: var(--info-soft); color: var(--info); }

.empty { text-align: center; padding: 46px 20px; color: var(--text-2); }
.empty__ic { font-size: 42px; margin-bottom: 10px; }
.empty p { margin: 0 0 16px; }

/* =============================================================
   THỐNG KÊ (DASHBOARD)
============================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand-600); }
.stat--danger::before { background: var(--danger); }
.stat--warn::before { background: var(--warn); }
.stat--info::before { background: var(--info); }
.stat--success::before { background: var(--success); }
.stat--plain::before { display: none; }
.stat__ic { font-size: 26px; width: 50px; height: 50px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat__value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.stat__label { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }

.top-list { display: flex; flex-direction: column; gap: 14px; }
.top-row { display: flex; align-items: center; gap: 12px; }
.top-row.clickable { cursor: pointer; padding: 6px; margin: -6px; border-radius: 10px; }
.top-row.clickable:hover { background: var(--surface-2); }
.top-row__main { flex: 1; min-width: 0; }
.top-row__name { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.top-row__right { text-align: right; font-weight: 700; font-size: 14px; }
.bar { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-600), var(--danger)); border-radius: 999px; }
.bar--lg { height: 10px; }

.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.feed-row:last-child { border-bottom: none; }
.feed-ic { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.feed-ic--debt { background: var(--danger-soft); }
.feed-ic--pay { background: var(--success-soft); }
.feed-main { flex: 1; min-width: 0; font-size: 14px; }
.feed-row .money-owed, .feed-row .money-clear { font-weight: 700; white-space: nowrap; }

/* =============================================================
   CHI TIẾT KHÁCH HÀNG
============================================================= */
.detail-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.detail-head__info { flex: 1; min-width: 0; }
.detail-head__info h3 { font-size: 20px; font-weight: 800; }
.detail-pdf { flex-shrink: 0; }
.detail-head__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13.5px; margin-top: 5px; }
.detail-note { margin-top: 8px; font-size: 13px; color: var(--text-2); background: var(--surface-2); padding: 8px 12px; border-radius: 8px; }

.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.dstat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.dstat span { font-size: 12.5px; color: var(--text-2); display: block; margin-bottom: 4px; }
.dstat strong { font-size: 18px; font-weight: 800; }
.dstat--rem { background: var(--brand-soft); border-color: #dbe6ff; }

.detail-section { margin-bottom: 22px; }
.detail-section h4 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.detail-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.detail-section__head h4 { margin-bottom: 0; }

.debt-list { display: flex; flex-direction: column; gap: 10px; }
.debt-item {
  display: flex; gap: 13px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; background: var(--surface);
}
.debt-item.is-paid { background: var(--surface-2); }
.debt-item__ic { font-size: 22px; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.debt-item__main { flex: 1; min-width: 0; }
.debt-item__title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.35; }
.debt-item__cat { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.debt-item__meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 5px; }
.debt-item__money { text-align: right; flex-shrink: 0; min-width: 110px; }
.debt-item__amount { font-weight: 800; font-size: 16px; }
.debt-item__rem { font-size: 13px; color: var(--danger); font-weight: 700; margin-top: 3px; }
.debt-item__actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.debt-item.is-paid .debt-item__title { color: var(--text-2); }

.pay-list { display: flex; flex-direction: column; gap: 8px; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: var(--success-soft); border-radius: 9px; font-size: 13.5px; }
.pay-row__amt { font-weight: 700; color: var(--success); }
.pay-row__time { color: var(--text-2); }
.pay-row__note { color: var(--text-2); font-style: italic; }

/* =============================================================
   BÁO CÁO
============================================================= */
.cat-report { display: flex; flex-direction: column; gap: 15px; }
.cat-report__row { display: grid; grid-template-columns: 1fr 34% auto; gap: 12px; align-items: center; }
.cat-report__label { font-size: 13.5px; font-weight: 600; }
.cat-report__val { font-weight: 700; text-align: right; white-space: nowrap; }

.month-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; height: 190px; padding-top: 10px; }
.month-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }
.month-col__bar { width: 60%; max-width: 44px; min-height: 4px; background: linear-gradient(180deg, var(--brand-600), var(--brand)); border-radius: 6px 6px 0 0; transition: height .3s; }
.month-col__val { font-size: 11px; font-weight: 700; color: var(--text-2); }
.month-col__label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* =============================================================
   FORM & MODAL
============================================================= */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field em { color: var(--danger); font-style: normal; }
.field input, .field textarea, .field select {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 14.5px; color: var(--text); width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field textarea { resize: vertical; }
.form-hint { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); padding: 9px 12px; border-radius: 9px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amount-preview { background: var(--brand-soft); border: 1px solid #dbe6ff; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.amount-preview strong { font-size: 18px; font-weight: 800; color: var(--brand-700); }
.new-cust-box { border: 1px dashed var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.new-cust-box[hidden] { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.confirm-msg { font-size: 14.5px; color: var(--text-2); line-height: 1.6; margin: 0 0 8px; }

.pay-summary { background: var(--surface-2); border-radius: 11px; padding: 12px 15px; display: flex; flex-direction: column; gap: 7px; }
.pay-summary > div { display: flex; justify-content: space-between; font-size: 14px; }
.pay-summary span { color: var(--text-2); }
.pay-summary__rem { border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 2px; }
.pay-summary__rem strong { color: var(--danger); font-size: 16px; }
.quick-pay { display: flex; gap: 8px; flex-wrap: wrap; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  z-index: 100; opacity: 0; transition: opacity .2s;
  overflow-y: auto;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 500px;
  box-shadow: var(--shadow-lg); transform: translateY(14px) scale(.98); transition: transform .2s;
  max-height: calc(100vh - 36px); display: flex; flex-direction: column;
  margin: auto;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal--sm { max-width: 420px; }
.modal--md { max-width: 520px; }
.modal--lg { max-width: 760px; }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; }
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 22px; overflow-y: auto; }

/* =============================================================
   TOAST
============================================================= */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--text); color: #fff; padding: 12px 16px; border-radius: 11px;
  display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); max-width: 360px;
  opacity: 0; transform: translateX(20px); transition: all .25s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast--success { background: #14532d; }
.toast--error { background: #7f1d1d; }
.toast--warn { background: #78350f; }
.toast--info { background: #1e3a5f; }
.toast__icon { font-size: 16px; }

/* =============================================================
   SPINNER & LOADING
============================================================= */
.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; vertical-align: -2px;
}
.spinner--lg { width: 32px; height: 32px; border-width: 3px; border-color: rgba(37,99,235,.25); border-top-color: var(--brand-600); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-view { text-align: center; padding: 70px 20px; color: var(--text-2); }
.loading-view p { margin-top: 14px; }

/* =============================================================
   RESPONSIVE
============================================================= */
@media (max-width: 1040px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .main { margin-left: 0; }
  /* Trên di động menu dạng trượt, bỏ hiệu ứng thu gọn */
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); padding-left: 14px; padding-right: 14px; }
  body.sidebar-collapsed .main { margin-left: 0; }
  body.sidebar-collapsed .brand__name,
  body.sidebar-collapsed .nav-item__label,
  body.sidebar-collapsed .user-chip__mail,
  body.sidebar-collapsed .btn-label { display: inline; }
  .collapse-btn { display: none; }
  .topbar { display: flex; }
  .content { padding: 18px 16px 90px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; padding: 7px 2px; border-radius: 10px;
    color: var(--muted); font-size: 11px; font-weight: 600;
  }
  .bottom-item__ic { font-size: 20px; }
  .bottom-item.active { color: var(--brand-600); }
  .stat-grid--3 { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page-title { font-size: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .col-addr, .col-desc { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .seg { overflow-x: auto; }
  .detail-stats { grid-template-columns: 1fr; }
  .stat__value { font-size: 20px; }
  .debt-item { flex-wrap: wrap; }
  .debt-item__actions { flex-direction: row; width: 100%; justify-content: flex-end; margin-top: 4px; }
  .cat-report__row { grid-template-columns: 1fr auto; }
  .cat-report__row .bar { display: none; }
}
