* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--fog);
  color: var(--charcoal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---------- Stage: screen rail + scaled iPhone ---------- */
.stage { height: 100vh; height: 100dvh; display: flex; overflow: hidden; }
.rail {
  width: 260px; flex: none; height: 100%;
  background: var(--paper); box-shadow: 1px 0 0 var(--hair);
  display: flex; flex-direction: column;
}
.rail-head { padding: 24px 20px 12px; }
.rail-copy { font-size: 13px; line-height: 1.5; color: var(--slate); margin: 10px 0 0; }
.rail-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.rail-group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin: 18px 8px 6px; }
.rail-item {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 7px 12px; border-radius: var(--r-pill);
  font-size: 14.5px; font-weight: 500; color: var(--obsidian);
}
.rail-item:hover { background: var(--fog-2); }
.rail-item.on { background: var(--forest); color: var(--paper); }
.rail-foot { padding: 14px 20px 18px; box-shadow: 0 -1px 0 var(--hair); display: flex; flex-direction: column; gap: 8px; }
.rail-label { font-size: 12px; font-weight: 600; color: var(--obsidian); }
.rail-select { height: 38px; border-radius: var(--r-sm); border: 1px solid var(--pebble); background: var(--paper); padding: 0 10px; font-size: 14px; color: var(--obsidian); }
.rail-btns { display: flex; gap: 8px; }
.rail-btn { flex: 1; height: 36px; border-radius: var(--r-pill); border: 1px solid var(--forest); background: var(--paper); color: var(--forest); font-weight: 600; font-size: 13px; }
.rail-btn:hover { background: var(--linen); }
.rail-note { margin: 2px 0 0; font-size: 12px; color: var(--slate); line-height: 1.45; }

.stage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--paper); box-shadow: 0 1px 0 var(--hair); }
.topbar .rail-select { max-width: 60%; }
.device-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px; }
.device-box { position: relative; flex: none; }
.device {
  position: absolute; left: 0; top: 0;
  width: 414px; height: 868px; padding: 12px;
  border-radius: 60px; background: var(--obsidian);
  transform-origin: 0 0;
}
.device-island { position: absolute; top: 23px; left: 50%; transform: translateX(-50%); width: 122px; height: 35px; border-radius: 20px; background: #000; z-index: 200; }
.device-home { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 134px; height: 5px; border-radius: 3px; background: var(--obsidian); z-index: 200; opacity: .85; }
.app {
  position: relative; width: 390px; height: 844px;
  border-radius: 48px; overflow: hidden; overflow: clip;
  clip-path: inset(0 round 48px);
  background: var(--ground); isolation: isolate;
}
.statusbar {
  position: absolute; left: 0; right: 0; top: 0; height: 54px; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 34px 0 42px; pointer-events: none;
  font-size: 16px; font-weight: 600; color: var(--obsidian); letter-spacing: -0.01em;
}
.statusbar .sb-icons { display: flex; gap: 6px; align-items: center; }
.statusbar svg { display: block; }

@media (max-width: 820px) {
  .rail { display: none; }
  .topbar { display: flex; }
}
/* On a real phone: no frame, the app is the screen */
body.native { background: var(--ground); }
body.native .stage { display: block; }
body.native .rail, body.native .topbar, body.native .device-island, body.native .device-home, body.native .statusbar { display: none; }
body.native .device-wrap { padding: 0; display: block; height: 100dvh; }
body.native .device { position: static; width: 100%; height: 100dvh; padding: 0; border-radius: 0; background: var(--ground); transform: none !important; }
body.native .device-box { width: 100% !important; height: 100dvh !important; }
body.native .app { width: 100%; height: 100%; border-radius: 0; clip-path: none; --safe-top: max(env(safe-area-inset-top), 12px); --safe-bottom: max(env(safe-area-inset-bottom), 8px); }
/* Embedded in the landing page: the app screen only, sized by the host iframe */
body.embed { background: var(--ground); }
body.embed .stage { display: block; }
body.embed .rail, body.embed .topbar, body.embed .device-island, body.embed .device-home { display: none; }
body.embed .device-wrap { padding: 0; display: block; height: 100vh; }
body.embed .device { position: static; width: 100%; height: 100vh; padding: 0; border-radius: 0; background: var(--ground); transform: none !important; }
body.embed .device-box { width: 100% !important; height: 100vh !important; }
body.embed .app { width: 100%; height: 100%; border-radius: 0; clip-path: none; }

/* ---------- Views ---------- */
.views { position: absolute; inset: 0; }
.view {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--ground);
  padding-top: var(--safe-top);
  transition: transform .34s var(--ease);
  will-change: transform;
}
.view.at-right { transform: translateX(100%); }
.view.at-left { transform: translateX(-26%); }
.view.hidden { visibility: hidden; }
.view.has-tabbar .scroll { padding-bottom: 120px; }

