:root {
  --navy-900: #0B1633;
  --teal-100: #D7F5F0;
  --teal-300: #8DE3D8;
  --teal-500: #1DB9A6;
  --teal-600: #149F8F;
  --teal-700: #0E7B6F;
  --coral-100: #FFE3DC;
  --coral-500: #FF6A4D;
  --coral-600: #E5533A;
  --coral-700: #B93E2A;
  --sun-100: #FFF1CC;
  --sun-500: #FFC53D;
  --sun-800: #8A6410;
  --sky-100: #DBEEFF;
  --sky-700: #1F6FA8;
  --paper-0: #FFFFFF;
  --paper-50: #F7F5F0;
  --paper-100: #EEEBE3;
  --paper-200: #DDD9CF;
  --paper-300: #C6C1B5;
  --ink-600: #6B675F;
  --ink-800: #2B2A27;
  --ink-900: #17171A;

  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 24px; --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(11, 22, 51, .06), 0 4px 16px rgba(11, 22, 51, .06);
  --shadow-float: 0 8px 32px rgba(11, 22, 51, .10);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --display: 'Outfit', system-ui, sans-serif;
  --body: 'Nunito Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper-50); color: var(--ink-900); font: 400 16px/1.5 var(--body); }
p { margin: 0; }
a { color: var(--teal-700); }
img { display: block; max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.page { display: flex; flex-direction: column; gap: 48px; padding-bottom: 48px; }
.page.lifted { margin-top: -72px; position: relative; }
.page.narrow { max-width: 480px; padding-top: 40px; }
.page.admin { padding-top: 28px; gap: 28px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.block { display: block; }
.muted { color: var(--ink-600); font-size: 14px; }
.row-title { font-weight: 800; font-size: 16px; }
.row-between { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.h-hero { margin: 0; font: 800 44px/1.05 var(--display); letter-spacing: -.02em; }
.h-section { margin: 0; font: 800 28px/1.15 var(--display); letter-spacing: -.02em; }
.h-sub { margin: 0; font: 700 22px/1.2 var(--display); letter-spacing: -.01em; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; }

.hero {
  background:
    radial-gradient(55% 90% at 100% 0%, rgba(29, 185, 166, .38), rgba(29, 185, 166, 0) 70%),
    radial-gradient(45% 80% at 0% 100%, rgba(255, 106, 77, .30), rgba(255, 106, 77, 0) 70%),
    var(--navy-900);
  color: var(--paper-0);
  padding: 24px 0 120px;
}
.hero.compact { padding-bottom: 104px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-height: 44px; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.wordmark { font: 700 22px/1 var(--display); letter-spacing: -.02em; }
.wordmark span { color: var(--teal-500); }
.wordmark.small { font-size: 18px; }
.pill { padding: 4px 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .10); font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .86); }
.live-status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255, 255, 255, .78); }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 4px rgba(29, 185, 166, .25); }

.hero-body { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-end; justify-content: space-between; margin-top: 56px; }
.hero-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.overline { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: var(--teal-300); }
.hero-amount { font: 800 88px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-amount .peso { font-size: .55em; vertical-align: .45em; margin-right: 6px; color: rgba(255, 255, 255, .7); }
.hero-amount .cents { font-size: .55em; color: rgba(255, 255, 255, .78); }
.hero-amount.settled { font-size: 64px; }
.hero-lead { font-size: 18px; color: rgba(255, 255, 255, .86); max-width: 56ch; }

.ledger { flex: 1 1 320px; max-width: 400px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r-lg); padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.ledger-row { display: flex; justify-content: space-between; gap: 16px; }
.ledger-row span { color: rgba(255, 255, 255, .78); }
.ledger-rule { height: 1px; background: rgba(255, 255, 255, .16); }
.ledger-note { font-size: 13px; color: rgba(255, 255, 255, .7); }

.card { background: var(--paper-0); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card.raised { box-shadow: var(--shadow-float); }

.split { border-radius: var(--r-xl); padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.split-bar { display: flex; height: 20px; border-radius: var(--r-pill); overflow: hidden; gap: 3px; }
.split-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.legend-item { display: flex; gap: 12px; align-items: flex-start; }
.legend-name { font-weight: 700; }
.swatch { flex: none; width: 12px; height: 12px; border-radius: 4px; margin-top: 6px; }

.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.service-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; color: inherit; text-decoration: none; transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
.service-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); }
.service-card:active { transform: scale(.98); }
.service-head { display: flex; align-items: center; gap: 12px; }
.service-title { font-weight: 800; font-size: 17px; }
.service-purpose { font-size: 15px; line-height: 1.45; color: var(--ink-800); }
.service-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--paper-100); font-size: 14px; }
.balance { display: flex; flex-direction: column; gap: 8px; }
.balance-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; flex-wrap: wrap; }

