/* Clentavo web app. Tokens mirror clentavo_app/lib/core/theme (AppColors,
   Space, Radii, Motion) so the web and the app look the same. */

@font-face { font-family: 'PlusJakartaSans'; src: url('../assets/fonts/PlusJakartaSans-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'PlusJakartaSans'; src: url('../assets/fonts/PlusJakartaSans-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'PlusJakartaSans'; src: url('../assets/fonts/PlusJakartaSans-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'PlusJakartaSans'; src: url('../assets/fonts/PlusJakartaSans-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../assets/fonts/Inter-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

/* ------------------------------------------------------------ tokens */

:root {
  --primary: #0E9F6E;
  --on-primary: #FFFFFF;
  --primary-container: #D1FAE5;
  --on-primary-container: #064E3B;
  --secondary: #0B1B33;
  --on-secondary: #FFFFFF;
  --accent: #FF7A59;
  --accent-container: #FFE8E1;
  --bg: #F7F9FB;
  --surface: #FFFFFF;
  --surface-alt: #F1F5F9;
  --outline: #E2E8F0;
  --card-border: var(--outline);
  --text: #0F172A;
  --text-2: #64748B;
  --s-draft: #94A3B8;
  --s-sent: #3B82F6;
  --s-viewed: #8B5CF6;
  --s-partial: #F59E0B;
  --s-overdue: #EF4444;
  --s-paid: #10B981;
  --sk-base: #E9EEF3;
  --sk-hi: #F8FAFC;
  --tint-a: .12;
  --nav-pill: var(--primary-container);
  --nav-ink: var(--on-primary-container);
  --toast-bg: #0B1B33;
  --shadow-bar: 0 -4px 16px rgba(0,0,0,.04);
  --brand-gradient: linear-gradient(135deg, #0B1B33 0%, #0B3B3A 55%, #0E9F6E 100%);
  --hero-gradient: linear-gradient(135deg, #0E9F6E 0%, #0B7F68 50%, #0B1B33 100%);
  --accent-gradient: linear-gradient(135deg, #FF9F7F 0%, #FF7A59 50%, #F0567A 100%);
  --logo: url('../assets/brand/clentavo_logo_light.svg');

  --av-0: var(--primary); --av-1: var(--s-sent); --av-2: var(--s-viewed); --av-3: var(--accent);
  --av-4: var(--s-partial); --av-5: #14B8A6; --av-6: #EC4899; --av-7: #6366F1;

  /* Space, Radii */
  --sp-xxs: 4px; --sp-xs: 8px; --sp-sm: 12px; --sp-md: 16px; --sp-lg: 24px; --sp-xl: 32px; --sp-xxl: 48px;
  --screen: 20px;
  --r-card: 16px; --r-button: 14px; --r-input: 12px; --r-sheet: 28px; --r-pill: 999px;

  /* Motion */
  --micro: 120ms; --short: 200ms; --medium: 300ms; --long: 500ms;
  --ease-out: cubic-bezier(.33, 1, .68, 1);          /* easeOutCubic */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);       /* easeInOutCubic */
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);      /* easeOutBack */

  --head: 'PlusJakartaSans', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  color-scheme: light;
}

/* index.html and Theme resolve "system" to data-theme="light" | "dark". */
:root[data-theme="dark"] {
  --primary: #34D399;
  --on-primary: #071226;
  --primary-container: #064E3B;
  --on-primary-container: #D1FAE5;
  --secondary: #E2E8F0;
  --on-secondary: #0B1B33;
  --accent: #FF9479;
  --accent-container: #4A2318;
  --bg: #0B1220;
  --surface: #131C2E;
  --surface-alt: #1A2438;
  --outline: #26324A;
  --card-border: transparent;
  --text: #F1F5F9;
  --text-2: #94A3B8;
  --s-sent: #60A5FA;
  --s-viewed: #A78BFA;
  --s-partial: #FBBF24;
  --s-overdue: #F87171;
  --s-paid: #34D399;
  --sk-base: #1A2438;
  --sk-hi: #26324A;
  --tint-a: .18;
  --nav-pill: rgba(6, 78, 59, .5);
  --nav-ink: var(--primary);
  --toast-bg: #1A2438;
  --shadow-bar: 0 -4px 16px rgba(0,0,0,.3);
  --brand-gradient: linear-gradient(135deg, #071226 0%, #0B1B33 50%, #0B5E4C 100%);
  --hero-gradient: linear-gradient(135deg, #0E9F6E 0%, #0B6B5A 50%, #0B1B33 100%);
  --accent-gradient: linear-gradient(135deg, #FFA58A 0%, #FF9479 50%, #F0567A 100%);
  --logo: url('../assets/brand/clentavo_logo_dark.svg');
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--medium) var(--ease-in-out), color var(--medium);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal;
  font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
  user-select: none; flex: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* Type scale (AppTheme._text) */
.display-lg { font: 800 40px/1.1 var(--head); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.display-md { font: 800 32px/1.15 var(--head); letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.display-sm { font: 700 28px/1.2 var(--head); letter-spacing: -.6px; }
.headline-lg { font: 800 26px/1.2 var(--head); letter-spacing: -.6px; margin: 0; }
.headline-md { font: 700 24px/1.25 var(--head); letter-spacing: -.4px; margin: 0; }
.headline-sm, .title-lg { font: 700 20px/1.3 var(--head); letter-spacing: -.2px; margin: 0; }
.title-md { font: 600 17px/1.35 var(--head); letter-spacing: -.1px; margin: 0; }
.title-sm { font: 600 15px/1.35 var(--head); margin: 0; font-variant-numeric: tabular-nums; }
.body-lg { font: 400 16px/1.5 var(--body); }
.body-md { font: 400 15px/1.45 var(--body); }
.body-sm { font: 400 13px/1.4 var(--body); color: var(--text-2); margin: 0; }
.label-lg { font: 600 15px/1.2 var(--body); letter-spacing: .1px; }
.label-md { font: 500 13px/1.3 var(--body); color: var(--text-2); }
.label-sm { font: 600 11px/1.3 var(--body); color: var(--text-2); letter-spacing: .8px; text-transform: uppercase; }
.muted { color: var(--text-2); }
.strong { font-weight: 800; }
.num { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.center { text-align: center; }
.spacer { flex: 1; }
.c-paid { color: var(--s-paid); } .c-overdue { color: var(--s-overdue); } .c-accent { color: var(--accent); }

/* ------------------------------------------------------------ motion helpers */

@keyframes entry { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 100% { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-20%); } to { opacity: 1; transform: none; } }
@keyframes slideUpBar { from { transform: translateY(100%); } to { transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes shake { 0%,100% { transform: none; } 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
@keyframes pulseFade { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
@keyframes swing { 0%,100% { transform: rotate(0); } 20% { transform: rotate(22deg); } 50% { transform: rotate(-20deg); } 75% { transform: rotate(10deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes shine { from { background-position: -120% 0; } to { background-position: 220% 0; } }

.enter { animation: entry 420ms var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 12) * var(--stagger, 40ms) + var(--d, 0ms)); }
.pop { animation: pop 500ms var(--ease-back) both; animation-delay: var(--d, 0ms); }
.float { animation: float 3.2s ease-in-out infinite; }
.shake { animation: shake 360ms ease-in-out; }
.page-in { animation: pageIn 320ms var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateX(14px) scale(.995); } to { opacity: 1; transform: none; } }
.fade-through { animation: fadeThrough 300ms var(--ease-out) both; }
@keyframes fadeThrough { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.modal-in { animation: modalIn 380ms var(--ease-out) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* Pressable: scale on press */
.press { transition: transform var(--micro) ease-out, background-color var(--short), border-color var(--short), box-shadow var(--short); }
.press:active { transform: scale(.97); }

/* ------------------------------------------------------------ app frame */

#app { min-height: 100%; }

.shell { min-height: 100vh; min-height: 100dvh; display: flex; }
.shell__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: var(--sp-md) var(--screen) 130px;
}
.page--wide { max-width: 1180px; }
.page--flush { padding-left: 0; padding-right: 0; }
.page-head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.page-head .headline-lg { flex: 1; min-width: 0; }

/* Bottom navigation (mobile), HomeShell._BottomBar */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--outline);
  box-shadow: var(--shadow-bar);
  display: flex;
}
.bottombar__gap { width: 76px; flex: none; }
.navitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-2); min-width: 0;
}
.navitem__pill {
  width: 36px; height: 30px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  transition: width var(--medium) var(--ease-back), background-color var(--medium);
}
.navitem__label { font: 500 11.5px/1.2 var(--body); transition: color var(--short); }
.navitem.is-active .navitem__pill { width: 52px; background: var(--nav-pill); color: var(--nav-ink); }
.navitem.is-active .navitem__pill .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; animation: pop 300ms var(--ease-back); }
.navitem.is-active .navitem__label { color: var(--text); font-weight: 700; }

.fab {
  position: fixed; left: 50%; bottom: calc(68px / 2 + env(safe-area-inset-bottom) + 6px); z-index: 41;
  width: 62px; height: 62px; margin-left: -31px; border-radius: 50%;
  background: var(--hero-gradient); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform var(--micro);
}
.fab:active { transform: scale(.9); }
.fab .ms { font-size: 32px; transition: transform var(--medium) var(--ease-back); }
.fab.is-open .ms { transform: rotate(45deg); }

/* Sidebar (desktop) — same nav items as the bottom bar */
.sidebar { display: none; }

@media (min-width: 960px) {
  .bottombar, .fab { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    width: 256px; flex: none;
    padding: 22px 16px;
    background: var(--surface);
    border-right: 1px solid var(--outline);
  }
  .sidebar__logo { height: 30px; width: 117px; background: var(--logo) left center / contain no-repeat; margin: 2px 8px 22px; }
  .sidebar__new {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 52px; border-radius: var(--r-button); margin-bottom: 14px;
    background: var(--hero-gradient); color: #fff; font: 700 15px var(--head);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent);
  }
  .sidebar__new .ms { transition: transform var(--medium) var(--ease-back); }
  .sidebar__new.is-open .ms { transform: rotate(45deg); }
  .sidenav {
    display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 12px;
    border-radius: var(--r-pill); color: var(--text-2); font: 500 15px var(--body);
    transition: background-color var(--short), color var(--short);
  }
  .sidenav:hover { background: var(--surface-alt); color: var(--text); }
  .sidenav.is-active { background: var(--nav-pill); color: var(--nav-ink); font-weight: 700; }
  .sidenav.is-active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
  .sidenav .badge-count { margin-left: auto; }
  .sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
  .sidebar__user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-card); border: 1px solid var(--card-border); background: var(--surface-alt); }
  .page { padding: 28px 40px 80px; }
  .page--flush { padding-left: 0; padding-right: 0; }
}

/* Offline banner (OfflineBanner) */
.offline-banner {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 10px;
  background: var(--secondary); color: var(--bg);
  font: 400 13px/1.4 var(--body);
  animation: slideDown var(--medium) var(--ease-in-out);
  position: sticky; top: 0; z-index: 30;
}
.offline-banner .ms { font-size: 18px; }

/* App bar for detail screens */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  min-height: 60px; padding: 6px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.appbar__title { flex: 1; min-width: 0; font: 700 20px/1.3 var(--head); padding-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar--clear { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; color: #fff; position: absolute; left: 0; right: 0; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: inherit;
  transition: background-color var(--short), transform var(--micro);
}
.iconbtn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.iconbtn:active { transform: scale(.9); }
@media (min-width: 960px) {
  .appbar { padding: 14px 32px 6px; }
}
.detail-wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 4px var(--screen) 150px; }
@media (min-width: 960px) { .detail-wrap { padding: 8px 40px 120px; } }

/* Sticky bottom action bar (detail screens) */
.actionbar {
  position: sticky; bottom: 0; z-index: 25;
  padding: 12px var(--screen) calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--outline);
  display: flex; gap: 12px;
  animation: slideUpBar 400ms var(--ease-out) both;
  margin-top: auto;
}
.actionbar > * { min-width: 0; }
.actionbar .f2 { flex: 2; } .actionbar .f3 { flex: 3; }
@media (min-width: 960px) {
  .actionbar { justify-content: flex-end; padding: 14px 40px; }
  .actionbar .f2, .actionbar .f3 { flex: 0 0 auto; min-width: 200px; }
}

/* ------------------------------------------------------------ surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--r-card);
  padding: var(--sp-md);
}
.card--flush { padding: 0; overflow: hidden; }
.card--tap { cursor: pointer; transition: transform var(--micro), box-shadow var(--short), border-color var(--short); }
.card--tap:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--outline)); box-shadow: 0 6px 20px rgba(15, 23, 42, .05); }
.card--tap:active { transform: scale(.97); }
.divider { height: 1px; background: var(--outline); border: 0; margin: 0; }
.divider--inset { margin-left: 64px; }
.divider--inset68 { margin-left: 68px; }

.section-card__hd { display: flex; align-items: center; gap: 10px; margin-bottom: var(--sp-md); }
.section-card__icon { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; }
.section-card__icon .ms { font-size: 16px; }
.section-card__hd .title-md { flex: 1; }

.section-header { display: flex; align-items: center; padding: var(--sp-lg) 0 var(--sp-xs); }
.section-header .title-md { flex: 1; }

.stack > * + * { margin-top: var(--sp-md); }
.stack-10 > * + * { margin-top: 10px; }

/* Settings group / tile */
.sgroup__title { padding: var(--sp-lg) 4px var(--sp-xs); }
.stile {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px var(--sp-md); transition: background-color var(--short), transform var(--micro);
}
button.stile:hover, a.stile:hover { background: var(--surface-alt); }
button.stile:active, a.stile:active { transform: scale(.985); }
.stile__icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stile__icon .ms { font-size: 20px; }
.stile__chev { color: var(--text-2); }
.stile.is-danger .title-sm { color: var(--s-overdue); }

/* Tint helper — set --c on the element */
.tint { background: color-mix(in srgb, var(--c) calc(var(--tint-a) * 100%), transparent); color: var(--c); }
.tint-14 { background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 24px; border-radius: var(--r-button);
  font: 700 15px/1 var(--head); white-space: nowrap;
  transition: transform var(--micro), box-shadow var(--short), background-color var(--short), width var(--medium) var(--ease-in-out), border-radius var(--medium);
  overflow: hidden;
}
.btn:active { transform: scale(.97); }
.btn .ms { font-size: 20px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn--primary:hover { filter: brightness(1.04); }
.btn--gradient { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 30%, #14B8A6)); }
.btn--primary:disabled, .btn--primary[aria-disabled="true"] { background: var(--outline); color: var(--text-2); box-shadow: none; cursor: not-allowed; }
.btn--secondary { background: var(--surface); color: var(--text); border: 1.2px solid var(--outline); padding: 0 14px; }
.btn--secondary:hover { background: var(--surface-alt); }
.btn--danger { background: var(--s-overdue); color: #fff; }
.btn--sm { height: 44px; padding: 0 18px; font-size: 14px; }
.btn--text { height: 40px; padding: 0 12px; color: var(--primary); font: 700 15px var(--body); border-radius: var(--r-button); }
.btn--text:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.btn.is-loading { width: 56px !important; padding: 0; border-radius: 28px; flex: none !important; min-width: 0 !important; margin: 0 auto; }
.btn.is-loading > * { display: none; }
.btn.is-loading::after { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2.6px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

.tintbtn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--outline);
  display: grid; place-items: center; color: var(--text);
  transition: transform var(--micro), border-color var(--short);
}
.tintbtn:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--outline)); }
.tintbtn:active { transform: scale(.9); }
.tintbtn.is-primary { color: var(--primary); }
.tintbtn__dot { position: absolute; right: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pop 400ms var(--ease-back); }
.badge-count {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: #fff; font: 800 10px/20px var(--body); text-align: center;
  border: 2px solid var(--bg); line-height: 16px;
}
.tintbtn .badge-count { position: absolute; right: -4px; top: -4px; animation: pop 400ms var(--ease-back) 500ms both; }
.bell.is-ringing .ms { animation: swing 600ms ease-in-out 600ms; transform-origin: top center; }

/* ------------------------------------------------------------ fields */

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font: 600 13px/1.2 var(--body); color: var(--text); }
.field__hint { font: 400 12px/1.3 var(--body); color: var(--text-2); }
.field__error { font: 400 13px/1.4 var(--body); color: var(--s-overdue); }
.input, .select, .textarea {
  width: 100%; height: 56px; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-input);
  outline: 0; transition: border-color var(--short), box-shadow var(--short);
  font: 400 15px var(--body);
}
.textarea { height: auto; min-height: 96px; padding: 14px 16px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--text-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: inset 0 0 0 .6px var(--primary); }
.field.has-error .input { border-color: var(--s-overdue); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input.has-suffix { padding-right: 48px; }
.input-wrap .input.has-prefix { padding-left: 44px; }
.input-wrap__prefix { position: absolute; left: 14px; color: var(--text-2); pointer-events: none; }
.input-wrap__suffix { position: absolute; right: 6px; color: var(--text-2); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 22px) 26px, calc(100% - 16px) 26px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid-2.wrap { grid-template-columns: 1fr; } }

.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 16px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-pill);
  transition: border-color var(--short);
}
.search:focus-within { border-color: var(--primary); }
.search .ms { color: var(--text-2); font-size: 20px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; height: 100%; }
.search__clear { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); animation: pop 250ms var(--ease-back); }
.search__clear .ms { font-size: 18px; }

