/* TN AIR v5. Soft cards on an off-white ground, Lexend, white fields with a visible edge, one navy action per screen, slow-out easing.
   The tokens, shapes and motion follow the design prototype at version 14 and later, including the visible edges at 3 to 1. */
:root {
  --paper: #F6F7F9; --card: #FFFFFF; --ink: #22304A; --ink-2: #5A6A7E; --line: #848FA2; --tint: #EEF1F6; --tint-2: #E1E6EF; --field: #FFFFFF; --field-line: #6B7A94;
  --accent: #1B2A4A; --accent-ink: #FFFFFF; --accent-soft: #E7ECF5;
  --good: #276E4A; --good-soft: #E6F2EB; --warn: #7A5C20; --warn-soft: #F7F0E1; --bad: #A83A3F; --bad-soft: #F9EAEB;
  --mic: #C8102E; --mic-ink: #FFFFFF; --decal: transparent;
  --shadow: 0 1px 2px rgba(27,42,74,.04), 0 8px 24px rgba(27,42,74,.06);
  --ui: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22,1,.36,1); --r: 20px; --scale: 1;
}
@media (prefers-color-scheme: dark) { :root {
  --paper: #0F1A2F; --card: #182641; --ink: #F1F4F9; --ink-2: #AEBBD0; --line: #64789F; --tint: #1E2E4D; --tint-2: #2A3E66; --field: #2A3E66; --field-line: #93A6C7;
  --accent: #C9D6F0; --accent-ink: #0F1A2F; --accent-soft: #22365C;
  --good: #8CD6AB; --good-soft: #183324; --warn: #E6C77E; --warn-soft: #36301A; --bad: #F2A3A3; --bad-soft: #43202A;
  --mic: #E8324D; --decal: #F4F6FA; --shadow: 0 1px 0 rgba(255,255,255,.03); color-scheme: dark; } }
html[data-text="larger"] { --scale: 1.15; }
html[data-text="largest"] { --scale: 1.3; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--ui); font-size: calc(18px * var(--scale)); line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
a { color: inherit; }
img { max-width: 100%; }

/* The app frame: a scrolling screen above a fixed bar. */
.app { min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right)); display: flex; flex-direction: column; gap: 20px; max-width: 640px; width: 100%; margin: 0 auto; }
.screen.wide { max-width: 1180px; }
.apphead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 6px; }
.decal { display: inline-flex; align-items: center; background: var(--decal); padding: 4px 6px; border-radius: 9px; }
.decal img { height: 30px; width: auto; display: block; }
.decal.big img { height: 52px; }

