/* Invoices: Apple-style design system (iOS grouped lists, macOS sidebar, Wallet rows).
   --accent comes from the current business on <html>. Light + dark follow the device. */

:root {
  --accent: #0071e3;
  --tint: var(--accent);
  --on-accent: #fff;
  --bg: #f2f2f7;
  --card: #ffffff;
  --card-2: #f7f7fa;
  --label: #1d1d1f;
  --label-2: rgba(60, 60, 67, .62);
  --label-3: rgba(60, 60, 67, .32);
  --sep: rgba(60, 60, 67, .17);
  --fill: rgba(120, 120, 128, .14);
  --fill-2: rgba(120, 120, 128, .08);
  --bar: rgba(249, 249, 251, .78);
  --side: rgba(238, 238, 243, .82);
  --green: #248a3d; --red: #d70015; --orange: #c93400; --blue: #0066cc; --purple: #8944ab;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .1);
  --r: 14px;
  --r-lg: 22px;
  --side-w: 256px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --spring: cubic-bezier(.22, .9, .26, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tint: color-mix(in srgb, var(--accent) 68%, #fff);
    --bg: #000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --label: #f5f5f7;
    --label-2: rgba(235, 235, 245, .62);
    --label-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .55);
    --fill: rgba(120, 120, 128, .3);
    --fill-2: rgba(120, 120, 128, .18);
    --bar: rgba(22, 22, 24, .78);
    --side: rgba(28, 28, 30, .86);
    --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --blue: #409cff; --purple: #bf5af2;
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(255, 255, 255, .12);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 17px/1.4 var(--font); letter-spacing: -.01em; color: var(--label); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--tint); text-decoration: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 .7em; }
.ic { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--label-2); }
.tnum, .num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--tint) 50%, transparent); outline-offset: 2px; border-radius: 8px; }

/* =================================================== shell */
.app { min-height: 100dvh; }
.col { min-width: 0; }
.side { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 transparent; transition: box-shadow .2s;
}
.topbar.scrolled { box-shadow: 0 .5px 0 var(--sep); }
.topbar__title { flex: 1; min-width: 0; text-align: center; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .2s; }
.topbar.scrolled .topbar__title { opacity: 0; }
@media (min-width: 600px) { .topbar.scrolled .topbar__title { opacity: 1; } }
.topbar__end { display: flex; gap: 2px; }
.topbar .icon-btn { color: var(--tint); }
.topbar .icon-btn .ic { width: 24px; height: 24px; }

.switcher { display: inline-flex; align-items: center; gap: 8px; max-width: 58vw; height: 36px; padding: 0 6px 0 2px; border: 0; background: none; font-weight: 600; font-size: 17px; color: var(--label); }
.switcher__icon { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; box-shadow: 0 0 0 .5px var(--sep); }
.switcher__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher__name small { display: none; }
.switcher .ic { width: 15px; height: 15px; color: var(--label-2); }

.main { padding: 4px 16px calc(84px + var(--safe-b)); max-width: 1180px; margin: 0 auto; }
.main--bare { padding-bottom: calc(120px + var(--safe-b)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(50px + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding-top: 2px; color: var(--label-2); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; }
.tabbar a .ic { width: 25px; height: 25px; stroke-width: 1.6; }
.tabbar a[aria-current="page"] { color: var(--tint); }
.tabbar a[aria-current="page"] .ic { stroke-width: 2.1; }
.tabbar a:active .ic { transform: scale(.86); transition: transform .12s; }
.fab { display: none !important; }

@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 14px 12px 12px;
    background: var(--side); backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px);
    box-shadow: inset -.5px 0 0 var(--sep);
  }
  .side .switcher { width: 100%; max-width: none; height: auto; padding: 8px; border-radius: 12px; gap: 10px; text-align: left; }
  .side .switcher:hover { background: var(--fill-2); }
  .side .switcher__icon { width: 36px; height: 36px; border-radius: 9px; }
  .side .switcher__name { flex: 1; display: grid; font-size: 15px; line-height: 1.25; }
  .side .switcher__name small { display: block; font-weight: 400; font-size: 12px; color: var(--label-2); }
  .side__new { display: flex; gap: 8px; margin: 10px 4px 14px; }
  .side__new .btn { flex: 1; }
  .nav { display: flex; flex-direction: column; gap: 1px; }
  .nav__label { font-size: 11px; font-weight: 600; color: var(--label-3); letter-spacing: .02em; padding: 14px 10px 4px; }
  .nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--label); font-size: 15px; }
  .nav a .ic { width: 19px; height: 19px; color: var(--tint); }
  .nav a:hover { background: var(--fill-2); }
  .nav a[aria-current="page"] { background: var(--fill); font-weight: 600; }
  .nav__sep { display: none; }
  .side__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 2px; box-shadow: 0 -.5px 0 var(--sep); }
  .side__user { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side__foot .menu__item { width: auto; padding: 6px 8px; font-size: 13px; color: var(--label-2); }
  .topbar, .tabbar { display: none; }
  .main { padding: 34px 48px 72px; width: 100%; }
  .main--bare { padding-bottom: 150px; }
}

