/* ============================================================
   Orbitrix · Billing & Collections demo
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --line: #e6e9f2;
  --line-2: #d8dcea;
  --ink: #0d1430;
  --ink-2: #4a5272;
  --ink-3: #8a91ab;
  --brand: #4c5bff;
  --brand-2: #7b4dff;
  --brand-ink: #3240e6;
  --brand-soft: #eef0ff;
  --nav: #0b1230;
  --nav-2: #131b40;
  --nav-ink: #c9cdea;
  --good: #11875a;
  --good-soft: #e5f6ee;
  --warn: #b46a00;
  --warn-soft: #fff3df;
  --bad: #d23c3c;
  --bad-soft: #fde9e9;
  --info: #2a78d6;
  --info-soft: #e7f0fc;
  --violet-soft: #f1ecff;
  --age-current: #2a78d6;
  --age-30: #f6b48f;
  --age-60: #eb6834;
  --age-90: #c4491b;
  --age-90p: #8a2c0b;
  --sariwa: #1f6b45;
  --sariwa-2: #2f8f5e;
  --sariwa-soft: #e8f4ec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(13, 20, 48, .05), 0 1px 1px rgba(13, 20, 48, .03);
  --shadow-2: 0 8px 24px -8px rgba(13, 20, 48, .14), 0 2px 6px rgba(13, 20, 48, .05);
  --shadow-3: 0 30px 80px -20px rgba(13, 20, 48, .35), 0 10px 30px -10px rgba(13, 20, 48, .2);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-ink); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: radial-gradient(120% 60% at 0% 0%, #1a2460 0%, var(--nav) 55%);
  color: var(--nav-ink); display: flex; flex-direction: column; padding: 20px 14px; gap: 6px; z-index: 20;
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.logo-icon { height: 28px; width: 28px; object-fit: contain; display: block; }
.logo-slot {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  border: 1.5px dashed rgba(255, 255, 255, .45); color: rgba(255, 255, 255, .75);
  border-radius: 8px; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; line-height: 1.15; padding: 4px 8px;
}
.logo-slot.on-light { border-color: var(--line-2); color: var(--ink-3); }
.logo-slot.icon { height: 28px; width: 28px; padding: 0; font-size: 8px; }
.product-tag { font-size: 11px; color: #8f96c7; padding: 0 10px 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--nav-ink);
  font-weight: 500; border: 0; background: transparent; width: 100%; text-align: left; position: relative;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(124, 135, 255, .16); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--brand), var(--brand-2)); }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 6px; }
.nav-item.locked { color: #7d84b3; }
.nav-item.locked .lock { margin-left: auto; width: 14px; height: 14px; opacity: .6; }
.cta-card {
  margin-top: auto; border-radius: 14px; padding: 14px; background: linear-gradient(135deg, rgba(76, 91, 255, .35), rgba(123, 77, 255, .25));
  border: 1px solid rgba(255, 255, 255, .1); color: #fff;
}
.cta-card b { display: block; font-size: 13.5px; margin-bottom: 4px; }
.cta-card p { margin: 0 0 10px; font-size: 12px; color: #d4d8ff; }
.cta-card a { display: flex; justify-content: center; background: #fff; color: var(--nav); font-weight: 700; border-radius: 9px; padding: 8px 10px; font-size: 12.5px; transition: transform .2s var(--ease); }
.cta-card a:hover { transform: translateY(-1px); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  background: rgba(244, 246, 251, .82); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -.02em; font-weight: 750; }
.topbar .crumb { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.topbar .spacer { flex: 1; }
.mobile-brand { display: none; }

/* Demo clock */
.clock {
  display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: var(--shadow-1);
}
.clock .date { display: flex; flex-direction: column; padding: 2px 10px 2px 8px; min-width: 128px; }
.clock .date small { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--brand-ink); text-transform: uppercase; display: flex; align-items: center; gap: 5px; }
.clock .date small::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(76, 91, 255, .18); animation: pulse 2s infinite; }
.clock .date span { font-weight: 700; font-size: 13.5px; white-space: nowrap; display: inline-block; }
.clock .date span.flip { animation: flip .5s var(--ease); }
.clock button {
  border: 0; background: var(--surface-2); border-radius: 9px; padding: 8px 10px; font-weight: 650; font-size: 12.5px; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, transform .15s; white-space: nowrap;
}
.clock button:hover { background: var(--brand-soft); color: var(--brand-ink); }
.clock button:active { transform: scale(.96); }
.clock button.primary { background: var(--ink); color: #fff; }
.clock button.primary:hover { background: #1d2550; color: #fff; }
.clock button svg { width: 14px; height: 14px; }
.clock button:disabled { opacity: .55; cursor: default; }
.clock .reset { color: var(--ink-3); background: transparent; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(76, 91, 255, .18); } 50% { box-shadow: 0 0 0 6px rgba(76, 91, 255, .05); } }
@keyframes flip { 0% { transform: translateY(-60%); opacity: 0; } 100% { transform: none; opacity: 1; } }

.content { padding: 8px 28px 120px; max-width: 1320px; width: 100%; }
.view { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(6) { animation-delay: .2s; } .stagger > *:nth-child(7) { animation-delay: .24s; }
.stagger > *:nth-child(n+8) { animation-delay: .28s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; padding: 10px 16px; font-weight: 650;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s;
  white-space: nowrap; font-size: 13.5px; text-decoration: none;
}
.btn:hover { border-color: #c4c9dc; box-shadow: var(--shadow-1); }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -6px rgba(76, 91, 255, .7); }
.btn.primary:hover { box-shadow: 0 10px 24px -8px rgba(76, 91, 255, .8); transform: translateY(-1px); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); transition: background .15s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px 20px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card-h .sub { font-size: 12.5px; color: var(--ink-3); }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.section-gap { height: 16px; }

.kpi { position: relative; overflow: hidden; padding: 18px 20px 16px; }
.kpi .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.kpi .label i { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.kpi .label i svg { width: 15px; height: 15px; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .foot { font-size: 12px; color: var(--ink-3); }
.kpi.flash { animation: kpiFlash 1.2s var(--ease); }
@keyframes kpiFlash { 0% { box-shadow: 0 0 0 0 rgba(76, 91, 255, .0); } 25% { box-shadow: 0 0 0 4px rgba(76, 91, 255, .22); } 100% { box-shadow: var(--shadow-1); } }
.tone-brand i { background: var(--brand-soft); color: var(--brand-ink); }
.tone-good i { background: var(--good-soft); color: var(--good); }
.tone-info i { background: var(--info-soft); color: var(--info); }
.tone-bad i { background: var(--bad-soft); color: var(--bad); }

.hero-strip {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--radius); margin-bottom: 16px; color: #fff;
  background: radial-gradient(90% 140% at 100% 0%, rgba(123, 77, 255, .55), transparent 60%), linear-gradient(120deg, #111a47, #1b2668);
  box-shadow: var(--shadow-2); position: relative; overflow: hidden;
}
.hero-strip::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 14px); pointer-events: none; }
.hero-strip h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.hero-strip p { margin: 3px 0 0; color: #c4c9f2; font-size: 13px; }
.hero-strip .btn { position: relative; z-index: 1; }
.hero-strip .grow { flex: 1; position: relative; z-index: 1; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12px; font-weight: 650; white-space: nowrap; transition: background .4s, color .4s; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.paid { background: var(--good-soft); color: var(--good); }
.chip.unpaid { background: var(--info-soft); color: var(--info); }
.chip.partial { background: var(--warn-soft); color: var(--warn); }
.chip.overdue { background: var(--bad-soft); color: var(--bad); }
.chip.pop { animation: chipPop .7s var(--spring); }
@keyframes chipPop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.tag.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.tag.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.tag.violet { color: #5b3fd1; background: var(--violet-soft); border-color: transparent; }
.tag svg { width: 12px; height: 12px; }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .15s; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover { background: var(--surface-2); }
.t .r { text-align: right; }
.t .strong { font-weight: 700; }
.t tr.flash td { animation: rowFlash 1.6s var(--ease); }
@keyframes rowFlash { 0%, 30% { background: #eef0ff; } 100% { background: transparent; } }
.cust-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 750; font-size: 12px; flex: none; color: #fff; }
.cust-cell b { display: block; font-weight: 650; }
.cust-cell small { color: var(--ink-3); font-size: 12px; }
.zero { color: #c3c7d6; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); transition: background .2s, color .2s, box-shadow .2s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg button .n { color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; padding: 0 12px; height: 38px; min-width: 220px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.search svg { width: 16px; height: 16px; color: var(--ink-3); }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .grow small { color: var(--ink-3); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li.click { cursor: pointer; border-radius: 10px; transition: background .15s; }
.li.click:hover { background: var(--surface-2); }
.feed-ic { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.feed-ic svg { width: 16px; height: 16px; }
.feed-ic.payment { background: var(--good-soft); color: var(--good); }
.feed-ic.reminder { background: var(--violet-soft); color: #5b3fd1; }
.feed-ic.sent, .feed-ic.created { background: var(--info-soft); color: var(--info); }
.feed-ic.overdue { background: var(--bad-soft); color: var(--bad); }
.feed-ic.statement { background: var(--warn-soft); color: var(--warn); }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.good { color: var(--good); }
.amt.bad { color: var(--bad); }

/* ---------- Aging viz ---------- */
.aging-bar { display: flex; height: 16px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); margin: 6px 0 14px; }
.aging-bar > div { height: 100%; transition: flex-grow .8s var(--ease); min-width: 0; position: relative; cursor: default; }
.aging-bar > div:first-child { border-radius: 4px 0 0 4px; }
.aging-bar > div:last-child { border-radius: 0 4px 4px 0; }
.aging-bar > div:hover { filter: brightness(1.06); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.age-current { background: var(--age-current); } .age-b30 { background: var(--age-30); } .age-b60 { background: var(--age-60); }
.age-b90 { background: var(--age-90); } .age-b90p { background: var(--age-90p); }
.aging-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.aging-legend .it { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aging-legend .it span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.aging-legend .it b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aging-legend .it small { font-size: 11.5px; color: var(--ink-3); }
.bucket-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bucket-card { padding: 14px 16px; position: relative; overflow: hidden; }
.bucket-card::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--c); }
.bucket-card .l { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.bucket-card .v { font-size: 20px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.02em; white-space: nowrap; }
.bucket-card .s { font-size: 11.5px; color: var(--ink-3); }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #fff; border-radius: 9px; padding: 8px 10px; font-size: 12px;
  box-shadow: var(--shadow-2); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.tooltip.on { opacity: 1; }
.tooltip b { display: block; font-size: 13px; }

/* Cash-flow chart */
.cf-chart { position: relative; height: 230px; display: flex; align-items: flex-end; gap: 10px; padding: 10px 0 26px; border-bottom: 1px solid var(--line); }
.cf-chart .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--ink-3); }
.cf-chart .gl span { position: absolute; right: 0; top: -15px; background: var(--surface); padding-left: 4px; }
.cf-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; cursor: default; }
.cf-col .bar { width: min(34px, 70%); border-radius: 4px 4px 0 0; transition: height .8s var(--ease); min-height: 0; }
.cf-col .bar.collected { background: var(--info); }
.cf-col .bar.expected { background: repeating-linear-gradient(135deg, #9ec5f4 0 4px, #cde2fb 4px 8px); }
.cf-col .x { position: absolute; bottom: -22px; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.cf-col.now .x { color: var(--ink); font-weight: 700; }
.cf-col:hover .bar { filter: brightness(1.08); }
.cf-col .hit { position: absolute; inset: 0 -5px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); font-weight: 600; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw.collected { background: var(--info); }
.sw.expected { background: repeating-linear-gradient(135deg, #9ec5f4 0 3px, #cde2fb 3px 6px); }

.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.meter > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--good), #29b57c); transition: width .9s var(--ease); }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 35, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .25s var(--ease); }
.overlay.closing { animation: fadeOut .2s var(--ease) forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; animation: pop .38s var(--spring); position: relative; }
.modal.wide { width: min(880px, 100%); }
.overlay.closing .modal, .overlay.closing .drawer { animation: popOut .2s var(--ease) forwards; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes popOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-h h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 12px 22px 18px; }
.modal-f { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal-f .grow { flex: 1; }

.overlay.right { justify-content: flex-end; padding: 0; }
.drawer { background: var(--bg); width: min(540px, 100%); height: 100%; overflow: auto; box-shadow: var(--shadow-3); animation: slideIn .4s var(--ease); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-h { position: sticky; top: 0; z-index: 2; background: rgba(244, 246, 251, .9); backdrop-filter: blur(10px); padding: 18px 22px 14px; display: flex; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 18px; }
.drawer-b { padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 14px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label, .lbl { font-size: 12px; font-weight: 650; color: var(--ink-2); }
.input, select.input, textarea.input {
  border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; background: var(--surface); outline: 0; width: 100%;
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76, 91, 255, .15); }
textarea.input { resize: vertical; min-height: 60px; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.terms-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.terms-seg button { border: 1px solid var(--line-2); background: var(--surface); padding: 8px 12px; border-radius: 10px; font-weight: 650; font-size: 12.5px; transition: all .2s var(--ease); }
.terms-seg button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); box-shadow: 0 0 0 3px rgba(76, 91, 255, .12); }
.due-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-weight: 650; }
.due-pill b { color: var(--brand-ink); }
.due-pill.bump b { animation: flip .45s var(--ease); display: inline-block; }
.items { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 104px 104px 32px; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); animation: rise .3s var(--ease); }
.item-row.head { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; animation: none; }
.item-row .input { padding: 8px 9px; font-size: 13px; }
.item-row .amount { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-row .del { border: 0; background: transparent; color: var(--ink-3); border-radius: 8px; height: 30px; }
.item-row .del:hover { background: var(--bad-soft); color: var(--bad); }
.items-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--surface-2); gap: 8px; flex-wrap: wrap; }
.totals-box { margin-top: 14px; margin-left: auto; width: min(300px, 100%); display: flex; flex-direction: column; gap: 6px; }
.totals-box div { display: flex; justify-content: space-between; font-size: 13.5px; }
.totals-box .grand { font-size: 18px; font-weight: 800; padding-top: 8px; border-top: 1px solid var(--line); letter-spacing: -.02em; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; }
.switch input { display: none; }
.switch .tr { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .25s var(--ease); flex: none; }
.switch .tr::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .25s var(--spring); }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { transform: translateX(16px); }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 11px; font-weight: 600; font-size: 12.5px; cursor: pointer; transition: all .2s; user-select: none; }
.check input { accent-color: var(--brand); margin: 0; }
.check.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.err { color: var(--bad); font-size: 12px; font-weight: 600; min-height: 16px; }
.amount-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* Invoice detail */
.inv-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.inv-summary div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.inv-summary small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.inv-summary b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 2px; }
.tl { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.tl::before { content: ''; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .grow { flex: 1; min-width: 0; }
.tl .grow b { font-weight: 650; }
.tl .grow small { display: block; color: var(--ink-3); font-size: 12px; }
.bubble { margin-top: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 9px 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.tl.new { animation: rise .5s var(--ease); }

/* Reminders page */
.msg-card { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.msg-card:last-child { border-bottom: 0; }
.msg-card .grow { flex: 1; min-width: 0; }
.msg-card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.msg-card .meta b { font-weight: 650; }
.msg-card .bubble { max-width: 640px; }
.msg-card.new { animation: newMsg 1.2s var(--ease); }
@keyframes newMsg { 0% { background: var(--violet-soft); } 100% { background: transparent; } }
.rule { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule .grow { flex: 1; }
.rule .grow small { display: block; font-size: 12px; color: var(--ink-3); }
.dot-line { width: 30px; display: flex; justify-content: center; }
.tone-dot { width: 10px; height: 10px; border-radius: 50%; }
.tone-friendly { background: #1baf7a; } .tone-gentle { background: #eda100; } .tone-firm { background: #eb6834; } .tone-final { background: #d23c3c; }

/* Customer grid */
.cust-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cust-card { cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s; display: flex; flex-direction: column; gap: 12px; }
.cust-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.cust-card .stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.cust-card .stats small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.cust-card .stats b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Recurring */
.rec-card { display: flex; flex-direction: column; gap: 12px; }
.rec-card .top { display: flex; gap: 12px; align-items: flex-start; }
.rec-card .top .grow { flex: 1; min-width: 0; }
.rec-card .top b { font-size: 15px; }
.rec-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rec-meta div { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.rec-meta small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.rec-meta b { font-size: 13.5px; white-space: nowrap; }

/* Full version */
.fv { text-align: center; padding: 30px 26px 26px; }
.fv .ic { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-soft), var(--violet-soft)); color: var(--brand-ink); animation: pop .5s var(--spring); }
.fv .ic svg { width: 26px; height: 26px; }
.fv h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.fv p { margin: 0 auto 18px; color: var(--ink-2); max-width: 380px; }
.fv .badge { display: inline-block; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-ink); background: var(--brand-soft); border-radius: 99px; padding: 4px 10px; margin-bottom: 12px; }
.fv .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Toasts */
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; background: #0f1636; color: #fff; border-radius: 14px; padding: 12px 14px; width: min(380px, calc(100vw - 32px));
  box-shadow: var(--shadow-3); animation: toastIn .45s var(--spring); border: 1px solid rgba(255, 255, 255, .06);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .feed-ic { width: 30px; height: 30px; }
.toast .feed-ic.payment { background: rgba(17, 135, 90, .25); color: #6ee2b0; }
.toast .feed-ic.reminder { background: rgba(123, 77, 255, .28); color: #c8b8ff; }
.toast .feed-ic.overdue { background: rgba(210, 60, 60, .28); color: #ffaaaa; }
.toast .feed-ic.sent, .toast .feed-ic.created { background: rgba(42, 120, 214, .3); color: #a8cdfb; }
.toast .feed-ic.statement { background: rgba(180, 106, 0, .3); color: #ffd28a; }
.toast b { display: block; font-size: 13px; }
.toast small { display: block; color: #aeb4d6; font-size: 12px; margin-top: 2px; line-height: 1.4; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Fast-forward overlay */
.ff { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.ff-card { background: rgba(11, 18, 48, .92); color: #fff; border-radius: 22px; padding: 22px 30px; text-align: center; box-shadow: var(--shadow-3); animation: pop .35s var(--spring); min-width: 260px; }
.ff-card small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9aa3e6; font-weight: 700; }
.ff-card .d { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.ff-card .bar { height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .12); overflow: hidden; margin-top: 12px; }
.ff-card .bar div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); width: 0; transition: width .1s linear; }
.ff.out .ff-card { animation: popOut .25s var(--ease) forwards; }

/* ---------- Phone + customer invoice ---------- */
.phone-stage { display: flex; gap: 28px; align-items: center; justify-content: center; padding: 10px; }
.phone-side { max-width: 260px; color: #fff; }
.phone-side h3 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; }
.phone-side p { color: #c4c9f2; margin: 0 0 14px; font-size: 13.5px; }
.phone-side .btn { margin: 0 8px 8px 0; }
.phone {
  width: 360px; height: min(740px, calc(100vh - 60px)); border-radius: 46px; background: #0a0d1c; padding: 12px; position: relative; box-shadow: var(--shadow-3), inset 0 0 0 2px #23284a;
  animation: phoneIn .55s var(--spring); flex: none;
}
@keyframes phoneIn { from { opacity: 0; transform: translateY(30px) scale(.94) rotate(-1deg); } }
.phone .notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 110px; height: 30px; background: #000; border-radius: 20px; z-index: 5; }
.phone .screen { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: #f3f5f2; position: relative; }
.phone .screen-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.phone .screen-scroll::-webkit-scrollbar { display: none; }
.statusbar { display: flex; justify-content: space-between; padding: 16px 26px 6px; font-size: 13px; font-weight: 700; color: #fff; position: relative; z-index: 3; }
.lockscreen { position: absolute; inset: 0; background: radial-gradient(120% 70% at 30% 0%, #3a4aa8, #121842 60%); color: #fff; z-index: 4; display: flex; flex-direction: column; align-items: center; transition: opacity .5s var(--ease), transform .5s var(--ease); }
.lockscreen.gone { opacity: 0; transform: scale(1.06); pointer-events: none; }
.lockscreen .time { font-size: 64px; font-weight: 300; margin-top: 44px; letter-spacing: -.03em; }
.lockscreen .ld { font-size: 15px; opacity: .8; }
.notif { margin: 26px 12px 0; width: calc(100% - 24px); background: rgba(255, 255, 255, .88); color: #111; border-radius: 18px; padding: 12px 14px; text-align: left; animation: notifIn .6s .35s var(--spring) both; cursor: pointer; backdrop-filter: blur(10px); border: 0; display: block; }
@keyframes notifIn { from { opacity: 0; transform: translateY(-30px) scale(.95); } }
.notif .nh { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: #555; font-weight: 600; margin-bottom: 4px; }
.notif .nh i { width: 18px; height: 18px; border-radius: 5px; background: #7360f2; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-style: normal; font-size: 10px; }
.notif .nh i.sms { background: #33c759; }
.notif .nh i.email { background: #2a78d6; }
.notif .nh span { margin-left: auto; }
.notif b { display: block; font-size: 13.5px; }
.notif p { margin: 2px 0 0; font-size: 12.5px; color: #333; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.lockscreen .hint { margin-top: auto; margin-bottom: 26px; font-size: 12px; opacity: .7; }

/* Customer-facing invoice document */
.doc { background: #f3f5f2; color: #172119; min-height: 100%; font-size: 13.5px; position: relative; }
.doc-head { background: linear-gradient(150deg, var(--sariwa) 0%, #174f34 100%); color: #fff; padding: 52px 20px 64px; position: relative; overflow: hidden; }
.doc-head::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .12), transparent 70%); }
.doc.standalone .doc-head { padding-top: 22px; }
.biz { display: flex; gap: 10px; align-items: center; position: relative; z-index: 1; }
.mono { width: 40px; height: 40px; border-radius: 12px; background: #fff; color: var(--sariwa); font-weight: 850; display: flex; align-items: center; justify-content: center; font-size: 15px; letter-spacing: -.04em; flex: none; }
.biz b { display: block; font-size: 15px; letter-spacing: -.01em; }
.biz small { display: block; font-size: 11px; color: #cfe6d8; }
.demo-ribbon { margin: 14px 0 0; display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 214, 0, .95); color: #3a2c00; font-weight: 800; font-size: 10.5px; letter-spacing: .06em; padding: 4px 9px; border-radius: 6px; position: relative; z-index: 1; }
.doc-amount { position: relative; z-index: 1; margin-top: 16px; }
.doc-amount small { font-size: 12px; color: #cfe6d8; font-weight: 600; }
.doc-amount .big { font-size: 34px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.doc-amount .dd { font-size: 12.5px; color: #e7f3ec; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-amount .chip { background: rgba(255, 255, 255, .95); }
.doc-body { padding: 0 14px 20px; margin-top: -44px; position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; }
.paper { background: #fff; border-radius: 16px; box-shadow: 0 6px 20px -10px rgba(20, 40, 25, .25); padding: 16px; position: relative; overflow: hidden; }
.paper h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #6b7a70; }
.paper .wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 30px; font-weight: 900; color: rgba(31, 107, 69, .06); transform: rotate(-24deg); letter-spacing: .1em; white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
.kv span { color: #6b7a70; }
.kv b { text-align: right; font-weight: 650; }
.doc-items .di { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #e1e7e2; }
.doc-items .di:last-child { border-bottom: 0; }
.doc-items .di b { display: block; font-weight: 600; font-size: 13px; }
.doc-items .di small { color: #6b7a70; font-size: 11.5px; }
.doc-items .di .a { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-tot div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.doc-tot .g { font-weight: 800; font-size: 15.5px; border-top: 1px solid #e1e7e2; margin-top: 6px; padding-top: 9px; }
.doc-tot .bal { color: var(--sariwa); font-weight: 800; font-size: 16px; }
.pay-btns { display: flex; flex-direction: column; gap: 8px; }
.pay-btn { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid #e1e7e2; background: #fff; text-align: left; transition: transform .15s var(--ease), box-shadow .2s, border-color .2s; width: 100%; }
.pay-btn:hover { border-color: #b7cbbd; box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .3); }
.pay-btn:active { transform: scale(.98); }
.pay-btn .pl { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 850; font-size: 12px; flex: none; letter-spacing: -.02em; }
.pl.gcash { background: #0a5bd8; } .pl.maya { background: #0e9f6e; } .pl.bank { background: #3c4b5e; }
.pay-btn b { display: block; font-size: 13.5px; }
.pay-btn small { color: #6b7a70; font-size: 11.5px; }
.pay-btn .go { margin-left: auto; color: #9aa79f; }
.paid-stamp { text-align: center; padding: 18px 10px; }
.paid-stamp .ring { width: 64px; height: 64px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; animation: pop .6s var(--spring); }
.paid-stamp .ring svg { width: 30px; height: 30px; }
.paid-stamp b { font-size: 16px; display: block; }
.doc-foot { text-align: center; font-size: 11.5px; color: #6b7a70; padding: 6px 10px 24px; line-height: 1.6; }
.doc-foot a { color: var(--sariwa); font-weight: 700; }
.doc-foot .orb { display: inline-flex; align-items: center; gap: 6px; justify-content: center; margin-top: 4px; }
.doc-foot .orb img { height: 14px; }
.doc-hist .h { display: flex; justify-content: space-between; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed #e1e7e2; }
.doc-hist .h:last-child { border-bottom: 0; }

.sheet-wrap { position: absolute; inset: 0; z-index: 6; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet { background: #fff; width: 100%; border-radius: 22px 22px 0 0; padding: 10px 18px 22px; animation: sheetUp .4s var(--ease); max-height: 92%; overflow: auto; color: #172119; }
.sheet-wrap.fixed { position: fixed; z-index: 55; }
.sheet-wrap.fixed .sheet { max-width: 480px; margin: 0 auto; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: #d9ded9; margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet p { margin: 0 0 12px; color: #6b7a70; font-size: 12.5px; }
.sheet .opt { display: flex; align-items: center; gap: 10px; border: 1.5px solid #e1e7e2; border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; cursor: pointer; transition: border-color .2s, background .2s; }
.sheet .opt.on { border-color: var(--sariwa); background: var(--sariwa-soft); }
.sheet .opt input[type=radio] { accent-color: var(--sariwa); margin: 0; }
.sheet .opt .grow { flex: 1; }
.sheet .opt .input { padding: 7px 10px; }
.sheet .paybig { width: 100%; border: 0; border-radius: 13px; padding: 14px; font-weight: 750; color: #fff; font-size: 15px; margin-top: 6px; transition: transform .15s, filter .2s; }
.sheet .paybig:active { transform: scale(.98); }
.sheet .paybig.gcash { background: #0a5bd8; } .sheet .paybig.maya { background: #0e9f6e; } .sheet .paybig.bank { background: #3c4b5e; }
.sheet .bankbox { background: #f3f5f2; border-radius: 12px; padding: 12px; font-size: 12.5px; margin-bottom: 10px; }
.sheet .bankbox div { display: flex; justify-content: space-between; padding: 2px 0; gap: 10px; }
.spin { width: 52px; height: 52px; border-radius: 50%; border: 4px solid #e1e7e2; border-top-color: var(--sariwa); animation: spin .8s linear infinite; margin: 18px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.success { text-align: center; padding: 8px 0 4px; }
.success .ring { width: 70px; height: 70px; border-radius: 50%; background: var(--good); color: #fff; display: flex; align-items: center; justify-content: center; margin: 6px auto 12px; animation: pop .55s var(--spring); }
.success .ring svg { width: 34px; height: 34px; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .25s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success b { display: block; font-size: 18px; }
.success .ref { font-family: var(--mono); font-size: 12px; background: #f3f5f2; display: inline-block; padding: 4px 10px; border-radius: 8px; margin: 8px 0; }

/* Standalone customer page (#/view/…) */
.standalone-wrap { min-height: 100vh; background: #e6ebe7; display: flex; justify-content: center; }
.standalone-wrap .doc { width: min(480px, 100%); min-height: 100vh; box-shadow: 0 0 60px -20px rgba(0, 0, 0, .25); }
.standalone-bar { display: flex; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid #e1e7e2; align-items: center; font-size: 12px; }
.standalone-bar .grow { flex: 1; color: #6b7a70; }

/* Statement of account */
.soa { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.soa-head { padding: 22px 24px; background: linear-gradient(150deg, var(--sariwa), #174f34); color: #fff; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.soa-head .grow { flex: 1; min-width: 200px; }
.soa-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.soa-head small { color: #cfe6d8; }
.soa-head .demo-ribbon { margin-top: 10px; }
.soa-b { padding: 20px 24px; }
.soa-parties { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.soa-parties div { min-width: 0; }
.soa-parties small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; margin-bottom: 4px; }
.soa-parties b { display: block; }
.soa-total { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-top: 16px; flex-wrap: wrap; }
.soa-total .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }

/* Empty */
.empty { text-align: center; padding: 30px 10px; color: var(--ink-3); }
.empty svg { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }

/* Mobile bottom nav */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .bucket-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; background: rgba(11, 18, 48, .96); color: #fff; }
  .topbar h1 { font-size: 16px; color: #fff; }
  .topbar .crumb { display: none; }
  .topbar .title-wrap { order: 3; display: none; }
  .topbar .new-btn { padding: 8px 12px; font-size: 12.5px; }
  .clock { order: 4; width: 100%; justify-content: space-between; border-color: rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .06); color: #fff; box-shadow: none; }
  .clock .date { min-width: 0; }
  .clock .date small { color: #a9b1ff; }
  .clock button { background: rgba(255, 255, 255, .08); color: #e6e8ff; padding: 8px 9px; }
  .clock button.primary { background: #fff; color: var(--nav); }
  .clock .reset { background: transparent; color: #a9b1d6; }
  .clock .lbl-long { display: none; }
  .content { padding: 14px 16px 110px; }
  .page-title-m { display: block !important; margin: 4px 0 12px; font-size: 21px; letter-spacing: -.02em; font-weight: 800; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav button { flex: 1; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 650; color: var(--ink-3); padding: 6px 0; border-radius: 10px; position: relative; }
  .bottom-nav button svg { width: 21px; height: 21px; }
  .bottom-nav button.active { color: var(--brand-ink); }
  .bottom-nav .count { position: absolute; top: 2px; right: calc(50% - 20px); background: var(--bad); color: #fff; font-size: 9.5px; border-radius: 99px; padding: 0 5px; }
  #toast-root { left: 16px; right: 16px; bottom: 84px; align-items: stretch; }
  .toast { width: 100%; }
  .phone-side { display: none; }
  .overlay { padding: 12px; }
  .overlay.phone-ov { padding: 0; }
  .phone { width: 100%; height: 100%; border-radius: 0; padding: 0; box-shadow: none; }
  .phone .notch { display: none; }
  .phone .screen { border-radius: 0; }
  .modal { max-height: calc(100vh - 24px); }
}
@media (max-width: 640px) {
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 21px; }
  .kpi .label { font-size: 12px; }
  .kpi .label i { display: none; }
  .card { padding: 16px; border-radius: 14px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .hero-strip { flex-direction: column; align-items: flex-start; padding: 16px; }
  .aging-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bucket-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bucket-cards > :first-child { grid-column: span 2; }
  .row { grid-template-columns: 1fr; gap: 0; }
  .item-row { grid-template-columns: minmax(0, 1fr) 56px 84px 28px; }
  .item-row .amount { display: none; }
  .item-row.head .amount { display: none; }
  .inv-summary { grid-template-columns: 1fr 1fr; }
  .soa-parties { grid-template-columns: 1fr; }
  .soa-head, .soa-b { padding: 16px; }
  .search { min-width: 0; flex: 1; }
  .filters { flex-direction: column; align-items: stretch; }
  .seg { overflow-x: auto; flex-wrap: nowrap; }
  .seg button { white-space: nowrap; }
  .rec-meta { grid-template-columns: 1fr 1fr; }
  .modal-f { flex-wrap: wrap; }
  .modal-f .grow { flex-basis: 100%; }
  .modal-h, .modal-b, .modal-f { padding-left: 16px; padding-right: 16px; }
  .drawer-h, .drawer-b { padding-left: 16px; padding-right: 16px; }
  .hide-sm { display: none !important; }
  .cf-chart { gap: 4px; }
  .cf-col .x { font-size: 9.5px; }
}
.page-title-m { display: none; }

@media print {
  .sidebar, .topbar, .bottom-nav, #toast-root, .no-print, .standalone-bar { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
  .soa, .card { box-shadow: none; }
  .overlay { position: static; background: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Mid-width (tablet / small laptop): let the demo clock wrap under the title */
@media (min-width: 901px) and (max-width: 1180px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar .crumb { display: none; }
  .clock { margin-left: auto; }
}
.clock .date small { white-space: nowrap; }
.clock .lbl-short { display: none; }
@media (max-width: 900px) {
  .clock .lbl-short { display: inline; }
  .clock .date { padding-right: 4px; }
  .clock button[data-act="ff"] svg { display: none; }
}
@media (max-width: 640px) {
  .hero-strip { flex-direction: row; flex-wrap: wrap; gap: 10px; }
  .hero-strip .grow { flex-basis: 100%; }
  .hero-strip .btn { flex: 1; }
}
@media (max-width: 1180px) { .two { grid-template-columns: minmax(0, 1fr); } }
.card-h { flex-wrap: wrap; }
.bubble, .notif p { overflow-wrap: anywhere; }
.filters > * { min-width: 0; max-width: 100%; }
.msg-card .meta .muted:last-child { margin-left: 0; }
@media (min-width: 641px) { .msg-card .meta .muted:last-child { margin-left: auto; } }
@media (max-width: 900px) {
  .overlay.phone-ov .phone-stage { width: 100%; height: 100%; padding: 0; }
  .overlay.phone-ov .phone { animation: sheetUp .45s var(--ease); }
  .phone-close-m { display: flex !important; }
}
.phone-close-m { display: none; position: absolute; top: 12px; right: 12px; z-index: 8; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.phone-close-m svg { width: 18px; height: 18px; }
.logo-icon { border-radius: 9px; }
.brand-row .logo-icon { width: 36px; height: 36px; }
.doc-foot .orb .logo-icon { width: 16px; height: 16px; border-radius: 4px; }
.embedded .embed-hide { display: none !important; }
.topbar { top: env(safe-area-inset-top, 0px); }