.nav {
  flex: none;
  height: 52px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 8px; }
.nav-right { justify-content: flex-end; }
.nav-title { font-size: 17px; font-weight: 600; color: var(--obsidian); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; text-align: center; }
.nav-text-btn { border: 0; background: none; font-size: 16px; font-weight: 600; color: var(--forest); padding: 10px 6px; min-height: 44px; }
.nav-text-btn:disabled { color: var(--pebble); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--fog-2); color: var(--forest);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; position: relative;
}
.icon-btn:active { background: var(--fog); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--fog-2); }

.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 16px 40px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }

.large-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 40px;
  line-height: .92;
  letter-spacing: -0.035em;
  color: var(--obsidian);
  margin: 4px 0 20px;
}
.h2 { font-family: var(--font-display); font-weight: 900; font-size: 28px; line-height: 1; letter-spacing: -0.03em; color: var(--obsidian); margin: 0; }
.h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--obsidian); margin: 0; }
.section-label { font-size: 14px; font-weight: 600; color: var(--obsidian); margin: 24px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.section-label .link { font-weight: 600; }
.muted { color: var(--slate); }
.small { font-size: 14px; }
.micro { font-size: 12px; }
.link { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
.center { text-align: center; }

/* ---------- Footer bar ---------- */
.footer {
  flex: none;
  padding: 12px 16px calc(var(--safe-bottom) + 8px);
  background: var(--ground);
  box-shadow: 0 -1px 0 var(--hair);
  display: flex; gap: 10px;
}
.footer > * { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 48px; padding: 0 24px;
  border-radius: var(--r-pill);
  border: 0;
  font-size: 16px; font-weight: 600; letter-spacing: -0.006em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--lime); color: var(--forest); }
.btn-primary:active { background: var(--lime-press); }
.btn-dark { background: var(--forest); color: var(--paper); }
.btn-secondary { background: var(--paper); color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.btn-secondary:active { background: var(--linen); }
.btn-soft { background: var(--fog-2); color: var(--forest); }
.btn-soft:active { background: var(--fog); }
.btn-danger { background: var(--paper); color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 14px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.fab {
  position: absolute; right: 16px; bottom: calc(84px + 16px); z-index: 20;
  min-height: 56px; min-width: 56px; padding: 0 22px 0 18px;
  border-radius: var(--r-pill); border: 0;
  background: var(--lime); color: var(--forest);
  font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: padding .25s var(--ease), gap .25s var(--ease), background .15s;
  box-shadow: 0 0 0 1px rgba(14,15,12,.06);
}
.fab svg { width: 22px; height: 22px; }
.fab:active { background: var(--lime-press); }
.fab-label { display: inline-block; max-width: 160px; overflow: hidden; white-space: nowrap; transition: max-width .25s var(--ease), opacity .2s; }
.fab.mini { padding: 0; gap: 0; }
.fab.mini .fab-label { max-width: 0; opacity: 0; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  height: 84px; padding: 6px 6px 0;
  background: var(--ground);
  box-shadow: 0 -1px 0 var(--hair);
  display: grid; grid-template-columns: repeat(5, 1fr);
  transition: transform .3s var(--ease);
}
.tabbar.gone { transform: translateY(100%); }
.tab {
  border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding-top: 2px;
  font-size: 11px; font-weight: 500; color: var(--slate);
}
.tab-ico { width: 56px; height: 32px; border-radius: var(--r-pill); display: flex; align-items: center; justify-content: center; transition: background .2s; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--forest); font-weight: 600; }
.tab.on .tab-ico { background: var(--linen); }

/* ---------- Segmented / chips ---------- */
.seg { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; min-height: 40px; padding: 0 18px;
  border-radius: var(--r-pill); border: 0;
  background: var(--fog-2); color: var(--charcoal);
  font-size: 15px; font-weight: 500;
}
.seg button.on { background: var(--forest); color: var(--paper); }
.seg.outline button { background: var(--paper); box-shadow: inset 0 0 0 1px rgba(14,15,12,.14); }
.seg.outline button.on { background: var(--forest); box-shadow: none; color: var(--paper); }
.seg.full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fog-2); padding: 4px; border-radius: var(--r-pill); gap: 4px; }
.seg.full button { background: none; min-height: 36px; }
.seg.full button.on { background: var(--paper); color: var(--forest); box-shadow: var(--ring); font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); border: 0;
  background: var(--fog-2); color: var(--forest);
  font-size: 14px; font-weight: 500;
}
.chip svg { width: 16px; height: 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--fog-2);
  margin-bottom: 16px; color: var(--slate);
}
.search svg { width: 20px; height: 20px; flex: none; }
.search input { border: 0; background: none; outline: none; flex: 1; font-size: 16px; color: var(--obsidian); min-width: 0; }
.search input::placeholder { color: var(--slate); }