/* Switch */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch__track { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-alt); border: 2px solid var(--outline); transition: background-color var(--short), border-color var(--short); }
.switch__thumb { position: absolute; top: 8px; left: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: all var(--short) var(--ease-back); }
.switch input:checked ~ .switch__track { background: var(--primary); border-color: var(--primary); }
.switch input:checked ~ .switch__thumb { left: 24px; top: 4px; width: 24px; height: 24px; background: #fff; }

/* Segmented control (SegmentedTabs) */
.segmented { position: relative; display: flex; height: 46px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-alt); }
.segmented__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: var(--r-pill); background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.08); transition: transform var(--medium) var(--ease-back); }
.segmented button { position: relative; flex: 1; font: 500 15px var(--body); color: var(--text-2); transition: color var(--short); }
.segmented button.is-active { color: var(--text); font-weight: 700; }

/* Status tabs (InvoicesScreen._StatusTabs) */
.status-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px var(--screen) 10px; margin: 0 calc(var(--screen) * -1); animation: fadeIn 300ms both; }
.status-tabs::-webkit-scrollbar { display: none; }
.stab {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--outline);
  font: 500 15px var(--body); color: var(--text);
  transition: background-color var(--medium) var(--ease-in-out), color var(--short), box-shadow var(--medium), transform var(--micro);
}
.stab:active { transform: scale(.94); }
.stab__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.stab.is-active { background: var(--c); color: #fff; border-color: transparent; font-weight: 700; box-shadow: 0 4px 12px color-mix(in srgb, var(--c) 30%, transparent); }
.stab.is-active.is-all { color: var(--bg); }
.stab.is-active .stab__dot { display: none; }
@media (min-width: 960px) { .status-tabs { margin: 0; padding: 2px 0 10px; } }

/* Choice chip (ChoiceChipX) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--outline);
  font: 500 13px var(--body); color: var(--text); transform: scale(.97);
  transition: all var(--short) var(--ease-back);
}
.chip .ms { font-size: 16px; color: var(--text-2); }
.chip.is-active { --c: var(--primary); background: color-mix(in srgb, var(--c) calc(var(--tint-a) * 100%), transparent); border: 1.4px solid var(--c); color: var(--c); font-weight: 700; transform: scale(1); }
.chip.is-active .ms { color: var(--c); }
.input-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 10px; border-radius: 10px; border: 1px solid var(--outline); background: var(--surface); font: 500 13px var(--body); animation: pop 300ms var(--ease-back); }
.input-chip .ms { font-size: 14px; color: var(--primary); }
.input-chip button .ms { color: var(--text-2); font-size: 18px; }

/* ------------------------------------------------------------ avatars, pills */

.avatar {
  --size: 44px; width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 95%, transparent), color-mix(in srgb, var(--c) 82%, #000));
  color: #fff; font: 800 calc(var(--size) * .36)/1 var(--head); letter-spacing: -.3px;
}
.avatar.is-square { border-radius: calc(var(--size) * .3); }

.pill {
  --c: var(--s-draft);
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--c) calc(var(--tint-a) * 100%), transparent);
  color: var(--c); font: 700 12px/1.2 var(--body); letter-spacing: .2px; white-space: nowrap;
  transition: background-color var(--short), color var(--short);
}
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill .ms { font-size: 13px; }
.pill--dense { padding: 3px 8px; font-size: 11px; gap: 5px; }
.pill--dense .ms { font-size: 11px; }

