/* UI refresh: offline, responsive and lightweight. Existing brand colours stay editable. */
:root {
  --bg: #f5f7fc;
  --bg-subtle: #f4f6fb;
  --surface-border: #e3e8f2;
  --text: #18233d;
  --text-muted: #5a6882;
  --radius-lg: 22px;
  --shadow-sm: 0 4px 20px rgba(24, 35, 61, .035);
  --sidebar-width: 268px;
  --gutter: 28px;
}
html[data-theme="dark"] { --bg: #0c1424; --bg-subtle: #19253a; --surface-border: #2c3b53; --text: #edf3ff; --text-muted: #b5c4dc; }
body { line-height: 1.6; }
body.public-page { background: var(--bg-elevated); }
h1, h2 { text-wrap: balance; }
.card, .stat, .record-card, .feature-card { box-shadow: var(--shadow-sm); }
.card-header { background: transparent; }
.card-header h2 { font-size: 1.08rem; letter-spacing: -.025em; }
.page-head { margin-bottom: 26px; align-items: center; }
.page-head h1 { font-size: clamp(1.65rem, 1.3rem + 1.1vw, 2.25rem); letter-spacing: -.045em; }
.page-head p { color: var(--text-muted); font-size: 13px; }
.page-head > .row-end { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border-radius: 11px; font-weight: 650; transition-duration: 150ms; }
.btn-ghost { box-shadow: 0 1px 2px rgba(12, 20, 36, .03); }
.btn:focus-visible { outline-offset: 3px; }
.btn-group { gap: 8px; }
.input, .select, .textarea { border-radius: 11px; border-color: var(--surface-border-strong); background-color: var(--bg-elevated); }
.input:hover:not(:disabled), .select:hover:not(:disabled), .textarea:hover:not(:disabled) { border-color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { background-color: var(--bg-elevated); }
.label { font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.field { min-width: 0; }
.help { line-height: 1.55; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv dd, .record-card dd, .balance-entry-copy { min-width: 0; overflow-wrap: anywhere; }
.table-wrap { overscroll-behavior-x: contain; scrollbar-width: thin; }
.table-wrap:focus-visible { outline-offset: 2px; }
.table thead th { background: var(--bg-subtle); color: var(--text-muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.table tbody td { padding-block: 17px; }
.table tbody tr:last-child td { border-bottom: 0; }
.money-cell { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.record-card { border-radius: 18px; }
.badge { border-radius: 8px; }
.empty-state { background: var(--bg-elevated); border-radius: 20px; }
.eyebrow, .topbar-eyebrow { font-size: 10px; line-height: 1.5; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; color: var(--text-faint); }
/* Balanced headers and public pages */
.site-header { background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; }
.site-header-inner { max-width: 1440px; gap: 20px; min-height: 80px; }
.site-nav { margin-inline: auto; }
.site-nav a { font-size: 12px; padding-inline: 10px; }
.brand-mark { border-radius: 14px; }
.brand-text strong { font-size: 14px; max-width: 205px; }
.brand-text span { font-size: 9px; letter-spacing: .13em; }
.header-actions { gap: 7px; }
.site-footer { border-top: 1px solid var(--surface-border); margin-top: 56px; background: var(--bg-subtle); }
.footer-links li { margin-bottom: 9px; }
.mobile-nav { box-shadow: 0 12px 22px rgba(12,20,36,.08); }
.mobile-nav .container > a { display: flex; align-items: center; gap: 12px; }
.mobile-account-card { border: 1px solid var(--surface-border); border-radius: 14px; padding: 14px; margin: 8px 0 12px; background: var(--bg-subtle); }
.mobile-account-card > span { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; overflow-wrap: anywhere; }
.mobile-account-card .balance-chip { display: flex !important; min-height: 56px !important; background: var(--bg-elevated) !important; }
.hero { position: relative; padding: 54px 44px 64px; }
.hero h1 { font-size: clamp(2.5rem, 1.6rem + 2.5vw, 4.3rem); letter-spacing: -.055em; line-height: 1.08; }
.hero-lead { font-size: 16px; line-height: 1.8; max-width: 56ch; }
.hero-grid { gap: 56px; align-items: center; }
.hero-trust { gap: 8px; }
.hero-overview { position: relative; padding: 26px; background: var(--bg-subtle); border-color: var(--surface-border); box-shadow: 0 16px 50px rgba(24,35,61,.065); }
.workspace-preview-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 24px; }
.workspace-preview-head .feature-icon { margin: 0; background: var(--brand-primary); color: #fff; }
.hero-overview > .card-header { margin: 0; padding: 0 0 16px; }
.hero-overview > .card-body { padding: 16px 0 0; }
.hero-overview .plan-benefits li { background: var(--bg-elevated); padding: 13px 14px; border: 1px solid var(--surface-border); border-radius: 11px; font-size: 13px; margin-bottom: 9px; }
.hero-overview .plan-benefits li:last-child { margin-bottom: 0; }
.section-head h2 { letter-spacing: -.04em; }
.plan-card { border-radius: 22px; }
.plan-card.is-featured { border-color: var(--brand-primary); }
/* A more compact admin workspace */
.admin-sidebar { background: var(--sidebar-bg); }
.admin-sidebar-head { padding: 22px 18px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.admin-sidebar-head .brand-text strong { max-width: 171px; }
.admin-sidebar-head .brand-text span { letter-spacing: .08em; }
.sidebar-search { padding: 15px 18px 0; flex: 0 0 auto; }
.sidebar-search .input { min-height: 40px; font-size: 12px; background: rgba(255,255,255,.07); color: var(--sidebar-text); border-color: var(--sidebar-line); }
.sidebar-search .input::placeholder { color: var(--sidebar-muted); }
.sidebar-search .input:focus { background: rgba(255,255,255,.1); }
.nav-group { padding-top: 20px; }
.nav-group-title { letter-spacing: .13em; font-size: 9px; padding-bottom: 8px; }
.nav-link { min-height: 42px; padding-block: 10px; font-size: 12px; margin-bottom: 3px; }
.nav-link.is-active { box-shadow: inset 3px 0 0 #a6c6ff; background: rgba(141,183,255,.13); }
.nav-filter-empty { margin: 20px; font-size: 13px; color: var(--sidebar-muted); }
.admin-sidebar-foot { padding: 16px 18px; }
.sidebar-identity { padding-top: 12px; font-size: 10px; }
.sidebar-identity strong { font-size: 11px; font-weight: 500; }
.admin-sidebar-foot .btn-group { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
.admin-sidebar-foot .btn { font-size: 11px; padding: 7px 6px; min-height: 35px; width: 100%; border-radius: 8px; }
.admin-topbar { padding: 16px 28px; background: var(--bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; flex-wrap: nowrap; }
.topbar-title { min-width: 0; }
.topbar-title strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-eyebrow { display: block; margin-bottom: 2px; font-size: 9px; }
.admin-topbar .topbar-search { width: clamp(160px, 22vw, 300px); flex: 0 1 300px; }
.admin-topbar .topbar-search .input { min-width: 0 !important; }
.admin-content { padding-top: 30px; }
.admin-content .card + .card { margin-top: 22px; }
.sidebar-close { display: none; font-size: 24px; background: rgba(255,255,255,.08); border-color: var(--sidebar-line); color: var(--sidebar-text); }
.sidebar-scrim { -webkit-backdrop-filter: none; backdrop-filter: none; }
.admin-shell.sidebar-open .admin-sidebar { animation: drawer-enter 170ms ease-out both; }
.stat-grid { gap: 16px; }
.stat { border-radius: 17px; padding: 22px; position: relative; }
.stat::before { width: 26px; height: 4px; margin-bottom: 17px; }
.stat-value { letter-spacing: -.045em; }
.stat-meta { font-size: 11px; }
.account-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--info-bg); border: 1px solid var(--surface-border); border-radius: 22px; padding: 26px; }
.account-welcome h2 { font-size: 1.3rem; margin-top: 8px; }
/* Peso balances: visible on every user account */
.balance-chip { display: inline-flex; gap: 10px; align-items: center; min-width: 0; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--bg-subtle); color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.balance-chip:hover { text-decoration: none; border-color: var(--surface-border-strong); background: var(--bg-inset); }
.balance-chip svg { flex: 0 0 auto; color: var(--link); }
.balance-chip span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.balance-chip small { font-size: 9px; color: var(--text-muted); }
.balance-chip strong { font-size: 13px; font-weight: 750; white-space: nowrap; }
.admin-sidebar-foot .balance-chip { display: flex; padding: 11px; background: rgba(255,255,255,.06); border-color: var(--sidebar-line); color: var(--sidebar-text); }
.admin-sidebar-foot .balance-chip small { color: var(--sidebar-muted); }
.admin-sidebar-foot .balance-chip svg { color: #aacaff; }
.balance-overview { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.balance-overview > div:first-child { min-width: 0; }
.balance-value { font-size: clamp(1.8rem, 1.35rem + 1.6vw, 2.75rem); line-height: 1.2; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; margin: 8px 0; }
.balance-symbol { font-size: 32px; line-height: 1; font-weight: 700; width: 62px; height: 62px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 19px; background: var(--info-bg); color: var(--link); }
.balance-adjust-form { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--surface-border); }
.balance-adjust-form > .row { align-items: center; }
.balance-adjust-form > .row .help { max-width: 38ch; flex: 1 1 180px; }
.balance-entry-list { list-style: none; padding: 0; margin: 0; }
.balance-entry { display: flex; align-items: flex-start; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--surface-border); }
.balance-entry:first-child { padding-top: 0; }
.balance-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.balance-entry-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 20px; flex: 0 0 auto; }
.balance-entry-icon.is-credit { color: var(--success); background: var(--success-bg); }
.balance-entry-icon.is-debit { color: var(--danger); background: var(--danger-bg); }
.balance-entry-copy { flex: 1 1 auto; }
.balance-entry-copy strong { display: block; font-size: 13px; margin-bottom: 3px; }
.balance-entry-copy span, .balance-entry-amount span { display: block; font-size: 11px; }
.balance-entry-amount { text-align: right; flex: 0 1 auto; max-width: 50%; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.balance-entry-amount strong { display: block; font-size: 13px; margin-bottom: 3px; }
.balance-empty { display: flex; align-items: center; flex-direction: column; gap: 8px; text-align: center; padding: 12px; }
.balance-empty svg { color: var(--text-faint); margin-bottom: 5px; }
/* Conversations use the full workspace and keep messages first on phones. */
.conversation-details summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 16px; font-weight: 700; list-style: none; }
.conversation-details summary::-webkit-details-marker { display: none; }
.conversation-details summary > span { transition: transform 150ms ease; color: var(--text-muted); }
.conversation-details[open] summary > span { transform: rotate(180deg); }
.conversation-details summary:focus-visible { outline: 3px solid var(--brand-primary); outline-offset: 5px; border-radius: 4px; }
.conversation-details-body { padding-top: 20px; }
.support-messages .card-header { gap: 8px; flex-wrap: wrap; }
.support-messages .card-header > .text-small { font-size: 11px; }
.support-messages .row-between { gap: 14px; flex-wrap: wrap; }
.support-messages .row-between > .text-small { flex: 1 1 180px; }
.support-messages .bubble { max-width: min(90%, 680px); }
.support-messages .bubble-meta strong { overflow-wrap: anywhere; }
.support-messages .bubble.from-customer { align-self: flex-end; background: var(--info-bg); border-radius: 16px 16px 5px 16px; }
.support-messages .bubble.from-staff { align-self: flex-start; background: var(--bg-subtle); border-radius: 16px 16px 16px 5px; }
.combo-item { overflow-wrap: anywhere; }
.combo-item.is-active { outline: 2px solid var(--brand-primary); outline-offset: -2px; }
.table-wrap { position: relative; }
@media (min-width: 1024px) {
  .support-shell { grid-template-columns: 260px minmax(0,1fr); }
}
@media (max-width: 1023px) {
  .support-shell > .support-messages { order: -1; }
  .support-shell > .context-panel { padding: 20px; }
}
@media (max-width: 767px) {
  .support-messages .thread { max-height: 40dvh; }
  .support-messages .row-between > .btn { width: 100%; }
  .support-messages .bubble { max-width: 95%; }
}
/* Sign-in presentation */
.auth-shell { padding: 42px 20px; min-height: 100dvh; display: grid; place-items: center; }
.auth-card { max-width: 480px; width: 100%; padding: 36px; border-radius: 24px; box-shadow: 0 18px 54px rgba(24,35,61,.06); }
.auth-card h1 { font-size: 1.9rem; }
.auth-brand-mark { margin: 0 auto 20px; width: 52px; height: 52px; border-radius: 17px; }
.auth-card > .text-center p { font-size: 13px; }
/* Short CSS-only effects. No animation loops or external libraries. */
@media (prefers-reduced-motion: no-preference) {
  .page-head, .account-welcome { animation: surface-enter 220ms ease-out both; }
  .mobile-nav.is-open { animation: surface-enter 140ms ease-out; }
  .modal-backdrop:not([hidden]) .modal { animation: surface-enter 160ms ease-out; }
  @media (hover: hover) and (pointer: fine) {
    .feature-card, .plan-card, .stat { transition: transform 150ms ease, border-color 150ms ease; }
    .feature-card:hover, .plan-card:hover { transform: translateY(-3px); border-color: var(--surface-border-strong); }
    .stat:hover { transform: translateY(-2px); }
    .btn-primary:hover, .btn-secondary:hover { transform: translateY(-1px); }
  }
}
@keyframes surface-enter { from { opacity: .6; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drawer-enter { from { transform: translateX(-18px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
@media (min-width: 1024px) and (max-width: 1439px) {
  .site-header-inner { flex-wrap: wrap; gap: 12px 20px; padding-block: 14px; }
  .site-header-inner .site-nav { order: 3; flex-basis: 100%; justify-content: center; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  .admin-topbar .topbar-search { flex-basis: 200px; }
  .admin-content .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1023px) {
  :root { --gutter: 22px; }
  .sidebar-close { display: inline-flex; }
  .admin-sidebar-head .brand-text strong { max-width: 130px; }
  .admin-topbar { min-height: 68px; padding: 12px var(--gutter); gap: 8px; flex-wrap: wrap; }
  .admin-topbar .topbar-title { display: block; flex: 1 1 100px; }
  .admin-topbar .topbar-search { display: flex; flex: 1 1 100%; width: 100%; order: 10; }
  .admin-topbar > .btn-icon { display: inline-flex; }
  .admin-topbar [data-theme-toggle] { margin-left: 0; }
  .admin-topbar .topbar-search .input { min-height: 42px; width: 100%; }
  .admin-content { padding-inline: var(--gutter); padding-top: 24px; }
  .admin-sidebar { width: min(88vw, 300px); }
  .admin-shell.sidebar-open .admin-sidebar { width: min(88vw, 300px); }
  .sidebar-search .input { font-size: 16px; }
  .admin-sidebar-foot .btn { min-height: 44px; }
  .nav-link { min-height: 44px; font-size: 13px; }
  .site-header .site-header-inner { min-height: 68px; gap: 10px; padding-block: 12px; }
  .site-header .brand-text strong { max-width: calc(100vw - 186px); }
  .site-header .mobile-nav { max-height: calc(100dvh - 166px); overscroll-behavior: contain; }
  .mobile-tabbar { border-radius: 20px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero-grid { gap: 32px; }
  .hero { padding: 32px 28px 42px; }
  .hero h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.3rem); }
}
@media (max-width: 767px) {
  :root { --gutter: 18px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0,1fr); }
  .card { border-radius: 18px; }
  .stat { padding: 18px; }
  .page-head { gap: 16px; }
  .page-head > .btn-group, .page-head > .row-end { flex: 1 1 100%; justify-content: flex-start; }
  .page-head .btn { white-space: normal; min-height: 44px; }
  .page-head .btn-group > .btn, .page-head > .row-end > .btn { flex: 1 1 130px; }
  .input, .select, .textarea { font-size: 16px; min-height: 48px; }
  .field .row > .input.flex-1 { flex-basis: 110px; }
  .card-body .grid { gap: 16px; }
  .account-welcome { padding: 22px; flex-wrap: wrap; gap: 16px; }
  .account-welcome > .balance-chip { width: 100%; background: var(--bg-elevated); min-height: 58px; }
  .hero { padding: 30px 20px; }
  .hero-overview { padding: 20px; }
  .hero-overview > .card-header { margin: 0; }
  .hero-lead { font-size: 15px; }
  .hero-actions .btn { width: 100%; }
  .hero-trust .badge { white-space: normal; }
  .site-footer { margin-top: 36px; }
  .auth-shell { padding: 24px 18px; }
  .auth-card { padding: 26px 22px; }
  .balance-symbol { width: 48px; height: 48px; font-size: 26px; border-radius: 14px; }
  .balance-adjust-form > .row .btn { width: 100%; }
  .balance-entry { gap: 9px; flex-wrap: wrap; }
  .balance-entry-copy { flex: 1 1 calc(100% - 46px); }
  .balance-entry-amount { max-width: 100%; margin-left: 43px; text-align: left; }
  .balance-overview .balance-value { font-size: clamp(1.65rem, 6vw, 2.4rem); }
  .table td .btn { min-height: 44px; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1 1 120px; white-space: normal; }
}
@media (max-width: 379px) {
  :root { --gutter: 14px; }
  .admin-topbar { gap: 6px; }
  .admin-topbar .topbar-title { flex-basis: 66px; }
  .topbar-title strong { font-size: 12px; }
  .topbar-eyebrow { font-size: 8px; }
  .admin-topbar > .btn-icon { width: 40px; min-width: 40px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
  .brand { gap: 8px; }
  .site-header .brand-text strong { max-width: calc(100vw - 164px); font-size: 12px; }
  .hero h1 { font-size: 2.15rem; }
  .badge { max-width: 100%; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .admin-shell.sidebar-open .admin-sidebar { animation: none; } }
@media print { .balance-chip, .sidebar-search, .sidebar-close { display: none !important; } .balance-panel { break-inside: avoid; } .balance-entry { break-inside: avoid; } }

/* Keep overview cards compact and remove unused gaps between groups. */
@media (min-width: 1024px) {
  .dashboard-content > .stat-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .dashboard-content > .grid-sidebar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-content > .grid-sidebar > .stack { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; gap: 16px; }
  .dashboard-content > .grid-sidebar > .stack > * { margin-top: 0; }
}
@media (max-width: 479px) {
  .hero > .hero-grid > .hero-overview > .card-header { margin: 0; padding: 0 0 16px; }
  .hero > .hero-grid > .hero-overview > .card-body { padding-top: 16px; }
}