/* ---------- Cards / groups / rows ---------- */
.group { background: var(--fog-2); border-radius: var(--r-sm); overflow: hidden; }
.group + .group { margin-top: 12px; }
.row {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px;
  border: 0; background: none; text-align: left;
  position: relative;
}
button.row:active, a.row:active { background: var(--fog); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.row-ico {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper); color: var(--forest);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.row-ico svg { width: 20px; height: 20px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title, .row-sub { display: block; }
.row-title { font-size: 16px; font-weight: 500; color: var(--obsidian); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 14px; color: var(--slate); line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub.wrap { white-space: pre-line; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right; }
.row-val { font-size: 16px; font-weight: 600; color: var(--obsidian); }
.row-val.muted { font-weight: 500; color: var(--slate); }
.chev { width: 18px; height: 18px; color: var(--pebble); flex: none; }
.row.add { color: var(--forest); font-weight: 600; }
.row.add .row-ico { background: var(--linen); }
.row.danger .row-title { color: var(--red); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--fog); color: var(--forest);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex: none; letter-spacing: -0.01em;
}
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.linen { background: var(--linen); }

.doc-row { border: 0; background: none; width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-radius: var(--r-sm); position: relative; }
.doc-row:active { background: var(--fog-2); }
.doc-row + .doc-row::before { content: ""; position: absolute; top: 0; left: 60px; right: 4px; height: 1px; background: var(--hair); }

.month-head { font-size: 13px; font-weight: 600; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; margin: 20px 4px 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.b-draft { background: var(--fog); color: var(--charcoal); }
.b-sent { background: var(--fog-2); color: var(--forest); box-shadow: var(--ring-inset); }
.b-viewed { background: var(--blue-soft); color: var(--blue); }
.b-partial { background: var(--amber-soft); color: var(--amber); }
.b-overdue { background: var(--red-soft); color: #a51d24; }
.b-paid, .b-approved { background: var(--linen); color: var(--forest); }
.b-declined { background: var(--red-soft); color: #a51d24; }
.b-invoiced { background: var(--forest); color: var(--paper); }
.b-plan { background: var(--linen); color: var(--forest); }

/* ---------- Hero summary ---------- */
.hero {
  background: var(--forest); color: var(--paper);
  border-radius: var(--r-lg); padding: 24px;
  margin-bottom: 20px;
}
.hero-label { font-size: 14px; font-weight: 500; color: var(--on-ink-muted); }
.hero-amount { font-family: var(--font-display); font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: -0.035em; margin: 8px 0 16px; color: var(--paper); }
.hero-stats { display: flex; gap: 24px; }
.hero-stat b { display: block; font-size: 17px; font-weight: 600; color: var(--paper); }
.hero-stat span { font-size: 13px; color: var(--on-ink-muted); }
.hero-stat.warn b { color: var(--lime); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .field .label { font-size: 14px; font-weight: 500; color: var(--charcoal); }
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  border-radius: var(--r-sm);
  border: 1px solid var(--pebble);
  background: var(--paper);
  padding: 12px 14px;
  font-size: 16px; color: var(--obsidian);
  outline: none;
  transition: box-shadow .15s, border-color .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.input::placeholder, .textarea::placeholder { color: var(--pebble); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--forest) 50%), linear-gradient(135deg, var(--forest) 50%, transparent 50%); background-position: right 19px center, right 13px center; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: 1.3fr .8fr .9fr; }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--slate); font-size: 15px; pointer-events: none; }
.input-affix .input { padding-right: 36px; }
.hint { font-size: 13px; color: var(--slate); line-height: 1.45; }

/* Inline form rows inside a group */
.frow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px; position: relative; }
.frow + .frow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.frow label { font-size: 16px; color: var(--slate); flex: none; min-width: 64px; }
.frow input, .frow select, .frow textarea { flex: 1; border: 0; background: none; outline: none; font-size: 16px; text-align: left; color: var(--obsidian); min-width: 0; padding: 8px 0; }
.frow textarea { text-align: left; min-height: 60px; resize: none; }
.frow select { direction: rtl; appearance: none; color: var(--forest); font-weight: 500; }
.frow input::placeholder { color: var(--pebble); }
.frow.stack { flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px; }
.frow.stack label { font-size: 13px; color: var(--slate); min-width: 0; }
.frow.stack input, .frow.stack textarea { text-align: left; padding: 2px 0; }

/* Switch */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--fog); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 1px rgba(14,15,12,.08); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--forest); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--forest); outline-offset: 2px; }