.glass-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); color: #fff; font: 600 13px var(--body); min-width: 0; }
.glass-chip .ms { font-size: 14px; }

.pro-badge { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: var(--r-pill); background: var(--surface-alt); font: 800 13px var(--body); color: var(--text); flex: none; }
.pro-badge .ms { font-size: 16px; color: var(--accent); }
.pro-badge.is-pro { background: var(--accent-gradient); color: #fff; }
.pro-badge.is-pro .ms { color: #fff; }
.tag { display: inline-flex; padding: 3px 8px; border-radius: 6px; font: 800 10px/1.2 var(--body); letter-spacing: .6px; }
.tag--free { background: var(--primary-container); color: var(--on-primary-container); }
.tag--pro { background: var(--accent-gradient); color: #fff; }

/* ------------------------------------------------------------ dashboard */

.dash-head { display: flex; align-items: center; gap: 12px; padding: 0 0 var(--sp-md); animation: dashHead 350ms var(--ease-out) both; }
.biz-switch { display: flex; align-items: center; gap: 2px; max-width: 100%; margin-top: 2px; padding: 0; border-radius: 8px; text-align: left; }
.biz-switch:hover h1 { color: var(--primary); }
@keyframes dashHead { from { opacity: 0; transform: translateY(-20%); } to { opacity: 1; transform: none; } }

.hero {
  position: relative; overflow: hidden; display: block; width: 100%; text-align: left;
  padding: var(--sp-lg); border-radius: 24px; color: #fff;
  background: var(--hero-gradient);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 30%, transparent);
}
.hero__ring { position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; border: 18px solid rgba(255,255,255,.08); }
.hero__dot { position: absolute; right: 28px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: #FF7A59; }
.hero .w70 { color: rgba(255,255,255,.7); }
.hero__chips { display: flex; gap: 8px; margin-top: var(--sp-md); flex-wrap: wrap; }

.kpis { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding: 0 var(--screen) 4px; margin: var(--sp-md) calc(var(--screen) * -1) 0; }
.kpis::-webkit-scrollbar { display: none; }
.kpi { flex: none; width: 178px; height: 132px; padding: 14px; display: flex; flex-direction: column; text-align: left; }
.kpi__icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.kpi__icon .ms { font-size: 18px; }
.kpi__amount { font: 800 20px/1.3 var(--head); letter-spacing: -.2px; margin-top: auto; font-variant-numeric: tabular-nums; }

.probanner { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: var(--r-card); background: var(--accent-gradient); color: #fff; }
.probanner__icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }

.chart { position: relative; height: 200px; display: grid; grid-template-columns: 44px 1fr; }
.chart__y { position: relative; }
.chart__y span { position: absolute; right: 8px; transform: translateY(50%); font: 600 10px var(--body); color: var(--text-2); }
.chart__plot { position: relative; border-bottom: 0; }
.chart__grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--outline); }
.chart__bars { position: absolute; inset: 0 0 26px 0; display: flex; justify-content: space-around; align-items: flex-end; }
.chart__group { position: relative; display: flex; gap: 4px; align-items: flex-end; height: 100%; cursor: pointer; padding: 0 6px; }
.chart__bar { width: 12px; border-radius: 6px; height: 0; transition: height 900ms var(--ease-out); }
.chart__bar--inv { background: var(--primary-container); }
.chart__bar--paid { background: linear-gradient(to top, var(--primary), color-mix(in srgb, var(--primary) 75%, var(--accent))); }
.chart__x { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; display: flex; justify-content: space-around; }
.chart__x span { font: 600 11px var(--body); color: var(--text-2); width: 40px; text-align: center; }
.chart__x span.is-active { color: var(--text); }
.chart__tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--secondary); color: var(--bg); border-radius: 10px; padding: 6px 10px; font: 700 12px/1.35 var(--body); white-space: nowrap; text-align: center; pointer-events: none; animation: pop 200ms var(--ease-back); z-index: 2; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.act { display: flex; align-items: center; gap: 12px; padding: 12px var(--sp-md); width: 100%; text-align: left; transition: background-color var(--short); }
a.act:hover, button.act:hover { background: var(--surface-alt); }
.act__icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.act__icon .ms { font-size: 18px; }

