/* Wallet — cash, custody, collections, advances.
   Uses the shared ERP shell, cards, tables and buttons; only wallet-specific
   composition lives here. */
.wallet-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.wallet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -6px; }
.wallet-actions .btn { gap: 6px; }
.wallet-actions .btn svg { flex: 0 0 auto; }

/* ------------------------------------------------------------- balances */
.wallet-currency-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.wallet-currency {
  position: relative; overflow: hidden; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: 17px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
  box-shadow: var(--shadow-xs);
}
.wallet-currency.is-usd { background: linear-gradient(135deg, #ffffff 0%, #f1fbf6 100%); }
.wallet-currency::after {
  content: ''; position: absolute; inset-inline-end: -34px; top: -34px;
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 76, 241, 0.11), transparent 70%);
  pointer-events: none;
}
.wallet-currency.is-usd::after { background: radial-gradient(circle, rgba(16, 138, 96, 0.12), transparent 70%); }
.wc-head { display: flex; align-items: center; gap: 8px; }
.wc-code {
  padding: 3px 8px; border-radius: 7px; font-size: 10.5px; font-weight: 800;
  letter-spacing: 0.6px; background: var(--brand-50); color: var(--brand-2);
}
.wallet-currency.is-usd .wc-code { background: #e4f7ee; color: #0b7a55; }
.wc-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.wc-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 12px; }
.wc-balance { min-width: 0; }
.wc-total { display: flex; align-items: baseline; gap: 7px; }
.wc-total strong {
  font-size: clamp(26px, 2.3vw, 34px); font-weight: 800; letter-spacing: -1px;
  line-height: 1.05; color: #0f2744; font-variant-numeric: tabular-nums;
}
.wc-total span { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: 0.4px; }
.wc-caption { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.wc-split {
  display: grid; grid-template-columns: repeat(2, minmax(120px, auto)); gap: 10px 22px;
  flex: 0 0 auto; padding-inline-start: 24px; border-inline-start: 1px dashed var(--line);
}
.wc-split small { display: block; font-size: 10px; color: var(--muted); margin-bottom: 3px; }
.wc-split strong { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-currency.is-zero { background: var(--surface); }
.wallet-currency.is-zero .wc-total strong { color: var(--muted); }

/* ---------------------------------------------------------- request cards */
.wallet-requests { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); align-items: start; gap: 10px; }
.wallet-request {
  display: grid; align-content: start; gap: 9px; padding: 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-xs);
}
.wallet-request.overdue { border-color: #f0c3c9; background: linear-gradient(180deg, #fff 55%, #fff8f8 100%); }
.wr-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wr-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.wr-kind svg { color: var(--brand); }
.wr-number { margin-inline-start: auto; font-size: 10.5px; color: var(--muted-2); letter-spacing: 0.4px; font-weight: 700; }
.wr-main { display: flex; align-items: baseline; justify-content: flex-start; gap: 6px 14px; flex-wrap: wrap; }
.wr-amount { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; color: #0f2744; font-variant-numeric: tabular-nums; }
.wr-owner { font-size: 11.5px; color: var(--muted); }
.wr-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 10.5px; color: var(--muted); }
.wr-meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.wr-meta svg { flex: 0 0 auto; opacity: 0.8; }
.wr-warn { color: #b32e3d !important; font-weight: 700; }
.wr-figures {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  padding: 9px 10px; border-radius: 10px; background: var(--surface-2);
}
.wr-figures > div { min-width: 0; }
.wr-figures small { display: block; font-size: 9.5px; color: var(--muted); margin-bottom: 2px; }
.wr-figures strong { font-size: 11.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.wr-state { font-size: 11px; color: var(--muted); }
.wr-note { font-size: 11px; color: var(--ink-2); background: var(--surface-2); padding: 7px 9px; border-radius: 8px; line-height: 1.6; }
.wr-overdue { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #b32e3d; }
.wr-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ----------------------------------------------------------- smaller parts */
.wallet-sub { display: block; margin-top: 2px; font-size: 10px; color: var(--muted-2); letter-spacing: 0.2px; }
.wallet-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-empty-inline {
  display: flex; align-items: center; gap: 9px; padding: 18px 14px;
  border: 1px dashed var(--line-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px;
}
.wallet-empty-inline svg { color: var(--muted-2); flex: 0 0 auto; }
.wallet-footnote { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: 10.5px; line-height: 1.75; color: var(--muted); }
.wallet-footnote svg { flex: 0 0 auto; margin-top: 2px; }

.wallet-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.wallet-stat { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-xs); }
.wallet-stat small { display: block; font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.wallet-stat strong { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; color: #0f2744; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tables */
.wallet-page .table-wrap { max-width: 100%; }
.wallet-page .card-body.flush .table-wrap.round { border: 0; border-radius: 0; }
.wallet-page .table th { font-size: 10px; text-transform: none; letter-spacing: 0; }
.wallet-page .table td { vertical-align: top; }
.wallet-page .table .btn { white-space: nowrap; }
.wallet-page .table .wallet-amount { white-space: nowrap; }
.wallet-page .table th:first-child,
.wallet-page .table td:first-child { min-width: 150px; }
.wallet-page .wallet-sub [dir="ltr"],
.wallet-page .wallet-sub[dir="ltr"] { white-space: nowrap; }

/* --------------------------------------------------------------- controls */
.wallet-search {
  display: flex; align-items: center; gap: 8px; max-width: 460px;
  height: 38px; padding: 0 11px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.wallet-search svg { color: var(--muted-2); flex: 0 0 auto; }
.wallet-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 12px; color: var(--ink); }

.wallet-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.wallet-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.wallet-field input, .wallet-field select, .wallet-field textarea {
  width: 100%; max-width: 100%; box-sizing: border-box; height: 38px;
  padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 12px;
}
.wallet-field textarea { height: auto; min-height: 64px; padding: 9px 10px; resize: vertical; }
.wallet-field input:focus, .wallet-field select:focus, .wallet-field textarea:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
.wallet-form-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.wallet-form .wallet-hint { grid-column: 1 / -1; }
.wallet-form > p:not(.wallet-error):not(.wallet-hint) { grid-column: 1 / -1; margin: 0; }
.wallet-error { grid-column: 1 / -1; margin: 0; color: #b42318; font-size: 11px; min-height: 0; }
.wallet-hint { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 11px; line-height: 1.65; color: var(--muted); }
.wallet-hint svg { flex: 0 0 auto; margin-top: 2px; }
.wallet-check { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-2); }
.wallet-check input { width: 15px; height: 15px; }

.wallet-config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.wallet-onboard-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* --------------------------------------------------------------- receipt */
.wallet-receipt { padding: 8px; }
.wallet-receipt h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: 0.5px; }
.wallet-receipt p { margin: 6px 0; font-size: 12px; color: var(--muted); }
.wallet-receipt strong { display: block; margin: 12px 0; font-size: 26px; color: #0f2744; }
.wallet-receipt button { margin-top: 10px; }

/* ------------------------------------------------------------ overview */
.wallet-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.wallet-toolbar .wallet-footnote { flex: 1 1 320px; margin: 0; }
.wallet-currency-tag {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px;
  border-radius: 8px; background: var(--brand-50); color: var(--brand-2);
  font-size: 11px; font-weight: 800; letter-spacing: 0.6px;
}

.wallet-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.wallet-kpi {
  position: relative; display: flex; align-items: flex-start; gap: 12px;
  min-width: 0; padding: 15px 16px;
  border: 1px solid var(--line); border-radius: 15px;
  background: var(--surface); box-shadow: var(--shadow-xs);
}
.wallet-kpi-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  background: var(--brand-50); color: var(--brand);
}
.wallet-kpi.is-green .wallet-kpi-icon { background: #e4f7ee; color: #0b7a55; }
.wallet-kpi.is-blue .wallet-kpi-icon { background: var(--brand-50); color: var(--brand); }
.wallet-kpi.is-amber .wallet-kpi-icon { background: #fff2dd; color: #a86400; }
.wallet-kpi.is-red .wallet-kpi-icon { background: #fdeaea; color: #b42318; }
.wallet-kpi.is-red { border-color: #f0c3c9; }
.wallet-kpi-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wallet-kpi-copy small { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.wallet-kpi-copy strong {
  font-size: clamp(18px, 1.65vw, 24px); font-weight: 800; letter-spacing: -0.6px;
  line-height: 1.15; color: #0f2744; font-variant-numeric: tabular-nums;
}
.wallet-kpi-copy > span { font-size: 10px; color: var(--muted-2); line-height: 1.5; }
.wallet-kpi-extra { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.wallet-kpi-extra > span {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); font-size: 10.5px; color: var(--muted);
}
.wallet-kpi-extra strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-kpi-extra svg { flex: 0 0 auto; opacity: 0.85; }
.wallet-kpi.is-zero { background: var(--surface-2); box-shadow: none; }
.wallet-kpi.is-zero .wallet-kpi-icon { background: var(--surface-3); color: var(--muted-2); }
.wallet-kpi.is-zero .wallet-kpi-copy strong { color: var(--muted); }
.wallet-kpi.is-zero .wallet-kpi-extra > span { background: var(--surface); }

.wallet-overview-grid {
  /* The custody table carries nine columns; it needs the full content width
     so the employee drill-down action is never clipped. */
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start;
}
.wallet-self .card-head { flex-wrap: wrap; gap: 8px; }

/* -------------------------------------------------------------- my hero */
.wallet-hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.wallet-hero {
  position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 17px; border: 1px solid var(--line); border-radius: 15px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%); box-shadow: var(--shadow-xs);
}
.wallet-hero.is-purple { background: linear-gradient(135deg, #ffffff 0%, #f6f1ff 100%); }
.wallet-hero.is-blue { background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%); }
.wallet-hero.is-amber { background: linear-gradient(135deg, #ffffff 0%, #fff8ec 100%); }
.wallet-hero > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wallet-hero small { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.wallet-hero p { margin: 0; font-size: 10px; line-height: 1.6; color: var(--muted-2); }
.wallet-hero .btn { align-self: flex-start; margin-top: 2px; }
.wallet-hero-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  background: #efe8ff; color: #6b46c1;
}
.wallet-hero.is-blue .wallet-hero-icon { background: var(--brand-50); color: var(--brand); }
.wallet-hero.is-amber .wallet-hero-icon { background: #fff2dd; color: #a86400; }
.wallet-hero-values { display: flex; flex-direction: column; gap: 2px; }
.wallet-hero-line { display: flex; align-items: baseline; gap: 6px; }
.wallet-hero-line strong {
  font-size: 21px; font-weight: 800; letter-spacing: -0.5px; color: #0f2744;
  font-variant-numeric: tabular-nums;
}
.wallet-hero-line span { font-size: 10px; font-weight: 800; color: var(--muted); letter-spacing: 0.4px; }
.wallet-hero-zero { font-size: 12px; color: var(--muted-2); }

/* --------------------------------------------------------------- controls */
.wallet-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.wallet-filterbar .wallet-search { flex: 1 1 260px; max-width: 420px; margin-bottom: 0; }
.wallet-select {
  height: 38px; min-width: 140px; max-width: 220px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 11.5px;
}
.wallet-select:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
.wallet-filter-count { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wallet-date { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.wallet-nowrap { white-space: nowrap; }
.wallet-date input {
  height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 11.5px;
}
.wallet-date input:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }
.wallet-row-actions { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* ------------------------------------------------------ salary breakdown */
.wallet-breakdown {
  display: grid; gap: 0; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: var(--surface);
}
.wallet-breakdown > div {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.wallet-breakdown > div:last-child { border-bottom: 0; }
.wallet-breakdown > div > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wallet-breakdown strong { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; text-align: end; }
.wallet-breakdown strong.is-deduction { color: #b42318; }
.wallet-breakdown .is-total { background: var(--surface-2); }
.wallet-breakdown .is-total span { font-weight: 700; color: var(--ink-2); }
.wallet-breakdown .is-total strong { font-size: 15px; font-weight: 800; color: #0f2744; }
.wallet-breakdown small.wallet-sub { display: inline; margin: 0; }

.wallet-progress-wrap { display: grid; gap: 6px; margin-bottom: 12px; }
.wallet-progress-label { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted); }
.wallet-progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wallet-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #4b8df8); }

/* --------------------------------------------------------- employee modal */
.wallet-profile { display: grid; gap: 14px; }
.wallet-profile-head { display: flex; align-items: center; gap: 11px; }
.wallet-profile-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand);
}
.wallet-profile-head strong { display: block; font-size: 14px; color: var(--ink); }
.wallet-profile .wallet-stat-grid { margin-top: 2px; }
.wallet-detail-section { display: grid; gap: 8px; }
.wallet-detail-section > h3 {
  margin: 0; font-size: 11.5px; font-weight: 800; color: var(--ink-2);
  letter-spacing: 0.2px;
}

/* ------------------------------------------------------------ focus state */
.wallet-request.is-focused { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }

/* -------------------------------------------------------- offline outbox */
.wallet-outbox {
  display: grid; gap: 9px; padding: 13px 15px;
  border: 1px solid #f0dcb4; border-radius: 14px;
  background: linear-gradient(180deg, #fffdf8 0%, #fff8ec 100%);
  box-shadow: var(--shadow-xs);
}
.wallet-outbox-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wallet-outbox-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  background: #fff2dd; color: #a86400;
}
.wallet-outbox-head > div { display: grid; gap: 3px; flex: 1 1 260px; min-width: 0; }
.wallet-outbox-head strong { font-size: 12px; color: var(--ink); }
.wallet-outbox-head span { font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.wallet-outbox-head .btn { flex: 0 0 auto; }
.wallet-outbox-list { display: grid; gap: 6px; }
.wallet-outbox-row {
  display: flex; align-items: center; gap: 7px 12px; flex-wrap: wrap;
  padding: 7px 10px; border: 1px solid #f0e2c6; border-radius: 9px;
  background: rgba(255, 255, 255, 0.78); font-size: 10.5px; color: var(--muted);
}
.wallet-outbox-kind { font-weight: 700; color: var(--ink-2); }
.wallet-outbox-state { display: inline-flex; align-items: center; gap: 4px; }
.wallet-outbox-state.is-error { color: #b42318; font-weight: 700; }
.wallet-outbox-time { margin-inline-start: auto; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------- report tabs */
.wallet-report-tabs {
  display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-inline: contain;
  padding: 2px 2px 11px; margin-bottom: 1px; scrollbar-width: none;
}
.wallet-report-tabs::-webkit-scrollbar { display: none; }
.wallet-report-tab {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--muted);
  font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.wallet-report-tab svg { opacity: 0.85; }
.wallet-report-tab:hover { border-color: var(--line-strong); color: var(--ink-2); }
.wallet-report-tab.active { border-color: var(--brand); background: var(--brand-50); color: var(--brand-2); }
.wallet-report-tab:focus-visible { outline: 2px solid var(--brand-50); outline-offset: 1px; }

.wallet-report-range {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-bottom: 9px; font-size: 10.5px; color: var(--muted);
}
.wallet-report-range:empty { display: none; }
.wallet-report-range svg { flex: 0 0 auto; opacity: 0.85; }
.wallet-report-range strong { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wallet-report-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wallet-report-summary:empty { display: none; }
.wallet-summary-chip {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); font-size: 10.5px; color: var(--muted);
}
.wallet-summary-chip strong { font-size: 12px; color: #0f2744; font-variant-numeric: tabular-nums; }
.wallet-summary-chip small { font-size: 9.5px; color: var(--muted-2); }
.wallet-summary-chip.is-zero { border-style: dashed; background: transparent; }
.wallet-summary-code {
  padding: 2px 6px; border-radius: 6px; font-size: 9px; font-weight: 800;
  letter-spacing: 0.5px; background: var(--brand-50); color: var(--brand-2);
}
.wallet-report-loading {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 34px 14px; border: 1px dashed var(--line-strong); border-radius: 12px;
  background: var(--surface-2); font-size: 11.5px; color: var(--muted);
}
.wallet-report-loading svg { animation: wallet-spin 1.1s linear infinite; }
.wallet-report-error {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 14px; border: 1px solid #f2d0d0; border-radius: 12px;
  background: #fdf4f4; font-size: 11.5px; color: #b42318;
}
@keyframes wallet-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .wallet-report-loading svg { animation: none; }
}

/* ------------------------------------------------------ handover builder */
.wallet-form-grid {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 12px;
}
.wallet-handover-lines {
  grid-column: 1 / -1; display: grid; gap: 7px;
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  padding: 3px; margin: 0 -3px;
}
.wallet-handover-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 112px; align-items: center;
  gap: 7px 12px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  font-size: 11px; color: var(--ink);
}
.wallet-handover-line > span:first-child { min-width: 0; }
.wallet-handover-line .wallet-sub { font-size: 9.5px; margin-top: 1px; }
.wallet-handover-available { font-size: 10px; color: var(--muted); white-space: nowrap; }
.wallet-handover-available strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-handover-line input {
  width: 100%; height: 34px; box-sizing: border-box; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 12px;
  font-variant-numeric: tabular-nums; text-align: end;
}
.wallet-handover-line input:focus { outline: 2px solid var(--brand-50); border-color: var(--brand); }

/* ------------------------------------------------ approvals queue strip */
.wallet-queue-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.wallet-queue-item {
  display: flex; align-items: flex-start; gap: 10px; min-width: 0;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: inherit; text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wallet-queue-item:hover, .wallet-queue-item:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.wallet-queue-icon {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
  background: var(--brand-50); color: var(--brand);
}
.wallet-queue-item.is-alert { border-color: #f0c3c9; }
.wallet-queue-item.is-alert .wallet-queue-icon { background: #fdeaea; color: #b42318; }
.wallet-queue-copy { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.wallet-queue-copy strong { font-size: 19px; font-weight: 800; line-height: 1.05; color: #0f2744; font-variant-numeric: tabular-nums; }
.wallet-queue-copy > span { font-size: 10.5px; line-height: 1.45; color: var(--muted); }
.wallet-queue-amounts { display: grid; gap: 1px; flex: 0 0 auto; text-align: end; }
.wallet-queue-amount { font-size: 9.5px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-queue-amount.is-zero { font-weight: 600; color: var(--muted-2); }
.wallet-queue-item.is-empty { background: var(--surface-2); box-shadow: none; }
.wallet-queue-item.is-empty .wallet-queue-icon { background: var(--surface-3); color: var(--muted-2); }
.wallet-queue-item.is-empty .wallet-queue-copy strong { color: var(--muted); }

/* ---------------------------------------------------------------- print */
.wallet-print { display: none; }
.wallet-print h1 { margin: 0 0 4px; font-size: 17px; }
.wallet-print > p { margin: 0 0 12px; font-size: 11px; color: var(--muted); }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 1100px) {
  .wallet-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet-queue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wallet-overview-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Tablet portrait keeps 8-column wallet tables readable by switching them to
   the labelled record-card layout before the phone breakpoint. */
@media (min-width: 761px) and (max-width: 900px) {
  .wallet-page .table-wrap.round:has(.table-cards) { border: 0; background: transparent; }
  .wallet-page .table.table-cards { display: block; width: 100%; min-width: 0 !important; border-collapse: initial; font-size: 12.5px; }
  .wallet-page .table.table-cards thead { display: none; }
  .wallet-page .table.table-cards tbody { display: block; }
  .wallet-page .table.table-cards tr {
    display: block; margin-bottom: 9px; overflow: hidden;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .wallet-page .table.table-cards tbody tr:last-child { margin-bottom: 0; }
  .wallet-page .table.table-cards td {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 10px;
    width: 100%; text-align: start; white-space: normal; overflow-wrap: anywhere;
    padding: 8px 10px; border: 0; border-bottom: 1px solid #f1f5fa;
  }
  .wallet-page .table.table-cards tbody tr:last-child td { border-bottom: 0; }
  .wallet-page .table.table-cards td::before {
    content: attr(data-label); flex: 0 0 30%;
    font-size: 10.5px; font-weight: 700; color: var(--muted); line-height: 1.5;
  }
  .wallet-page .table.table-cards td:first-child {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
    padding: 9px 10px 8px;
  }
  .wallet-page .table.table-cards td:first-child::before {
    display: block; flex: 0 0 100%; width: auto; margin-bottom: 1px;
  }
  /* Codes carry dir="ltr" for correct bidi text; keep them inline so the flow
     stays at the start edge instead of pinning the invoice to the far left. */
  .wallet-page .table.table-cards td:first-child .wallet-sub {
    display: inline; margin-top: 0;
  }
  .wallet-page .table.table-cards td[data-label=""] { justify-content: flex-end; }
  .wallet-page .table.table-cards td[data-label=""]::before { display: none; }
  .wallet-page .table.table-cards td:empty { display: none; }
  .wallet-page .table.table-cards td[colspan] { display: block; text-align: center; }
  .wallet-page .table.table-cards td[colspan]::before { display: none; }
  .wallet-page .table.table-cards .cell-actions::before { display: none; }
}

@media (max-width: 760px) {
  /* Keep job and invoice codes on one start-aligned line in phone record cards;
     the global first-cell block layout lets dir="ltr" pin the invoice left. */
  .wallet-page .table.table-cards td:first-child {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  }
  .wallet-page .table.table-cards td:first-child::before {
    display: block; flex: 0 0 100%; width: auto; margin-bottom: 1px;
  }
  .wallet-page .table.table-cards td:first-child .wallet-sub {
    display: inline; margin-top: 0;
  }
}

@media (max-width: 700px) {
  .wallet-actions { gap: 7px; }
  .wallet-actions .btn { flex: 1 1 44%; justify-content: center; }
  .wallet-actions .btn.primary { flex-basis: 100%; }
  .wallet-currency { padding: 16px; }
  .wc-body { display: block; margin-top: 10px; }
  .wc-total strong { font-size: 27px; }
  .wc-split {
    margin-top: 12px; padding-top: 12px; padding-inline-start: 0;
    border-inline-start: 0; border-top: 1px dashed var(--line);
  }
  .wallet-requests { grid-template-columns: 1fr; }
  .wr-amount { font-size: 20px; }
  .wr-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wallet-config-grid { grid-template-columns: minmax(0, 1fr); }
  .wallet-search { max-width: none; }
  .wallet-form-foot .btn { width: 100%; justify-content: center; }
  .wallet-kpi { padding: 13px; gap: 10px; border-radius: 13px; }
  .wallet-kpi-icon { width: 34px; height: 34px; border-radius: 10px; }
  .wallet-kpi-copy strong { font-size: 18px; }
  .wallet-kpi-extra > span { flex: 1 1 100%; }
  .wallet-hero { padding: 14px; }
  .wallet-hero-line strong { font-size: 19px; }
  .wallet-filterbar .wallet-search { flex: 1 1 100%; }
  .wallet-select { flex: 1 1 44%; max-width: none; min-width: 0; }
  .wallet-date { flex: 1 1 44%; }
  .wallet-date input { flex: 1; width: 100%; min-width: 0; }
  .wallet-filter-count { flex: 1 1 100%; }
  .wallet-breakdown > div { padding: 9px 11px; }
  .wallet-row-actions { width: 100%; }
  .wallet-row-actions .btn { flex: 1 1 44%; justify-content: center; }
  .wallet-outbox { padding: 12px; }
  .wallet-outbox-head .btn { flex: 1 1 100%; justify-content: center; }
  .wallet-outbox-time { margin-inline-start: 0; }
  .wallet-report-tabs { flex-wrap: wrap; overflow: visible; }
  .wallet-report-tab { height: 36px; padding: 0 12px; flex: 1 1 auto; justify-content: center; }
  .wallet-handover-line { grid-template-columns: minmax(0, 1fr) auto; }
  .wallet-handover-line input { grid-column: 1 / -1; height: 38px; text-align: start; }
}

@media (max-width: 560px) {
  .wallet-kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .wallet-date { flex: 1 1 100%; }
  .wallet-report-summary { gap: 6px; }
  .wallet-summary-chip { flex: 1 1 100%; justify-content: space-between; }
  .wallet-handover-lines { max-height: none; }
  .wallet-queue-grid { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  body:has(.wallet-receipt) * { visibility: hidden; }
  body:has(.wallet-receipt) .wallet-receipt,
  body:has(.wallet-receipt) .wallet-receipt * { visibility: visible; }
  .wallet-receipt { position: absolute; inset: 0; background: white; color: black; padding: 24px; }
  .wallet-receipt button { display: none; }

  body:has(.wallet-print) * { visibility: hidden; }
  body:has(.wallet-print) .wallet-print,
  body:has(.wallet-print) .wallet-print * { visibility: visible; }
  body:has(.wallet-print) .wallet-print {
    display: block; position: absolute; inset: 0;
    background: white; color: black; padding: 24px;
  }
  body:has(.wallet-print) .wallet-print .wallet-sub { color: #555; }
  body:has(.wallet-print) .wallet-print .badge { border: 1px solid #999; color: #000; background: #fff; }
  body:has(.wallet-print) .wallet-print .table th,
  body:has(.wallet-print) .wallet-print .table td { color: #000; border-color: #ccc; }
}