/* Radio list */
.opt { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border: 0; background: none; text-align: left; font-size: 16px; color: var(--obsidian); position: relative; }
.opt + .opt::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.opt:active { background: var(--fog); }
.opt .check { margin-left: auto; width: 22px; height: 22px; color: var(--forest); }
.opt .opt-sub { display: block; font-size: 14px; color: var(--slate); }

/* ---------- Editor (document) ---------- */
.ed-card { background: var(--fog-2); border-radius: var(--r-sm); margin-bottom: 12px; overflow: hidden; }
.ed-head { display: flex; gap: 12px; padding: 16px; border: 0; background: none; width: 100%; text-align: left; align-items: flex-start; }
.ed-head:active { background: var(--fog); }
.logo-box { width: 56px; height: 56px; border-radius: var(--r-sm); background: var(--paper); box-shadow: var(--ring-inset); display: flex; align-items: center; justify-content: center; color: var(--pebble); overflow: hidden; flex: none; }
.logo-box img { width: 100%; height: 100%; object-fit: contain; }
.logo-box svg { width: 22px; height: 22px; }
.ed-meta { margin-left: auto; text-align: right; }
.ed-num { font-size: 17px; font-weight: 700; color: var(--obsidian); }
.item-row .row-sub { white-space: normal; }
.totals .trow { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 10px 16px; border: 0; background: none; width: 100%; font-size: 16px; color: var(--charcoal); position: relative; text-align: left; }
.totals button.trow:active { background: var(--fog); }
.totals .trow + .trow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.totals .trow b { color: var(--obsidian); font-weight: 600; }
.totals .trow .tval { display: flex; align-items: center; gap: 6px; color: var(--obsidian); }
.totals .trow.total { font-weight: 700; color: var(--obsidian); font-size: 17px; }
.totals .trow.balance { background: var(--forest); color: var(--paper); font-weight: 600; min-height: 60px; }
.totals .trow.balance .tval { color: var(--paper); font-family: var(--font-display); font-weight: 900; font-size: 26px; letter-spacing: -0.03em; }
.totals .trow.balance::before { display: none; }

