:root {
  --bg: #f5f5f7; --card: #fff; --ink: #1d1d1f; --muted: #6e6e73; --line: #e5e5ea;
  --accent: #0071e3; --accent-ink: #fff; --amber: #b25000; --amber-bg: #fff4e5; --green: #1a7f37; --green-bg: #e8f5ec; --red: #c4281c;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 14px; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 28px; background: rgba(255,255,255,.8); backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 600; color: var(--ink); font-size: 15px; }
.top nav { display: flex; gap: 20px; align-items: center; color: var(--muted); }
.banner { background: #eef4ff; color: #1d4f91; text-align: center; padding: 8px; font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 28px; }
h1 { font-size: 28px; font-weight: 600; margin: 0 0 20px; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); }
.flash { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; }

.drop label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 1.5px dashed #c7c7cc; border-radius: 14px; background: var(--card); cursor: pointer; transition: border-color .15s, background .15s; }
.drop label span { color: var(--muted); }
.drop.over label { border-color: var(--accent); background: #f0f7ff; }
.reading { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--muted); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 4px; margin: 28px 0 14px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.count { margin-left: 8px; background: var(--line); color: var(--muted); border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.tab.on .count { background: var(--ink); color: #fff; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { position: relative; } table.list tbody tr:hover { background: #fafafa; }
/* The vendor link covers the whole row, so a tap anywhere on it opens the invoice. */
a.row-link { color: inherit; } a.row-link::after { content: ''; position: absolute; inset: 0; }
a.row-link:focus-visible { outline: none; } table.list tbody tr:has(a.row-link:focus-visible) { box-shadow: inset 0 0 0 2px var(--accent); }
.v { font-weight: 500; } .why { color: var(--amber); font-size: 13px; margin-top: 3px; }
table.list td:nth-child(3) { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

button, .button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 980px; padding: 8px 18px; cursor: pointer; display: inline-block; }
button:hover, .button:hover { background: #f2f2f2; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.primary:hover { background: #0077ed; }
.quiet { border-color: transparent; color: var(--muted); }

.back { display: inline-block; margin-bottom: 16px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 24px; align-items: start; }
.pdf { position: sticky; top: 76px; } .pdf iframe { width: 100%; height: calc(100vh - 120px); border: 0; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.side { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); padding: 20px; }
.status { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pill { display: inline-block; border-radius: 980px; padding: 3px 10px; font-size: 12px; font-weight: 500; background: var(--line); color: var(--muted); }
.pill.ready, .pill.posted { background: var(--green-bg); color: var(--green); }
.pill.review, .pill.duplicate { background: var(--amber-bg); color: var(--amber); }
.pill.failed { background: #fdecea; color: var(--red); }
.issues { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.issues li { padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; }
.issues li.review { background: var(--amber-bg); color: #6b3500; }
.issues li.note { background: var(--bg); color: var(--muted); }

.bill label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.bill .printed { float: right; }
.bill input, .bill select { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 14px; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.bill input:disabled, .bill select:disabled { background: var(--bg); color: var(--ink); }
.bill input:focus, .bill select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
table.lines { width: 100%; border-collapse: collapse; margin: 4px 0 16px; }
table.lines th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 0; }
table.lines td { padding: 3px 0; } table.lines td:last-child { width: 120px; padding-left: 8px; }
table.lines input { width: 100%; font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
table.lines input:disabled { background: var(--bg); border-color: transparent; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.file { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.card { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); padding: 22px; max-width: 640px; }
.card p { line-height: 1.5; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } .pdf { position: static; } .pdf iframe { height: 70vh; } }
.small { font-size: 12px; margin-top: 10px; }
.card { margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card ul { padding-left: 18px; line-height: 1.7; }
.nowrap { white-space: nowrap; }
table.activity { width: 100%; border-collapse: collapse; font-size: 13px; }
table.activity td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.drop.busy label { opacity: .7; pointer-events: none; }
.history { margin-top: 14px; font-size: 13px; }
.history summary { cursor: pointer; color: var(--muted); }
.history ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
table.facts { border-collapse: collapse; margin: 8px 0 14px; }
table.facts td { padding: 4px 16px 4px 0; } table.facts td:first-child { color: var(--muted); }
.prose { max-width: 720px; line-height: 1.6; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 16px; margin-top: 24px; }

/* ---- app: centered single column (Settings) ---- */
.column { max-width: 720px; margin: 0 auto; }
.column .card { max-width: none; }

/* ---- public pages: terms, privacy, launch, disconnected ---- */
body.pub { background: #fff; display: flex; flex-direction: column; min-height: 100vh; }
.pub main { flex: 1; max-width: none; padding: 0; }
.pub-wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.pub-top { position: sticky; top: 0; z-index: 2; background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.pub-top .pub-wrap { height: 56px; }
.pub-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); }
.mark { width: 26px; height: 26px; border-radius: 7px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.pub nav { display: flex; gap: 24px; }
.pub nav a { color: var(--muted); font-size: 14px; }
.pub nav a:hover, .pub nav a.on { color: var(--ink); }

.legal { max-width: 720px; margin: 72px auto 104px; padding: 0 24px; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0; }
.legal h1 { font-size: 44px; line-height: 1.1; letter-spacing: -.025em; font-weight: 700; margin: 10px 0 14px; }
.updated { color: var(--muted); font-size: 14px; margin: 0 0 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.legal-body { font-size: 16.5px; line-height: 1.7; color: #333336; }
.legal-body .lead { font-size: 19px; line-height: 1.6; color: var(--ink); margin-top: 0; }
.legal-body h2 { font-size: 20px; letter-spacing: -.01em; color: var(--ink); margin: 44px 0 10px; }
.legal-body ul { padding-left: 20px; } .legal-body li { margin: 8px 0; }
.legal-body a { text-decoration: underline; text-underline-offset: 2px; }

.hero { text-align: center; max-width: 780px; margin: 104px auto 56px; padding: 0 24px; }
.hero h1 { font-size: 60px; line-height: 1.04; letter-spacing: -.035em; font-weight: 700; margin: 0; }
.hero .lead { font-size: 21px; line-height: 1.5; color: var(--muted); max-width: 580px; margin: 24px auto 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 1032px; margin: 0 auto; padding: 0 24px; }
.step { background: var(--bg); border-radius: 20px; padding: 28px 28px 30px; }
.step .n { width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; box-shadow: 0 0 0 1px var(--line); }
.step h3 { margin: 20px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.step p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.find { max-width: 620px; margin: 72px auto 112px; padding: 0 24px; text-align: center; }
.find h2 { font-size: 24px; letter-spacing: -.015em; margin: 0 0 12px; }
.find p { color: #424245; font-size: 16px; line-height: 1.6; }
.addr-pill { display: inline-block; background: var(--bg); border-radius: 8px; padding: 1px 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; color: var(--ink); }

.status-card { max-width: 520px; margin: 112px auto; padding: 0 24px; text-align: center; }
.status-card h1 { font-size: 32px; letter-spacing: -.02em; margin: 20px 0 12px; }
.status-card p { font-size: 16px; line-height: 1.6; }
.status-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--bg); color: var(--ink); display: grid; place-items: center; margin: 0 auto; }

.pub-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pub-foot .pub-wrap { height: 64px; }
.pub-foot nav a { font-size: 13px; }

@media (max-width: 760px) {
  .steps { grid-template-columns: 1fr; }
  .hero { margin-top: 64px; } .hero h1 { font-size: 40px; } .hero .lead { font-size: 18px; }
  .legal { margin-top: 48px; } .legal h1 { font-size: 34px; }
}
.bill textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 14px; color: var(--ink); padding: 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.bill textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.connected { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.danger { color: var(--red); border-color: #f1c4c0; }
.danger:hover { background: #fdecea; }
.firm-switch select { font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
table.lines td.job { width: 120px; padding-left: 8px; } table.lines td.cat { width: 170px; padding-left: 8px; }
table.lines select { width: 100%; font: inherit; font-size: 13px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table.lines select:disabled { background: var(--bg); border-color: transparent; }
.newvendor { background: var(--bg); border-radius: 10px; padding: 10px 12px 2px; margin: -4px 0 12px; }
.detail { grid-template-columns: minmax(0, 1fr) minmax(460px, 1fr); }
.rules h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.rules h3:first-of-type { margin-top: 4px; }
.rules .inline { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.rules .inline input { width: 90px; display: inline-block; margin: 0; }
.rules .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.rules .row { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin-bottom: 10px; }
label.check input[type=checkbox] { width: auto; margin: 0; }
.bill input.small-num { display: inline-block; width: 80px; margin: 0 2px; padding: 4px 6px; }
.holds { border-left: 2px solid var(--line); padding-left: 14px; margin: 4px 0 8px 6px; }
.holds.off { opacity: .55; }

/* ---- public pages: front door, guide, sign-in ---- */
.pub nav { align-items: center; }
.button.small { padding: 6px 14px; font-size: 13px; }
.pub nav a.button.small { color: var(--ink); }
.pub nav a.button.small:hover, .pub nav a.button.small.on { background: var(--bg); }
.button.large, button.large { padding: 11px 22px; font-size: 15px; }
.hero .kicker { margin-bottom: 16px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; margin-top: 32px; }
.features { max-width: 1032px; margin: 96px auto 0; padding: 0 24px; }
.features h2, .safe h2 { font-size: 28px; letter-spacing: -.02em; text-align: center; margin: 0 0 28px; }
.features .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature { border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.safe { max-width: 720px; margin: 96px auto 0; padding: 0 24px; }
.safe ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.safe li { font-size: 16px; line-height: 1.55; color: #424245; padding-left: 28px; position: relative; }
.safe li::before { content: ''; position: absolute; left: 0; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--green-bg); box-shadow: inset 0 0 0 4px var(--green); }
.pub-flash { max-width: 440px; margin: 24px auto 0; padding: 12px 16px; border-radius: 12px; background: var(--bg); text-align: center; }
.auth { max-width: 420px; margin: 88px auto 120px; padding: 0 24px; }
.auth h1 { font-size: 34px; letter-spacing: -.02em; margin: 0 0 10px; }
.auth > p { font-size: 16px; line-height: 1.55; color: #424245; }
.auth .bill label { font-size: 13px; }
.auth .bill input[type=email] { font-size: 16px; padding: 11px 12px; }
.auth button { width: 100%; margin-top: 6px; }
.guide { max-width: 1080px; margin: 56px auto 104px; padding: 0 24px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 56px; }
.toc { position: sticky; top: 88px; align-self: start; }
.toc nav { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.toc nav a { color: var(--muted); font-size: 14px; }
.toc nav a:hover { color: var(--ink); }
.guide-body { max-width: 720px; font-size: 16px; line-height: 1.65; color: #333336; }
.guide-body h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.025em; margin: 0 0 14px; color: var(--ink); }
.guide-body .lead { font-size: 19px; line-height: 1.55; color: var(--ink); }
.guide-body h2 { font-size: 22px; letter-spacing: -.01em; color: var(--ink); margin: 48px 0 10px; scroll-margin-top: 80px; }
.guide-body li { margin: 6px 0; }
.guide-table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0; }
.guide-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.guide-table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-table td:first-child { width: 38%; color: var(--ink); }
@media (max-width: 860px) {
  .features .grid { grid-template-columns: 1fr 1fr; }
  .guide { grid-template-columns: 1fr; gap: 24px; } .toc { position: static; }
}
@media (max-width: 560px) {
  .features .grid { grid-template-columns: 1fr; }
  .hero .cta { flex-direction: column; }
  .pub nav { gap: 14px; } .pub nav a:not(.button) { display: none; }
}
.toc nav { align-items: flex-start; gap: 10px; }
.auth .small, .find .small { font-size: 13px; color: var(--muted); line-height: 1.5; }
details.more { margin: 6px 0 4px; }
details.more > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; margin: 6px 0 10px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '▸ '; } details.more[open] > summary::before { content: '▾ '; }
.lines-sum { margin: 8px 0 0; font-size: 13px; color: var(--green); text-align: right; }
.lines-sum.off { color: var(--amber); }
ul.senders { list-style: none; padding: 0; } ul.senders li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
ul.senders form { margin: 0; } button.small { padding: 4px 10px; font-size: 12px; }
.add-sender .inline input { width: auto; flex: 1; }

/* ---- public nav: Sign in sits on the same line as the links ---- */
.pub nav a.button.small { margin-top: 0; font-size: 14px; padding: 6px 14px; }

/* ---- Bills and Checks: one row of ways to add, then the lists as chips ---- */
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.bar .button, .bar button { display: inline-flex; align-items: center; padding: 8px 16px; }
.bar .address { font-weight: 500; gap: 0; } .bar .address svg:last-child { margin: 0 0 0 8px; color: var(--muted); }
.drop-note { margin-left: auto; color: var(--muted); font-size: 13px; }
.button svg, button svg { vertical-align: -3px; margin-right: 7px; }
label.button { user-select: none; }
.upload-status { flex-basis: 100%; margin: 0; color: var(--muted); }
.upload-status.failed { color: var(--red); }
.bar.busy #upload-button { opacity: .55; pointer-events: none; }
.tests { margin: -12px 2px 18px; font-size: 13px; }
.drop-hint { display: none; position: fixed; inset: 0; z-index: 5; background: rgba(245,245,247,.86); padding: 24px; }
.drop-hint div { height: 100%; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 20px; color: var(--accent); font-size: 20px; font-weight: 500; }
body.dragging .drop-hint { display: block; }
.working { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; color: var(--muted); } .working b { color: var(--ink); font-weight: 500; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin: 0 0 12px; min-height: 38px; }
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 980px; color: var(--ink); background: var(--card); box-shadow: 0 0 0 1px var(--line); font-size: 14px; }
.chip:hover { box-shadow: 0 0 0 1px #c7c7cc; }
.chip .count { margin: 0; background: var(--bg); color: var(--muted); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 500; }
.chip[data-empty] { color: var(--muted); }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; font-weight: 500; } .chip.on .count { background: rgba(255,255,255,.2); color: #fff; }
.chip-action { display: flex; align-items: center; gap: 8px; } .chip-action form { margin: 0; }
.chip-action .search input { width: 240px; }
.howto { margin-top: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.top nav a.on { color: var(--ink); font-weight: 500; }

/* ---- pickers you can type in ---- */
.picker { position: relative; display: block; }
.picker select.behind { position: absolute; inset: 0; opacity: 0; pointer-events: none; margin: 0; }
.bill .picker input { margin-top: 4px; } table.lines .picker input { margin-top: 0; }
.bill .picker > input[role=combobox] { padding-right: 28px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center; text-overflow: ellipsis; }
.menu { position: absolute; z-index: 4; left: 0; top: calc(100% + 4px); min-width: 100%; width: max-content; max-width: 420px; max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  background: var(--card); border-radius: 10px; box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(0,0,0,.12); font-size: 14px; color: var(--ink); }
.menu li { padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu li:hover, .menu li.at { background: var(--bg); }
.menu li.at { box-shadow: inset 2px 0 0 var(--accent); }
.menu li.group, .menu li.none { cursor: default; color: var(--muted); font-size: 12px; } .menu li.group:hover, .menu li.none:hover { background: none; }
.menu li.group { text-transform: uppercase; letter-spacing: .05em; padding-top: 9px; }
.menu li b { font-weight: 600; }
/* Lists with a note on each name (usual category, how often used) are wider, the note on the right. */
.menu.rich { max-width: min(560px, 92vw); }
.menu.rich li[role=option] { display: flex; justify-content: space-between; gap: 18px; }
.menu li .name { overflow: hidden; text-overflow: ellipsis; } .menu li .hint { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.menu li.at .hint { color: var(--ink); }
.menu li.add { color: var(--accent); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; margin-top: 2px; }
.bill .filled, .bill input.filled, .bill .picker > input[role=combobox].filled { background-color: #f0f7ff; border-color: #a9cdf5; }
table.lines td.cat .menu { left: auto; right: 0; }

/* The guide inside the app: the top bar is a little shorter than the public one. */
main > .guide { margin-top: 12px; }

/* ---- test company banner, failed-post notice, search, review queue ---- */
.banner.test { background: var(--amber-bg); color: #6b3500; }
.notice { display: block; background: var(--amber-bg); color: #6b3500; border-radius: 14px; padding: 12px 20px; margin-bottom: 12px; }
.notice span { text-decoration: underline; text-underline-offset: 2px; }
.search { display: flex; align-items: center; gap: 8px; }
.search input { font: inherit; padding: 7px 12px; border: 1px solid var(--line); border-radius: 980px; background: var(--card); width: 280px; max-width: 100%; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.status { gap: 12px; flex-wrap: wrap; } .queue { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 13px; }
.button.skip { padding: 4px 12px; font-size: 13px; }

/* ---- a box a note is about ---- */
.bill label.flagged { color: var(--amber); }
.bill label.flagged input, .bill label.flagged select, table.lines td.flagged input { border-color: #e0a05a; background-color: #fffaf3; }

/* ---- invoice lines: more room for the description, all of it while typing ---- */
table.lines td.job { width: 96px; } table.lines td.cat { width: 140px; } table.lines td:last-child { width: 92px; }
table.lines td:first-child { position: relative; }
table.lines td:first-child input:focus { position: relative; z-index: 3; width: min(360px, 70vw); box-shadow: 0 0 0 3px rgba(0,113,227,.15); border-color: var(--accent); outline: none; }

/* ---- phones ---- */
@media (max-width: 700px) {
  main { padding: 16px; }
  /* Brand and links on one line, the firm's name on the next. */
  .top { padding: 10px 16px; flex-wrap: wrap; gap: 4px 14px; } .top nav { display: contents; font-size: 13px; }
  /* Brand and firm on the first line, the links on the second. */
  .top .brand { margin-right: auto; }
  .top nav > .company, .top nav > .firm-switch { font-size: 13px; color: var(--muted); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .top nav > .pill { display: none; }
  .top::after { content: ''; flex-basis: 100%; order: 1; }
  .top nav > a { font-size: 14px; order: 2; }
  /* Upload and Test side by side; the email address a quiet line under them. */
  .bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
  .bar .button { justify-content: center; }
  .bar .address { grid-column: 1 / -1; justify-self: start; background: none; border: 0; box-shadow: none; padding: 2px 2px; font-size: 13px; font-weight: 400; color: var(--muted); }
  .bar .address svg:first-child { display: none; } .bar .address::before { content: 'or email\00a0'; } .bar .address span { color: var(--ink); font-weight: 500; }
  .drop-note { display: none; } .upload-status { grid-column: 1 / -1; }
  /* The lists in one row that scrolls sideways, fading at the edge. */
  .list-head { display: block; min-height: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 1px 16px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .chips::-webkit-scrollbar { display: none; } .chip { flex-shrink: 0; }
  /* The one action is pinned to the bottom of the screen, in reach of a thumb. */
  .chip-action:not(.has-search) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(245,245,247,.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .chip-action > * { flex: 1; } .chip-action button, .chip-action .button { width: 100%; text-align: center; justify-content: center; padding: 11px 18px; }
  body:has(.chip-action:not(.has-search)) main { padding-bottom: 84px; }
  .chip-action.has-search { margin-top: 10px; } .chip-action .search input { width: auto; flex: 1; }
  table.list thead { display: none; }
  table.list tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 14px; border-bottom: 1px solid var(--line); gap: 2px 12px; }
  table.list td { padding: 0; border: 0; } table.list td:first-child { grid-column: 1 / -1; }
  table.list td:nth-child(2), table.list td:nth-child(3) { color: var(--muted); font-size: 13px; } table.list td:nth-child(3) { text-align: right; }
  table.list td.num { grid-column: 1 / -1; text-align: left; font-weight: 500; }
  .detail { grid-template-columns: 1fr; } .pdf iframe { height: 55vh; } .side { padding: 14px; }
  .row { grid-template-columns: 1fr; gap: 0; }
  table.lines thead { display: none; }
  table.lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.lines td, table.lines td.job, table.lines td.cat, table.lines td:last-child { width: auto; padding: 0; }
  table.lines td:first-child { grid-column: 1 / -1; } table.lines td.job { order: 1; } table.lines td:last-child { order: 2; } table.lines td.cat { order: 3; grid-column: 1 / -1; }
  table.lines td:first-child input:focus { width: 100%; }
  .actions button { flex: 1 1 auto; }
  .guide { margin-top: 8px; } .card { padding: 16px; }
}

.open-file { display: block; text-align: center; font-size: 13px; margin-top: 8px; position: relative; }
.pdf iframe { height: calc(100vh - 150px); }
@media (max-width: 860px) { .pdf iframe { height: 60vh; } }
.pdf-loading { inset: 0 0 auto 0; height: calc(100vh - 150px); }
@media (max-width: 860px) { .pdf-loading { height: 60vh; } }

/* List rows: the job, category and due date at a glance, and Post on ready rows. */
table.list .sub { color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 400; }
table.list td.jobs, table.list td.cat { font-size: 13px; }
table.list td.jobs { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list td.act { width: 1%; padding-left: 0; text-align: right; }
table.list th.num { text-align: right; }
.row-post { position: relative; z-index: 1; margin: 0; } /* above the link that covers the row */
.row-post button { padding: 5px 14px; font-size: 13px; }
@media (max-width: 700px) {
  table.list td.jobs, table.list td.cat { color: var(--muted); }
  table.list td.cat { text-align: right; }
  /* Without column headings, say which number is which. */
  table.list td.inv::before { content: 'Invoice '; } table.list td.jobs:not(.none)::before { content: 'Job '; }
  table.list tr:has(td.act) td.num { grid-column: auto; }
  table.list td.act { width: auto; align-self: center; }
}

/* ---- checks ---- */
.wide-column { max-width: 860px; }
.check-photo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.check-photo .button { display: inline-flex; align-items: center; gap: 6px; }
#check-photo-status { font-size: 13px; } #check-photo-status.failed { color: #b3261e; }
.check-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.check-form .wide { grid-column: 1 / -1; }
.check-form .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-form .filled { background-color: #f1f7ff; border-color: #9cc3f5; }
.check-form .unclear, .check-form .filled.unclear { background-color: #fff6e6; border-color: #e0a05a; box-shadow: 0 0 0 2px rgba(224,160,90,.25); }
.notice.error { background: #fdecea; color: #8a1c14; border-radius: 10px; padding: 10px 14px; }
@media (max-width: 700px) { .check-form { grid-template-columns: 1fr 1fr; } }

/* Checks: the how-to on the list page, and the review form. */
.howto { background: var(--card); border-radius: 14px; box-shadow: 0 0 0 1px var(--line); padding: 12px 18px; margin: 0 0 18px; font-size: 14px; }
.howto summary { cursor: pointer; font-weight: 500; }
.howto ol { margin: 10px 0 6px 18px; padding: 0; } .howto li { margin: 6px 0; } .howto p { margin: 6px 0 2px; }
.review-form .hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.review-form .actions button.quiet { margin-left: auto; }
.payees-confirm { margin-bottom: 14px; } .payees-confirm ul { margin: 6px 0 12px 18px; padding: 0; columns: 2; font-size: 14px; } .payees-confirm form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .payees-confirm .hint { font-size: 12px; color: var(--muted); }
table.list td.inv { white-space: nowrap; }