@media (min-width: 960px) {
  .dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .dash-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: stretch; }
  .dash-top .hero { height: 100%; }
  .kpis { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; margin: 0; padding: 0; }
  .kpi { width: auto; height: 120px; }
  .dash-grid .section-header { padding-top: 0; }
}

/* ------------------------------------------------------------ lists */

.list > * + * { margin-top: 10px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 14px; width: 100%; text-align: left; }
.doc-row__amt { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.list-footer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: var(--sp-lg) 0; }
.list-footer i { width: 24px; height: 1px; background: var(--outline); }
.sync-icon { color: var(--s-partial); font-size: 16px; animation: pulseFade 1.8s ease-in-out infinite; }

@media (min-width: 960px) {
  .list--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .list--grid > * + * { margin-top: 0; }
}

/* Client row swipe reveal on hover (desktop stand-in for swipe actions) */
.client-row { position: relative; }
.client-row__actions { display: none; }
@media (hover: hover) {
  .client-row__actions { position: absolute; right: 120px; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; opacity: 0; transition: opacity var(--short); }
  .client-row:hover .client-row__actions { opacity: 1; }
  .client-row__actions button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-alt); color: var(--text-2); }
  .client-row__actions button:hover { color: var(--primary); }
}

/* Skeleton */
.sk { background: linear-gradient(90deg, var(--sk-base) 0, var(--sk-hi) 40%, var(--sk-base) 80%); background-size: 800px 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
.sk--circle { border-radius: 50%; }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--surface); border-radius: var(--r-card); }

/* Empty / error */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-xl); margin: auto; max-width: 420px; }
.empty__illo { height: 180px; animation: scaleIn 600ms var(--ease-back) both; }
.empty__illo img { height: 100%; width: auto; }
.empty--compact .empty__illo { height: 130px; }
.empty .headline-sm { margin-top: var(--sp-lg); }
.empty .body-md { color: var(--text-2); margin: var(--sp-xs) 0 0; }
.empty .btn { margin-top: var(--sp-lg); }

/* ------------------------------------------------------------ detail */

.doc-hero { position: relative; overflow: hidden; padding: var(--sp-lg); border-radius: 24px; color: #fff; transition: background var(--long); }
.doc-hero__status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); background: rgba(255,255,255,.18); font: 700 13px var(--body); }
.doc-hero__status .ms { font-size: 14px; }
.doc-hero .w70 { color: rgba(255,255,255,.7); }
.progress { height: 8px; border-radius: 8px; background: var(--surface-alt); overflow: hidden; }
.progress--light { background: rgba(255,255,255,.2); }
.progress > i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--s-paid)); transition: width 900ms var(--ease-out); }
.progress--light > i { background: linear-gradient(90deg, #fff, rgba(255,255,255,.7)); }

.line-row { display: flex; align-items: flex-start; gap: 12px; }
.totals-row { display: flex; align-items: baseline; padding: 3px 0; }
.totals-row > :first-child { flex: 1; }

.timeline__item { display: flex; gap: 10px; }
.timeline__rail { width: 24px; display: flex; flex-direction: column; align-items: center; flex: none; }
.timeline__dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 40%, transparent); }
.timeline__line { flex: 1; width: 2px; background: var(--outline); }
.timeline__body { padding-bottom: 16px; }

.menu {
  position: absolute; z-index: 60; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-card);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  animation: scaleIn 160ms var(--ease-out) both; transform-origin: top right;
}
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 10px; text-align: left; }
.menu button:hover { background: var(--surface-alt); }
.menu button .ms { font-size: 20px; }
.menu button.is-danger { color: var(--s-overdue); }
.menu button .check { margin-left: auto; color: var(--primary); }

/* Client detail header */
.client-hero { position: relative; overflow: hidden; height: 260px; background: var(--brand-gradient); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 24px; text-align: center; }
.client-hero__ring { position: absolute; right: -40px; top: -20px; width: 200px; height: 200px; border-radius: 50%; border: 24px solid rgba(255,255,255,.12); }
.client-hero .avatar { animation: scaleIn 450ms var(--ease-back) both; box-shadow: 0 0 0 4px rgba(255,255,255,.14); }
@media (min-width: 960px) { .client-hero { border-radius: 24px; margin: 8px 40px 0; height: 240px; } }
.totals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.totals-grid .card { padding: 12px; }
.contact-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.contact-actions button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; }
.contact-actions .ms { color: var(--primary); }
.info-row { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0; }
.info-row .ms { color: var(--text-2); font-size: 20px; }

/* ------------------------------------------------------------ form */

.form-total { position: sticky; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--outline); padding: 12px var(--screen) calc(12px + env(safe-area-inset-bottom)); }
.form-total__amt { font: 800 22px/1.2 var(--head); white-space: nowrap; font-variant-numeric: tabular-nums; transition: color var(--short); }
.form-total__amt.bump { animation: bump 300ms var(--ease-back); }
@keyframes bump { 50% { transform: scale(1.06); color: var(--primary); } }
@media (min-width: 960px) { .form-total { padding: 14px 40px; } }
@media (max-width: 479px) { .btn.icon-sm { width: 52px; padding: 0; flex: none; } .btn.icon-sm span:not(.ms) { display: none; } }