.badge-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.badge-icon svg { width: 22px; height: 22px; }
.badge-icon.sm { width: 40px; height: 40px; }
.badge-icon.sm svg { width: 20px; height: 20px; }
.badge-icon.lg { width: 64px; height: 64px; }
.badge-icon.lg svg { width: 30px; height: 30px; }

.tag { flex: none; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; white-space: nowrap; }
.tag.paid { background: var(--teal-100); color: var(--teal-700); }
.tag.free { background: var(--sky-100); color: var(--sky-700); }
.tag.pending { background: var(--sun-100); color: var(--sun-800); }

.meter { height: 8px; border-radius: var(--r-pill); background: var(--paper-100); overflow: hidden; }
.meter-fill { height: 100%; background: var(--teal-500); border-radius: var(--r-pill); }
.meter-fill.low { background: var(--coral-500); }

.timeline { padding: 4px 24px; }
.timeline-row { display: flex; gap: 8px 20px; align-items: center; padding: 18px 0; flex-wrap: wrap; color: inherit; text-decoration: none; }
.timeline-row + .timeline-row { border-top: 1px solid var(--paper-100); }
.timeline-row .when { flex: none; width: 92px; font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--teal-700); }
.timeline-row .grow { flex: 1 1 260px; }
.timeline-row .amount { font: 700 18px/1.2 var(--display); }

.empty-card { background: var(--paper-0); border: 1.5px dashed var(--paper-300); border-radius: var(--r-lg); padding: 32px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.empty-card .muted { max-width: 44ch; font-size: 15px; }

.payment { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.payment-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.payment-amounts { text-align: right; }
.payment-amount { font: 800 22px/1.2 var(--display); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { border: 1px solid var(--paper-200); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; color: inherit; text-decoration: none; transition: border-color 200ms var(--ease-out); }
.tile:hover { border-color: var(--teal-500); }
.tile-preview { height: 120px; background: var(--paper-50); display: grid; place-items: center; color: var(--coral-700); overflow: hidden; }
.tile-preview img { width: 100%; height: 100%; object-fit: cover; }
.tile-preview svg { width: 36px; height: 36px; stroke-width: 1.6; }
.tile-name { padding: 10px 12px; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: rgba(255, 255, 255, .86); text-decoration: none; font-weight: 700; font-size: 15px; }
.back svg { width: 20px; height: 20px; }
.service-hero { display: flex; align-items: center; gap: 18px; margin-top: 28px; flex-wrap: wrap; }
.service-hero-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; color: rgba(255, 255, 255, .8); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.stat-label { font-size: 14px; font-weight: 700; color: var(--ink-600); }
.stat-value { font: 800 34px/1.1 var(--display); letter-spacing: -.02em; }
.live-note { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--teal-700); }
.live-note .dot { box-shadow: none; }

.two-col { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.col-main { flex: 999 1 520px; min-width: 0; }
.col-side { flex: 1 1 340px; min-width: 0; }
.about { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.fact-label { font-size: 13px; font-weight: 800; color: var(--ink-600); margin-bottom: 4px; }

.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-600); border-top: 1px solid var(--paper-200); padding-top: 20px; }
.foot p { max-width: 70ch; }
.foot a { color: var(--ink-600); }

.admin-bar { background: var(--navy-900); color: var(--paper-0); padding: 10px 0; }
.admin-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-email { font-size: 14px; color: rgba(255, 255, 255, .78); margin-right: 4px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.quick { padding: 16px; display: flex; flex-direction: column; gap: 4px; border-radius: 16px; }
.quick-value { font: 800 24px/1.2 var(--display); }
.quick.action .btn { margin-top: 6px; align-self: flex-start; }

.list { padding: 4px 20px; }
.admin-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; }
.admin-row + .admin-row { border-top: 1px solid var(--paper-100); }
.row-actions { display: flex; gap: 4px; flex: none; }
.empty { text-align: center; color: var(--ink-600); padding: 24px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: var(--r-sm); background: var(--paper-50); font-size: 13px; font-weight: 700; max-width: 100%; }
.chip a { color: var(--ink-800); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip a:hover { color: var(--teal-700); }
.chip button { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-600); display: grid; place-items: center; cursor: pointer; }
.chip button:hover { background: var(--coral-100); color: var(--coral-600); }
.chip button svg { width: 14px; height: 14px; }
.chip.add { padding: 6px 10px; border: 1px dashed var(--paper-300); background: var(--paper-0); color: var(--teal-700); cursor: pointer; }

.service-edit { display: block; }
.service-edit summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; min-height: 44px; }
.service-edit summary::-webkit-details-marker { display: none; }
.service-edit[open] summary { margin-bottom: 12px; }

.form { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; padding: 16px; border-radius: var(--r-md); background: var(--paper-50); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--ink-800); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
input, select, textarea { font: 400 16px/1.4 var(--body); color: var(--ink-900); background: var(--paper-0); border: 1px solid var(--paper-200); border-radius: var(--r-md); min-height: 44px; padding: 0 12px; width: 100%; }
textarea { padding: 10px 12px; min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border: 2px solid var(--teal-500); box-shadow: 0 0 0 4px rgba(29, 185, 166, .2); }
.joined { display: flex; border: 1px solid var(--paper-200); border-radius: var(--r-md); background: var(--paper-0); overflow: hidden; }
.joined:focus-within { border: 2px solid var(--teal-500); box-shadow: 0 0 0 4px rgba(29, 185, 166, .2); }
.joined select, .joined input { border: 0; border-radius: 0; box-shadow: none !important; }
.joined select { width: auto; flex: none; background: var(--paper-50); border-right: 1px solid var(--paper-200); font-weight: 700; font-size: 14px; }
.joined input { flex: 1; min-width: 0; }
.joined input:focus, .joined select:focus { border: 0; }
.prefix { display: grid; place-items: center; padding: 0 12px; background: var(--paper-50); border-right: 1px solid var(--paper-200); font-weight: 700; }

.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--paper-100); border-radius: var(--r-md); }
.segmented button { min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; font: 700 14px var(--body); color: var(--ink-600); cursor: pointer; transition: background 200ms var(--ease-out); }
.segmented button.on { background: var(--paper-0); color: var(--ink-900); font-weight: 800; box-shadow: 0 1px 2px rgba(11, 22, 51, .10); }