/* =================================================== headers */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 6px 0 22px; }
.page-head__text { flex: 1 1 240px; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--label-2); margin-bottom: 2px; }
.page-head h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; }
.page-head .sub { color: var(--label-2); margin-top: 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 0; color: var(--tint); font-size: 17px; margin: 0 0 2px -6px; height: 34px; }
.back .ic { width: 24px; height: 24px; stroke-width: 2; }
@media (min-width: 1024px) { .page-head h1 { font-size: 40px; } }

/* =================================================== buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 0; background: var(--fill); color: var(--tint); font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  white-space: nowrap; text-decoration: none !important; transition: transform .14s var(--spring), opacity .2s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn .ic { width: 18px; height: 18px; stroke-width: 2.1; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn--ghost { background: transparent; color: var(--tint); padding: 0 10px; }
.btn--ghost:hover { background: var(--fill-2); }
.btn--white { background: var(--card); color: var(--tint); box-shadow: 0 0 0 .5px var(--sep); }
.btn--danger { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 14px; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 17px; border-radius: 14px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .45; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--label-2); }
.icon-btn:hover { background: var(--fill-2); }
.icon-btn--filled { background: var(--fill); color: var(--tint); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* =================================================== grouped sections (iOS inset grouped) */
.group { margin-bottom: 26px; min-width: 0; }
.group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 16px 7px; }
.group__title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; color: var(--label); }
.group__title--small { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); }
.group__link { font-size: 15px; }
.group__foot { font-size: 13px; color: var(--label-2); padding: 7px 16px 0; line-height: 1.35; }
.card, .group__card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 16px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card__title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.card__link { font-size: 15px; }
.section-title { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); margin: 26px 16px 7px; }
.grid { display: grid; gap: 0 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); } }

