/* FirmDesk's look: Zoho Books' iPhone app as the firm showed it (TODO E7) — light grey page, white
   rounded cards, the system font, blue accents — in the firm's own drawing, with the iPad and laptop
   versions (plans/devices.md). Moves only by transform and opacity. */
:root {
  --bg: #F2F3F7; --card: #FFFFFF; --ink: #111827; --ink-2: #374151; --muted: #6B7280; --faint: #9CA3AF; --line: #E5E7EB; --line-2: #EEF0F4;
  --blue: #2F6FED; --blue-ink: #1D4ED8; --blue-soft: #E8F0FE; --blue-bg: #EEF4FF; --navy: #16203A; --ansv: #1F4DB5;
  --green: #16A34A; --green-soft: #E7F6EC; --red: #DC2626; --red-soft: #FDECEC; --orange: #D97706; --orange-soft: #FEF3E2; --grey-soft: #F1F2F4;
  --amber: #C98A1E; --r-card: 20px; --r-row: 14px; --shadow: 0 1px 2px rgba(17,24,39,.04), 0 4px 16px rgba(17,24,39,.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --ease: cubic-bezier(0.32, 0.72, 0, 1); --tabbar-h: 74px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 400 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0 0 8px; }
[hidden] { display: none !important; }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ loading screen (matches the iPhone launch image) */
#boot { position: fixed; inset: 0; background: #FFFFFF; display: grid; place-items: center; z-index: 100; }
#boot img { width: 180px; height: auto; }
#boot .boot-line { position: absolute; left: 50%; top: calc(50% + 70px); width: 120px; height: 3px; margin-left: -60px; border-radius: 3px; background: #E8EEFC; overflow: hidden; }
#boot .boot-line i { display: block; height: 100%; width: 40%; background: var(--ansv); border-radius: 3px; animation: boot 1.1s var(--ease) infinite; }
@keyframes boot { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { #boot .boot-line i { animation: none; width: 100%; } }

/* ------------------------------------------------------------ sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); background: linear-gradient(180deg, #EEF3FF 0%, var(--bg) 60%); overflow: auto; height: 100%; }
.signin-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 28px 22px 22px; box-shadow: var(--shadow); }
.signin-card .logo { display: block; width: 170px; margin: 0 auto 18px; }
.signin-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.signin-card .lead { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.signin-card .field { padding: 0; border: 0; display: block; margin-bottom: 12px; }
.signin-card .field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.signin-card .input { width: 100%; background: var(--grey-soft); border-radius: 12px; padding: 13px 14px; text-align: left; }
.signin-card .btn-pill.primary { width: 100%; padding: 14px; margin-top: 6px; font-size: 17px; }
.signin-card .error { color: var(--red); font-size: 14px; min-height: 20px; text-align: center; margin-top: 8px; }

/* ------------------------------------------------------------ buttons */
.btn-pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 15px; background: var(--card); border: 1px solid var(--line); transition: transform .12s ease; white-space: nowrap; }
.btn-pill:active { transform: scale(0.97); }
.btn-pill.primary { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 2px 8px rgba(47,111,237,.25); }
.btn-pill.dark { background: #0B1020; color: #fff; border-color: #0B1020; }
.btn-pill.ghost { background: rgba(255,255,255,.9); }
.btn-pill.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-pill.small { padding: 6px 12px; font-size: 14px; }
.btn-pill[disabled] { opacity: .5; }
.btn-pill.busy { opacity: .7; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); transition: transform .12s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn.plain { border: 0; background: transparent; }
.link-btn { color: var(--blue); font-weight: 600; }
.fab { position: fixed; right: calc(18px + var(--safe-r)); bottom: calc(var(--tabbar-h) + 16px + var(--safe-b)); width: 60px; height: 60px; border-radius: 999px; background: #0B1020; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 20; transition: transform .15s; }
.fab:active { transform: scale(.94); }
.form-regular .fab { display: none; }

/* ------------------------------------------------------------ app frame */
#app { height: 100%; }
.app { height: 100%; position: relative; }
.main { position: absolute; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); will-change: transform; contain: layout paint; }
.nav-bar { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; padding: calc(6px + var(--safe-t)) calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l)); background: rgba(242,243,247,.86); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.screen.scrolled .nav-bar { border-bottom-color: var(--line); }
.nav-left { display: flex; align-items: center; min-width: 0; }
.nav-back { display: inline-flex; align-items: center; gap: 2px; color: var(--blue); font-size: 17px; height: 40px; padding-right: 8px; }
.nav-back span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-title { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .18s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw; text-align: center; }
.screen.scrolled .nav-title, .nav-bar.always .nav-title { opacity: 1; }
.nav-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 calc(16px + var(--safe-r)) calc(var(--tabbar-h) + 40px + var(--safe-b)) calc(16px + var(--safe-l)); }
.large-title { padding: 2px 4px 14px; }
.large-title h1 { font-size: 32px; letter-spacing: -0.02em; line-height: 1.15; }
.large-sub { color: var(--muted); font-size: 15px; margin-top: 2px; }

/* tab bar: a floating pill */
.tabbar { position: absolute; left: calc(14px + var(--safe-l)); right: calc(14px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); height: 64px; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; padding: 6px; border-radius: 999px; background: rgba(255,255,255,.82); backdrop-filter: saturate(1.8) blur(22px); -webkit-backdrop-filter: saturate(1.8) blur(22px); box-shadow: 0 6px 24px rgba(17,24,39,.12), 0 0 0 1px rgba(17,24,39,.05); }
.tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 52px; font-size: 11px; font-weight: 500; color: var(--ink-2); }
.tab.on { color: var(--blue); }
.tab-pill { position: absolute; left: 0; top: 6px; height: 52px; width: 20%; border-radius: 999px; background: rgba(17,24,39,.07); transition: transform .3s var(--ease), width .3s var(--ease); z-index: 0; }
.has-sheet .tabbar { pointer-events: none; }

