:root {
  --bg: #F8FAFC;
  --surface: #ffffff;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --muted: #64748B;
  --border: #E5E7EB;
  --primary: #0F172A;
  --primary-dark: #1E293B;
  --accent: #C8A96B;
  --accent-light: rgba(200, 169, 107, 0.15);
  --success: #1a9d5a;
  --danger: #e5484d;
  --warning: #e08a00;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --font: "Segoe UI", Tahoma, "Vazirmatn", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 272px;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar:has(.drawer-inner) {
  overflow: hidden;
}
.brand {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand__top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand__title {
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 700;
  font-size: 15px;
}

.brand__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(168, 139, 74, 0.18) 0%, rgba(59, 130, 246, 0.12) 55%, rgba(16, 185, 129, 0.1) 100%);
  border: 1px solid rgba(168, 139, 74, 0.22);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  min-width: 0;
}

.brand__user-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #a88b4a 0%, #3b82f6 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.25);
}

.brand__user-svg {
  width: 14px !important;
  height: 14px !important;
  display: block;
}

.brand__user-initial {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.brand__user-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.35;
  overflow: hidden;
}

.brand__user-role {
  font-size: 12px;
  font-weight: 700;
  color: #a88b4a;
  flex-shrink: 0;
}

.brand__user-sep {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.brand__user-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}



.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary);
  display: grid; place-items: center; color: var(--accent);
  flex-shrink: 0;
}
.brand .logo .icon { width: 20px; height: 20px; }