/* inset list rows */
.ilist { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.ilist > * { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 16px; color: inherit; text-decoration: none !important; position: relative; width: 100%; background: none; border: 0; text-align: left; font: inherit; }
.ilist > * + *::before { content: ""; position: absolute; top: 0; right: 0; left: 60px; height: .5px; background: var(--sep); }
.ilist > a:hover, .ilist > button:hover { background: var(--fill-2); }
.ilist > a:active, .ilist > button:active { background: var(--fill); }
.ilist .grow { flex: 1; min-width: 0; }
.ilist .t { font-size: 17px; }
.ilist .s { font-size: 15px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ilist .chev { width: 17px; height: 17px; color: var(--label-3); stroke-width: 2.4; }
.ilist__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); flex: none; }
.ilist__icon .ic { width: 18px; height: 18px; color: #fff; stroke-width: 2; }
.ilist__icon--gray { background: #8e8e93; } .ilist__icon--green { background: #34c759; } .ilist__icon--orange { background: #ff9500; } .ilist__icon--red { background: #ff3b30; } .ilist__icon--blue { background: #007aff; } .ilist__icon--indigo { background: #5856d6; }
.ilist .value { color: var(--label-2); font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); flex: none; letter-spacing: 0; }

/* =================================================== dashboard */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 22px 22px 20px; color: #fff; margin-bottom: 14px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .26), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(0, 0, 0, .28), transparent 60%),
    linear-gradient(140deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent) 45%, color-mix(in srgb, var(--accent) 62%, #000));
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--accent) 70%, transparent), 0 1px 0 rgba(255, 255, 255, .25) inset;
}
.hero__top { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; opacity: .95; }
.hero__top img { width: 34px; height: 34px; border-radius: 9px; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.hero__label { margin-top: 26px; font-size: 15px; font-weight: 500; opacity: .85; }
.hero__amount { font-size: clamp(40px, 9vw, 56px); font-weight: 700; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero__amount small { font-size: .42em; font-weight: 600; letter-spacing: 0; opacity: .8; margin-right: 6px; vertical-align: .35em; }
.hero__amount .dec { opacity: .7; }
.hero__sub { font-size: 15px; opacity: .85; margin-top: 4px; }
.hero__actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.glass-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; color: #fff; font-weight: 600; font-size: 15px;
  background: rgba(255, 255, 255, .2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .35); text-decoration: none !important; transition: transform .14s var(--spring), background .2s; }
.glass-btn:hover { background: rgba(255, 255, 255, .28); }
.glass-btn:active { transform: scale(.96); }
.glass-btn .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.glass-btn--solid { background: #fff; color: var(--accent); box-shadow: none; }
.glass-btn--solid:hover { background: rgba(255, 255, 255, .9); }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
.tile { display: block; background: var(--card); border-radius: var(--r); padding: 12px 14px; color: inherit; text-decoration: none !important; box-shadow: var(--shadow-sm); min-width: 0; transition: transform .14s var(--spring); }
.tile:active { transform: scale(.97); }
.tile__label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile__label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); flex: none; }
.tile__value { font-size: clamp(17px, 4.6vw, 24px); font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile__value small { font-size: .6em; font-weight: 600; color: var(--label-2); margin-right: 3px; letter-spacing: 0; }
.tile__foot { font-size: 13px; color: var(--label-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile--red .tile__value { color: var(--red); } .tile--red .dot { background: var(--red); }
.tile--green .dot { background: var(--green); } .tile--blue .dot { background: var(--blue); }
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr 1fr; } .tiles .tile:last-child { grid-column: 1 / -1; } }

/* weekly-activity style bars */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 150px; }
.bars__col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bars__pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.bars__bar { width: min(14px, 34%); border-radius: 999px; background: var(--accent); min-height: 6px; transform-origin: bottom; animation: grow .8s var(--spring) both; }
.bars__bar--rec { background: #34c759; }
.bars__lbl { font-size: 12px; color: var(--label-2); font-weight: 500; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--label-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--accent); }
.legend i.rec { background: #34c759; }
@keyframes grow { from { transform: scaleY(0); } }

/* =================================================== transaction rows (Wallet style) */
.rows { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-sm); }
.txn { display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 16px; min-height: 64px; color: inherit; text-decoration: none !important; position: relative; -webkit-tap-highlight-color: transparent; }
.txn + .txn::before { content: ""; position: absolute; top: 0; right: 0; left: 68px; height: .5px; background: var(--sep); }
.txn:hover { background: var(--fill-2); }
.txn:active { background: var(--fill); }
.txn__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 14px; font-weight: 700; color: #fff; letter-spacing: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c, var(--accent)) 72%, #fff), var(--c, var(--accent))); }
.txn__icon--quote { --c: #5856d6; }
.txn__main { flex: 1; min-width: 0; }
.txn__title { font-size: 16px; font-weight: 600; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.txn__sub { font-size: 14px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; margin-top: 1px; }
.txn__end { text-align: right; flex: none; max-width: 46%; }
.txn__amt { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: block; }
.txn__status { font-size: 13px; color: var(--label-2); white-space: nowrap; display: block; margin-top: 1px; }
.txn .chev { width: 15px; height: 15px; color: var(--label-3); stroke-width: 2.6; flex: none; }
.s-paid, .s-accepted, .s-invoiced { color: var(--green) !important; }
.s-overdue, .s-declined { color: var(--red) !important; }
.s-partial, .s-expired { color: var(--orange) !important; }
.s-sent { color: var(--blue) !important; }
.s-viewed { color: var(--purple) !important; }
.s-void { color: var(--label-3) !important; text-decoration: line-through; }
.rows__foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 0 16px; margin-top: 8px; font-size: 13px; color: var(--label-2); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 7px; }
.month-head b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.month-head span { font-size: 13px; color: var(--label-2); font-variant-numeric: tabular-nums; }

/* status pill (used in headers only) */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--label-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--paid, .badge--accepted, .badge--invoiced { color: var(--green); }
.badge--overdue, .badge--declined { color: var(--red); }
.badge--partial, .badge--expired { color: var(--orange); }
.badge--sent { color: var(--blue); }
.badge--viewed { color: var(--purple); }
.badge--void { color: var(--label-3); }

/* =================================================== segmented + search */
.seg { display: flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: 9px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.seg::-webkit-scrollbar { display: none; }
.seg a { flex: 1 0 auto; text-align: center; padding: 6px 12px; border-radius: 7px; color: var(--label); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background .2s; }
.seg a[aria-current="true"] { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; }
@media (prefers-color-scheme: dark) { .seg a[aria-current="true"] { background: #636366; } }
.seg .count { color: var(--label-2); font-weight: 500; margin-left: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.search { flex: 1 1 220px; position: relative; display: block; }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--label-2); width: 17px; height: 17px; }
.search input { width: 100%; height: 38px; border-radius: 10px; border: 0; background: var(--fill); padding: 0 12px 0 33px; font-size: 17px; color: var(--label); }
.search input::placeholder { color: var(--label-2); }
.search input:focus { outline: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--fill); font-size: 14px; font-weight: 500; }
.chip .ic { width: 16px; height: 16px; }
.chip a { color: var(--label-2); display: grid; }

/* =================================================== empty */
.empty { text-align: center; padding: 36px 22px 32px; }
.empty__icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--tint); }
.empty__icon .ic { width: 32px; height: 32px; stroke-width: 1.6; }
.empty h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.empty p { color: var(--label-2); max-width: 360px; margin: 0 auto 18px; font-size: 15px; }
.empty .btn-row { justify-content: center; }