.dropzone { position: relative; border: 1.5px dashed var(--paper-300); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--paper-50); cursor: pointer; transition: border-color 200ms var(--ease-out), background 200ms var(--ease-out); }
.dropzone svg { width: 26px; height: 26px; color: var(--teal-700); }
.dropzone.over, .dropzone:hover { border-color: var(--teal-500); background: var(--teal-100); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-files { font-size: 13px; font-weight: 700; color: var(--teal-700); }
.dropzone-files:empty { display: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 800 15px/1 var(--body); min-height: 44px; padding: 0 18px; border-radius: var(--r-md); border: 0; cursor: pointer; text-decoration: none; transition: transform 200ms var(--ease-out), background 200ms var(--ease-out); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--teal-500); color: var(--paper-0); min-height: 48px; font-size: 16px; }
.btn.primary:hover { background: var(--teal-600); }
.btn.outline { background: var(--paper-0); border: 1px solid var(--paper-300); color: var(--teal-700); min-height: 40px; }
.btn.ghost { background: transparent; color: var(--teal-700); }
.btn.ghost-dark { background: rgba(255, 255, 255, .10); color: var(--paper-0); font-weight: 700; font-size: 14px; }
.btn.ghost-dark:hover { background: rgba(255, 255, 255, .18); }
.btn.link { background: transparent; color: var(--teal-700); min-height: 36px; padding: 0 10px; font-size: 14px; }
.btn.link.danger { color: var(--coral-600); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.notice { border-radius: var(--r-md); padding: 12px 16px; font-size: 14px; font-weight: 700; }
.notice.error { background: var(--coral-100); color: var(--coral-700); }
.notice.ok { background: var(--teal-100); color: var(--teal-700); }

.loader-card { padding: 40px 0; }
.loader { display: flex; justify-content: center; gap: 6px; }
.loader span { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); animation: dot 1s var(--ease-out) infinite; }
.loader span:nth-child(2) { animation-delay: .15s; background: var(--coral-500); }
.loader span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding-bottom: 96px; }
  .hero-body { margin-top: 32px; gap: 24px; }
  .hero-amount { font-size: 56px; }
  .hero-amount.settled { font-size: 44px; }
  .hero-lead { font-size: 16px; }
  .live-status { font-size: 13px; }
  .ledger { max-width: none; }
  .page { gap: 36px; }
  .h-hero { font-size: 34px; }
  .h-section { font-size: 24px; }
  .split { padding: 20px; }
  .service-grid { grid-template-columns: 1fr; }
  .timeline { padding: 4px 16px; }
  .timeline-row .when { width: auto; }
  .stat-value { font-size: 30px; }
  .admin-row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.ledger-sub { font-size: 13px; color: rgba(255, 255, 255, .6); margin-left: 4px; }
.ledger-note { margin-top: -8px; }
.tag.topup { background: var(--sky-100); color: var(--sky-700); vertical-align: 2px; margin-left: 4px; }
.split-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.split-amount { font: 800 32px/1.1 var(--display); letter-spacing: -.02em; }
.range { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-100); border-radius: var(--r-md); flex-wrap: wrap; }
.range button { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; font: 700 13px var(--body); color: var(--ink-600); cursor: pointer; }
.range button.on { background: var(--paper-0); color: var(--ink-900); font-weight: 800; box-shadow: 0 1px 2px rgba(11, 22, 51, .10); }
