@font-face { font-family: "Plus Jakarta Sans"; src: url(fonts/PlusJakartaSans.ttf) format("truetype"); font-weight: 200 800; font-display: swap; }

:root {
  --navy: #12305f; --navy-dark: #0c2346; --link: #1d56b8;
  --ink: #1a1d24; --muted: #5b6472; --line: #e3e7ee; --control: #8a94a3;
  --bg: #f6f8fb; --surface: #fff; --tint: #eef3fb;
  --green: #17663a; --green-bg: #e6f4ea; --red: #b3261e; --red-bg: #fdecea; --amber: #855300; --amber-bg: #fdf3dc;
  --r: 6px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 "Plus Jakarta Sans", "Segoe UI", sans-serif; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; color: var(--navy); overflow-wrap: anywhere; }
h2 { font-size: 16px; font-weight: 700; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
main:focus { outline: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-top: 32px; padding-bottom: 64px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: var(--surface); padding: 10px 16px; z-index: 10; }
.skip:focus { top: 8px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; text-decoration: none; }
.strong:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.brandbar { display: flex; height: 4px; }
.brandbar i { flex: 1; background: #4285f4; }
.brandbar i:nth-child(2) { background: #34a853; }
.brandbar i:nth-child(3) { background: #fbbc05; }
.brandbar i:nth-child(4) { background: #ea4335; }
.app { padding-left: 248px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; z-index: 5; }
.sidebar > .brandbar { flex: none; }
.logo { display: flex; }
.sidebar .logo { padding: 20px 20px 16px; }
.sidebar > .btn { margin: 4px 16px 20px; flex: none; }
.sidebar nav { display: grid; gap: 4px; padding: 0 12px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r); color: var(--muted); font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: var(--bg); color: var(--navy); }
.sidebar nav a[aria-current] { background: var(--tint); color: var(--navy); font-weight: 600; }
.sidebar .signout { margin-top: auto; padding: 12px 12px 12px 24px; border-top: 1px solid var(--line); justify-content: space-between; }
.mobilebar, .scrim { display: none; }
.signout { display: flex; align-items: center; gap: 8px; }
.user { color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1px solid #c7cedb; border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--tint); border-color: #9fb0cb; }
.btn:active { background: #dfe8f6; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #1b4483; }
.btn.primary:active { background: var(--navy-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--tint); }
.btn.ghost.danger:hover { background: var(--red-bg); }
.btn.square { width: 44px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.pagehead h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.back { display: inline-block; padding: 4px 0; font-size: 14px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.card > h2 { margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.narrow { max-width: 820px; }
.gap { margin-top: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.alert { padding: 12px 16px; border-radius: var(--r); margin-bottom: 20px; font-weight: 500; }
.alert.success { background: var(--green-bg); color: var(--green); }
.alert.error { background: var(--red-bg); color: var(--red); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 20px; }
.stats > div { padding: 20px 24px; min-width: 0; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats .warn dd:nth-of-type(1) { color: var(--red); }
.stats dd.sub { font-size: 13px; font-weight: 400; color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: -12px; }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s; }
.tabs a:hover { background: var(--bg); }
.tabs a[aria-current] { background: var(--tint); color: var(--navy); font-weight: 600; }
.search { display: flex; gap: 8px; }
.search input { width: 210px; min-width: 0; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--navy); white-space: nowrap; }
td { padding: 8px 12px; height: 60px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 13px; font-weight: 600; line-height: 1.5; letter-spacing: 0; background: #eceff4; color: #454e5c; }
.badge.issued { background: var(--tint); color: #1d4a94; }
.badge.paid { background: var(--green-bg); color: var(--green); }
.badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.draft { background: var(--amber-bg); color: var(--amber); }
.badge.cancelled { text-decoration: line-through; }
.empty { padding: 64px 24px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; border-top: 1px solid var(--line); color: var(--muted); }
.pager div { display: flex; gap: 8px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.full { grid-column: 1 / -1; }
.field { min-width: 0; }
label, .lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--red); }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s; }
input:hover, select:hover, textarea:hover { border-color: var(--navy); }
textarea { resize: vertical; display: block; }
[aria-invalid=true] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error:not(.alert) { font-size: 13px; color: var(--red); margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; margin: 0; padding-top: 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; flex: none; accent-color: var(--navy); }
.check small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.formend { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }

.line { display: grid; grid-template-columns: 110px 90px 1fr 1fr 44px; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.line:first-child { padding-top: 0; }
.l-name { grid-column: 1 / 4; grid-row: 1; }
.l-desc { grid-column: 4 / -1; grid-row: 1; }
.l-sac, .l-qty, .l-rate, .l-amount { grid-row: 2; }
.l-amount { text-align: right; }
.l-amount output { display: block; padding-top: 10px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.l-del { grid-row: 2; margin-top: 27px; align-self: start; }
.addrow { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.addrow select { width: auto; max-width: 100%; }
.summary { position: sticky; top: 20px; display: grid; gap: 10px; }
.summary > h2 { margin: 0; }
.summary dl > div, .facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; }
.summary dt, .facts dt { color: var(--muted); flex: none; }
.summary dd, .facts dd { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.summary .total, .facts .total { border-top: 2px solid var(--navy); margin-top: 8px; padding-top: 12px; font-size: 18px; font-weight: 700; }
.total dt, .total dd { color: var(--navy) !important; }
.facts + form { margin-top: 16px; }

.alert.warn { background: var(--amber-bg); color: var(--amber); }
.file { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.cardhead { padding: 18px 24px; border-bottom: 1px solid var(--line); }
.pad { padding: 20px 24px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.rowactions { display: flex; justify-content: flex-end; }
.rowactions .btn { padding: 8px 10px; }
.upload { padding: 16px 24px; border-top: 1px solid var(--line); }
.upload summary { list-style: none; width: fit-content; }
.upload summary::-webkit-details-marker { display: none; }
.upload form { margin-top: 20px; }
.rep { padding: 0 0 20px; }
.rep + .rep { border-top: 1px solid var(--line); padding-top: 20px; }
.rep > .btn { margin-top: 8px; margin-left: -16px; }
.upload .rep { border: 0; }
.intro { margin: -8px 0 16px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 20px 0 0; padding: 20px 0 0; min-width: 0; }
legend { float: left; width: 100%; font-weight: 700; margin-bottom: 12px; padding: 0; }
legend + * { clear: both; }
input[type=file] { padding: 7px; }
input[readonly], textarea[readonly] { background: var(--bg); }
.share { margin-top: 14px; }
.share textarea { font-size: 14px; }
.regform { display: grid; grid-template-columns: 170px minmax(0, 820px); gap: 28px; align-items: start; }
.toc { position: sticky; top: 24px; display: grid; }
.toc a { padding: 10px 0; color: var(--muted); font-weight: 500; text-decoration: none; }
.toc a:hover { color: var(--navy); text-decoration: underline; }
.regform .card { scroll-margin-top: 20px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 16px 0; background: var(--bg); border-top: 1px solid var(--line); }
.regform :is(input, select, textarea) { scroll-margin-bottom: 100px; }
.formend.tight { margin-top: 12px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; align-items: start; }
.choices .card { display: grid; gap: 12px; justify-items: start; }
.choices .card > * { margin: 0; }
.choices .card > form { width: 100%; margin-top: 8px; }
.choices .icon { width: 24px; height: 24px; color: var(--navy); }
.choices .btn .icon { width: 18px; height: 18px; color: inherit; }
.clientcard { white-space: pre-line; color: var(--muted); }
.accountcard { margin-top: 12px; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.clientcard:empty { display: none; }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; color: var(--muted); font-size: 14px; container-type: inline-size; min-width: 0; }
.sheet > *:not(.brandbar) { margin: 0 clamp(16px, 7cqi, 56px); }
.sheet > .alert { margin-top: 24px; }
.sheet header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 40px 0 36px; flex-wrap: wrap; }
.sheet header img { margin-left: -6px; max-width: 100%; height: auto; }
.sheet header div { margin-left: auto; text-align: right; }
.sheet b, .sheet dd, .sheet .who, .sheet .dark { color: var(--ink); }
.sheet .doc { font-size: 26px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); margin-right: -.1em; }
.sheet h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sheet .who { font-weight: 700; }
.sheet p, .sheet dd { overflow-wrap: anywhere; }
.sheet .parties { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line); line-height: 1.65; }
.sheet dl > div { display: flex; justify-content: space-between; gap: 12px; }
.sheet dl dd { text-align: right; font-variant-numeric: tabular-nums; }
.sheet table { width: auto; min-width: calc(100% - 2 * clamp(16px, 7cqi, 56px)); margin-top: 24px; }
.sheet th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 10px 8px; }
.sheet td { color: var(--ink); padding: 14px 8px; height: auto; }
.sheet :is(th, td):first-child { padding-left: 0; width: 40px; }
.sheet :is(th, td):last-child { padding-right: 0; }
.sheet tbody tr:hover { background: none; }
.sheet tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.sheet td b { font-weight: 700; }
.sheet td small { display: block; color: var(--muted); font-size: 13px; }
.sheet .c { text-align: center; }
.sheet .closing { display: grid; grid-template-columns: 1fr minmax(0, 300px); gap: 28px; padding: 28px 0 40px; }
.sheet .closing dl > div { padding: 5px 0; }
.sheet .total { border-top: 1px solid var(--navy); margin-top: 8px; padding-top: 12px !important; font-size: 18px; font-weight: 700; }
.sheet .pay { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 180px); align-items: end; gap: 16px; padding: 28px 0; border-top: 1px solid var(--line); }
.sheet .pay dl > div { display: grid; grid-template-columns: 108px minmax(0, 1fr); }
.sheet .pay .sign { grid-column: 3; }
.sheet .pay dd { text-align: left; }
.qr { display: grid; justify-items: center; font-size: 12px; gap: 4px; }
.sign { text-align: right; color: var(--ink); }
.sign p + p { margin-top: 52px; padding-top: 8px; border-top: 1px solid var(--ink); }
.qr span { text-align: center; }
.sheet .juris { font-size: 13px; padding-bottom: 12px; }
.kinds { margin: 0 0 20px; }
.sheet footer { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding: 16px 0 28px; font-size: 12px; }
@container (max-width: 620px) {
  .sheet .parties, .sheet .closing { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sheet .pay { grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 24px; }
  .sheet .pay dl { width: 100%; }
  .sheet .pay .sign { grid-column: 1; justify-self: end; min-width: 180px; }
  .sheet .doc { font-size: 20px; }
  .sheet header div { margin: 0; text-align: left; }
  .sheet th.c:nth-child(3), .sheet td.c:nth-child(3) { display: none; }
  .sheet :is(th, td):first-child { width: 28px; }
}
.pubhead { max-width: 900px; margin: 0 auto 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.pubhead h1 { font-size: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bare .sheet { max-width: 900px; margin: 0 auto; }
.auth { width: 100%; max-width: 420px; margin: 6vh auto 0; padding: 40px; }
.auth h1 { margin: 24px 0 16px; font-size: 22px; }
.auth > h1:first-child { margin-top: 0; }
.auth .lead { color: var(--muted); margin: -8px 0 20px; }
.auth > img { margin-left: -5px; display: block; max-width: 100%; height: auto; }
dialog { border: 0; border-radius: 8px; padding: 24px; max-width: 420px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgb(12 35 70 / .5); }
dialog div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

@media (max-width: 1280px) {
  .regform { grid-template-columns: minmax(0, 820px); }
  .toc { display: none; }
}
@media (max-width: 1180px) { .app .split { grid-template-columns: minmax(0, 1fr); } .app .summary { position: static; } }
@media (max-width: 1000px) {
  .app { padding-left: 0; }
  .mobilebar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .sidebar { visibility: hidden; transform: translateX(-100%); transition: transform .2s, visibility .2s; }
  .menu-open .sidebar { visibility: visible; transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgb(12 35 70 / .5); z-index: 4; }
  .duo { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .pad, .cardhead, .upload { padding-left: 16px; padding-right: 16px; }
  .choices { grid-template-columns: minmax(0, 1fr); }
  main.wrap { padding-top: 20px; }
  .card { padding: 16px; }
  .stats > div { padding: 14px 16px; }
  .stats dd { font-size: 18px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .toolbar { padding: 12px 16px; }
  .search { width: 100%; }
  .search input { flex: 1; }
  input, select, textarea { font-size: 16px; }
  .line { grid-template-columns: 1fr 1fr; }
  .line > * { grid-column: auto; grid-row: auto; }
  .l-name, .l-desc { grid-column: 1 / -1; }
  .l-amount { text-align: left; }
  .l-del { grid-column: 2; margin: 0; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.sidebar a.user { color: var(--ink); text-decoration: none; padding: 4px 0; line-height: 1.35; }
.user small { display: block; color: var(--muted); font-size: 13px; }
.sidebar a.user:hover small, a.user[aria-current] small { color: var(--link); text-decoration: underline; }
.roles { display: grid; gap: 8px; font-size: 14px; }
.roles div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.roles dt { font-weight: 600; }
.roles dd { color: var(--muted); }
@media (max-width: 760px) { .roles div { grid-template-columns: 1fr; gap: 0; } }
.cardhead.row { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; min-height: 64px; }
.cardhead.row > div { display: flex; gap: 8px; flex-wrap: wrap; }
.count { font-weight: 500; color: var(--muted); margin-left: 4px; }
.segments { display: flex; gap: 24px; margin-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.segments a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.segments a:hover { color: var(--navy); }
.segments a[aria-current] { color: var(--navy); font-weight: 600; border-bottom-color: var(--navy); }
@media (max-width: 760px) { .segments { gap: 4px 16px; } }
.who { font-size: 14px; }
td .who a { color: inherit; }
.related { margin: 0; padding-top: 16px; }
.related legend { margin-bottom: 0; }
.related .check { margin-top: 8px; font-weight: 500; }
.dochead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.dochead h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.dochead .kind { margin-top: 6px; color: var(--muted); font-weight: 500; }
.docstats dd.name { font-size: 18px; line-height: 1.35; padding: 3px 0; }
.docstats .late dd.name, .docstats .late dd.sub { color: var(--red); }
.docstats .late dd.sub { font-weight: 600; }
.split.doc { grid-template-columns: minmax(0, 1fr) 340px; }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; }
.panel .facts > div { padding: 6px 0; }
.panel .facts + .facts { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.panel label { margin-top: 14px; }
.panel .field label { margin-top: 0; }
.wide { width: 100%; }
.joined { display: flex; }
.joined input { border-radius: var(--r) 0 0 var(--r); min-width: 0; font-size: 14px; text-overflow: ellipsis; }
.joined .btn { flex: none; border-color: var(--control); margin-left: -1px; border-radius: 0; }
.joined .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.joined > :focus-visible { z-index: 1; position: relative; }
.btn.done, .btn.done:hover { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.btn.done.primary { background: var(--green); color: #fff; }
.reveal { margin-top: 4px; }
.reveal summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--link); font-size: 14px; font-weight: 500; list-style: none; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal summary::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border: solid currentColor; border-width: 0 1.75px 1.75px 0; transform: translateY(-2px) rotate(45deg); }
.reveal[open] summary::after { transform: translateY(2px) rotate(225deg); }
.bubble { background: #e7f6e3; border-radius: 8px; padding: 12px 14px; font-size: 14px; max-height: 340px; overflow-y: auto; overflow-wrap: anywhere; }
.payform { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 16px; gap: 14px; }
.payform h3 { margin: 0; font-size: 15px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.pair .btn { padding: 8px 6px; font-size: 14px; }
.todo { border-color: #e5c27a; background: var(--amber-bg); }
.todo h2 { color: var(--amber); margin-bottom: 8px; }
.todo ul { margin: 0 0 14px; padding-left: 20px; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu > div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 3; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid #c7cedb; border-radius: 8px; box-shadow: 0 6px 20px rgb(12 35 70 / .12); }
.menu > div :is(a, button) { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r); background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.menu > div :is(a, button):hover { background: var(--tint); }
.menu > div .danger { color: var(--red); }
.menu > div .danger:hover { background: var(--red-bg); }
.menu .apart { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.offscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.upiqr { display: block; background: #fff; }
.qrcheck { display: flex; align-items: center; gap: 20px; margin-top: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.qrcheck > div { flex: 1 1 220px; }
@media (max-width: 1180px) {
  .split.doc { grid-template-columns: minmax(0, 1fr); }
  .split.doc > aside { order: -1; grid-template-columns: 1fr 1fr; align-items: start; }
  .split.doc > aside .todo { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .split.doc > aside { grid-template-columns: minmax(0, 1fr); }
  .dochead .actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .dochead .actions .btn { width: 100%; }
  .dochead .actions > form { grid-column: 1 / -1; grid-row: 1; }
  .dochead .actions > a.btn:nth-child(odd) { grid-column: 1 / -1; }
  .menu > div { right: auto; left: 0; }
  .docstats dd.name { font-size: 16px; }
}
.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; align-content: start; }
.docs > .sheet { width: 100%; }
.sheet .parties.two { grid-template-columns: 1fr 1fr; }
.sheet.slip .doc { font-size: 20px; letter-spacing: .08em; }
.sheet.slip .pay.thanks { grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 32px; padding-top: 48px; }
.sheet.slip .pay.thanks .sign { grid-column: 2; }
@container (max-width: 620px) {
  .sheet .parties.two { grid-template-columns: minmax(0, 1fr); }
  .sheet.slip .doc { font-size: 17px; }
    .sheet.slip .pay.thanks { grid-template-columns: minmax(0, 1fr); padding-top: 28px; }
  .sheet.slip .pay.thanks .sign { grid-column: 1; }
}
.sheet.slip .parties { border-bottom: 0; padding-bottom: 8px; }
.sheet.slip table { border: 1px solid #c5cedd; margin-top: 16px; }
.sheet.slip th, .sheet.slip td { padding: 10px 12px !important; border: 1px solid #c5cedd; width: auto !important; }
.sheet.slip thead th { background: var(--navy); border-color: var(--navy); color: #fff; font-size: 13px; text-transform: none; letter-spacing: 0; white-space: normal; }
.sheet.slip .grid4 :is(th, td) { width: 25% !important; }
.sheet.slip .grid5 :is(thead th, tbody td):first-child { width: 52px !important; }
.sheet.slip tfoot :is(th, td) { background: var(--tint); color: var(--navy); font-weight: 700; font-size: 14px; text-align: right; text-transform: none; letter-spacing: 0; white-space: normal; }
.sheet .inwords { padding: 22px 0 32px; }
.paylist { list-style: none; margin: 0; padding: 0; }
.paylist li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.paylist li > div { min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.paylist small { display: block; color: var(--muted); font-size: 13px; }
.paylist .btn { margin-right: -12px; flex: none; }
.panel .sum dd { font-weight: 600; }
@container (max-width: 620px) {
  .sheet.slip thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .sheet.slip table, .sheet.slip tbody, .sheet.slip tfoot, .sheet.slip tr { display: block; }
  .sheet.slip tr + tr, .sheet.slip tfoot tr { border-top: 2px solid #c5cedd; }
  .sheet.slip :is(td, tfoot th), .sheet.slip .grid4 td, .sheet.slip .grid5 :is(thead th, tbody td):first-child { display: flex !important; width: auto !important; justify-content: space-between; gap: 16px; border: 0; border-bottom: 1px solid var(--line); text-align: right; }
  .sheet.slip tr > :last-child { border-bottom: 0; }
  .sheet.slip td::before { content: attr(data-label); color: var(--muted); font-weight: 400; text-align: left; flex: none; }
  .sheet.slip tfoot th { display: none !important; }
}

/* ---------- Phones and tablets ---------- */
.scroll { container-type: inline-size; }
@container (max-width: 700px) {
  table.cards thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  table.cards, table.cards tbody { display: block; }
  table.cards tr { display: block; position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: flex; justify-content: space-between; gap: 16px; height: auto; padding: 4px 0; border: 0; text-align: right; min-width: 0; }
  table.cards td > * { min-width: 0; }
  table.cards td:first-child { padding: 4px 48px 6px 0; text-align: left; display: block; }
  table.cards td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  table.cards td:last-child:not(.keep) { position: absolute; top: 8px; right: 4px; padding: 0; }
  table.cards .rowactions { width: 100%; flex-wrap: wrap; }
  table.cards .nowrap { white-space: normal; }
}
@container (max-width: 820px) {
  table.ilist thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  table.ilist, table.ilist tbody { display: block; }
  table.ilist tr { display: block; position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.ilist tr:last-child { border-bottom: 0; }
  table.ilist td { display: flex; justify-content: space-between; gap: 16px; height: auto; padding: 4px 0; border: 0; text-align: right; min-width: 0; }
  table.ilist td > * { min-width: 0; }
  table.ilist td:first-child { padding: 4px 48px 6px 0; text-align: left; display: block; }
  table.ilist td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  table.ilist td:last-child:not(.keep) { position: absolute; top: 8px; right: 4px; padding: 0; }
  table.ilist .rowactions { width: 100%; flex-wrap: wrap; }
  table.ilist .nowrap { white-space: normal; }
}
@container (max-width: 1000px) {
  table.wide thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  table.wide, table.wide tbody { display: block; }
  table.wide tr { display: block; position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.wide tr:last-child { border-bottom: 0; }
  table.wide td { display: flex; justify-content: space-between; gap: 16px; height: auto; padding: 4px 0; border: 0; text-align: right; min-width: 0; }
  table.wide td > * { min-width: 0; }
  table.wide td:first-child { padding: 4px 48px 6px 0; text-align: left; display: block; }
  table.wide td[data-label]::before { content: attr(data-label); color: var(--muted); text-align: left; flex: none; }
  table.wide td:last-child:not(.keep) { position: absolute; top: 8px; right: 4px; padding: 0; }
  table.wide .rowactions { width: 100%; flex-wrap: wrap; }
  table.wide .nowrap { white-space: normal; }
}
@container (max-width: 820px) {
  table.cards.ilist tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 16px 6px; }
  table.cards.ilist td, table.cards.ilist td:first-child, table.cards.ilist td:last-child:not(.keep) { display: block; position: static; padding: 0; }
  table.cards.ilist td[data-label]::before { content: none; }
  table.ilist .c-id { grid-area: 1 / 1; text-align: left !important; }
  table.ilist .c-total { grid-area: 1 / 2; align-self: start; font-weight: 600; }
  table.cards.ilist .c-total { padding-top: 10px; }
  table.ilist .c-total > div::before { content: "₹ "; }
  table.ilist .c-total > div { display: inline-block; vertical-align: top; }
  table.ilist .c-date { grid-area: 2 / 1; text-align: left !important; font-size: 14px; color: var(--muted); }
  table.ilist .c-due { grid-area: 3 / 1; text-align: left !important; font-size: 14px; color: var(--muted); }
  table.ilist .c-due::before { content: attr(data-label) " " !important; }
  table.ilist .c-type { grid-area: 4 / 1; text-align: left !important; font-size: 14px; color: var(--muted); }
  table.ilist .c-status { grid-area: 2 / 2; }
  table.ilist .c-pdf { grid-area: 3 / 2 / span 2; justify-self: end; }
  table.ilist .c-pdf .btn { margin-right: -12px; }
}
.tabbar, .quicksave { display: none; }
.tabs, .segments { scrollbar-width: none; }
.tabs::-webkit-scrollbar, .segments::-webkit-scrollbar { display: none; }

@media (max-width: 1000px) {
  .mobilebar { position: sticky; top: 0; z-index: 4; padding-top: max(6px, env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); }
  .mobilebar .logo { min-height: 44px; align-items: center; }
  .sidebar { z-index: 8; width: min(300px, 86vw); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); overscroll-behavior: contain; }
  .menu-open { overflow: hidden; }
  .menu-open .scrim { z-index: 7; }
  .sidebar nav a { min-height: 48px; }
  .app main.wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; inset: auto 0 0 0; z-index: 5; display: flex; background: var(--surface); border-top: 1px solid #c7cedb; padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); }
  .tabbar :is(a, button) { flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer; }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar [aria-current] { color: var(--navy); font-weight: 700; }
  .tabbar .new .icon { width: 36px; height: 26px; padding: 3px 8px; border-radius: 13px; background: var(--navy); color: #fff; }
  .tabbar :is(a, button):active { background: var(--tint); }
  .tabbar :focus-visible { outline-offset: -3px; }
  /* Long forms have their own bar at the bottom, so only one bar is ever on screen. */
  body:has(#invoice-form) .tabbar, body:has(.savebar) .tabbar { display: none; }
  .savebar { bottom: 0; z-index: 3; margin: 0 -24px; padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
  .savebar .primary { flex: 1; }
  .app:has(.savebar) main.wrap, .app:has(#invoice-form) main.wrap { padding-bottom: 0; }
  #invoice-form { gap: 20px; }
  .quicksave { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 -24px; padding: 8px 24px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid #c7cedb; }
  .quicksave small { display: block; color: var(--muted); font-size: 13px; line-height: 1.2; }
  .quicksave b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .quicksave .btn { min-height: 48px; padding: 8px 24px; }
  #invoice-form .summary .primary { display: none; }
  :is(#invoice-form, .regform) :is(input, select, textarea, button) { scroll-margin: 80px 0 100px; }
  .toc { display: flex; gap: 8px; overflow-x: auto; position: static; margin: 0 -24px; padding: 0 24px; scrollbar-width: none; }
  .toc::-webkit-scrollbar { display: none; }
  .toc a { flex: none; padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center; border: 1px solid #c7cedb; border-radius: 22px; background: var(--surface); font-size: 14px; }
  .regform { gap: 16px; }
  .regform .card { scroll-margin-top: 72px; }
}
@media (min-width: 1001px) and (max-width: 1280px) { .regform .toc { display: none; } }

@media (max-width: 760px) {
  h1 { font-size: 23px; }
  .pagehead { align-items: center; margin-bottom: 16px; gap: 10px 12px; }
  .pagehead > div:first-child { min-width: 0; }
  .toolbar { gap: 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 10px; width: calc(100% + 32px); }
  .tabs a { flex: none; }
  .kinds { margin-bottom: 16px; }
  .segments { flex-wrap: nowrap; overflow-x: auto; gap: 20px; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .segments a { flex: none; }
  .savebar, .quicksave { margin: 0 -16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .toc { margin: 0 -16px; padding: 0 16px; }
  .savebar .btn { padding-left: 12px; padding-right: 12px; }
  .formend .btn, .formend form { flex: 1 1 auto; }
  .formend form .btn { width: 100%; }
  .line { grid-template-columns: 1fr 1fr 44px; }
  .l-name, .l-desc { grid-column: 1 / -1; }
  .l-sac { grid-column: 1; }
  .l-qty { grid-column: 2 / -1; }
  .l-rate { grid-column: 1; }
  .l-amount { grid-column: 2; text-align: left; }
  .l-del { grid-column: 3; margin: 27px 0 0; justify-self: end; }
  .addrow > * { flex: 1 1 140px; }
  .addrow select { width: 100%; }
  .cardhead.row { padding-top: 8px; padding-bottom: 8px; }
  dialog div { flex-direction: column-reverse; }
  dialog .btn { width: 100%; min-height: 48px; }
  .pager { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .pubhead .btn { width: 100%; }
  .qrcheck { justify-content: center; text-align: center; }
  .empty { padding: 40px 16px; }
}
@media (max-width: 359px) {
  .pair { grid-template-columns: 1fr; }
  .dochead .actions .btn { padding-left: 8px; padding-right: 8px; }
  .stats dd { font-size: 16px; }
  .stats > div { padding: 12px; }
}
/* Invoice and slip on narrow screens: every column stays inside the page. */
@container (max-width: 620px) {
  .sheet:not(.slip) > table :is(th, td):nth-child(1) { display: none; }
  .sheet:not(.slip) > table :is(th, td):nth-child(2) { padding-left: 0; }
  .sheet:not(.slip) > table td:nth-child(2) { width: 100%; }
  .sheet:not(.slip) > table th { white-space: normal; letter-spacing: .02em; padding-left: 4px; padding-right: 4px; }
  .sheet:not(.slip) > table td { padding-left: 4px; padding-right: 4px; }
  .sheet:not(.slip) > table :is(th, td):nth-child(2) { padding-left: 0; }
  .sheet:not(.slip) > table :is(th, td):last-child { padding-right: 0; white-space: nowrap; }
  .sheet header { padding: 28px 0 24px; }
  .sheet .doc { overflow-wrap: normal; letter-spacing: .06em; }
}
/* Touch screens of any size: comfortable targets, and 16px fields so iOS does not zoom in. */
@media (pointer: coarse), (max-width: 760px) {
  input, select, textarea, .joined input, .share textarea { font-size: 16px; }
  .back { min-height: 44px; display: inline-flex; align-items: center; padding: 0; }
  .tabs a { min-width: 48px; justify-content: center; }
  td .strong, li .strong { display: inline-flex; align-items: center; min-height: 40px; }
  td .who a, .facts dd a, .hint a, .linkbtn, main p > a:not(.btn) { display: inline-block; padding: 10px 0; margin: -6px 0; }
  .linkbtn { min-height: 44px; }
  .check { padding-top: 10px; padding-bottom: 10px; }
  .check input { width: 22px; height: 22px; }
  .sidebar a.user { min-height: 44px; display: inline-flex; flex-direction: column; justify-content: center; }
  .menu > div :is(a, button) { min-height: 48px; }
}
/* Phones held sideways: bars scroll away so the little height left is for content. */
@media (max-height: 480px) and (max-width: 1000px) {
  .mobilebar { position: static; }
  .tabbar :is(a, button) { min-height: 48px; flex-direction: row; gap: 8px; font-size: 13px; }
  .savebar, .quicksave { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
}
@media print { .tabbar, .mobilebar, .sidebar, .savebar, .quicksave { display: none !important; } .app { padding-left: 0; } }
/* Amounts, dates and statuses are never broken across lines; names may wrap between words. */
td { overflow-wrap: break-word; }
.sheet td, .sheet dd, .file { overflow-wrap: anywhere; }
td.num, td .badge, .c-type, .badge { white-space: nowrap; }
.sheet.slip td.num, .sheet td.num { white-space: nowrap; }
.sign img { display: block; margin: 6px auto 0; max-width: 100%; height: auto; }
.sign img + p { margin-top: 5px; padding-top: 8px; border-top: 1px solid var(--ink); }
.sheet .mark { margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.sheet .closing dt small { display: block; font-size: 12px; }
.sheet .payable { border-top: 1px solid var(--navy); margin-top: 4px; font-weight: 700; }
.sheet .payable :is(dt, dd) { color: var(--navy); }
.vouchers li { flex-wrap: wrap; }
.vouchers .rowbtns { display: flex; margin-right: -12px; }
.vouchers .rowbtns .btn { margin: 0; }
.vouchers .reveal { flex: 1 0 100%; margin: 0; }
.reveal form { padding: 4px 0 12px; }
.creditsum { margin-top: 20px; font-size: 16px; }
.ritems td small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.ritems td { height: auto; padding-top: 12px; padding-bottom: 12px; }
.ritems tfoot th { border: 0; color: var(--navy); font-size: 14px; padding-left: 24px; }
.ritems tfoot td { border: 0; color: var(--navy); font-size: 16px; }
.creditsum b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.related-docs { max-width: 900px; margin: 24px auto 0; }
.related-docs ul { margin: 0; padding-left: 20px; }
.related-docs li { padding: 6px 0; }
.monthpick { display: flex; gap: 8px; }
.monthpick input { min-width: 0; }
.pairnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pairnav b { text-align: center; }
tfoot th[scope=row] { text-align: right; border: 0; }
tfoot td { font-weight: 700; border-bottom: 0; }
@container (max-width: 1000px) {
  table.wide tfoot, table.wide tfoot tr { display: block; }
  table.wide tfoot tr { background: var(--tint); }
  table.wide tfoot th { display: block; text-align: left; padding: 4px 0; }
  table.wide tfoot td:first-of-type { display: flex; padding: 4px 0; text-align: right; }
  table.wide td.num { white-space: normal; }
}
.pick { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 4px 0 -12px; vertical-align: middle; cursor: pointer; }
.pick input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--navy); }
.sharebar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.sharebar .primary { margin-left: auto; }
.reportdoc > .sheet { max-width: 900px; margin: 0 auto; }
.sheet.voucher .even { table-layout: fixed; }
.sheet.voucher h3:not(:first-child) { margin-top: 16px; }
.creditlines { border: 0; padding: 0; margin: 24px 0 0; min-width: 0; display: grid; gap: 16px; }
.creditlines legend { padding: 0; font-weight: 700; }
.creditlines > .hint { margin: 0; }
.creditlines .field label { overflow-wrap: anywhere; }
.rights { margin-top: 40px; color: var(--muted); font-size: 13px; text-align: center; }
.app:has(.savebar) .rights, .app:has(#invoice-form) .rights { display: none; }

.line { grid-template-columns: 100px 84px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 44px; }
.l-discount { grid-row: 2; }
.l-name { grid-column: 1 / 4; }
.l-desc { grid-column: 4 / -1; }
@media (max-width: 760px) {
  .line { grid-template-columns: 1fr 1fr 44px; }
  .l-name, .l-desc { grid-column: 1 / -1; }
  .l-rate, .l-discount, .l-sac, .l-qty, .l-amount, .l-del { grid-row: auto; }
  .l-discount { grid-column: 2 / -1; }
  .l-amount { grid-column: 1 / 3; }
  .l-del { grid-column: 3; margin-top: 10px; }
}
.spaced form { margin-top: 12px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain a { display: block; padding: 11px 0; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stats.dash .late .sub { color: var(--red); font-weight: 600; }
.dashgrid { grid-template-columns: minmax(0, 1fr) 360px; }
.dashgrid > .stack { grid-template-columns: minmax(0, 1fr); }
.dashlist { list-style: none; margin: 0; padding: 0; }
.dashlist li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 24px; border-top: 1px solid var(--line); }
.dashlist li > div { min-width: 0; overflow-wrap: anywhere; }
.dashlist small { display: block; color: var(--muted); font-size: 13px; }
.dashlist .end { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.dashlist .bad { color: var(--red); }
.dashlist + .pad { border-top: 1px solid var(--line); padding-top: 12px; padding-bottom: 12px; font-size: 14px; }
.chartcard { position: relative; }
.chartcard header { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.chartcard > .muted { font-size: 14px; }
.legend { list-style: none; display: flex; gap: 16px; margin: 0; padding: 0; font-size: 14px; color: var(--muted); }
.legend li, .tip span { display: flex; align-items: center; gap: 8px; }
.legend i, .tip i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
i.s1 { background: #1d56b8; }
i.s2 { background: #1a9e6b; }
.chart { overflow-x: auto; margin-top: 16px; }
.chart svg { display: block; width: 100%; min-width: 640px; height: auto; }
.chart text { font-size: 12px; fill: var(--muted); }
.chart path.s1 { fill: #1d56b8; }
.chart path.s2 { fill: #1a9e6b; }
.chart .grid-l { stroke: var(--line); }
.chart .base-l { stroke: var(--control); }
.chart .month rect { fill: transparent; }
.chart .month.on rect { fill: var(--tint); }
.tip { position: absolute; z-index: 2; min-width: 190px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 20px rgb(12 35 70 / .14); font-size: 13px; pointer-events: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip em { margin-left: auto; padding-left: 16px; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.chartcard .reveal { margin-top: 12px; }
.mini td { height: auto; padding: 8px 12px; }
.mini :is(th, td):first-child { padding-left: 0; }
@media (max-width: 1180px) { .dashgrid { grid-template-columns: minmax(0, 1fr) !important; } }
@media (max-width: 1000px) { .stats.three > div:nth-child(3) { border-top: 0; border-left: 1px solid var(--line); } .dash-new { display: none; } }
@media (max-width: 760px) {
  .dashlist li { padding: 12px 16px; }
  .stats.three { grid-template-columns: minmax(0, 1fr); }
  .stats.three > div + div { border-left: 0 !important; border-top: 1px solid var(--line) !important; }
}

/* ---------- Sign in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f1f4f9; }
.signin > .brandbar { flex: none; }
.signin main.wrap { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; }
.signin .login { width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; }
.signin .auth { max-width: 440px; margin: 0; padding: 40px; border-color: #dde3ec; border-radius: 10px; box-shadow: 0 1px 2px rgb(12 35 70 / .05), 0 12px 32px rgb(12 35 70 / .07); }
.signin .auth > img { margin: 0 auto; width: 210px; }
.signin .auth h1 { margin: 28px 0 24px; padding-top: 28px; border-top: 1px solid var(--line); font-size: 20px; text-align: center; letter-spacing: 0; }
.signin .auth .lead { margin: -16px 0 24px; text-align: center; }
.signin .auth .stack { gap: 18px; }
.signin .auth .req { display: none; }
.signin .auth input { min-height: 48px; }
.signin .auth .primary { width: 100%; min-height: 48px; margin-top: 6px; }
.signin .auth .stack + .hint { margin-top: 20px; text-align: center; }
.signin .rights { margin: 24px 0 0; padding-bottom: env(safe-area-inset-bottom); text-wrap: balance; }
.pwbox { position: relative; }
.pwbox input { padding-right: 52px; }
.pwbox button { position: absolute; inset: 0 0 0 auto; width: 48px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: var(--r); }
.pwbox button:hover { color: var(--navy); }
.caps:empty { display: none; }
.caps { color: var(--amber); }
@media (max-width: 480px) {
  .signin .auth { padding: 28px 20px; }
  .signin .auth h1 { margin: 22px 0 20px; padding-top: 22px; }
}

.track .plain li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.track .plain li > span { min-width: 0; overflow-wrap: anywhere; }
.track .plain a { flex: none; min-height: 44px; }
.sourceline { margin-bottom: 16px; }

/* ---------- Sidebar ---------- */
.sidebar { overflow: hidden; border-right-color: #e1e6ee; }
.sidebar .logo { padding: 18px 20px 14px; flex: none; }
.sidebar .logo img { width: 148px; height: auto; }
.sidebar > .btn { margin: 4px 14px 14px; min-height: 42px; border-radius: 8px; }
.sidebar nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: block; padding: 2px 14px 16px; scrollbar-width: thin; scrollbar-color: #d3dae5 transparent; }
.navgroup { display: grid; gap: 2px; }
.navgroup + .navgroup { margin-top: 18px; }
.navlabel { padding: 0 10px 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.sidebar nav a { min-height: 38px; gap: 11px; padding: 0 10px; border-radius: 8px; color: #3d4757; font-size: 14px; font-weight: 500; }
.sidebar nav a .icon { color: #6a7688; transition: color .15s; }
.sidebar nav a:hover { background: #f3f5f9; color: var(--ink); }
.sidebar nav a:hover .icon { color: var(--navy); }
.sidebar nav a[aria-current] { background: #e8eef9; color: var(--navy); font-weight: 600; }
.sidebar nav a[aria-current] .icon { color: var(--link); }
.sidebar nav a:focus-visible { outline-offset: -2px; }
.navcount { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--red-bg); color: var(--red); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.sidebar .signout { flex: none; margin: 0; padding: 10px 14px; gap: 4px; border-top-color: #e1e6ee; }
.sidebar a.user { flex: 1; min-width: 0; max-width: none; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; padding: 6px 8px; border-radius: 8px; transition: background .15s; }
.sidebar a.user:hover, .sidebar a.user[aria-current] { background: #f3f5f9; }
.sidebar a.user > span { min-width: 0; line-height: 1.3; }
.sidebar a.user :is(b, small) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; }
.sidebar a.user b { font-size: 14px; font-weight: 600; text-transform: capitalize; }
.sidebar a.user small { color: var(--muted) !important; font-size: 12px; }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 13px; font-weight: 600; font-style: normal; }
.sidebar .signout .btn { width: 40px; min-height: 40px; color: var(--muted); border-radius: 8px; }
.sidebar .signout .btn:hover { color: var(--navy); }
@media (max-width: 1000px), (pointer: coarse) {
  .sidebar nav a { min-height: 46px; font-size: 15px; }
  .sidebar > .btn { min-height: 46px; }
  .sidebar .signout .btn { width: 44px; min-height: 44px; }
  .sidebar a.user { min-height: 48px; }
}
@media (max-height: 700px) and (min-width: 1001px) and (pointer: fine) {
  .sidebar nav a { min-height: 34px; }
  .navgroup + .navgroup { margin-top: 12px; }
}
@media (max-height: 480px) {
  .sidebar { overflow-y: auto; }
  .sidebar nav { flex: none; overflow: visible; }
}
.lead { max-width: 75ch; }
.svcsearch select { width: 210px; min-width: 0; }
.svcsearch input { width: 150px; }
.grouprow th { background: #f6f8fb; color: var(--ink); font-size: 13px; font-weight: 700; padding: 9px 12px 9px 24px; border-bottom: 1px solid var(--line); white-space: normal; }
.svc td { padding-top: 10px; padding-bottom: 10px; }
.svc .rowactions { justify-content: flex-end; flex-wrap: nowrap; }
.picklist label { display: flex; gap: 14px; align-items: flex-start; margin: 0; font-weight: 400; cursor: pointer; min-height: 44px; }
.picklist label.done { cursor: default; color: var(--muted); }
.picklist input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.picklist b { font-weight: 600; }
.picklist .end > span { display: block; white-space: nowrap; }
.picklist .end .badge { display: inline-block; margin-top: 4px; }
.sacguide dl { margin: 8px 0 0; }
.sacguide dl > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: baseline; border-top: 1px solid var(--line); }
.sacguide .linkbtn { min-height: 44px; }
.sacguide dd { font-size: 14px; color: var(--muted); padding: 8px 0; }
#sac-text:empty { display: none; }
@media (max-width: 760px) {
  .svcsearch { flex-wrap: wrap; }
  .svcsearch select { width: 100%; }
  .svc .grouprow { padding: 0; border: 0; }
  .svc .grouprow th { display: block; width: 100%; padding: 10px 16px; }
  .picklist li { flex-direction: column; gap: 4px; }
  .picklist .end { text-align: left; padding-left: 34px; }
}
.card > .cardhead:has(+ .picklist) { margin-bottom: 0; }
@container (max-width: 700px) { table.cards.svc td:first-child { padding-right: 112px; } }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; min-width: 0; }
.manualno { margin-top: 12px; max-width: 360px; }
.numrow { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 8px 20px; }
.numrow .preview { grid-column: 1 / -1; margin: 0; font-weight: 600; color: var(--navy); overflow-wrap: anywhere; }
.numrow + .numrow { padding-top: 16px; border-top: 1px solid var(--line); }
.tokens code, .reveal code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--tint); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 760px) { .numrow { grid-template-columns: minmax(0, 1fr); } }
.months li.off { opacity: .6; }
.months .end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.citem .grid { margin-bottom: 8px; }
.citem + .citem { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.facts dt small { display: block; font-size: 12px; color: var(--muted); }
.card > .cardhead:has(+ .months) { margin-bottom: 0; }
#contract-form .field:has(#pick-service) { margin-bottom: 20px; }
.cfacts > div { align-items: flex-start; }
.cfacts dt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.cfacts dd { flex: none; white-space: nowrap; overflow-wrap: normal; }
.card > h2.gap { margin-top: 24px; }
.c-month { min-width: 0; }
.choice legend { font-weight: 700; font-size: 14px; margin-bottom: 4px; padding: 0; }
#bill .manualno { margin: 4px 0 0 32px; }
#bill .muted { margin-bottom: 4px; }
/* SAC and quantity never break inside a number. The description takes the remaining width. */
.sheet:not(.slip) td.c { white-space: nowrap; overflow-wrap: normal; }
.sheet:not(.slip) th.c { white-space: nowrap; }
.sheet:not(.slip) :is(th, td):nth-child(2) { width: 100%; }
#convert .manualno { margin: 4px 0 0 32px; }

/* ---------- 1gm dealer form ---------- */
.badge.gold { background: #fbf1d6; color: #7a5500; }
td .badge.gold { margin-left: 6px; vertical-align: 1px; }
.apply { max-width: 820px; margin: 0 auto; }
.applyhead { padding: 8px 0 24px; }
.brandmark { font-size: 15px; font-weight: 600; letter-spacing: .02em; color: #7a5500; margin-bottom: 10px; }
.brandmark b { font-size: 22px; font-weight: 800; color: var(--navy); margin-right: 4px; }
.applyhead h1 { font-size: 30px; margin-bottom: 8px; }
.applyhead .lead { color: var(--muted); max-width: 65ch; }
/* Formal look: square corners, a rule under the heading, and a numbered bar of the steps. */
.applyhead { border-bottom: 2px solid var(--navy); margin-bottom: 24px; }
.applyhead h1 { letter-spacing: -.01em; }
.apply .card { border-radius: 4px; }
.apply .alert { border-radius: 4px; }
.alert.info { background: var(--tint); color: var(--navy); }
.steps { list-style: none; margin: 0 0 24px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); counter-reset: none; }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.steps li::before { content: ''; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.steps li:first-child::before { display: none; }
.steps li.done::before, .steps li[aria-current]::before { background: var(--navy); }
.steps .no { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--control); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 14px; }
.steps li[aria-current] { color: var(--navy); font-weight: 700; }
.steps li[aria-current] .no { background: var(--navy); border-color: var(--navy); color: #fff; }
.steps li.done { color: var(--ink); cursor: pointer; }
.steps li.done .no { border-color: var(--navy); color: var(--navy); }
.steps li.done:hover .lbl { text-decoration: underline; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.apply .step > h2 { font-size: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.apply .step > h2:focus { outline: none; }
.apply .step > .intro { margin: 0 0 20px; }
.stepnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.stepnav .btn { min-height: 46px; min-width: 140px; border-radius: 4px; }
.stepnav .primary { margin-left: auto; }
.stepnav[hidden], .stepnav [hidden] { display: none; }
.sendcard .stepnav { width: 100%; margin-top: 0; padding-top: 0; border-top: 0; }
.keepnote { margin-top: 16px; }
@keyframes stepin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.apply .step.enter { animation: stepin .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .apply .step.enter { animation: none; } }
/* Phones: a compact header and step bar, room for the thumb, and Back and Next always at hand at the bottom of the screen. */
@media (max-width: 760px) {
  .applyhead { padding: 0 0 16px; margin-bottom: 16px; }
  .applyhead h1 { font-size: 22px; margin-bottom: 6px; }
  .applyhead .lead { font-size: 14px; }
  .apply .brandlogo { width: 150px; margin-bottom: 12px; }
  .steps { margin-bottom: 16px; }
  .steps .no { width: 28px; height: 28px; font-size: 13px; }
  .steps li::before { top: 13px; }
  .steps li { gap: 6px; }
  .steps .lbl { font-size: 11px; line-height: 1.25; }
  .apply .card.step { padding: 20px 16px; }
  .apply .step > h2 { font-size: 18px; padding-bottom: 12px; margin-bottom: 16px; }
  .wizard .stepnav { position: sticky; bottom: 0; z-index: 5; margin: 24px -16px -20px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(18, 48, 95, .08); border-radius: 0 0 4px 4px; }
  .wizard .sendcard .stepnav { width: auto; margin: 8px -16px -20px; padding-top: 12px; border-top: 1px solid var(--line); }
  .stepnav .btn { min-width: 0; flex: 1; min-height: 48px; }
  .stepnav [data-back] { flex: 0 0 34%; }
  .sendcard { gap: 12px; margin-top: 20px; padding-top: 16px; justify-items: stretch; }
  .sendcard .primary { min-width: 0; }
  .sendcard .cf-turnstile { max-width: 100%; }
  .decltext { max-height: 260px; padding: 12px; }
  .decl .check { align-items: flex-start; }
  .docrow input[type=file] { font-size: 14px; }
  .apply .alert { font-size: 14px; }
}
.apply .card > h2 { display: flex; align-items: center; gap: 10px; }
.stepno { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; flex: none; }
.stepno:empty { display: none; }
.typechoice { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.typechoice label { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--control); border-radius: 8px; cursor: pointer; margin: 0; font-weight: 400; min-height: 44px; }
.typechoice label:has(:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--tint); }
.typechoice input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.typechoice b { display: block; font-weight: 700; }
.typechoice small { color: var(--muted); font-size: 13px; }
.typed { display: grid; gap: 20px; }
.apply .intro { margin: -8px 0 16px; }
.docs-list, .decls { border: 0; margin: 0; padding: 0; min-width: 0; }
.docrow { padding: 14px 0; border-top: 1px solid var(--line); }
.docrow:first-of-type { border-top: 0; padding-top: 0; }
.docrow label { margin-bottom: 4px; }
.docrow .hint { margin: 0 0 8px; }
.docrow input[type=file] { padding: 8px; min-height: 44px; background: var(--bg); }
.docrow.bad input[type=file] { border-color: var(--red); }
.opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.held { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--green); margin: 0 0 8px; overflow-wrap: anywhere; }
.decl { padding: 16px 0; border-top: 1px solid var(--line); }
.decl h3 { font-size: 15px; margin: 0 0 8px; }
.decltext ol { margin: 8px 0 0; padding-left: 22px; }
.decl .check { font-weight: 600; }
.signbox { border-top: 1px solid var(--line); padding-top: 16px; max-width: 480px; }
.decl:first-of-type { border-top: 0; padding-top: 0; }
.decl summary { cursor: pointer; font-weight: 600; color: var(--link); min-height: 44px; display: flex; align-items: center; }
.decltext { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin: 4px 0 8px; font-size: 14px; max-height: 340px; overflow-y: auto; }
.decltext p + p, .decltext ul + p { margin-top: 8px; }
.decltext ul { margin: 8px 0 0; padding-left: 20px; }
.decltext li + li { margin-top: 4px; }
.decl.bad .check span { color: var(--red); }
.sendcard { display: grid; gap: 14px; justify-items: start; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.sendcard .primary { min-width: 240px; min-height: 48px; }
.sendcard .cf-turnstile { width: 100%; max-width: 400px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.applyfoot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; }
.thanks-card { text-align: center; padding: 40px 32px; margin-top: 24px; }
.thanks-card h1 { margin: 16px 0 8px; }
.thanks-card .lead { color: var(--muted); max-width: 52ch; margin: 0 auto; }
.tick { width: 56px; height: 56px; margin: 8px auto 0; border-radius: 50%; background: var(--green-bg); display: grid; place-items: center; }
.tick svg { width: 30px; height: 30px; fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.nextsteps { text-align: left; max-width: 520px; margin: 24px auto; padding-left: 20px; display: grid; gap: 10px; }
.dealerbanner { border-color: #e9d9a8; background: #fffaf0; }
.doccheck .end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.doccheck .rowbtns { display: flex; gap: 4px; }
.decllist li { padding: 4px 0; }
.approvenote { align-self: center; }
@media (max-width: 760px) {
  .typechoice { grid-template-columns: minmax(0, 1fr); }
  .applyhead h1 { font-size: 24px; }
  .doccheck li { flex-direction: column; }
  .doccheck .end { justify-content: flex-start; }
}
.brandlogo { display: block; width: 240px; max-width: 70%; height: auto; margin: 0 0 20px; }
.thanks-card .brandlogo { margin: 0 auto 8px; width: 200px; }
@media (max-width: 760px) { .brandlogo { width: 190px; } }
.declhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.declhead h3 { margin: 0; font-size: 15px; }
.decl label[for] { margin-top: 8px; }
.decl input[type=file] { padding: 8px; min-height: 44px; background: var(--bg); }
.decl.bad input[type=file] { border-color: var(--red); }
@media (max-width: 760px) { .declhead .btn { width: 100%; } }
.sheet .terms { padding-bottom: 12px; }
.sheet .terms h3 { margin-bottom: 4px; }
.sheet .terms p { font-size: 12.5px; line-height: 1.55; }
.subhead { margin: 24px 0 12px; font-size: 15px; }

/* Dealer form header: a letterhead, with the logo on the left and the title of the form on the right. */
.apply .applyhead { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: 4px; padding: 24px 28px 20px; margin-bottom: 24px; }
.apply .letterhead { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.apply .letterhead .brandlogo { width: 170px; max-width: 45%; margin: 0; }
.apply .formtitle { text-align: right; }
.apply .formtitle .eyebrow { margin-bottom: 6px; }
.apply .applyhead .formtitle h1 { font-size: 26px; margin: 0; line-height: 1.2; }
.apply .applyhead .lead { font-size: 15px; max-width: none; margin: 0; }
@media (max-width: 760px) {
  .apply .applyhead { padding: 18px 16px 16px; margin-bottom: 16px; }
  .apply .letterhead { flex-direction: column; align-items: flex-start; gap: 12px; padding-bottom: 14px; margin-bottom: 12px; }
  .apply .letterhead .brandlogo { width: 130px; max-width: 60%; }
  .apply .formtitle { text-align: left; }
  .apply .formtitle .eyebrow { font-size: 11px; }
  .apply .applyhead .formtitle h1 { font-size: 21px; }
  .apply .applyhead .lead { font-size: 14px; }
}