.edit-line { border: 1px solid var(--outline); border-radius: var(--r-input); padding: 12px; background: var(--bg); animation: lineOpen 360ms var(--ease-out) both; }
@keyframes lineOpen { from { opacity: 0; transform: translateY(-6px); max-height: 0; } to { opacity: 1; transform: none; max-height: 300px; } }
.edit-line .input { height: 46px; background: var(--surface); }
.edit-line__grid { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 8px; align-items: center; margin-top: 8px; }
.edit-line__grid .select { grid-column: 1 / -1; }
/* A milestone shows its date where the quantity would be. */
.edit-line__grid:has([data-lf="dueOn"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) 150px; }
@media (min-width: 560px) {
  .edit-line__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 84px; }
  .edit-line__grid:has([data-lf="dueOn"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 150px; }
  .edit-line__grid .select { grid-column: auto; }
}
/* Add milestones sheet */
.ms-row { border: 1px solid var(--outline); border-radius: var(--r-input); padding: 10px; background: var(--bg); animation: lineOpen 360ms var(--ease-out) both; }
.ms-row .input { height: 46px; background: var(--surface); }
.ms-row__n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--head); color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
/* Send sheet: share straight to an app */
.share-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.share-row button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; border-radius: 14px; transition: transform var(--short); }
.share-row button:active { transform: scale(.94); }
.share-row__ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.adj-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-input); background: var(--surface-alt); }
.client-pick { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.4px dashed var(--outline); border-radius: var(--r-card); width: 100%; text-align: left; transition: border-color var(--short); }
.client-pick:hover { border-color: var(--primary); }

/* ------------------------------------------------------------ sheets, dialogs, toast */

.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); animation: fadeIn var(--medium) both; display: flex; align-items: flex-end; justify-content: center; }
.scrim.is-closing { animation: fadeIn var(--medium) reverse both; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 0 var(--screen) calc(var(--sp-lg) + env(safe-area-inset-bottom));
  animation: sheetUp 380ms var(--ease-out) both;
}
.scrim.is-closing .sheet { animation: sheetUp var(--medium) var(--ease-in-out) reverse both; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet__handle { width: 32px; height: 4px; border-radius: 2px; background: var(--outline); margin: 12px auto 18px; }
.sheet__title { font: 700 20px/1.3 var(--head); margin: 0 0 var(--sp-md); }
@media (min-width: 960px) {
  .scrim { align-items: center; }
  .sheet { max-width: 520px; border-radius: 24px; padding-top: 24px; animation: dialogIn 320ms var(--ease-back) both; }
  .scrim.is-closing .sheet { animation: dialogIn 200ms ease-in reverse both; }
  .sheet__handle { display: none; }
}
@keyframes dialogIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

.dialog-scrim { align-items: center; padding: 24px; }
.dialog { width: 100%; max-width: 380px; background: var(--surface); border-radius: 24px; padding: 24px; animation: dialogIn 300ms var(--ease-back) both; }
.dialog p { color: var(--text-2); margin: 12px 0 20px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

.qa { --c: var(--primary); display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px; border-radius: var(--r-card); background: color-mix(in srgb, var(--c) 7%, transparent); border: 1px solid color-mix(in srgb, var(--c) 18%, transparent); }
:root[data-theme="dark"] .qa { background: color-mix(in srgb, var(--c) 14%, transparent); }
.qa:hover { border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.qa__icon { width: 46px; height: 46px; border-radius: 14px; background: var(--c); color: #fff; display: grid; place-items: center; flex: none; }

.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: 280px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px; padding: 14px 16px; border-radius: var(--r-button); background: var(--toast-bg); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: toastIn 320ms var(--ease-out) both; }
.toast.is-out { animation: toastIn 220ms ease-in reverse both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.toast .ms { animation: pop 500ms cubic-bezier(.5, 1.8, .5, .8); }
.toast__action { color: var(--primary); font-weight: 700; padding: 4px 8px; }

/* ------------------------------------------------------------ keypad (record payment) */

.amount-display { text-align: center; font: 800 40px/1.1 var(--head); letter-spacing: -1px; padding: 8px 0 4px; font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.keypad button { height: 54px; border-radius: 14px; background: var(--surface-alt); font: 700 22px var(--head); transition: transform var(--micro), background-color var(--short); }
.keypad button:active { transform: scale(.94); background: var(--outline); }

/* ------------------------------------------------------------ auth */

.auth { min-height: 100vh; min-height: 100dvh; display: flex; }
.auth__aside { display: none; }
.auth__main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.auth__inner { width: 100%; max-width: 460px; margin: 0 auto; padding: 12px var(--screen) 32px; flex: 1; display: flex; flex-direction: column; }
@media (min-width: 960px) {
  .auth__aside {
    display: flex; flex-direction: column; justify-content: space-between;
    width: 46%; max-width: 640px; padding: 40px 48px; color: #fff;
    background: var(--brand-gradient); position: relative; overflow: hidden;
  }
  .auth__aside .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .45; animation: drift 14s ease-in-out infinite alternate; }
  .auth__inner { justify-content: center; padding-top: 40px; }
}
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, -30px) scale(1.15); } }
.social { display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border-radius: var(--r-button); border: 1.2px solid var(--outline); background: var(--surface); font: 600 15px var(--body); width: 100%; transition: background-color var(--short), transform var(--micro); }
.social:hover { background: var(--surface-alt); }
.social:active { transform: scale(.97); }
/* Google's official button replaces ours once loaded (centred; Google caps it at 400 px). */
.gsi-wrap { display: flex; justify-content: center; align-items: center; min-height: 54px; }
.gsi-wrap.is-ready > .social { display: none; }
.gsi-wrap.is-busy { opacity: .5; pointer-events: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-2); font: 400 13px var(--body); margin: 20px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--outline); }
.code-boxes { display: flex; gap: 10px; justify-content: center; }
.code-boxes input { width: 48px; height: 58px; text-align: center; font: 800 24px var(--head); border-radius: var(--r-input); border: 1px solid var(--outline); background: var(--surface); outline: 0; transition: border-color var(--short), transform var(--micro); }
.code-boxes input:focus { border-color: var(--primary); transform: translateY(-2px); }
.code-boxes input.filled { border-color: color-mix(in srgb, var(--primary) 60%, var(--outline)); }

.welcome { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.welcome__tint { position: absolute; top: -120px; left: -80px; right: -80px; height: 62%; transition: background var(--long); pointer-events: none; }
.welcome__track { flex: 1; display: flex; transition: transform 500ms var(--ease-in-out); }
.welcome__slide { flex: 0 0 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 var(--sp-xl); text-align: center; }
.welcome__slide img { height: min(44vh, 360px); width: auto; transition: transform 500ms var(--ease-in-out), opacity 500ms; }
.welcome__slide:not(.is-active) img { opacity: 0; transform: scale(.85); }
.welcome__slide .headline-lg { margin-top: 28px; }
.welcome__slide p { color: var(--text-2); max-width: 360px; margin: 12px 0 0; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 24px 0; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: var(--outline); transition: width var(--medium) var(--ease-back), background-color var(--medium); }
.dots i.is-active { width: 28px; background: var(--primary); }

.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--brand-gradient); overflow: hidden; transition: opacity 400ms; }
.splash.is-out { opacity: 0; pointer-events: none; }
.splash .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: drift 6s ease-in-out infinite alternate; }
.splash svg { width: 120px; height: 120px; position: relative; }
.splash .arc { stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw 700ms var(--ease-out) 200ms forwards; }
.splash .dot-a { transform-origin: 24px 67px; animation: pop 400ms var(--ease-back) both; }
.splash .dot-b { transform-origin: 76px 33px; animation: pop 500ms var(--ease-back) 850ms both; }
.splash .ripple { transform-origin: 76px 33px; animation: ripple 900ms ease-out 950ms both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ripple { from { opacity: .6; transform: scale(1); } to { opacity: 0; transform: scale(3); } }

/* Onboarding */
.ob-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ob-progress i { height: 6px; border-radius: 3px; background: var(--outline); overflow: hidden; position: relative; }
.ob-progress i::after { content: ''; position: absolute; inset: 0; background: var(--primary); transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--ease-back); }
.ob-progress i.is-done::after { transform: scaleX(1); }
.ob-step { animation: pageIn 320ms var(--ease-out) both; }
.preview-head { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--card-border); border-top: 4px solid var(--brand, var(--primary)); }
.preview-head__logo { width: 42px; height: 42px; border-radius: 11px; background: var(--brand, var(--primary)); color: #fff; display: grid; place-items: center; font: 800 15px var(--head); animation: logoDrop 600ms var(--ease-back) both; }
@keyframes logoDrop { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--outline); transition: transform var(--short) var(--ease-back), box-shadow var(--short); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--c); transform: scale(1.08); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; border: 1.4px dashed var(--outline); border-radius: var(--r-card); text-align: center; cursor: pointer; transition: border-color var(--short); }
.drop:hover { border-color: var(--primary); }