/* =================================================== activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 8px 0; font-size: 15px; line-height: 1.35; }
.feed li + li { box-shadow: 0 -.5px 0 var(--sep); }
.feed li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--label-3); margin-top: 6px; }
.feed li.k-payment::before, .feed li.k-accepted::before { background: #34c759; }
.feed li.k-viewed::before { background: #af52de; }
.feed li.k-emailed::before, .feed li.k-marked_sent::before { background: #007aff; }
.feed li.k-declined::before, .feed li.k-void::before, .feed li.k-deleted::before { background: #ff3b30; }
.feed time { display: block; font-size: 13px; color: var(--label-2); margin-top: 1px; }
.feed a { color: inherit; }

/* =================================================== forms (iOS grouped) */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 13px; font-weight: 500; color: var(--label-2); }
.field .hint { font-size: 13px; color: var(--label-2); line-height: 1.35; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 10px; border: 0; background: var(--card-2);
  box-shadow: inset 0 0 0 .5px var(--sep); font-size: 17px; color: var(--label); transition: box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--label-3); }
.field select, select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' fill='none' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 5 3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field textarea, textarea.input { min-height: 88px; resize: vertical; line-height: 1.4; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--tint); }
.field input[type=date] { min-width: 0; }
.row2 { display: grid; gap: 14px; }
@media (min-width: 640px) { .row2 { grid-template-columns: 1fr 1fr; } .row3 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 1100px) { .ed__side .row2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; padding: 4px 0; cursor: pointer; line-height: 1.35; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.seg-input { display: inline-flex; padding: 2px; background: var(--fill); border-radius: 9px; gap: 2px; }
.seg-input label { position: relative; }
.seg-input input { position: absolute; opacity: 0; inset: 0; }
.seg-input span { display: block; padding: 6px 18px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg-input input:checked + span { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12); font-weight: 600; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 15px; margin-bottom: 16px; line-height: 1.35; }
.alert .ic { width: 20px; height: 20px; margin-top: 0; }
.alert--err { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.alert--ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.alert--info { background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); }
.alert--warn { background: color-mix(in srgb, var(--orange) 12%, transparent); color: var(--orange); }
.alert a { color: inherit; text-decoration: underline; }

/* =================================================== menus */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 240px; padding: 5px;
  background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 13px; box-shadow: var(--shadow-pop); transform-origin: top right; animation: pop .2s var(--spring);
}
.menu--up .menu__panel { top: auto; bottom: calc(100% + 8px); transform-origin: bottom right; }
.menu--left .menu__panel { right: auto; left: 0; transform-origin: top left; }
.menu__panel form { margin: 0; }
.menu__item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 15px; color: var(--label); text-decoration: none !important; }
.menu__item:hover { background: var(--accent); color: #fff; }
.menu__item:hover .ic { color: #fff; }
.menu__item .ic { width: 18px; height: 18px; color: var(--label-2); }
.menu__item--danger, .menu__item--danger .ic { color: var(--red); }
.menu__item--danger:hover { background: var(--red); }
.menu__sep { height: .5px; background: var(--sep); margin: 5px 10px; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }

/* =================================================== sheets */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 14px 14px 0 0;
  background: var(--bg); color: var(--label); box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet[open] { animation: sheet-up .42s var(--spring); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .36); animation: fade .3s; }
.sheet__grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 6px auto 0; flex: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 18px; flex: none; }
.sheet__head h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.sheet__head .icon-btn { width: 30px; height: 30px; background: var(--fill); color: var(--label-2); }
.sheet__head .icon-btn .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.sheet__body { padding: 4px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet__foot { padding: 10px 16px calc(10px + var(--safe-b)); display: flex; gap: 10px; flex: none; }
.sheet__foot .btn { flex: 1; min-height: 50px; border-radius: 14px; font-size: 17px; }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; width: min(540px, 92vw); border-radius: 14px; max-height: 86dvh; }
  dialog.sheet[open] { animation: pop .28s var(--spring); }
  .sheet__grab { display: none; }
  .sheet__head { padding-top: 14px; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.biz-list { display: grid; gap: 0; background: var(--card); border-radius: var(--r); overflow: hidden; }
.biz-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; position: relative; color: var(--label); }
.biz-opt + .biz-opt::before { content: ""; position: absolute; top: 0; right: 0; left: 74px; height: .5px; background: var(--sep); }
.biz-opt:hover { background: var(--fill-2); }
.biz-opt img { width: 44px; height: 44px; border-radius: 11px; object-fit: contain; box-shadow: 0 0 0 .5px var(--sep); }
.biz-opt b { display: block; font-size: 17px; font-weight: 600; }
.biz-opt span { font-size: 14px; color: var(--label-2); }
.biz-opt .ic { margin-left: auto; color: var(--tint); stroke-width: 2.6; }