.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r-sm); margin-bottom: 12px; font-size: 14px; line-height: 1.45; }
.banner svg { width: 22px; height: 22px; flex: none; }
.banner b { color: inherit; }
.banner.ok { background: var(--linen); color: var(--forest); }
.banner.info { background: var(--blue-soft); color: var(--blue); }
.banner.warn { background: var(--red-soft); color: #a51d24; }
.banner.amber { background: var(--amber-soft); color: var(--amber); }
.banner .btn { margin-left: auto; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px 16px; }
.photo { aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; border: 0; padding: 0; background: var(--fog); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: var(--paper); box-shadow: var(--ring-inset); color: var(--forest); font-size: 13px; font-weight: 600; }
.photo.add svg { width: 22px; height: 22px; }

.sig-img { height: 64px; object-fit: contain; object-position: left; }
.sig-pad-wrap { position: relative; background: var(--paper); border-radius: var(--r-sm); box-shadow: var(--ring-inset); height: 220px; touch-action: none; }
.sig-pad-wrap canvas { width: 100%; height: 100%; display: block; }
.sig-line { position: absolute; left: 24px; right: 24px; bottom: 48px; border-bottom: 1px dashed var(--pebble); pointer-events: none; }
.sig-x { position: absolute; left: 24px; bottom: 54px; color: var(--pebble); font-size: 20px; pointer-events: none; }

/* Timeline */
.timeline { position: relative; padding-left: 8px; }
.tl-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--fog); }
.tl-item:last-child::before { display: none; }
.tl-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--fog-2); color: var(--forest); display: flex; align-items: center; justify-content: center; flex: none; }
.tl-ico svg { width: 20px; height: 20px; }
.tl-ico.ok { background: var(--linen); }
.tl-ico.blue { background: var(--blue-soft); color: var(--blue); }
.tl-ico.red { background: var(--red-soft); color: var(--red); }
.tl-text { padding-top: 2px; }
.tl-text b { display: block; font-size: 16px; font-weight: 600; color: var(--obsidian); }
.tl-text span { font-size: 14px; color: var(--slate); }

/* ---------- Sheets ---------- */
.layer-root { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.sheet-wrap { position: absolute; inset: 0; pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: rgba(14, 15, 12, .42); opacity: 0; transition: opacity .3s; border: 0; padding: 0; width: 100%; cursor: default; }
.sheet-wrap.open .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: calc(100% - var(--safe-top) - 8px);
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .36s var(--ease);
}
.sheet.full { top: calc(var(--safe-top) - 8px); }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fog); margin: 8px auto 0; flex: none; }
.sheet-head { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px 8px 4px; min-height: 52px; }
.sheet-head .nav-right { justify-content: flex-end; }
.sheet-title { font-size: 17px; font-weight: 600; color: var(--obsidian); text-align: center; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px calc(var(--safe-bottom) + 20px); scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-foot { flex: none; padding: 12px 16px calc(var(--safe-bottom) + 8px); box-shadow: 0 -1px 0 var(--hair); display: flex; gap: 10px; }
.sheet-foot > * { flex: 1; }

.action-title { font-size: 14px; color: var(--slate); text-align: center; padding: 8px 16px 12px; }
.action-list .row-title { font-weight: 500; }

/* Dialog */
.dialog-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; padding: 24px; }
.dialog-wrap .backdrop { opacity: 0; }
.dialog-wrap.open .backdrop { opacity: 1; }
.dialog { position: relative; width: 100%; max-width: 320px; background: var(--paper); border-radius: var(--r-lg); padding: 24px; transform: scale(.94); opacity: 0; transition: transform .22s var(--ease), opacity .2s; }
.dialog-wrap.open .dialog { transform: scale(1); opacity: 1; }
.dialog h3 { margin: 0 0 8px; font-size: 20px; font-weight: 700; color: var(--obsidian); letter-spacing: -0.01em; }
.dialog p { margin: 0 0 20px; font-size: 15px; line-height: 1.5; color: var(--charcoal); }
.dialog .btns { display: flex; flex-direction: column; gap: 8px; }

/* Toast */
.toasts { position: absolute; top: calc(var(--safe-top) + 4px); left: 16px; right: 16px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill); background: var(--forest); color: var(--paper); font-size: 15px; font-weight: 500; transform: translateY(-16px); opacity: 0; transition: transform .3s var(--ease), opacity .3s; max-width: 100%; pointer-events: auto; }
.toast.in { transform: translateY(0); opacity: 1; }
.toast svg { width: 20px; height: 20px; color: var(--lime); flex: none; }

/* Empty */
.empty { text-align: center; padding: 48px 24px; }
.empty-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--linen); color: var(--forest); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty-ico svg { width: 32px; height: 32px; }
.empty h3 { font-size: 20px; font-weight: 700; color: var(--obsidian); margin: 0 0 6px; }
.empty p { margin: 0 0 20px; color: var(--slate); font-size: 15px; line-height: 1.5; }