/* regular: sidebar + workspace */
.form-regular { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: minmax(0, 1fr); }
.sidebar { height: 100%; display: flex; flex-direction: column; background: #FBFBFD; border-right: 1px solid var(--line); padding-top: var(--safe-t); z-index: 40; }
.side-head { padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; }
.side-head img { height: 34px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 20px; }
.side-group { margin-bottom: 6px; }
.side-label { font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding: 12px 10px 4px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 14.5px; color: var(--ink-2); }
.side-item:hover { background: var(--line-2); }
.side-item.on { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + var(--safe-b)); display: flex; align-items: center; gap: 10px; }
.workspace { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.workspace .main { position: relative; flex: 1; inset: auto; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .search-wrap { flex: 1; max-width: 520px; }
.topbar .spacer { flex: 1; }
.topbar .side-toggle { display: none; }
.form-regular .scroll { padding-bottom: 40px; }
.form-regular .nav-bar { padding-top: 6px; background: var(--bg); }
.split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; height: 100%; }
.split .list-pane { position: relative; border-right: 1px solid var(--line); container-type: inline-size; }
.split .detail-pane { position: relative; background: var(--bg); }
.single { position: relative; height: 100%; container-type: inline-size; }
.empty-pane { height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--faint); text-align: center; padding: 40px; }
html[data-form="laptop"] .split:not(.has-detail) { grid-template-columns: 1fr 0; }
html[data-form="laptop"] .split:not(.has-detail) .detail-pane { display: none; }
.split { transition: grid-template-columns .25s var(--ease); }
/* iPad portrait: the sidebar slides over */
@media (orientation: portrait) {
  html[data-form="ipad"] .form-regular { grid-template-columns: 1fr; }
  html[data-form="ipad"] .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-100%); transition: transform .35s var(--ease); box-shadow: 0 0 40px rgba(0,0,0,.15); }
  html[data-form="ipad"].side-open .sidebar { transform: none; }
  html[data-form="ipad"] .topbar .side-toggle { display: inline-grid; }
  html[data-form="ipad"] .side-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 39; }
  html[data-form="ipad"].side-open .side-scrim { opacity: 1; pointer-events: auto; }
}