/* =================================================== toast */
.toast {
  position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 90; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center; max-width: min(92vw, 480px); padding: 10px 18px 10px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--label); font-size: 15px; font-weight: 600;
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow-pop); animation: toast-in .5s var(--spring);
}
.toast .ic { width: 20px; height: 20px; color: #34c759; stroke-width: 2.4; }
.toast--err .ic { color: #ff3b30; }
.toast.out { opacity: 0; transform: translate(-50%, -16px); transition: .35s; }
@media (min-width: 1024px) { .toast { left: calc(50% + var(--side-w) / 2); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -24px) scale(.9); } }

/* =================================================== document view */
.doc-layout { display: grid; gap: 0 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .doc-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .doc-layout__main { grid-column: 1; grid-row: 1; } .doc-layout__side { grid-column: 2; grid-row: 1; } }
.doc-hero { text-align: center; padding: 8px 8px 22px; }
.doc-hero__icon { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 72%, #fff), var(--accent)); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.doc-hero__who { font-size: 17px; font-weight: 600; }
.doc-hero__num { font-size: 15px; color: var(--label-2); margin-top: 1px; }
.doc-hero__amount { font-size: 44px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.doc-hero__amount small { font-size: .45em; font-weight: 600; color: var(--label-2); letter-spacing: 0; margin-right: 4px; vertical-align: .3em; }
.doc-hero__status { margin-top: 6px; font-size: 15px; display: flex; justify-content: center; }
.round-actions { display: flex; justify-content: center; gap: 8px; margin: 22px auto 0; max-width: 440px; }
.ra { flex: 1 1 0; min-width: 0; max-width: 88px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 12px; border: 0;
  background: var(--card); color: var(--tint); font-size: 12px; font-weight: 500; text-decoration: none !important; box-shadow: var(--shadow-sm); transition: transform .14s var(--spring); position: relative; }
.ra:active { transform: scale(.94); }
.ra .ic { width: 22px; height: 22px; stroke-width: 2; }
.ra--primary { background: var(--accent); color: #fff; }
form.ra-form { display: contents; }
details.ra { padding: 0; }
details.ra > summary { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; cursor: pointer; width: 100%; }
details.ra > summary::-webkit-details-marker { display: none; }
details.ra .menu__panel { text-align: left; color: var(--label); font-size: 15px; }
.kv > * { justify-content: space-between; }
.kv .k { color: var(--label); font-size: 17px; }
.kv .v { color: var(--label-2); font-size: 17px; font-variant-numeric: tabular-nums; text-align: right; }
.kv .v.red { color: var(--red); } .kv .v.green { color: var(--green); } .kv .v.strong { color: var(--label); font-weight: 600; }
.kv > * + *::before { left: 16px !important; }
.paper { background: #fff; color: #1d1d1f; border-radius: 10px; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .08), 0 12px 40px -12px rgba(0, 0, 0, .18); padding: 22px 18px; overflow: hidden; }
@media (min-width: 768px) { .paper { padding: 48px 52px; } }
@media (max-width: 640px) {
  .paper .st { font-size: 13.5px; }
  .paper .st .head td { display: block; width: 100% !important; text-align: left !important; }
  .paper .st .doctitle, .paper .st .docnum { text-align: left; }
  .paper .st .head td:last-child { padding-top: 14px; }
  .paper .st .parties td { display: block; width: 100% !important; padding-bottom: 16px; }
  .paper .st .lines thead { display: none; }
  .paper .st .lines tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid #e5e5ea; }
  .paper .st .lines td { border: 0; padding: 0; }
  .paper .st .lines td.n, .paper .st .lines td:nth-child(4) { display: none; }
  .paper .st .lines td:nth-child(2) { grid-column: 1 / -1; }
  .paper .st .lines td:nth-child(3) { color: #6e6e73; text-align: left; padding-left: 0; }
  .paper .st .lines td:nth-child(3)::after { content: " ×"; }
  .paper .st .lines td:nth-child(5) { font-weight: 600; }
  .paper .st .totals { width: 100%; }
  .paper .st .notes td { display: block; padding-bottom: 14px; }
  .paper .st .pays td { font-size: 13px; }
}
.related { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; margin-top: 10px; color: var(--label-2); }
.related .ic { width: 16px; height: 16px; }
.summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5px; background: var(--sep); border-radius: var(--r); overflow: hidden; margin-bottom: 16px; }
@media (min-width: 768px) { .summary { grid-template-columns: repeat(4, 1fr); } }
.summary > div { background: var(--card); padding: 12px 16px; min-width: 0; }
.summary .k { font-size: 13px; color: var(--label-2); font-weight: 500; }
.summary .v { font-size: 19px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary .v.red { color: var(--red); } .summary .v.green { color: var(--green); }

/* =================================================== editor */
.ed-head { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.ed-head h1 { font-size: 34px; font-weight: 700; letter-spacing: -.025em; flex: 1; min-width: 0; }
.ed { display: grid; gap: 0 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .ed { grid-template-columns: minmax(0, 1fr) 350px; align-items: start; } .ed__side { position: sticky; top: 24px; } }
.ed .card { padding: 0; background: none; box-shadow: none; margin: 0 0 26px; border-radius: 0; }
.ed .card + .card { margin-top: 0; }
.ed .card__head { padding: 0 16px 7px; margin: 0; }
.ed .card__title { font-size: 20px; }
.ed .card > .form, .ed .card > .totals-box, .ed .card > .client-pick { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.ed .card > .form { padding: 16px; }
.client-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; text-align: left; min-height: 66px; color: var(--label); }
.client-pick:hover { background: var(--fill-2); }
.client-pick .grow { flex: 1; min-width: 0; }
.client-pick b { display: block; font-size: 17px; font-weight: 600; }
.client-pick span { color: var(--label-2); font-size: 15px; }
.client-pick .ph { color: var(--tint); font-weight: 600; font-size: 17px; display: block; }
#ed-lines { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.line { position: relative; padding: 12px 12px 12px 16px; }
.line + .line { box-shadow: 0 -.5px 0 var(--sep); }
.line.is-new { animation: fade .35s; }
.line__top { display: flex; gap: 6px; align-items: flex-start; }
.line__name { flex: 1; min-width: 0; position: relative; }
.line__name input { width: 100%; border: 0; background: transparent; font-size: 17px; font-weight: 600; padding: 6px 0; border-radius: 6px; color: var(--label); }
.line__name input::placeholder { color: var(--label-3); font-weight: 500; }
.line__name input:focus { outline: none; }
.line textarea.line__desc { width: 100%; border: 0; background: transparent; font-size: 15px; color: var(--label-2); padding: 0 0 4px; resize: none; min-height: 22px; line-height: 1.4; overflow: hidden; }
.line textarea.line__desc::placeholder { color: var(--label-3); }
.line textarea.line__desc:focus { outline: none; color: var(--label); }
.line__nums { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 8px; margin-top: 6px; align-items: end; }
.line__nums .mini { display: grid; gap: 3px; min-width: 0; }
.line__nums .mini > span:first-child { font-size: 12px; color: var(--label-2); font-weight: 500; padding-left: 2px; }
.line__nums input, .line__nums select { width: 100%; height: 38px; border: 0; border-radius: 9px; padding: 0 10px; font-size: 17px; background: var(--fill-2); color: var(--label); font-variant-numeric: tabular-nums; }
.line__nums input:focus, .line__nums select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--tint); }
.line__nums select { -webkit-appearance: none; appearance: none; padding: 0 6px; font-size: 14px; color: var(--label-2); }
.qty-unit { display: grid; grid-template-columns: 1fr 1fr; background: var(--fill-2); border-radius: 9px; overflow: hidden; }
.qty-unit input, .qty-unit select { background: transparent !important; border-radius: 0 !important; }
.qty-unit select { box-shadow: inset .5px 0 0 var(--sep) !important; }
.line__amt { text-align: right; font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; padding-bottom: 8px; white-space: nowrap; }
.line__extras { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 999px; border: 0; background: var(--fill-2); color: var(--tint); font-size: 13px; font-weight: 600; }
.pill .ic { width: 15px; height: 15px; stroke-width: 2.1; }
.pill:hover { background: var(--fill); }
.pill--on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pill input { border: 0; background: transparent; width: 9.5em; font-size: 13px; color: inherit; padding: 0; }
.pill input:focus { outline: none; }
.line__tools { display: flex; margin-left: auto; }
.line__tools .icon-btn { width: 32px; height: 32px; color: var(--label-3); }
.line__tools .icon-btn:hover { color: var(--tint); }
.line__tools .icon-btn .ic { width: 18px; height: 18px; }
.adjrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; margin-top: 8px; }
#ed-adj { padding: 4px 12px 12px 16px; box-shadow: 0 .5px 0 var(--sep); }
#ed-adj:empty { display: none; }
.adjrow input.nm { min-width: 0; height: 36px; border: 0; border-radius: 9px; padding: 0 10px; font-size: 15px; background: var(--fill-2); color: var(--label); }
.adjrow input.val { width: 84px; height: 36px; border: 0; border-radius: 9px; padding: 0 10px; font-size: 15px; text-align: right; background: var(--fill-2); color: var(--label); font-variant-numeric: tabular-nums; }
.adjrow input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--tint); }
.adjrow .mode { display: inline-flex; background: var(--fill); border-radius: 8px; padding: 2px; }
.adjrow .mode button { border: 0; background: transparent; padding: 0 9px; height: 30px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.adjrow .mode button[aria-pressed="true"] { background: var(--card); color: var(--label); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.adjrow .lbl-type { font-size: 13px; font-weight: 500; color: var(--label-2); grid-column: 1 / -1; margin-top: 8px; }
.adjrow .icon-btn { width: 30px; height: 30px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.add-row .btn { flex: 1 1 160px; }
.suggest { position: absolute; left: -8px; right: -8px; top: calc(100% + 2px); z-index: 50; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-radius: 13px; box-shadow: var(--shadow-pop); max-height: 300px; overflow-y: auto; padding: 5px; animation: pop .18s var(--spring); transform-origin: top; }
.suggest button { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 15px; color: var(--label); }
.suggest button:hover, .suggest button.on { background: var(--accent); color: #fff; }
.suggest button:hover small, .suggest button.on small, .suggest button:hover .rate, .suggest button.on .rate { color: rgba(255, 255, 255, .8); }
.suggest small { display: block; color: var(--label-2); font-size: 13px; }
.suggest .rate { color: var(--label-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 14px; }
.totals-box { display: grid; gap: 0; font-size: 17px; padding: 4px 16px; }
.totals-box .tr { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; padding: 10px 0; }
.totals-box .tr + .tr { box-shadow: 0 -.5px 0 var(--sep); }
.totals-box .tr span:first-child { color: var(--label); }
.totals-box .tr span:last-child { color: var(--label-2); }
.totals-box .grand { font-size: 20px; font-weight: 700; }
.totals-box .grand span:last-child { color: var(--label); }
.ed .card > .btn-row { margin: 0 0 10px; padding: 0 4px; }
#ed-due-quick .pill { height: 28px; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-b)); background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -.5px 0 var(--sep);
}
.savebar__total { flex: 1; min-width: 0; }
.savebar__total small { display: block; font-size: 12px; color: var(--label-2); font-weight: 500; }
.savebar__total b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.02em; }
@media (min-width: 1024px) { .savebar { left: var(--side-w); padding: 12px 48px; } }
.savebar .btn { min-height: 44px; }
.split { display: inline-flex; }
.split > .btn:first-child { border-radius: 999px 0 0 999px; padding-right: 14px; }
.split > .menu > summary.btn { border-radius: 0 999px 999px 0; padding: 0 12px; box-shadow: inset .5px 0 0 rgba(255, 255, 255, .35); }
.picker-list { display: grid; gap: 0; margin-top: 12px; background: var(--card); border-radius: var(--r); overflow: hidden; }
.picker-list:empty { display: none; }
.picker-list > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; background: none; text-align: left; position: relative; color: var(--label); }
.picker-list > button + button::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--sep); }
.picker-list > button:hover, .picker-list > button.on { background: var(--fill-2); }
.picker-list b { display: block; font-weight: 600; font-size: 17px; }
.picker-list span { font-size: 14px; color: var(--label-2); }
.picker-list p { margin: 0; padding: 4px 16px; }
.restore { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.show-sm { display: none !important; }
@media (max-width: 520px) {
  .hide-sm { display: none !important; }
  .show-sm { display: flex !important; }
  .savebar__total b { font-size: 18px; display: block; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 768px) { .hide-md { display: none; } }
@media (max-width: 1023px) { .page-head__actions .fab-dup { display: none; } }

/* =================================================== settings + misc */
.set-nav { margin-bottom: 22px; }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.swatches label { position: relative; }
.swatches input[type=radio] { position: absolute; opacity: 0; }
.swatches span { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .15); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--label-2); }
.logo-prev { max-height: 60px; max-width: 240px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; box-shadow: 0 0 0 .5px var(--sep); }
.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.vars code { font-size: 12.5px; background: var(--fill); color: var(--tint); padding: 4px 8px; border-radius: 6px; cursor: pointer; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.tbl-wrap { overflow-x: auto; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); font-weight: 500; padding: 12px 14px 8px; white-space: nowrap; }
.tbl td { padding: 11px 14px; box-shadow: inset 0 .5px 0 var(--sep); white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* stats (reports) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; margin-bottom: 22px; }
.stat { display: block; background: var(--card); border-radius: var(--r); padding: 12px 14px; color: inherit; text-decoration: none !important; box-shadow: var(--shadow-sm); min-width: 0; }
.stat__label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--label-2); }
.stat__label .ic { width: 15px; height: 15px; }
.stat__value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat__value small { font-size: .58em; font-weight: 600; color: var(--label-2); margin-right: 3px; letter-spacing: 0; }
.stat__foot { font-size: 13px; color: var(--label-2); margin-top: 1px; }