/* ---------- Onboarding ---------- */
.ob { position: absolute; inset: 0; z-index: 45; overflow: hidden; background: var(--ground); display: flex; flex-direction: column; padding-top: var(--safe-top); }
.ob-hero { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px 24px 8px; }
.ob-display { font-family: var(--font-display); font-weight: 900; font-size: 60px; line-height: .86; letter-spacing: -0.045em; color: var(--forest); margin: 0 0 20px; }
.ob-lead { font-size: 18px; line-height: 1.5; color: var(--charcoal); margin: 0 0 8px; }
.ob-art { flex: none; margin: 8px 24px 0; }
.ob-foot { padding: 16px 24px calc(var(--safe-bottom) + 12px); display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.ob-steps { display: flex; gap: 6px; padding: 14px 24px 0; }
.ob-steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--fog); }
.ob-steps span.on { background: var(--forest); }

.mini-invoice { background: var(--forest); border-radius: var(--r-lg); padding: 20px; color: var(--paper); }
.mini-invoice .mi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.mini-invoice .mi-amt { font-family: var(--font-display); font-weight: 900; font-size: 40px; letter-spacing: -0.035em; line-height: 1; }
.mini-invoice .mi-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--on-ink-muted); padding: 8px 0; border-top: 1px solid rgba(255,255,255,.14); }
.mini-invoice .mi-paid { display: inline-flex; align-items: center; gap: 6px; background: var(--lime); color: var(--forest); font-weight: 600; font-size: 13px; padding: 4px 12px; border-radius: var(--r-pill); }
.mini-invoice .mi-paid svg { width: 16px; height: 16px; }

/* ---------- Paywall ---------- */
.pw-head { padding: 8px 0 16px; }
.plans { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.plan { width: 100%; text-align: left; border: 0; background: var(--fog-2); border-radius: var(--r-sm); padding: 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--ring-inset); }
.plan.on { background: var(--linen); box-shadow: inset 0 0 0 2px var(--forest); }
.plan-radio { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--pebble); flex: none; margin-top: 2px; display: flex; align-items: center; justify-content: center; }
.plan.on .plan-radio { box-shadow: inset 0 0 0 7px var(--forest); }
.plan-name { font-size: 17px; font-weight: 700; color: var(--obsidian); display: flex; gap: 8px; align-items: center; }
.plan-desc { font-size: 14px; color: var(--charcoal); margin-top: 4px; line-height: 1.45; }
.plan-price { margin-left: auto; text-align: right; flex: none; }
.plan-price b { display: block; font-size: 17px; color: var(--obsidian); }
.plan-price span { font-size: 12px; color: var(--slate); }
.feat { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--charcoal); padding: 6px 0; line-height: 1.45; }
.feat svg { width: 20px; height: 20px; color: var(--forest); flex: none; margin-top: 1px; }

/* ---------- Reports ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat { background: var(--fog-2); border-radius: var(--r-sm); padding: 16px; }
.stat span { font-size: 13px; color: var(--slate); font-weight: 500; }
.stat b { display: block; font-size: 22px; font-weight: 700; color: var(--obsidian); letter-spacing: -0.02em; margin-top: 4px; }
.stat.dark { background: var(--forest); }
.stat.dark span { color: var(--on-ink-muted); }
.stat.dark b { color: var(--paper); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 150px; padding: 16px 16px 0; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; border: 0; background: none; padding: 0; }
.bar { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--forest); min-height: 3px; transition: height .4s var(--ease); }
.bar.zero { background: var(--fog); }
.bar-col.on .bar { background: var(--spruce); box-shadow: 0 0 0 2px var(--lime); }
.bar-lbl { font-size: 11px; color: var(--slate); padding-bottom: 12px; }
.chart-card { background: var(--fog-2); border-radius: var(--r-sm); margin-bottom: 12px; }
.chart-cap { display: flex; justify-content: space-between; padding: 16px 16px 0; font-size: 14px; color: var(--slate); }
.chart-cap b { color: var(--obsidian); font-size: 15px; }
.progress { height: 6px; border-radius: 3px; background: var(--fog); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--forest); border-radius: 3px; }

/* ---------- Templates ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tpl { border: 0; padding: 0; background: none; text-align: center; font-size: 13px; font-weight: 500; color: var(--charcoal); }
.tpl-thumb { aspect-ratio: 612/792; border-radius: 8px; overflow: hidden; background: var(--paper); box-shadow: var(--ring); margin-bottom: 6px; position: relative; }
.tpl.on .tpl-thumb { box-shadow: 0 0 0 2px var(--forest), 0 0 0 5px var(--linen); }
.tpl.on { color: var(--forest); font-weight: 700; }
.tpl-thumb .pdf { pointer-events: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.swatch svg { width: 20px; height: 20px; }
.swatch.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--obsidian); }

/* Preview frame */
.preview-wrap { background: var(--fog); margin: 0 -16px; padding: 16px; }
.preview-page { background: var(--paper); box-shadow: var(--ring); border-radius: 4px; overflow: hidden; }
.preview-page .pdf { zoom: .585; }
.tpl-thumb .pdf { zoom: .17; }