/* ------------------------------------------------------------ cards */
.card { background: var(--card); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { font-size: 18px; font-weight: 600; color: var(--ink-2); flex: 1; display: flex; align-items: center; gap: 10px; }
.card-head .ic { color: var(--muted); }
.card-sub { color: var(--muted); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--blue-bg); border-radius: 16px; padding: 16px; }
.tile .tile-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: #fff; margin-bottom: 12px; color: var(--ink); }
.tile .tile-label { color: var(--ink-2); font-size: 15px; }
.tile .tile-value { font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { color: var(--ink-2); font-size: 15px; }
.stat .v { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pale-red { background: #FCEDEE; border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: center; }
.pale-red b { font-size: 22px; }
.pale-blue { background: #EEF1F8; border-radius: 16px; padding: 18px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.quick .qi { width: 60px; height: 60px; border-radius: 16px; background: var(--grey-soft); display: grid; place-items: center; color: var(--ink); transition: transform .12s; }
.quick button:active .qi { transform: scale(.94); }
.toggle2 { display: inline-flex; background: var(--grey-soft); border-radius: 999px; padding: 3px; }
.toggle2 button { padding: 7px 16px; border-radius: 999px; font-weight: 500; font-size: 15px; color: var(--ink-2); }
.toggle2 button.on { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.1); color: var(--ink); }
.period-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; color: var(--ink-2); }
.totals2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.totals2 > div { border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.totals2 .in { color: var(--blue); } .totals2 .out { color: #EA6A2C; }
.totals2 b { display: block; font-size: 19px; color: var(--ink); }
.note { color: var(--muted); font-size: 13.5px; font-style: italic; margin-top: 12px; }
.timer-card { background: #DCEAFE; border-radius: 18px; padding: 26px 18px 22px; text-align: center; }
.timer-card .clock { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.timer-card .what { margin: 10px 0 18px; font-size: 18px; }
.timer-card .row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.timer-card .row-btns button { padding: 14px; border-radius: 12px; font-weight: 600; font-size: 17px; background: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.timer-card .row-btns .go { background: #0B1020; color: #fff; }
.line-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #F7F8FB; border-radius: 14px; margin-top: 12px; font-size: 16px; }
.line-row b { font-size: 18px; }
.home-tabs { display: flex; gap: 22px; padding: 0 4px 10px; overflow-x: auto; }
.home-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; color: var(--muted); font-size: 16px; border-bottom: 2px solid transparent; white-space: nowrap; }
.home-tabs button.on { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
.org-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; }
.org-head .org-logo { width: 44px; height: 44px; border-radius: 999px; background: #fff; display: grid; place-items: center; box-shadow: var(--shadow); overflow: hidden; font-size: 11px; font-weight: 700; color: var(--ansv); }
.org-head .org-name { font-size: 20px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 6px; }
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
html[data-size="regular"] .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
html[data-form="laptop"] .dash-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid .span-all { grid-column: 1 / -1; }
.recv { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.recv .stack { display: grid; gap: 10px; }

/* ------------------------------------------------------------ lists */
.list-tools { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; background: #E9EAEF; border-radius: 12px; padding: 0 12px; color: var(--muted); }
.search-wrap .input.search { border: 0; background: transparent; padding: 10px 0; flex: 1; min-width: 0; outline: none; text-align: left; color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; width: 100%; order: 3; padding: 2px 0; }
.chip { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 15px; white-space: nowrap; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(47,111,237,.3); }
.rows { background: var(--card); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); }
.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); transition: background .12s; min-height: 64px; }
.row:last-child { border-bottom: 0; }
.row:active, .row.selected { background: var(--blue-soft); }
.row:not(:has(.avatar)) { grid-template-columns: 1fr auto; }
.row .c-col { display: none; }
.c-main { display: flex; flex-direction: column; min-width: 0; }
.r-title { font-weight: 600; font-size: 16.5px; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-right { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.r-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.avatar { display: inline-grid; place-items: center; border-radius: 999px; color: #fff; font-weight: 600; flex: none; }
.list-count { color: var(--faint); font-size: 13px; text-align: center; padding: 12px; }
.table-head { display: none; }
.empty { padding: 48px 20px; display: grid; justify-items: center; gap: 12px; color: var(--faint); text-align: center; }
.empty p { color: var(--muted); max-width: 280px; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-orange { background: var(--orange-soft); color: var(--orange); }
.tone-blue { background: var(--blue-soft); color: var(--blue-ink); }
.tone-grey { background: var(--grey-soft); color: var(--muted); }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin-top: 8px; }
.figures .k { color: var(--ink-2); font-size: 14.5px; }
.figures .v { font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
/* the list as a table, where the pane is wide (laptop and iPad landscape) */
@container (min-width: 720px) {
  .table-head { display: grid; grid-template-columns: var(--cols, 2fr 1fr 1fr 1fr 1fr); gap: 14px; padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  .table-head + .rows .row, .rows.table .row { grid-template-columns: var(--cols, 2fr 1fr 1fr 1fr 1fr); min-height: 52px; padding: 10px 16px; }
  .table-head + .rows .row .avatar { display: none; }
  .table-head + .rows .row .c-col { display: block; color: var(--ink-2); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-head + .rows .r-title { font-size: 15px; }
  .table-head + .rows .row .c-right { display: none; }
  .table-head + .rows .row .r-sub { display: none; }
}
.form-regular .large-title h1 { font-size: 26px; }

/* grouped link rows (More, Settings) */
.form-group { margin-bottom: 18px; }
.group-title { color: var(--muted); font-size: 15px; font-weight: 500; padding: 0 6px 8px; }
.group-card { background: var(--card); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow); }
.link-row { display: flex; width: 100%; align-items: center; gap: 14px; padding: 15px 16px; text-align: left; font-size: 17px; position: relative; }
.link-row + .link-row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; border-top: 1px solid var(--line-2); }
.link-row:active { background: var(--line-2); }
.link-row .link-icon { width: 28px; display: grid; place-items: center; color: var(--ink); }
.link-row .link-label { flex: 1; }
.link-row .link-value { color: var(--muted); font-size: 15px; }
.link-row .chev { color: #C4C7CE; }
.link-row.danger { color: var(--red); }

/* ------------------------------------------------------------ forms */
.field { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; align-items: center; gap: 10px; padding: 12px 16px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line-2); }
.field label { color: var(--ink-2); font-size: 16px; }
.field label.required { color: #D9433A; }
.field.wide { grid-template-columns: 1fr; }
.field.wide label { font-size: 13px; color: var(--muted); }
.field.is-toggle .control { justify-self: end; }
.field.has-error { background: #FFF5F5; }
.field.has-error label { color: var(--red); }
.control { min-width: 0; }
.input { width: 100%; border: 0; background: transparent; padding: 6px 0; text-align: right; color: var(--blue); outline: none; font-size: 16px; }
.field.wide .input, textarea.input { text-align: left; color: var(--ink); }
textarea.input { resize: vertical; min-height: 60px; }
.input::placeholder { color: #B3B8C2; }
select.input { appearance: none; -webkit-appearance: none; text-align-last: right; }
.picker { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.picker .placeholder { color: #B3B8C2; }
.picker .ic { color: #C4C7CE; }
.hint { color: var(--faint); font-size: 13px; margin-top: 2px; text-align: right; }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 999px; background: #E5E5EA; position: relative; transition: background .2s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 999px; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch:checked { background: #34C759; }
.switch:checked::after { transform: translateX(20px); }
.segmented { display: inline-flex; background: var(--grey-soft); border-radius: 10px; padding: 2px; float: right; }
.segmented button { padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.segmented button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
html[data-form="laptop"] .field { grid-template-columns: 200px 1fr; }
html[data-form="laptop"] .input { text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
html[data-form="laptop"] .picker { justify-content: space-between; }
html[data-form="laptop"] .field.wide .input { background: #fff; }
html[data-form="laptop"] .hint { text-align: left; }
html[data-form="laptop"] .segmented { float: none; }

/* ------------------------------------------------------------ sheets, popovers, toasts */
.overlay-root { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.overlay-root > * { pointer-events: auto; }
.sheet-wrap { position: fixed; inset: 0; }
.scrim { position: absolute; inset: 0; background: rgba(15,18,30,.32); }
.sheet { position: absolute; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 -4px 30px rgba(0,0,0,.18); }
.sheet-bottom { left: 0; right: 0; bottom: 0; top: calc(12px + var(--safe-t)); border-radius: 22px 22px 0 0; }
.sheet-center { left: 50%; top: 50%; width: min(600px, calc(100vw - 48px)); max-height: min(86vh, 900px); margin-left: calc(min(600px, calc(100vw - 48px)) / -2); translate: 0 -50%; border-radius: 22px; }
.sheet-center.wide { width: min(980px, calc(100vw - 48px)); margin-left: calc(min(980px, calc(100vw - 48px)) / -2); }
.sheet-center.full, .sheet-side.full { width: min(1180px, calc(100vw - 48px)); margin-left: calc(min(1180px, calc(100vw - 48px)) / -2); }
.sheet-side { right: 0; top: 0; bottom: 0; width: min(680px, 100vw); border-radius: 18px 0 0 18px; }
.sheet-side.wide { width: min(1000px, 100vw); }
.sheet-side.full { left: auto; margin: 0; width: min(1180px, 100vw); }
.grip { width: 38px; height: 5px; border-radius: 999px; background: #D1D5DB; margin: 8px auto 0; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 14px; touch-action: none; }
.sheet-head > :first-child { justify-self: start; }
.sheet-title { font-weight: 600; font-size: 17px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-actions { justify-self: end; display: flex; gap: 8px; }
.sheet-foot { display: flex; gap: 10px; padding: 10px 16px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: rgba(242,243,247,.95); }
.sheet-foot .btn-pill { flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 6px 16px calc(24px + var(--safe-b)); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.pop-shield { position: fixed; inset: 0; }
.popover { position: fixed; min-width: 200px; max-width: 320px; background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.05); padding: 6px; transform-origin: top right; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; text-align: left; font-size: 15px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--blue-soft); outline: none; }
.menu-item.danger { color: var(--red); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.action-list { background: #fff; border-radius: var(--r-card); overflow: hidden; }
.action-row { display: flex; width: 100%; align-items: center; gap: 12px; padding: 16px; font-size: 17px; border-bottom: 1px solid var(--line-2); }
.action-row.danger { color: var(--red); }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 16px + var(--safe-b)); display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.form-regular ~ .overlay-root .toasts, html[data-size="regular"] .toasts { bottom: 24px; }
.toast { pointer-events: auto; background: #1F2430; color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.22); display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); }
.toast.error { background: #B42318; }
.toast-action { color: #8FB0F5; font-weight: 700; }
.confirm p { color: var(--ink-2); }
.confirm .input { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-align: left; color: var(--ink); }
.picker-list { margin-top: 10px; background: #fff; border-radius: 16px; overflow: hidden; }
.picker .input.search, .picker > .input.search { background: #E9EAEF; border-radius: 12px; padding: 10px 12px; text-align: left; color: var(--ink); }
.pick-row { display: flex; width: 100%; align-items: center; gap: 10px; padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line-2); }
.pick-row.on { color: var(--blue); }
.pick-row.create { color: var(--blue); font-weight: 600; }
.pick-main { flex: 1; display: flex; flex-direction: column; }
.pick-sub { color: var(--muted); font-size: 13.5px; }
.pick-empty { padding: 18px; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------ record pages */
.rec-head { background: var(--card); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.rec-head .rec-title { display: flex; align-items: center; gap: 12px; }
.rec-head h2 { font-size: 21px; }
.rec-head .rec-sub { color: var(--muted); font-size: 14.5px; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; overflow-wrap: anywhere; }
.big-amount { font-size: 30px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.sec-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 12px; scrollbar-width: none; }
.sec-tabs button { padding: 8px 14px; border-radius: 999px; font-size: 15px; color: var(--ink-2); background: transparent; white-space: nowrap; }
.sec-tabs button.on { background: var(--card); box-shadow: var(--shadow); color: var(--ink); font-weight: 600; }
.lines-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.lines-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.lines-table td { padding: 10px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lines-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { margin-top: 10px; display: grid; gap: 6px; font-size: 15px; }
.totals > div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 700; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.line-edit { background: var(--card); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.line-edit .le-top { display: flex; gap: 8px; align-items: center; }
.line-edit .le-top .input { text-align: left; color: var(--ink); font-weight: 600; }
.line-edit .le-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.line-edit .le-grid label { font-size: 12px; color: var(--muted); display: block; }
.line-edit .le-grid .input { text-align: left; color: var(--ink); background: var(--grey-soft); border-radius: 8px; padding: 7px 9px; }
.line-edit textarea.input { background: var(--grey-soft); border-radius: 8px; padding: 7px 9px; margin-top: 6px; font-size: 14.5px; min-height: 40px; }
.line-edit .le-amount { text-align: right; font-weight: 600; margin-top: 6px; }
.line-edit.header { background: #F7F8FB; }
.add-line { display: flex; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; }
.doc-preview { background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.timeline { display: grid; gap: 12px; }
.tl-item { display: grid; grid-template-columns: 10px 1fr; gap: 12px; font-size: 14.5px; }
.tl-item i { width: 10px; height: 10px; border-radius: 99px; background: var(--blue); margin-top: 6px; }
.tl-item .when { color: var(--muted); font-size: 13px; }
.progress { height: 8px; border-radius: 99px; background: var(--grey-soft); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.week-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.week-grid th, .week-grid td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line-2); }
.week-grid td:first-child, .week-grid th:first-child { text-align: left; }
.week-grid .cell { width: 100%; text-align: center; background: var(--grey-soft); border-radius: 8px; padding: 6px 2px; border: 0; }
.attention { display: grid; gap: 8px; }
.attention a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #FFF8EB; color: #8A5A00; font-size: 15px; }
.attention a.red { background: #FDECEC; color: #A61B1B; }
.offline-banner { position: fixed; top: calc(8px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 90; background: #1F2430; color: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.timer-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #DCEAFE; color: var(--blue-ink); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; max-height: 320px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .line { stroke-width: 2.6; }
.chart .cursor { stroke: var(--faint); stroke-dasharray: 3 3; }
.chart .band { fill: rgba(47,111,237,.06); }
.chart-tip { position: absolute; top: 4px; left: 0; background: #1F2430; color: #fff; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; pointer-events: none; min-width: 140px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.donut-wrap { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.donut { width: 150px; }
.donut-center { font-size: 18px; font-weight: 700; fill: var(--ink); }
.donut-sub { font-size: 11px; fill: var(--muted); }
.legend { display: grid; gap: 8px; font-size: 14px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.report-table th { text-align: left; font-size: 12.5px; color: var(--muted); text-transform: uppercase; padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); }
.report-table td { padding: 8px; border-bottom: 1px solid var(--line-2); }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table tr.total td { font-weight: 700; border-top: 1px solid var(--line); }
.report-table tr.group td { font-weight: 600; background: #F7F8FB; }
.report-table tr.sub td:first-child { padding-left: 24px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.update-bar { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + var(--safe-b)); transform: translateX(-50%); z-index: 85; background: #fff; border-radius: 16px; padding: 10px 12px 10px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.15); display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
html[data-size="regular"] .update-bar { bottom: 20px; }

/* ---------------------------------------------------------------- Counsel (screens/counsel.js) */
.counsel { display: flex; flex-direction: column; min-height: calc(100% - 8px); max-width: 760px; margin: 0 auto; }
.cs-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 12px 0 18px; }
.cs-hello { text-align: center; padding: 28px 8px 8px; }
.cs-hello h2 { font-size: 24px; margin: 14px 0 6px; letter-spacing: -.01em; }
.cs-hello p { color: var(--muted); margin: 0 auto 18px; max-width: 420px; font-size: 15px; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cs-chips .chip { font-size: 14px; }
.cs-face { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto; display: grid; place-items: center; font: 700 24px/1 var(--font); color: #fff;
  background: linear-gradient(135deg, var(--ansv), var(--blue)); box-shadow: 0 6px 18px rgba(31,77,181,.28); }
.cs-face.small { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; margin: 2px 0 0; flex: none; box-shadow: none; }
.cs-row { display: flex; gap: 10px; align-items: flex-start; animation: cs-in .22s var(--ease) both; }
.cs-row.still { animation: none; }
.cs-row.me { justify-content: flex-end; }
.cs-row.me .cs-bubble { background: var(--blue); color: #fff; border-radius: 20px 20px 6px 20px; max-width: 82%; padding: 10px 14px; white-space: pre-wrap; }
.cs-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cs-row.them .cs-bubble { position: relative; background: var(--card); border-radius: 6px 20px 20px 20px; padding: 10px 14px; box-shadow: var(--shadow); max-width: 100%; align-self: flex-start; }
.cs-bubble.is-error { color: var(--red); }
.cs-text p { margin: 0 0 6px; } .cs-text p:last-child { margin-bottom: 0; }
.cs-text ul { margin: 4px 0 6px; padding-left: 20px; } .cs-text li { margin: 2px 0; }
.cs-bubble.has-speak { padding-right: 42px !important; }
.cs-speak { position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; color: var(--muted); }
.cs-speak:hover { color: var(--blue); background: var(--blue-soft); }
.cs-dots { display: inline-flex; gap: 4px; padding: 6px 0; } .cs-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--faint); animation: cs-dot 1s infinite ease-in-out; }
.cs-dots i:nth-child(2) { animation-delay: .15s; } .cs-dots i:nth-child(3) { animation-delay: .3s; }
.cs-done, .cs-pending { background: var(--card); border-radius: 16px; padding: 12px 14px; border: 1px solid var(--line); max-width: 460px; }
.cs-done { border-left: 3px solid var(--green, #16A34A); }
.cs-done.is-undone { opacity: .55; }
.cs-pending { border: 1.5px solid var(--blue); box-shadow: 0 4px 16px rgba(47,111,237,.12); }
.cs-pending.danger { border-color: var(--red); box-shadow: 0 4px 16px rgba(220,38,38,.1); }
.cs-pending.is-decided { border-color: var(--line); box-shadow: none; }
.cs-done-head { display: flex; gap: 8px; align-items: center; font-size: 15px; } .cs-done-head svg { flex: none; color: var(--muted); }
.cs-lines { color: var(--ink-2); font-size: 14px; margin: 6px 0 2px 24px; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.cs-done .btn-pill { margin: 8px 0 0 24px; }
.cs-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; } .cs-actions .btn-pill { min-width: 96px; }
.cs-undone { display: inline-block; margin: 8px 0 0 24px; color: var(--muted); font-size: 13px; font-weight: 600; }
.scroll:has(> .counsel) { padding-bottom: calc(var(--tabbar-h) + 6px + var(--safe-b)); }
.form-regular .scroll:has(> .counsel) { padding-bottom: 14px; }
.cs-compose { position: sticky; bottom: 0; padding: 8px 0 0; background: linear-gradient(180deg, rgba(242,243,247,0), var(--bg) 30%); z-index: 5; }
.cs-box { display: flex; align-items: flex-end; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 6px 6px 6px 16px; box-shadow: 0 4px 18px rgba(17,24,39,.08); }
.cs-input { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 16px; line-height: 1.4; padding: 8px 0; max-height: 160px; color: var(--ink); }
.cs-send, .cs-mic { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; flex: none; }
.cs-send { background: var(--blue); color: #fff; } .cs-send:disabled { opacity: .4; }
.cs-mic { color: var(--muted); } .cs-mic.on { background: #FDE8E8; color: var(--red); animation: cs-pulse 1.2s infinite; }
.nav-actions .icon-btn.on { background: var(--blue-soft); color: var(--blue-ink); border-color: transparent; }
@keyframes cs-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cs-dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
@keyframes cs-pulse { 50% { box-shadow: 0 0 0 6px rgba(220,38,38,.12); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
@media print {
  body { overflow: visible; background: #fff; }
  .tabbar, .sidebar, .topbar, .nav-bar, .fab, .overlay-root .scrim, .list-tools { display: none !important; }
}