h1 { font-size: calc(30px * var(--scale)); line-height: 1.2; font-weight: 400; letter-spacing: -.015em; }
h2 { font-size: calc(21px * var(--scale)); line-height: 1.3; font-weight: 500; }
h3 { font-size: calc(17px * var(--scale)); font-weight: 500; color: var(--ink); }
.eyebrow { font-size: calc(16px * var(--scale)); color: var(--ink); }
.muted { color: var(--ink-2); font-size: calc(16px * var(--scale)); }
.greet { display: flex; flex-direction: column; gap: 2px; }
.greet .quip { color: var(--ink-2); font-size: calc(18px * var(--scale)); max-width: 34ch; }
.greet .date { font-size: calc(16px * var(--scale)); color: var(--ink-2); }
.title { display: flex; flex-direction: column; gap: 4px; }
.back { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--ink-2); min-height: 44px; padding: 0 6px 0 0; font-size: calc(17px * var(--scale)); align-self: flex-start; margin-bottom: -8px; }
.back svg { width: 22px; height: 22px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-width: 0; }
.row > * { min-width: 0; }
.row > .money, .row > .big, .row > .chip, .row > .switch { flex: none; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sect { display: flex; flex-direction: column; gap: 10px; }
.sect > h3 { padding: 0 4px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.big { font-size: calc(34px * var(--scale)); font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tag { font-size: calc(16px * var(--scale)); color: var(--ink-2); background: var(--tint); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.kv { display: flex; justify-content: space-between; gap: 14px; font-size: calc(16px * var(--scale)); padding: 7px 0; border-top: 1px solid var(--line); }
.kv:first-child { border-top: 0; }
.kv span:first-child { color: var(--ink-2); }
.kv span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 18px; border-radius: 16px; border: 0; background: var(--tint); color: var(--ink); font-weight: 500; font-size: calc(17px * var(--scale)); flex: 1; text-align: center; white-space: nowrap; text-decoration: none; transition: transform .2s var(--ease), background-color .35s var(--ease); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--good-soft); color: var(--good); }
.btn.sm { min-height: 44px; font-size: calc(16px * var(--scale)); flex: 0 0 auto; padding: 0 16px; border-radius: 13px; }
.btn.tall { min-height: 60px; font-size: calc(18px * var(--scale)); }
.btn.wide { width: 100%; }
.screen > .btn, .sheet > .btn { flex: none; }
.btn:active, .item:active, .chip:active, .daychip:active { transform: scale(.975); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 19px; height: 19px; }
.link { border: 0; background: none; color: var(--ink-2); min-height: 44px; padding: 0 4px; font-size: calc(16px * var(--scale)); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px; }
.link.inl { display: inline-flex; align-items: center; align-self: flex-start; padding: 0 4px; margin-left: -4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions.center { justify-content: center; gap: 18px; }
.addrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.addrow .btn { flex: 1 1 auto; min-width: 0; padding-left: 12px; padding-right: 12px; }
/* Mark done stays in the flow of the visit, after the notes. A floating bar covered the card text under it. */
.pinned { position: static; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 14px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); text-align: left; width: 100%; min-width: 0; transition: transform .2s var(--ease); }
.item .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .t b { font-size: calc(18px * var(--scale)); font-weight: 500; }
.item .t span { color: var(--ink-2); font-size: calc(16px * var(--scale)); }
.chev { color: var(--ink-2); opacity: .7; width: 20px; height: 20px; flex: 0 0 auto; }
.vlist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 6px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.vrow { display: flex; flex-direction: column; gap: 12px; padding: 6px; }
.vrow + .vrow { border-top: 1px solid var(--line); }
.vrow .top { display: flex; gap: 12px; align-items: flex-start; border: 0; background: none; padding: 10px 8px; border-radius: 14px; text-align: left; width: 100%; color: inherit; }
.vrow .when { width: 92px; flex: 0 0 auto; font-size: calc(16px * var(--scale)); color: var(--ink-2); padding-top: 2px; }
.vrow .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* At the larger text sizes the time sits above the name, so the name and the address keep the whole row. */
html[data-text="larger"] .vrow .top, html[data-text="largest"] .vrow .top { flex-wrap: wrap; row-gap: 2px; }
html[data-text="larger"] .vrow .when, html[data-text="largest"] .vrow .when { width: 100%; padding-top: 0; }
.vrow .t b { font-weight: 500; font-size: calc(18px * var(--scale)); }
.vrow .t span { color: var(--ink-2); font-size: calc(16px * var(--scale)); }
/* A row that opens the visit shows at most four lines of the address and note. The visit screen shows the whole note. */
.vrow button.top .t span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.vrow .actions { padding: 0 8px 8px; }
.vrow.done .t b { color: var(--ink-2); font-weight: 400; }
.vrow.rem .t b { font-weight: 400; }
/* Parts and prices: the bought items are flat hairline rows, and each row carries one line about the purchases. */
.grp { display: flex; flex-direction: column; gap: 12px; }
.grp > .title h2 { font-size: calc(22px * var(--scale)); }
.flat { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.flat .vrow { padding: 0; border-top: 0; border-bottom: 1px solid var(--line); }
.flat .vrow .top { padding: 12px 2px; }
.vrow .t.end { flex: none; align-items: flex-end; text-align: right; }
.vrow.hasbuy { gap: 0; }
.vrow.hasbuy .top { padding-bottom: 2px; }
.vrow .buy { color: var(--ink); font-size: calc(16px * var(--scale)); padding: 0 8px 10px; }
.flat .vrow .buy { padding: 0 2px 12px; }
.vrow .noprice { flex: none; color: var(--ink-2); font-size: calc(16px * var(--scale)); white-space: nowrap; }
.search + .seg.sub { margin-top: 0; }
.ok { color: var(--good); }
.ok svg { width: 22px; height: 22px; }
.quietrow { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: transparent; text-align: left; width: 100%; color: var(--ink); }
.quietrow .pt { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: 0 0 auto; }
.quietrow .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.quietrow .t b { font-weight: 500; font-size: calc(17px * var(--scale)); }
.quietrow .t span { font-size: calc(16px * var(--scale)); color: var(--ink-2); }
.emptyday { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.status { display: flex; gap: 10px; align-items: center; font-size: calc(17px * var(--scale)); padding: 14px 16px; border-radius: 16px; background: var(--good-soft); color: var(--good); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status svg { width: 20px; height: 20px; flex: 0 0 auto; }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 16px; padding: 12px 16px; font-size: calc(16px * var(--scale)); }

/* The pinned block: header row and action row stay at the top of every home while the rest scrolls under it. */
.pinhead { position: static; z-index: 4; background: var(--paper); margin: calc(-12px - env(safe-area-inset-top, 0px)) -16px 0; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.pinhead .apphead { padding-top: 0; }
.gear { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink-2); min-height: 44px; padding: 0 4px; font-size: calc(16px * var(--scale)); }
.gear svg { width: 22px; height: 22px; }
.gear.on { color: var(--ink); }
.gear.dot { position: relative; }
.gear.dot::after { content: ''; position: absolute; top: 6px; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
@media (min-width: 900px) { .pinhead { position: sticky; top: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; } }

/* The day strip */
.strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; scroll-padding-inline: 16px; flex: none; }
.strip::-webkit-scrollbar { display: none; }
/* On the phone the row scrolls sideways, so its right edge fades to show there is more. */
@media (max-width: 899px) { .strip { -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 44px), transparent); } }
.daychip { flex: none; border: 1px solid var(--line); background: var(--tint); color: var(--ink); border-radius: 18px; min-width: 66px; min-height: 74px; padding: 8px 12px 12px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; position: relative; transition: background-color .45s var(--ease), color .45s var(--ease), transform .2s var(--ease); }
.daychip .wd { font-size: calc(16px * var(--scale)); }
.daychip .dn { font-size: calc(16px * var(--scale)); font-weight: 500; }
.daychip .sh { display: none; }
.daychip .dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.daychip .dot.none { background: transparent; }
.daychip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.daychip[aria-pressed="true"] .dot { background: var(--accent-ink); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--tint); border-radius: 999px; padding: 0 17px; min-height: 46px; font-size: calc(17px * var(--scale)); display: inline-flex; align-items: center; color: var(--ink); transition: background-color .35s var(--ease), color .35s var(--ease); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* A chip that opens the date picker. On a phone the invisible date field covers the whole chip, because a phone opens its picker only for a direct tap on the field.
   With a mouse the chip itself takes the click and app.js opens the calendar, because a PC browser opens it only from the small calendar icon. */
.datechip { position: relative; cursor: pointer; }
.datechip input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
@media (hover: hover) and (pointer: fine) {
  .datechip input[type="date"] { pointer-events: none; }
  .datechip input[type="date"]::-webkit-calendar-picker-indicator { display: none; }
}
.seg { position: relative; display: flex; background: var(--tint); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg > button { flex: 1; border: 0; background: none; border-radius: 999px; min-height: 46px; padding: 0 10px; color: var(--ink-2); font-size: calc(17px * var(--scale)); white-space: nowrap; }
.seg > button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgba(27,42,74,.1); }
.seg.sub { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; gap: 4px; margin-top: -8px; }
.seg.sub > button { border-radius: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; font-size: calc(16px * var(--scale)); padding: 0 6px; }
.seg.sub > button[aria-pressed="true"] { background: none; box-shadow: none; border-bottom-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: calc(16px * var(--scale)); color: var(--ink-2); }
.input { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; background: var(--tint); font-size: calc(19px * var(--scale)); outline: none; }
.input:focus { box-shadow: 0 0 0 2px var(--accent) inset; background: var(--card); }
.input::placeholder { color: var(--ink-2); opacity: .85; }
/* The search field must not look like one more card: its own fill, a stronger outline, a magnifier at the left and a clear button at the right. */
.search { position: relative; display: flex; align-items: center; }
.search .mag { position: absolute; left: 16px; width: 22px; height: 22px; color: var(--ink-2); pointer-events: none; }
.search .input { padding-left: 48px; padding-right: 48px; background: var(--field); border: 1.5px solid var(--field-line); }
.search .input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.search .clear { position: absolute; right: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--tint-2); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.search .clear svg { width: 18px; height: 18px; }
.pinhead .search { margin-top: 10px; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.45; }
.code-in { font-size: calc(32px * var(--scale)); letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; min-height: 44px; color: inherit; }
.switch .track { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--tint-2); border: 1px solid var(--line); transition: background-color .35s var(--ease); flex: 0 0 auto; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .45s var(--ease); }
.switch[aria-checked="true"] .track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
.setrow { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.setrow .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setrow .t b { font-weight: 500; font-size: calc(18px * var(--scale)); }
.setrow.stackrow { flex-direction: column; align-items: stretch; }
.setbtns { display: flex; flex-direction: column; gap: 8px; flex: none; }
.parked { margin-top: 6px; }
/* On a phone the sentence takes the full width of the row and the button sits under it. A row with a switch or a short title stays one line. */
@media (max-width: 899px) {
  .setrow:not(.keeprow) { flex-direction: column; align-items: stretch; gap: 12px; }
  .setrow:not(.keeprow) > .btn, .setrow:not(.keeprow) > .switch { align-self: flex-start; }
  .setbtns { flex-direction: row; flex-wrap: wrap; }
}
.state { display: flex; gap: 6px; align-items: center; font-size: calc(16px * var(--scale)); }
.state svg { width: 18px; height: 18px; flex: 0 0 auto; }
.state.on { color: var(--good); }
.state.off { color: var(--warn); }

/* Invoices */
.inv .amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.st { font-size: calc(16px * var(--scale)); }
.st.paid { color: var(--good); } .st.sent { color: var(--bad); } .st.draft { color: var(--warn); }
.nudge { color: var(--warn) !important; }
.sum { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 4px; flex-wrap: wrap; }
.sum .big { font-size: min(calc(34px * var(--scale)), 12vw); max-width: 100%; }
.hist { display: flex; flex-direction: column; }
.he { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: calc(16px * var(--scale)); }
.he:first-child { border-top: 0; }
.he.hebtn { border-left: 0; border-right: 0; border-bottom: 0; background: none; width: 100%; text-align: left; font-family: inherit; color: inherit; cursor: pointer; }
.lrow { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; padding-top: 0; }
.totalrow { border-top: 1px solid var(--line); padding-top: 12px; }
.he .d { color: var(--ink-2); }
.he .k { color: var(--ink-2); display: block; }

/* The bar: three homes and Tina raised in the middle */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
.tabbar button { position: relative; border: 0; background: none; min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 16px; color: var(--ink-2); border-radius: 18px; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 500; background: var(--tint); box-shadow: inset 0 0 0 1px var(--line); }
.tabbar .tina { color: var(--ink-2); }
.tabbar .tina .dot { width: 56px; height: 56px; margin-top: -30px; border-radius: 50%; background: var(--mic); color: var(--mic-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(200,16,46,.3), 0 0 0 5px var(--card); }
.tabbar .tina .dot svg { width: 26px; height: 26px; }
.tabbar .tina[aria-current="page"] { background: none; box-shadow: none; }
.tbadge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #FFFFFF; font-size: 16px; font-weight: 500; display: flex; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 0 0 2px var(--card); }
.tbadge.in { position: static; margin-left: auto; font-size: calc(16px * var(--scale)); min-width: calc(22px * var(--scale)); height: calc(22px * var(--scale)); }
@media (prefers-color-scheme: dark) { .tbadge { color: #0F1A2F; } }

/* Sign-in and loading */
.center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 32px 16px; text-align: center; }
.center .card { width: 100%; max-width: 420px; text-align: left; }
.progress { height: 10px; border-radius: 5px; background: var(--tint); border: 1px solid var(--line); overflow: hidden; width: 100%; max-width: 420px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top)); z-index: 9; background: var(--card); color: var(--ink); border: 1px solid var(--line); padding: 12px 18px; border-radius: 999px; font-size: calc(16px * var(--scale)); box-shadow: 0 6px 28px rgba(17,29,53,.16); max-width: 90%; animation: rise .5s var(--ease); }
.toast.warn { color: var(--warn); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.rise { animation: risein .5s var(--ease) both; }
@keyframes risein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* The PC: a rail with room around every item, a content column with real gutters, and the same pinned block. */
@media (min-width: 900px) {
  .pc2 { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 860px); gap: 32px; align-items: start; }
  .tabbar { top: 0; bottom: auto; left: 0; right: auto; width: 132px; height: 100%; display: flex; flex-direction: column; gap: 10px; align-content: start; padding: 24px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .tabbar button { min-height: 78px; width: 100%; border-radius: 16px; gap: 6px; font-size: 15px; }
  .tabbar .tina { order: 0; }
  .tabbar .tina .dot { margin-top: 0; width: 48px; height: 48px; box-shadow: 0 4px 12px rgba(200,16,46,.25); }
  .tabbar .tina .dot svg { width: 22px; height: 22px; }
  .tbadge { top: 10px; left: calc(50% + 10px); }
  .screen { padding: 24px 40px 48px 172px; max-width: 1180px; margin: 0; }
  .pinhead { margin: -24px 0 0; padding: 24px 0 14px; }
  /* The PC has no swipe, so the fourteen day chips sit in a grid: seven to a row, one row for each week. Larger text makes the chips wider and the rows shorter. */
  .strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(48px * var(--scale)), 1fr)); gap: 6px; margin: 0; padding: 2px 0 4px; overflow: visible; }
  .daychip { min-width: 0; min-height: 58px; padding: 6px 0 8px; border-radius: 14px; gap: 1px; cursor: pointer; }
  .daychip .wd, .daychip .dn { font-size: calc(15px * var(--scale)); }
  .daychip .lg, .daychip .mo { display: none; }
  .daychip .sh { display: inline; }
  .daychip .dot { margin-top: 3px; width: 6px; height: 6px; }
  .addrow .btn.primary { max-width: 360px; }
  .addrow .btn:not(.primary) { flex: 0 1 auto; }
  .item:hover, .vrow .top:hover, .quietrow:hover, .daychip:hover { background: var(--accent-soft); }
  .btn:hover { filter: brightness(.96); }
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.input:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* A gentle difference between invoice states: a thin edge on the left in the state's color, so a glance sorts the list. */
.item.inv { border-left-width: 5px; }
.item.inv.s-draft { border-left-color: var(--warn); }
.item.inv.s-sent { border-left-color: var(--bad); }
.item.inv.s-paid { border-left-color: var(--good); }
.item.inv.s-paid .amt .money { color: var(--ink-2); }

/* Sheets: one question at a time, rising from the bottom on the phone and centered on the PC. */
.sheet-layer { position: fixed; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: rgba(17,29,53,.3); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90%; background: var(--paper); border-top: 1px solid var(--line); border-radius: 30px 30px 0 0; display: flex; flex-direction: column; overflow: hidden; animation: sheetup .45s var(--ease); }
.grab { flex: 0 0 auto; height: 30px; display: flex; justify-content: center; align-items: center; }
.grab span { width: 42px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-body { overflow: auto; padding: 4px 22px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 900px) { .sheet-layer { display: flex; align-items: center; justify-content: center; } .sheet { position: relative; width: min(560px, 90%); max-height: 84%; border-radius: 26px; border: 1px solid var(--line); animation: risein .35s var(--ease); } .grab { height: 16px; } .grab span { display: none; } }

/* The invoice as the customer gets it, styled after the Invoice Simple layout. It stays at document scale. */
.pdf { background: #FFFFFF; color: #1A1F2B; border-radius: 6px; padding: 22px; font-size: 13.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 14px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 2px 6px rgba(27,42,74,.05), 0 20px 50px rgba(27,42,74,.14); }
.pdf-hd { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pdf-logo { height: 48px; width: auto; display: block; margin-bottom: 6px; }
.pdf-co { color: #4A5466; font-size: 12.5px; }
.pdf-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.pdf-meta b { font-size: 18px; letter-spacing: .06em; font-weight: 500; color: #1B2A4A; }
.pdf-meta .due { font-weight: 500; color: #1B2A4A; }
.pdf-bill b { font-size: 11px; letter-spacing: .08em; color: #4A5466; font-weight: 500; }
.pdf table { width: 100%; border-collapse: collapse; }
.pdf th { text-align: left; border-bottom: 1px solid #1B2A4A; padding: 5px 0; font-weight: 500; font-size: 11px; letter-spacing: .06em; color: #4A5466; }
.pdf td { padding: 7px 0; border-bottom: 1px solid #ECEEF2; vertical-align: top; }
.pdf .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 8px; }
.pdf .sub { color: #5A6A7E; }
.pdf .pd { color: #1B2A4A; }
.pdf .pd b { font-weight: 600; }
.pdf-tot { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-variant-numeric: tabular-nums; }
.pdf-tot div { display: flex; gap: 24px; }
.pdf-tot .bd { font-weight: 500; font-size: 15px; color: #1B2A4A; }
.pdf .paynow { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #DDE3EC; border-radius: 8px; padding: 10px 12px; }
.pdf .paynow b { font-weight: 600; color: #1B2A4A; }
.pdf .paybtn { background: #1B2A4A; color: #FFFFFF; border: 0; border-radius: 6px; min-height: 36px; padding: 8px 14px; font: inherit; font-weight: 500; font-size: 13px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; }
.pdf-foot { font-size: 12px; color: #5A6A7E; }
.muted.late { color: var(--warn); }
/* The ready-made lists, two to a row at every width, and the file beside the list on the PC. */
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ltile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; min-height: 68px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-align: left; font: inherit; color: var(--ink); cursor: pointer; transition: background-color .25s var(--ease); }
.ltile b { font-weight: 500; font-size: calc(16px * var(--scale)); }
.ltile span { color: var(--ink-2); font-size: calc(16px * var(--scale)); }
.ltile.hot { background: var(--warn-soft); border-color: var(--warn); }
.ltile.hot span { color: var(--warn); }
.ltile:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* On a phone an open list takes the place of the tiles, so its first names show without a scroll. The All customers chip brings the tiles back. */
@media (max-width: 899px) { .lists.picked { display: none; } }
.ltile:hover { background: var(--accent-soft); }
.ltile[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.item[aria-current="true"] { background: var(--accent-soft); }
.placeholder { padding: 48px 0; }
.listhead { display: flex; flex-direction: column; gap: 4px; }
.listhead h3, .listhead .muted { margin: 0; }
.row.top { align-items: flex-start; }
.row.rowbtn { width: 100%; min-height: 44px; border: 0; background: none; padding: 6px 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.card.snug { padding: 12px 18px; }
.start { align-self: flex-start; }
.gapt { margin-top: 10px; }
.selall { -webkit-user-select: all; user-select: all; }
.ppx { display: flex; gap: 6px; align-items: center; flex: none; }
.input.ppxin { width: 112px; min-height: 44px; padding: 8px 10px; }
.filebtn { position: relative; overflow: hidden; cursor: pointer; }
.fileinp { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.item .t.end, .row .t.end, .setrow .t.end { flex: none; align-items: flex-end; text-align: right; }
@media (min-width: 900px) {
  .ltile span { font-size: calc(15px * var(--scale)); }
  .pc2 > .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
}
/* Tina: the microphone in the pinned block, the five chips, the conversation and the typing row. */
.micwrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 2px; }
.mic-big { position: relative; width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--mic); color: var(--mic-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(200,16,46,.28); cursor: pointer; transition: transform .25s var(--ease), opacity .25s var(--ease); }
.mic-big:active { transform: scale(.96); }
.mic-big svg { width: 38px; height: 38px; }
.mic-big .halo { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid rgba(200,16,46,.4); opacity: 0; pointer-events: none; }
.mic-big.on .halo { opacity: 1; animation: halo 1.6s ease-out infinite; }
.mic-big.starting { opacity: .65; }
@keyframes halo { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.mic-cap { margin: 0; color: var(--ink-2); font-size: calc(16px * var(--scale)); }
.chips.center { justify-content: center; }
/* The five things to ask: an even grid, two to a row on the phone and three then two on the PC. */
.asks { display: flex; flex-direction: column; gap: 8px; }
.asks > .muted { margin: 0; text-align: center; }
.asklist { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.asklist .chip { grid-column: span 3; justify-content: center; text-align: center; padding: 4px 8px; line-height: 1.15; }
@media (max-width: 899px) { .asklist .chip:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (min-width: 900px) { .asklist .chip { grid-column: span 2; } .asklist .chip:nth-child(n+4) { grid-column: span 3; } }
.talk { display: flex; flex-direction: column; gap: 10px; }
.say { display: flex; }
.say.you { justify-content: flex-end; }
.say span { max-width: 86%; padding: 12px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); font-size: calc(17px * var(--scale)); line-height: 1.4; }
.say.you span { background: var(--accent-soft); border-color: transparent; }
.askrow { display: flex; gap: 10px; }
.askrow .input { flex: 1; min-width: 0; }
.askrow .btn { flex: none; }
.tabbar .tina.live .dot { animation: livedot 1.4s ease-in-out infinite; }
@keyframes livedot { 50% { box-shadow: 0 0 0 10px rgba(200,16,46,.16); } }
.stack > .chips { flex-direction: row; }
/* Phase 7, the PC on its own terms: columns that pin their own head and scroll on their own, the week, three-pane Invoices, one centered column for Tina and Setup. */
@media (min-width: 900px) {
  .screen.cols { height: 100vh; overflow: hidden; padding-bottom: 0; box-sizing: border-box; max-width: none; }
  .pc2, .pc3 { height: calc(100vh - 24px); }
  .pc3 { display: grid; gap: 32px; align-items: start; }
  .pc2 > .col, .pc3 > .col { overflow-y: auto; min-height: 0; max-height: 100%; padding: 0 2px 48px; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  .pc2 .pinhead, .pc3 .pinhead { margin: 0; padding-top: 0; }
  .colhead { position: sticky; top: 0; z-index: 3; background: var(--paper); padding: 0 0 14px; border-bottom: 1px solid var(--line); }
  .colhead h3 { margin: 0; font-size: calc(22px * var(--scale)); font-weight: 500; min-height: 44px; display: flex; align-items: center; }
  .col > .back, .narrowcol > .back { position: sticky; top: 0; z-index: 3; background: var(--paper); width: 100%; margin: 0; padding-right: 8px; }
  .pc3.sched { grid-template-columns: 400px minmax(0, 1fr); }
  .pc3.sched.has-detail { grid-template-columns: 400px minmax(0, 1fr) 420px; }
  .pc3.inv { grid-template-columns: 400px minmax(340px, 1fr) 380px; }
  .wk { display: flex; flex-direction: column; }
  .wkday { display: grid; grid-template-columns: calc(128px * var(--scale)) minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--tint-2); min-width: 0; }
  .wkday:first-child { border-top: 0; padding-top: 0; }
  .wkhead { border: 0; background: none; text-align: left; min-height: 44px; padding: 8px 10px; border-radius: 12px; display: flex; flex-direction: column; color: var(--ink); font: inherit; cursor: pointer; }
  .wkhead b { font-weight: 500; font-size: calc(16px * var(--scale)); }
  .wkhead span { color: var(--ink-2); font-size: calc(15px * var(--scale)); }
  .wkhead:hover, .wkday.cur .wkhead { background: var(--accent-soft); }
  .wkcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--scale)), 1fr)); gap: 8px; min-width: 0; align-items: start; }
  .wkcard, .wkrem { min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
  .wkcard { padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(27,42,74,.06); }
  .wkrem { min-height: 44px; justify-content: center; padding: 6px 10px; border: 0; border-left: 3px solid var(--line); border-radius: 0 12px 12px 0; background: none; }
  .wkcard:hover, .wkrem:hover { background: var(--accent-soft); }
  .wkcard .when, .wkrem .when { font-size: calc(15px * var(--scale)); color: var(--ink-2); }
  .wkcard b { font-weight: 500; font-size: calc(16px * var(--scale)); line-height: 1.3; overflow-wrap: anywhere; }
  .wkcard .p { font-size: calc(15px * var(--scale)); color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .wkrem .p { font-size: calc(15px * var(--scale)); overflow-wrap: anywhere; }
  .wkcard.done b { color: var(--ink-2); font-weight: 400; }
  .wkempty { color: var(--ink-2); font-size: calc(15px * var(--scale)); padding: 10px; }
  .narrowcol { width: min(640px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
  /* A sticky block cannot start above its own column, so the column itself starts at the top of the window and the block keeps its 24 px of room. */
  .narrowcol.pin { margin-top: -24px; }
  /* The narrow column sits in the middle of the room beside the rail on every window width. */
  .screen.mid { max-width: none; }
  .narrowcol.pin .pinhead { margin: 0; }
  .col.detail > .back { order: -3; }
  .col.detail > .title { order: -2; }
  .col.detail > .pinned { order: -1; }
  .pdfcol .pdf { font-size: 13px; }
  .placeholder { min-height: min(60vh, 520px); padding: 32px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
  .placeholder svg { width: 40px; height: 40px; color: var(--line); }
  .placeholder p { max-width: 340px; margin: 0; }
}
/* At 1400 px and up the PDF column is always open beside the invoice, so the links that open the PDF are not needed. */
@media (min-width: 1400px) { .pc3.inv [data-go="preview"] { display: none; } }
@media (min-width: 900px) and (max-width: 1499px) { .pc3.sched.has-detail { grid-template-columns: 400px minmax(0, 620px); } }
@media (min-width: 900px) and (max-width: 1099px) { .pc3.sched.has-detail { grid-template-columns: minmax(0, 1fr); } .pc3.sched.has-detail > .col:first-child { display: none; } }
@media (min-width: 900px) and (max-width: 1399px) { .pc3.inv { grid-template-columns: 400px minmax(0, 1fr); } .pc3.inv .pdfcol { display: none; } }
@media (min-width: 900px) { .pc3.inv.no-pdf { grid-template-columns: 400px minmax(0, 720px); } }
@media (min-width: 900px) and (max-width: 1049px) { .pc3.inv.has-open { grid-template-columns: minmax(340px, 1fr); } .pc3.inv.has-open > .col:first-child { display: none; } }
/* Photos: thumbnails under the customer's name, and the one-photo sheet. */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ph { border: 0; background: none; padding: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--ink-2); cursor: pointer; min-width: 0; }
.ph img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--tint); display: block; color: transparent; }
.ph span { font-size: calc(16px * var(--scale)); line-height: 1.3; }
.ph.pend img { opacity: .55; }
.photo-big { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: var(--tint); }
/* The sign-in on a PC: centered in the window, a wider card, and larger type. */
@media (min-width: 900px) {
  .center { min-height: calc(100vh - 72px); justify-content: center; gap: 24px; }
  .center .card { max-width: 520px; padding: 28px 30px; }
  .center .card h2 { font-size: 26px; }
  .center .card .muted { font-size: 17px; }
  .center .decal.big img { width: 240px; }
}
@media (min-width: 900px) {
  .screen.full { padding: 0 40px; max-width: none; min-height: 100vh; justify-content: center; }
  .screen.full .center { min-height: 0; gap: 32px; padding: 0; }
  .screen.full .center .card { max-width: 600px; padding: 36px 40px; border-radius: 24px; }
  .screen.full .center .card h2 { font-size: 30px; margin-bottom: 8px; }
  .screen.full .center .card .muted { font-size: 19px; }
  .screen.full .center .card .input { font-size: 20px; min-height: 60px; }
  .screen.full .center .card .btn { min-height: 64px; font-size: 20px; }
  .screen.full .decal.big img { width: 320px; }
}
/* Larger text on a narrow phone: choice rows wrap. The bar's labels shrink only on a phone narrower than 365 pixels. */
.seg > button { white-space: normal; line-height: 1.15; }
.tabbar button { min-width: 0; padding-left: 2px; padding-right: 2px; }
.tabbar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 364px) { .tabbar button { font-size: 15px; } }
@media (max-width: 339px) { .tabbar button { font-size: 14px; letter-spacing: -.01em; } }
[inert] { pointer-events: none; }
/* A reminder that was missed sits on today in the warning tint until it is closed. */
.vrow.rem.late { border-left: 3px solid var(--warn); }
.vrow.rem.late .when { color: var(--warn); }
/* Narrow phones with larger text: choice rows wrap instead of widening the page. */
.seg { flex-wrap: wrap; }
.seg > button { min-width: 0; flex: 1 1 auto; }
/* Clip, not hidden: hidden turns the screen into a scroll box of its own, and then no pinned block can hold its place while the window scrolls. Older browsers keep hidden. */
.screen { overflow-x: hidden; overflow-x: clip; }
/* Where the browser's own bar comes and goes, the dynamic height keeps each column's last row on the screen. */
@supports (height: 100dvh) { @media (min-width: 900px) { .screen.cols { height: 100dvh; } .pc2, .pc3 { height: calc(100dvh - 24px); } .center { min-height: calc(100dvh - 72px); } .screen.full { min-height: 100dvh; } .screen.full .center { min-height: 0; } } }