/* =================================================== login + public */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth__card { width: min(380px, 100%); }
.auth__logos { display: flex; justify-content: center; gap: 12px; margin-bottom: 28px; }
.auth__logos img { width: 54px; height: 54px; border-radius: 13px; box-shadow: 0 6px 16px rgba(0, 0, 0, .14), 0 0 0 .5px var(--sep); background: #fff; animation: pop .6s var(--spring) both; }
.auth__logos img:nth-child(2) { animation-delay: .06s; } .auth__logos img:nth-child(3) { animation-delay: .12s; } .auth__logos img:nth-child(4) { animation-delay: .18s; }
.auth h1 { font-size: 34px; font-weight: 700; letter-spacing: -.025em; text-align: center; margin-bottom: 6px; }
.auth .sub { text-align: center; color: var(--label-2); margin-bottom: 26px; font-size: 17px; }
.auth .btn { min-height: 50px; border-radius: 14px; font-size: 17px; }
.pub { max-width: 900px; margin: 0 auto; padding: 18px 16px 60px; }
.pub__bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.pub__bar .grow { flex: 1; min-width: 200px; }
.pub__bar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.pub__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pub__foot { text-align: center; color: var(--label-2); font-size: 13px; margin-top: 26px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .side, .savebar, .menu__panel, .toast, .suggest { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card); }
}
@media print {
  .side, .topbar, .tabbar, .no-print, .toast, .savebar, .doc-layout__side, .round-actions { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
  .paper { box-shadow: none; padding: 0; }
  .app, .doc-layout { display: block; }
}

/* terms box + trip pills */
textarea.terms-box { min-height: 160px; max-height: 420px; overflow-y: auto !important; font-size: 14px; line-height: 1.5; }
#t-inc .pill { cursor: pointer; gap: 6px; }
#t-inc .pill input { margin: 0; }

/* leads */
.nav__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ff3b30; color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.tab-ic { position: relative; display: block; }
.tab-badge { position: absolute; top: -4px; left: 15px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.dot-new { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff9500; margin-left: 4px; vertical-align: 2px; }
.seg-btn { flex: 1 0 auto; border: 0; background: none; padding: 7px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--label); cursor: pointer; }
.seg-btn[aria-pressed="true"] { background: var(--card); box-shadow: 0 3px 8px rgba(0, 0, 0, .12); font-weight: 600; }
@media (prefers-color-scheme: dark) { .seg-btn[aria-pressed="true"] { background: #636366; } }
.kv .k { flex: none; white-space: nowrap; }
.kv .v { flex: 1; min-width: 0; }