/* ------------------------------------------------------------ paywall */

.paywall { min-height: 100vh; min-height: 100dvh; background: var(--brand-gradient); color: #fff; position: relative; overflow: hidden; }
.paywall__inner { position: relative; max-width: 520px; margin: 0 auto; padding: 12px var(--screen) 40px; }
.paywall .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35; animation: drift 10s ease-in-out infinite alternate; }
.benefit { display: flex; gap: 14px; align-items: flex-start; }
.benefit__icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex: none; }
.benefit__icon .ms { color: #34D399; }
.paywall .w70 { color: rgba(255,255,255,.7); }
.price-toggle { display: flex; padding: 4px; border-radius: var(--r-pill); background: rgba(255,255,255,.1); position: relative; }
.price-toggle button { flex: 1; height: 40px; border-radius: var(--r-pill); color: rgba(255,255,255,.75); font: 600 15px var(--body); position: relative; z-index: 1; transition: color var(--short); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.price-toggle button.is-active { color: var(--secondary); }
.price-toggle__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: var(--r-pill); background: #fff; transition: transform var(--medium) var(--ease-back); }
.price-toggle .save { background: var(--accent); color: #fff; font: 800 10px/1 var(--body); padding: 3px 6px; border-radius: 6px; }
.price { font: 800 40px/1.1 var(--head); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.price.swap { animation: priceSwap 350ms var(--ease-back); }
@keyframes priceSwap { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }
.btn--breathe { animation: breathe 2.4s ease-in-out infinite; background: #fff; color: var(--secondary); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.shimmer-text { background: linear-gradient(110deg, #fff 35%, #FFD0C2 50%, #fff 65%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 2.4s linear infinite; }

/* ------------------------------------------------------------ invoice paper + templates
   Same 10 designs as clentavo_app/lib/features/invoices/invoice_paper.dart, drawn at the
   same 380 px width with the same sizes, so app, web and marketing match. Sizes scale
   with --k (Compact is 0.9). Keep both in step when changing a template. */

.paper {
  --brand: #0E9F6E; --ink: #0F172A; --muted: #64748B; --line: #E2E8F0; --midnight: #0B1B33;
  --coral: #FF7A59; --soft: #F8FAFC; --r: 14px; --k: 1; --pad: calc(22px * var(--k));
  --tint-08: color-mix(in srgb, var(--brand) 8%, #fff);
  position: relative; width: 380px; overflow: hidden; isolation: isolate;
  background: var(--bg-paper, #fff); color: var(--ink); border-radius: var(--r);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .10);
  font: 400 calc(10px * var(--k))/1.35 'Inter', system-ui, sans-serif; font-variant-numeric: tabular-nums;
  text-align: left; -webkit-font-smoothing: antialiased;
}
.paper * { box-sizing: border-box; }
.paper.is-serif, .paper.is-serif * { font-family: Georgia, 'Times New Roman', serif !important; }
.paper .d { font-family: 'PlusJakartaSans', 'Inter', sans-serif; }
.paper .m { color: var(--muted); }
.paper .w { color: #fff; }
.paper .w7 { color: rgba(255, 255, 255, .7); }
.paper .k { display: block; font-weight: 700; font-size: calc(8px * var(--k)); letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.paper .k.w7 { color: rgba(255, 255, 255, .7); }
.paper .s95 { font-size: calc(9.5px * var(--k)); }
.paper .s105 { font-size: calc(10.5px * var(--k)); font-weight: 600; }
.paper .s11 { font-size: calc(11px * var(--k)); }
.paper .b6 { font-weight: 600; } .paper .b7 { font-weight: 700; } .paper .b8 { font-weight: 800; }
.paper .row { display: flex; align-items: flex-start; gap: 12px; }
.paper .grow { flex: 1; min-width: 0; }
.paper .end { text-align: right; }
.paper .pad { padding-left: var(--pad); padding-right: var(--pad); }
.paper .pre { white-space: pre-line; }
.paper__inner { position: relative; z-index: 1; }

/* logo + business */
.pp-logo { width: calc(42px * var(--k)); height: calc(42px * var(--k)); flex: none; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; font: 800 calc(15px * var(--k)) 'PlusJakartaSans', sans-serif; }
.pp-logo.on-dark { background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); }
.pp-logo.round { border-radius: 50%; }
.is-serif .pp-logo { border-radius: 4px; }
.pp-name { font: 800 calc(13px * var(--k))/1.35 'PlusJakartaSans', sans-serif; margin-bottom: 2px; }
.pp-title { font-weight: 800; font-size: calc(12px * var(--k)); letter-spacing: 1.4px; color: var(--brand); }
.pp-num { font-weight: 600; font-size: calc(11px * var(--k)); margin-top: 4px; }

/* parties + summary */
.pp-parties { display: grid; grid-template-columns: 3fr 2fr 2fr; gap: 0; padding-top: calc(16px * var(--k)); }
.pp-parties.bill-only { grid-template-columns: 1fr; }
.pp-client { font-size: calc(10.5px * var(--k)); font-weight: 700; }
.pp-strip { margin: 0 var(--pad); padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 7%, #fff); display: grid; grid-template-columns: repeat(3, 1fr); }
.pp-strip .hi { font-size: calc(11.5px * var(--k)); font-weight: 800; color: var(--brand); }
.pp-boxes { display: flex; padding-top: calc(14px * var(--k)); }
.pp-boxes > div { flex: 4; padding: 8px; border: 1px solid var(--line); border-left: 0; }
.pp-boxes > div:first-child { border-left: 1px solid var(--line); }
.pp-boxes > div.hi { flex: 5; background: var(--tint-08); }
.pp-boxes .v { font-size: calc(10px * var(--k)); font-weight: 600; }
.pp-boxes .hi .v { font-size: calc(10.5px * var(--k)); font-weight: 800; color: var(--brand); }
.t-corporate .pp-boxes .hi .v { color: var(--midnight); }

/* table */
.pp-table { margin-top: calc(14px * var(--k)); }
.pp-tr { display: grid; grid-template-columns: 5fr 1.4fr 3fr 3.4fr; column-gap: 6px; padding: calc(8px * var(--k)) 10px; }
/* Numbers never run into each other: one line, a touch smaller. */
.pp-tr > :not(:first-child) { white-space: nowrap; font-size: calc(9px * var(--k)); }
.pp-th > :not(:first-child) { font-size: calc(8px * var(--k)); }
.pp-table.numbered .pp-tr { grid-template-columns: 0.8fr 5fr 1.4fr 3fr 3.4fr; }
.pp-table.slim .pp-tr { grid-template-columns: 6fr 3.4fr; }
.pp-tr > :not(:first-child) { text-align: right; }
.pp-table.numbered .pp-tr > :nth-child(2) { text-align: left; }
.pp-th { padding: 7px 10px; font-weight: 700; font-size: calc(8px * var(--k)); letter-spacing: .6px; color: var(--muted); }
.pp-desc { font-weight: 600; }
.pp-type { font-size: calc(8.5px * var(--k)); color: var(--muted); }
.pp-amt { font-weight: 600; }
.pp-table .pp-body .pp-tr { border-bottom: 1px solid var(--line); }
.tb-tint .pp-th { background: var(--tint-08); border-radius: 6px; }
.tb-ruled .pp-th { border-bottom: 1px solid var(--ink); }
.tb-plain .pp-th { border-bottom: 1px solid var(--line); }
.tb-zebra .pp-th { background: var(--brand); color: #fff; border-radius: 8px; }
.tb-zebra .pp-body .pp-tr { border-bottom: 0; }
.tb-zebra .pp-body .pp-tr:nth-child(even) { background: color-mix(in srgb, var(--brand) 5%, #fff); }
.tb-grid .pp-th { background: var(--brand); color: #fff; }
.t-corporate .tb-grid .pp-th { background: var(--midnight); }
.tb-grid .pp-body .pp-tr { border: 1px solid var(--line); border-top: 0; }
.tb-pill .pp-th { background: color-mix(in srgb, var(--brand) 10%, #fff); border-radius: 20px; }
.tb-pill .pp-body .pp-tr { border-bottom: 0; background: var(--soft); border-radius: 14px; margin-top: 6px; }

/* totals */
.pp-totals { display: flex; flex-direction: column; align-items: flex-end; padding: 12px calc(var(--pad) + 10px) 0 var(--pad); }
.pp-trow { display: flex; width: 100%; max-width: 210px; gap: 8px; padding: 2px 0; }
.pp-trow > :first-child { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-due { display: inline-flex; align-items: center; margin-top: 6px; padding: 9px 14px; max-width: 100%; }
.pp-due .l { font-size: calc(10.5px * var(--k)); font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-due .a { font: 800 calc(13px * var(--k)) 'PlusJakartaSans', sans-serif; white-space: nowrap; }
.tt-rule .pp-due { border-top: 2px solid var(--brand); }
.tt-filled .pp-due { background: var(--brand); border-radius: 6px; }
.t-corporate .tt-filled .pp-due { background: var(--midnight); }
.tt-pill .pp-due { background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--coral))); border-radius: 30px; }
.tt-filled .pp-due .l, .tt-filled .pp-due .a, .tt-pill .pp-due .l, .tt-pill .pp-due .a { color: #fff; }
.tt-card .pp-due { background: var(--tint-08); border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff); border-radius: 12px; }
.tt-light .pp-due .a { font-size: calc(16px * var(--k)); font-weight: 300; letter-spacing: -.5px; }
.tt-double .pp-dbl { display: flex; flex-direction: column; align-items: flex-end; margin-top: 6px; }
.tt-double .pp-dbl::before { content: ''; width: 210px; max-width: 100%; height: 1px; background: var(--ink); margin-bottom: 6px; }
.tt-double .pp-dbl .l { font-size: 11px; font-weight: 700; }
.tt-double .pp-dbl .a { font-size: 14px; font-weight: 700; }
.tt-double .pp-dbl::after { content: ''; width: 110px; height: 4px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-top: 4px; }
.tt-centered { padding-right: var(--pad); }
.tt-centered .pp-ctr { align-self: stretch; margin-top: 10px; padding: 12px 0; text-align: center; border: 1px solid color-mix(in srgb, var(--brand) 45%, #fff); border-radius: 4px; }
.tt-centered .pp-ctr .l { font-size: 8.5px; font-weight: 700; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.tt-centered .pp-ctr .a { font-size: 16px; font-weight: 700; color: var(--brand); margin-top: 4px; }

/* instructions, notes, branding */
.pp-box { margin: 16px var(--pad) 0; padding: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: min(var(--r), 12px); font-size: calc(9.5px * var(--k)); }
.is-cream .pp-box { background: rgba(255, 255, 255, .6); }
.pp-box.est { display: flex; gap: 10px; align-items: center; }
.pp-box.est .ms { color: var(--brand); font-size: 18px; }
.pp-notes { padding-top: 12px; font-size: calc(9.5px * var(--k)); color: var(--muted); white-space: pre-line; }
.is-serif .pp-notes { font-style: italic; }
.t-elegant .pp-notes { text-align: center; }
.pp-end { height: calc(18px * var(--k)); }
.pp-brandmark { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0; background: var(--soft); font-size: 9px; font-weight: 600; color: var(--muted); position: relative; z-index: 1; }
.pp-brandmark svg { width: 14px; height: 14px; }

/* ---- per-template headers ---- */
.hd-clean .bar { height: 6px; background: var(--brand); }
.hd-clean .row { padding: var(--pad) var(--pad) 18px; }
.hd-bold { background: var(--brand); border-bottom-left-radius: 40px; padding: var(--pad) var(--pad) 26px; }
.hd-bold .big { font: 800 24px/1.2 'PlusJakartaSans', sans-serif; letter-spacing: -.5px; color: #fff; }
.hd-bold .amt { font: 800 16px/1.3 'PlusJakartaSans', sans-serif; color: #fff; }
.is-cream { --bg-paper: #FFFCF5; }
.hd-classic { padding: calc(var(--pad) + 4px) var(--pad) 0; }
.hd-classic .biz { font-size: 14px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; }
.hd-classic .script { font-size: 24px; font-style: italic; color: var(--brand); letter-spacing: -.3px; line-height: 1.2; }
.hd-classic .dbl { margin-top: 14px; height: 4.4px; border-top: 1.6px solid var(--ink); border-bottom: .8px solid var(--ink); }
.hd-minimal { padding: calc(var(--pad) + 10px) var(--pad) 0; }
.hd-minimal .row { align-items: flex-end; }
.hd-minimal .big { font: 300 26px/1.2 'PlusJakartaSans', sans-serif; letter-spacing: -1px; }
.hd-minimal .rule { height: 1px; background: var(--ink); margin-top: 16px; }
.hd-elegant { padding: var(--pad) var(--pad) 4px; text-align: center; }
.hd-elegant .ring { width: 50px; height: 50px; margin: 0 auto; border-radius: 50%; border: 1.4px solid var(--brand); display: grid; place-items: center; }
.hd-elegant .ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--tint-08); color: var(--brand); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.hd-elegant .biz { margin-top: 10px; font-size: 13px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; }
.hd-elegant .orn { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.hd-elegant .orn i { flex: 1; height: 1px; background: color-mix(in srgb, var(--brand) 50%, #fff); }
.hd-elegant .orn b { color: var(--brand); font-size: 10px; letter-spacing: 1.2px; white-space: nowrap; max-width: 236px; overflow: hidden; text-overflow: ellipsis; }
.t-elegant .pp-frame { margin: 9px; border: 1px solid color-mix(in srgb, var(--brand) 40%, #fff); }
.hd-corporate { display: flex; }
.hd-corporate .l { flex: 1; background: var(--midnight); padding: var(--pad) var(--pad) 18px; }
.hd-corporate .r { width: 112px; background: var(--brand); padding: var(--pad) var(--pad) 14px 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; text-align: right; }
.hd-corporate .r .pp-title { font-size: 14px; color: #fff; }
.hd-creative { padding: calc(var(--pad) + 8px) var(--pad) 6px; }
.hd-creative .big { font: 800 28px/1.2 'PlusJakartaSans', sans-serif; letter-spacing: -1.2px; }
.hd-creative .chip { display: inline-block; margin-top: 2px; padding: 2px 8px; border-radius: 20px; background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); font-size: 10.5px; font-weight: 700; }
.hd-creative .row { margin-top: 16px; align-items: center; padding-right: 80px; }
.pp-blob { position: absolute; border-radius: 50%; z-index: 0; }
.pp-sticker { position: absolute; right: 24px; top: 104px; z-index: 2; transform: rotate(-.14rad); background: var(--coral); color: #fff; border-radius: 12px; padding: 7px 12px; text-align: center; box-shadow: 0 4px 12px color-mix(in srgb, var(--coral) 40%, transparent); }
.pp-sticker small { display: block; font-size: 7.5px; font-weight: 800; letter-spacing: 1.2px; }
.pp-sticker b { font: 800 12px 'PlusJakartaSans', sans-serif; }
.hd-compact { display: flex; align-items: center; gap: 10px; padding: 14px var(--pad) 12px; border-bottom: 1px solid var(--line); }
.hd-compact .bar { width: 8px; height: 30px; background: var(--brand); }
.hd-compact .nm { font: 800 calc(13px * var(--k)) 'PlusJakartaSans', sans-serif; }
.hd-compact .tt { color: var(--brand); font-weight: 700; font-size: calc(11px * var(--k)); letter-spacing: .6px; white-space: nowrap; }
.pp-wash { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 45%, var(--coral)), color-mix(in srgb, var(--brand) 60%, var(--midnight))); }
.hd-gradient { padding: var(--pad) var(--pad) 20px; }
.hd-gradient .amt { font: 800 21px/1.3 'PlusJakartaSans', sans-serif; letter-spacing: -.6px; color: #fff; }
.hd-gradient .glass { display: inline-block; padding: 5px 10px; margin: 0 6px 0 0; border-radius: 20px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); color: #fff; font-size: 9.5px; font-weight: 600; }
.pp-washbar { height: 5px; }
/* Modern: full-height sidebar */
.pp-side { display: flex; align-items: stretch; }
.pp-side__col { width: 112px; flex: none; background: var(--brand); padding: 22px 12px 22px 16px; color: #fff; }
.pp-side__col .pp-title { color: #fff; margin-top: 18px; }
.pp-side__col .pp-logo { width: 40px; height: 40px; }
.pp-side__col .it { margin-top: 14px; }
.pp-side__col .it .v { font-size: 10.5px; font-weight: 600; }
.pp-side__col .it .v.big { font: 800 13px 'PlusJakartaSans', sans-serif; }
.pp-side__main { flex: 1; min-width: 0; }

.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 700px) { .tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tpl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tpl { position: relative; text-align: left; border-radius: var(--r-card); padding: 10px; background: var(--surface); border: 1.4px solid var(--card-border); transition: border-color var(--short), transform var(--micro); }
.tpl:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--outline)); }
.tpl.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.tpl__thumb { position: relative; aspect-ratio: 380 / 500; overflow: hidden; border-radius: 10px; background: var(--surface-alt); }
.tpl__thumb .paper { position: absolute; left: 0; top: 0; transform-origin: top left; box-shadow: none; border-radius: 0; pointer-events: none; }
.tpl__lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 27, 51, .28); color: #fff; opacity: 0; transition: opacity var(--short); }
.tpl:hover .tpl__lock { opacity: 1; }

.preview-stage { background: var(--surface-alt); border-radius: 24px; padding: 20px; }
.paper-fit { position: relative; max-width: 608px; margin: 0 auto; }
.paper-fit > .paper { transform-origin: top left; }
@media (min-width: 960px) { .preview-stage { padding: 40px; } }

/* ------------------------------------------------------------ celebrations */

.celebrate { position: fixed; inset: 0; z-index: 150; pointer-events: none; display: grid; place-items: center; }
.celebrate__pill { position: absolute; bottom: 22%; padding: 12px 18px; border-radius: var(--r-pill); background: var(--secondary); color: var(--bg); font: 700 15px var(--head); display: inline-flex; gap: 8px; align-items: center; animation: pop 450ms var(--ease-back) both; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.plane { position: absolute; left: 50%; top: 55%; color: var(--primary); animation: planeFly 1400ms cubic-bezier(.5, 0, .3, 1) forwards; }
.plane .ms { font-size: 56px; transform: rotate(-30deg); font-variation-settings: 'FILL' 1; }
@keyframes planeFly {
  0% { transform: translate(-50%, 0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  45% { transform: translate(-120%, -60px) rotate(-10deg); }
  100% { transform: translate(60vw, -70vh) rotate(10deg) scale(.6); opacity: 0; }
}
.trail { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.trail path { stroke: var(--primary); stroke-width: 3; fill: none; stroke-dasharray: 6 8; stroke-dashoffset: 400; animation: trail 1200ms ease-out forwards; opacity: .5; }
@keyframes trail { to { stroke-dashoffset: 0; } }
.wallet { position: absolute; top: 52%; width: 110px; height: 80px; border-radius: 20px; background: var(--hero-gradient); display: grid; place-items: center; color: #fff; animation: pop 400ms var(--ease-back) both, glow 1.6s ease-out 1s; }
.wallet .ms { font-size: 44px; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); } 100% { box-shadow: 0 0 0 40px transparent; } }
.coin { position: absolute; top: 52%; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFE29A, #F5B300 60%, #C98A00); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); animation: coinDrop 700ms cubic-bezier(.55, 0, .7, 1) both; }
@keyframes coinDrop { from { transform: translateY(-60vh) rotate(0); opacity: 1; } 90% { opacity: 1; } to { transform: translateY(0) rotate(540deg); opacity: 0; } }
.confetti { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti 2200ms cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

/* theme reveal */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* appearance options */
.theme-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 8px; border-radius: var(--r-card); border: 1.4px solid var(--outline); background: var(--surface); transition: border-color var(--short); }
.theme-opt.is-active { border-color: var(--primary); }
.theme-opt__prev { width: 100%; height: 74px; border-radius: 10px; position: relative; overflow: hidden; }
.theme-opt__prev i { position: absolute; left: 10px; right: 10px; height: 8px; border-radius: 4px; }

.help-q { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 14px var(--sp-md); }
.help-q .ms { transition: transform var(--medium) var(--ease-in-out); color: var(--text-2); }
.help-q[aria-expanded="true"] .ms { transform: rotate(180deg); }
.help-a { padding: 0 var(--sp-md) 14px; color: var(--text-2); margin: 0; animation: fadeIn 300ms both; }

.desktop-only { display: none; }
@media (min-width: 960px) { .desktop-only { display: initial; } .btn.desktop-only { display: inline-flex; } .mobile-only { display: none !important; } }
/* Plan & usage */
.usage-row { padding: 2px 0; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; }
.plan-card.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.plan-card__price { font: 800 24px var(--head); margin-top: 4px; }
.plan-card__ticks { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.plan-card__ticks li { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.plan-card__ticks li .ms { color: var(--s-paid); }
.plan-card__ticks li.is-off { color: var(--text-2); }
.plan-card__ticks li.is-off .ms { color: var(--text-2); }
.plan-card .btn { margin-top: auto; }
.stile.is-locked .title-sm { color: var(--text-2); }
/* Paywall plan picker: on the dark background, readable when picked or not. */
.pw-chip { height: 38px; padding: 0 18px; border-radius: 999px; font: 700 14px var(--head); color: #fff; background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.35); transition: background var(--short), color var(--short), border-color var(--short); }
.pw-chip:hover { border-color: #fff; }
.pw-chip.is-active { background: #fff; color: #0B1B33; border-color: #fff; }

/* Very long amounts (millions): a step smaller so nothing crowds or wraps. */
.paper.is-long .pp-tr > :not(:first-child) { font-size: calc(8px * var(--k)); }
.paper.is-long .pp-due .a, .paper.is-long .tt-double .pp-dbl .a { font-size: calc(11.5px * var(--k)); }
.paper.is-long .tt-light .pp-due .a, .paper.is-long .tt-centered .pp-ctr .a { font-size: 13px; }
.paper.is-long .hd-bold .amt { font-size: 13px; }
.paper.is-long .hd-gradient .amt { font-size: 17px; }
.paper.is-long .pp-strip .hi, .paper.is-long .pp-boxes .hi .v { font-size: calc(9.5px * var(--k)); }
.paper.is-long .pp-side__col .it .v.big { font-size: 11px; }
.paper.is-long .pp-trow { max-width: 240px; }