/* Client portal */
.portal { background: var(--fog-2); min-height: 100%; }
.portal-bar { display: flex; align-items: center; gap: 8px; margin: 0 16px 12px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--paper); box-shadow: var(--ring); font-size: 13px; color: var(--slate); }
.portal-bar svg { width: 14px; height: 14px; }
.pay-methods { display: flex; flex-direction: column; gap: 10px; }

/* Help */
details.faq { background: var(--fog-2); border-radius: var(--r-sm); margin-bottom: 8px; }
details.faq summary { list-style: none; padding: 16px; font-size: 16px; font-weight: 500; color: var(--obsidian); cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary svg { width: 18px; height: 18px; color: var(--forest); transition: transform .2s; flex: none; margin-top: 2px; }
details.faq[open] summary svg { transform: rotate(180deg); }
details.faq p { margin: 0; padding: 0 16px 16px; font-size: 15px; line-height: 1.55; color: var(--charcoal); }

.suggest { background: var(--paper); border-radius: var(--r-sm); box-shadow: var(--ring); margin-top: -8px; margin-bottom: 14px; overflow: hidden; }
.suggest .row { min-height: 48px; padding: 8px 14px; }

.kv { display: flex; justify-content: space-between; font-size: 15px; padding: 6px 0; }
.kv span { color: var(--slate); }
.kv b { color: var(--obsidian); font-weight: 600; }

.qr-box { width: 120px; height: 120px; background: var(--paper); border-radius: var(--r-sm); padding: 8px; box-shadow: var(--ring); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden-input { display: none; }

:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.row .check { width: 22px; height: 22px; color: var(--forest); flex: none; }
.row:disabled { opacity: .5; cursor: default; }
.avatar svg { width: 20px; height: 20px; }

/* ---------- v2 additions ---------- */
.wordmark { font-family: var(--font-display); font-weight: 900; letter-spacing: -0.03em; color: var(--forest); line-height: 1; }
.lockup .logo-mark { flex: none; display: block; }
.badge svg { width: 12px; height: 12px; stroke-width: 2.2; }
.avatar.t-linen { background: var(--linen); color: var(--forest); }
.avatar.t-blue { background: var(--blue-soft); color: var(--blue); }
.avatar.t-amber { background: var(--amber-soft); color: var(--amber); }
.avatar.t-red { background: var(--red-soft); color: #a51d24; }
.avatar.t-fog { background: var(--fog); color: var(--forest); }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-divider { height: 1px; background: rgba(255,255,255,.16); margin: 0 0 14px; }
.hero-stat span.lbl { display: flex; align-items: center; gap: 6px; }
.hero-stat span.lbl svg { width: 14px; height: 14px; }
.month-head.soft { text-transform: none; letter-spacing: -0.005em; font-size: 14px; font-weight: 500; color: var(--slate); }

/* Onboarding v2 */
.ob-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 8px 24px 0; scrollbar-width: none; }
.ob-body::-webkit-scrollbar { display: none; }
.ob-head { display: flex; align-items: center; gap: 12px; padding: 4px 16px 0; min-height: 52px; }
.ob-head .ob-steps { flex: 1; padding: 0; }
.ob-anim { animation: obIn .38s var(--ease) both; }
@keyframes obIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.ob-welcome-title { font-family: var(--font-display); font-weight: 900; font-size: 46px; line-height: .9; letter-spacing: -0.045em; color: var(--forest); margin: 26px 0 14px; }