.sidebar-logout-btn {
  color: #dc2626 !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  font-weight: 700;
}
.sidebar-logout-btn:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
}
.sidebar-logout-btn .icon-inline { stroke: #dc2626; }


.nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--text); font-size: 14px; margin-bottom: 0;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ico {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Sidebar tree / accordion */
.nav-standalone {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text); font-size: 14px; font-weight: 600;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.nav-standalone:hover { background: var(--surface-2); }
.nav-standalone.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.nav-standalone .ico {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 6px;
  overflow: hidden;
}

.nav-group[open],
.nav-group.is-open {
  border-color: rgba(200, 169, 107, 0.45);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.nav-group__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  list-style: none;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  transition: background 0.15s;
}

.nav-group__head::-webkit-details-marker { display: none; }
.nav-group__head::marker { content: ""; display: none; }

.nav-group__head:hover { background: var(--surface-2); }
.nav-group[open] > .nav-group__head,
.nav-group.is-open > .nav-group__head {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.nav-group__ico {
  width: 22px; height: 22px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  background: var(--surface-2);
}

.nav-group[open] > .nav-group__head .nav-group__ico,
.nav-group.is-open > .nav-group__head .nav-group__ico {
  color: var(--primary);
  background: var(--accent-light);
}

.nav-group__label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.nav-flat-group {
  margin-bottom: 6px;
  border-radius: var(--radius);
}

.nav-flat-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.nav-flat-group__ico {
  display: inline-flex;
  opacity: 0.85;
}

.nav-flat-group__label {
  line-height: 1.35;
}

.nav-flat-group__items {
  padding: 0 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-flat-group__items a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  padding-inline-start: 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.nav-flat-group__items a:hover {
  background: var(--surface-2);
}

.nav-flat-group__items a.active {
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-group__count {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.3;
  flex-shrink: 0;
}

.nav-group[open] > .nav-group__head .nav-group__count,
.nav-group.is-open > .nav-group__head .nav-group__count {
  background: var(--accent-light);
  color: var(--primary);
}

.nav-group__chev {
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.nav-group[open] .nav-group__chev,
.nav-group.is-open .nav-group__chev {
  transform: rotate(180deg);
  color: var(--primary);
}

.nav-group__items {
  padding: 6px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group__items a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  padding-inline-start: 14px;
  margin-inline-start: 10px;
  border-inline-start: 2px solid var(--border);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.nav-group__items a:hover {
  background: var(--surface-2);
  border-inline-start-color: var(--muted);
}

.nav-group__items a.active {
  background: var(--primary);
  color: #fff;
  border-inline-start-color: var(--accent);
}

.nav-group__items a .ico {
  width: 16px;
  height: 16px;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-group__items a span:last-child {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.nav .nav-group__items a {
  margin-bottom: 0;
  border-radius: 0 8px 8px 0;
}



.icon, .icon-inline { flex-shrink: 0; }
.icon-inline { vertical-align: middle; }
.stat .ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-light); color: var(--primary);
  margin-bottom: 4px;
}
.stat .ico .icon { width: 22px; height: 22px; }
.btn .icon-inline { margin-inline-end: 2px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

.sidebar-bottom-nav {
  flex-shrink: 0;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-bottom-nav .nav-standalone {
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-weight: 700; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.content { padding: 22px; flex: 1; }

.menu-toggle {
  display: none; background: none; border: none;
  color: var(--text); padding: 6px;
  align-items: center; justify-content: center;
}
.menu-toggle .icon { width: 22px; height: 22px; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 16px; }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px; border-radius: 10px;
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px;
  transition: 0.15s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.details {
  background: var(--accent-light);
  color: var(--primary);
  border-color: rgba(200, 169, 107, 0.45);
  font-weight: 600;
}
.btn.details:hover {
  background: rgba(200, 169, 107, 0.28);
  border-color: var(--accent);
  color: var(--primary-dark);
}
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn.icon { padding: 8px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 14px;
  font-family: inherit;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.amount-input {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.amount-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.amount-input__field {
  flex: 1;
  min-width: 0;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount-input__field::-webkit-outer-spin-button,
.amount-input__field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input__field:focus {
  box-shadow: none !important;
}

.amount-input__unit {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2, #f8fafc);
  border-inline-start: 1px solid var(--border);
  white-space: nowrap;
}

.stg-field .amount-input {
  border-radius: 12px;
  border: 1.5px solid var(--stg-border, #e2e8f0);
  background: #f8fafc;
}

.stg-field .amount-input:focus-within {
  border-color: rgba(200, 169, 107, 0.65);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 169, 107, 0.15);
}

.stg-field .amount-input__unit {
  background: #f1f5f9;
  border-inline-start-color: var(--stg-border, #e2e8f0);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.shamsi-clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.shamsi-clock__ico { color: var(--primary); opacity: 0.85; flex-shrink: 0; }
.shamsi-clock__text { letter-spacing: -0.01em; }

@media (max-width: 640px) {
  .shamsi-clock { font-size: 11px; padding: 5px 8px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: var(--surface-2); }
tr:hover td { background: var(--surface-2); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.green { background: rgba(26,157,90,.15); color: var(--success); }
.badge.red { background: rgba(229,72,77,.15); color: var(--danger); }
.badge.orange { background: rgba(224,138,0,.15); color: var(--warning); }
.badge.blue { background: rgba(31,111,235,.15); color: var(--primary); }
.badge.teal { background: rgba(13,148,136,.15); color: #0d9488; }
.badge.purple { background: rgba(124,58,237,.12); color: #7c3aed; }
.badge.gray { background: var(--surface-2); color: var(--muted); }

.pay-req-source-cell { min-width: 120px; }
.pay-req-source-detail {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pay-req-approve-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.pay-req-approve-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.pay-req-approve-option input { margin-top: 3px; flex-shrink: 0; }
.pay-req-approve-option span { font-size: 13px; line-height: 1.45; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,15,25,.5);
  display: grid; place-items: center; z-index: 100; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: 16px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; padding: 4px; }
.modal-body--detail { padding-top: 12px; }

/* ---------- Confirm dialog (structured summary) ---------- */
.modal--confirm {
  border-radius: 18px;
  overflow: hidden;
}
.modal--confirm .modal-head {
  padding: 16px 18px;
}
.modal--confirm .modal-head h3 {
  font-size: 16px;
  font-weight: 700;
}
.modal--confirm .modal-body {
  padding: 4px 18px 18px;
}
.modal-foot--confirm {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 14px 16px 16px;
}
.confirm-dialog__text {
  margin: 0;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-line;
}
.confirm-dialog__intro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}
.confirm-dialog__rows {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}
.confirm-dialog__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
}
.confirm-dialog__row:last-child {
  border-bottom: none;
}
.confirm-dialog__row--highlight {
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}
.confirm-dialog__row--highlight .confirm-dialog__value {
  color: #0f172a;
  font-size: 14px;
}
.confirm-dialog__label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.confirm-dialog__value {
  text-align: end;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.45;
}
.confirm-foot-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-size: 13px;
  font-family: Vazirmatn, inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.confirm-foot-btn--ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: #0f172a;
}
.confirm-foot-btn--ghost:hover {
  background: #f8fafc;
}
.confirm-foot-btn--primary {
  background: #0f172a;
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}
.confirm-foot-btn--primary:hover {
  transform: translateY(-1px);
}
.confirm-foot-btn--danger {
  background: var(--danger);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.2);
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Misc ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head__hint { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; max-width: 520px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; animation: slidein .2s; }
.toast.success { border-inline-start-color: var(--success); }
.toast.error { border-inline-start-color: var(--danger); }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

.chart-bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-col .bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-col .bar { width: 16px; border-radius: 4px 4px 0 0; }
.chart-col .bar.income { background: var(--success); }
.chart-col .bar.expense { background: var(--danger); }
.chart-col .lbl { font-size: 11px; color: var(--muted); }

.install-banner { display:flex; align-items:center; gap:10px; background: var(--surface); border:1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; box-shadow: var(--shadow); }

/* ---------- Responsive: app-wide mobile / desktop ---------- */
.vp-mobile .layout:not(.layout--dashboard) .content { padding: 14px 12px; }
.vp-desktop .layout:not(.layout--dashboard) .content { padding: 22px 28px; }

.vp-mobile .page-head {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.vp-mobile .page-head h2 { font-size: 18px; }
.vp-mobile .toolbar { width: 100%; }
.vp-mobile .toolbar .btn { flex: 1; justify-content: center; min-width: 0; }

.vp-mobile .card { padding: 14px; border: none; box-shadow: var(--shadow); }
.vp-desktop .card { border: none; box-shadow: var(--shadow); }

.vp-mobile table { font-size: 13px; }
.vp-mobile th, .vp-mobile td { padding: 9px 10px; }

.vp-desktop .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.vp-desktop .page-head h2 { font-size: 22px; }

/* ---------- Mobile bottom tab bar ---------- */
.vp-desktop .bottom-nav {
  display: none !important;
}

.bottom-nav {
  --bn-bg: #ffffff;
  --bn-border: #E5E7EB;
  --bn-muted: #64748B;
  --bn-text: #0F172A;
  --bn-gold: #C8A96B;
  display: none;
}

.vp-mobile .bottom-nav {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
  background: var(--bn-bg);
  border-top: 1px solid var(--bn-border);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.07);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__inner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 6px 8px;
  min-height: 58px;
  box-sizing: border-box;
}

.bottom-nav__item {
  flex: 1 1 0;
  min-width: 0;
  max-width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 2px 4px;
  text-decoration: none;
  color: var(--bn-muted);
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item:active {
  opacity: 0.85;
}

.bottom-nav__ico-wrap {
  width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
  color: var(--bn-muted);
}

.bottom-nav__ico {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.bottom-nav__ico svg {
  display: block;
  stroke: currentColor;
}

.bottom-nav__label {
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: var(--bn-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav__item.is-active {
  color: var(--bn-text);
}

.bottom-nav__item.is-active .bottom-nav__label {
  color: var(--bn-text);
  font-weight: 700;
}

.bottom-nav__item.is-active .bottom-nav__ico-wrap {
  color: var(--bn-gold);
  background: rgba(200, 169, 107, 0.14);
}

/* Center: dashboard */
.bottom-nav__item--center .bottom-nav__ico-wrap {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--bn-muted);
  background: transparent;
}

.bottom-nav__item--center.is-active .bottom-nav__ico-wrap {
  color: #fff;
  background: linear-gradient(145deg, #0F172A 0%, #1E293B 100%);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.22), 0 0 0 2px var(--bn-gold);
}

.bottom-nav__item--center .bottom-nav__label {
  color: var(--bn-muted);
  font-weight: 600;
}

.bottom-nav__item--center.is-active .bottom-nav__label {
  color: var(--bn-text);
  font-weight: 700;
}

.vp-mobile .main > .content {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
}

/* ---------- Responsive ---------- */
.backdrop { display: none; }
@media (max-width: 720px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; inset-inline-start: 0; top: 0;
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-100%);
  }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0) !important; z-index: 110; }
  .layout:has(.sidebar.open) .bottom-nav,
  body.drawer-open .bottom-nav {
    display: none !important;
  }
  html:has(.sidebar.open),
  body.drawer-open {
    overflow: hidden;
  }
  .menu-toggle { display: inline-flex; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 105; }
  .form-row { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .toolbar, .page-head button, .btn, .menu-toggle { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
}
