
:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1c2430; --muted: #667182; --line: #e1e5eb;
  --accent: #1f5fd1; --accent-text: #fff; --danger: #b3261e; --ok: #1a7f4b; --warn: #a15c00;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
.nav { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.nav-inner { max-width: 1040px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 4px; min-height: 52px; }
.nav-tabs { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-menu { display: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text); margin-right: 16px; }
.brand:hover { text-decoration: none; }
.brand .logo, .brand .logo svg { display: block; width: 24px; height: 24px; }
.nav a.tab { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav .btn.link { white-space: nowrap; margin-left: 8px; }
.two-col > div { min-width: 0; }
.nav a.tab:hover { background: var(--bg); text-decoration: none; }
.nav a.tab.active { color: var(--text); background: var(--bg); }
.nav .spacer { flex: 1; }
.nav form { margin: 0; }
main { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow-x: auto; }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(0.94); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eceff3; color: #48535f; white-space: nowrap; }
.badge.paid { background: #dff3e8; color: var(--ok); }
.badge.overdue { background: #fbe4e2; color: var(--danger); }
.badge.sent, .badge.partial { background: #e3ecfb; color: #1b4fae; }
.badge.warn { background: #fdf0d8; color: var(--warn); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tile .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .v.overdue { color: var(--danger); }
.tile .v.ok { color: var(--ok); }
.tile .k a { color: inherit; }
.tile .n { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters a { padding: 5px 11px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14px; }
.filters a.active { background: var(--text); color: #fff; }
.filters a:hover { text-decoration: none; background: #e6e9ee; }
.filters a.active:hover { background: var(--text); }
.section-tabs { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-tabs a { font-size: 15px; padding: 6px 14px; }
.new-type { margin-top: 10px; }
.new-type label { font-weight: 500; color: var(--muted); font-size: 13px; }
.filters form { margin-left: auto; }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.job-list { list-style: none; margin: 0; padding: 0; }
.job-list li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.job-list li:first-child { border-top: 0; padding-top: 0; }
.job-list li:last-child { padding-bottom: 0; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; margin: 2px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #c9cfd8; border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9db9ee; outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid2, .grid4 { grid-template-columns: 1fr; } }
.notice { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; border: 1px solid; }
.notice.ok { background: #e9f6ef; border-color: #bfe3cf; color: #14603a; }
.notice.error { background: #fdecea; border-color: #f3c4c0; color: #8c1d18; }
.notice.info { background: #eef3fc; border-color: #c9d8f5; color: #1b3f86; }
.notice ul { margin: 0; padding-left: 18px; }
.lines-editor { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.lines-editor th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 0 6px 6px 0; }
.lines-editor td { padding: 0 6px 8px 0; vertical-align: top; }
.lines-editor td.amount { text-align: right; padding-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines-editor textarea { min-height: 38px; height: auto; field-sizing: content; line-height: 1.4; }
[hidden] { display: none !important; }
@media screen and (min-width: 761px) {
  table.list td.row-actions { width: 1%; white-space: normal; min-width: 150px; }
  td.row-actions .inline-form { display: inline-block; margin: 2px 0; }
}
.card.flush .card-title { padding: 16px 16px 0; margin-bottom: 8px; }
.sheet.preview { margin: 0; }
.schedule-note { margin: 0 0 4px; padding: 10px 12px; border-radius: 8px; background: #eef3fc; color: #1b3a73; font-weight: 500; }
.lines-editor .c-rate { width: 120px; } .lines-editor .c-qty { width: 80px; } .lines-editor .c-amount { width: 110px; } .lines-editor .c-x { width: 32px; }
@media (max-width: 640px) {
  .lines-editor, .lines-editor tbody { display: block; }
  .lines-editor thead { display: none; }
  .lines-editor tr { display: grid; grid-template-columns: 1fr 72px 90px 32px; gap: 0 6px; padding-bottom: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
  .lines-editor td { padding: 0 0 6px 0; }
  .lines-editor td:first-child { grid-column: 1 / -1; }
}
.editor-total { text-align: right; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; margin-bottom: 20px; overflow-x: auto; }
.sheet .invoice-doc { min-width: 560px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } .sheet { padding: 24px 20px; } }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.kv.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.inline-form { display: inline; margin: 0; }
.auth-wrap { max-width: 380px; margin: 9vh auto 0; padding: 0 16px; }
.auth-wrap h1 { margin-bottom: 16px; }
.auth-wrap.privacy { max-width: 640px; margin-top: 6vh; margin-bottom: 40px; }
.auth-wrap.privacy h2 { font-size: 15px; margin: 18px 0 6px; }
.auth-wrap.privacy p { margin: 0 0 10px; }
.public-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.public-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.nowrap { white-space: nowrap; }
label.check { display: flex; gap: 8px; align-items: baseline; font-weight: 500; font-size: 15px; }
label.check input { width: auto; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-bar select, .filter-bar input { width: auto; max-width: 100%; }
.filter-bar input[type=search] { flex: 1 1 220px; }
input[type=file] { font: inherit; max-width: 100%; }
details { margin-bottom: 20px; }
details summary { cursor: pointer; margin-bottom: 8px; }
table.pnl td { padding: 7px 16px; }
table.pnl.dense th, table.pnl.dense td { padding: 6px 8px; font-size: 13px; }
table.pnl.dense th:first-child, table.pnl.dense td:first-child { padding-left: 16px; }
table.pnl .pnl-heading td { font-weight: 700; background: var(--bg); }
table.pnl .pnl-group td { font-weight: 600; }
table.pnl .pnl-sub td { color: var(--muted); }
table.pnl tr.depth-1 td:first-child { padding-left: 34px; }
table.pnl tr.depth-2 td:first-child { padding-left: 52px; }
table.pnl.dense tr.depth-1 td:first-child { padding-left: 28px; }
table.pnl.dense tr.depth-2 td:first-child { padding-left: 40px; }
table.pnl .pnl-total td { font-weight: 700; border-top: 1px solid #c9cfd8; }
table.pnl .pnl-percent td { color: var(--muted); }
table.pnl td.neg { color: var(--danger); }
table.pnl td.pos { color: var(--ok); }
.pnl-title { display: flex; flex-direction: column; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pnl-title strong { color: var(--text); font-size: 15px; }
.btn.link.danger { color: var(--danger); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
section.card { scroll-margin-top: 12px; }
.figures { max-width: 560px; margin-bottom: 12px; }
.worked-out { padding: 7px 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.file { border: 1px solid var(--line); border-radius: 6px; padding: 8px; min-width: 0; background: var(--surface); }
.file-open { display: flex; align-items: center; justify-content: center; height: 96px; background: var(--bg); border-radius: 4px; margin-bottom: 6px; overflow: hidden; }
.file-open:hover { text-decoration: none; }
.file-open img { max-width: 100%; max-height: 96px; display: block; }
.file-kind { font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.file-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.drive-folder { margin: 10px 0 0; }
.upload { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.upload select { width: auto; }
.upload .notice, form .notice[data-upload-status] { flex-basis: 100%; margin: 6px 0 0; }
.months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 8px 0 12px; }
@media (max-width: 800px) { .months { grid-template-columns: repeat(3, 1fr); } }
.month { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 0; display: flex; flex-direction: column; }
.month-name { font-weight: 600; font-size: 13px; color: var(--text); }
.month.have { border-color: #bfe3cf; background: #f3faf6; }
.month.missing { border-color: #f0d29a; background: #fff8ea; color: var(--warn); }
.month.later { color: var(--muted); }
.month a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.month-form select { width: auto; }
pre.summary { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; margin: 8px 0 12px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; margin-bottom: 12px; }
label.check.small { font-size: 13px; margin-bottom: 2px; }
table.checklist td { padding: 9px 16px; vertical-align: middle; }
.copy-link { margin: 8px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.statement-total td { font-weight: 700; border-top: 1px solid #c9cfd8; }
.statement-summary { padding: 14px 16px; max-width: 560px; }
.only-stack { display: none; }
.scroll-x { overflow-x: auto; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; padding: 7px 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; }
label.check input { flex: none; }
.pnl-swipe { display: none; }

/* A narrow screen swaps the row of tabs for a menu with large buttons. */
@media screen and (max-width: 760px) {
  .nav-tabs.collapses { display: none; }
  .nav-tabs { justify-content: flex-end; }
  .nav-menu { display: block; margin: 0 0 0 auto; }
  .nav-menu summary { list-style: none; display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 12px; margin: 0; border: 1px solid var(--line); border-radius: 6px; font-weight: 600; user-select: none; }
  .nav-menu summary::-webkit-details-marker { display: none; }
  .nav-menu .bars { display: block; width: 16px; height: 2px; border-radius: 1px; background: currentColor; box-shadow: 0 5px 0 currentColor, 0 -5px 0 currentColor; }
  .nav-menu[open] summary { background: var(--bg); }
  .menu-panel { position: absolute; left: 0; right: 0; top: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px 14px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 14px 24px rgba(28, 36, 48, 0.14); }
  .menu-panel a, .menu-panel button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
  .menu-panel a:hover { text-decoration: none; }
  .menu-panel a.active { background: var(--text); border-color: var(--text); color: #fff; }
  .menu-panel button { color: var(--muted); }
}

/* Fingers need bigger targets than a mouse, and a phone zooms in on any field with text under 16px. */
@media screen and (max-width: 760px), screen and (pointer: coarse) {
  body { font-size: 16px; }
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea { font-size: 16px; padding: 10px 12px; min-height: 44px; }
  .btn { padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
  .btn.small { padding: 8px 14px; min-height: 40px; font-size: 14px; }
  .btn.link { display: inline-block; min-height: 0; padding: 9px 0; }
  .nav a.tab { padding: 10px 10px; }
  .nav .btn.link { padding: 10px 4px; }
  .filters a { padding: 9px 14px; }
  label.check { align-items: center; padding: 7px 0; }
  label.check input { width: 20px; height: 20px; margin: 0; }
  label.check.small { font-size: 15px; }
  input[type=file]::file-selector-button { padding: 10px 14px; }
  details summary { padding: 9px 0; }
  .lines-editor textarea { min-height: 44px; height: auto; }
  .lines-editor .remove-line { min-width: 40px; padding: 8px 0; }
  .tile .k a, .hint a, .small a { text-underline-offset: 2px; }
}

/* A phone: one column, lists as stacked rows, and nothing that needs sideways scrolling by accident. */
@media screen and (max-width: 640px) {
  main { padding: 16px 12px 56px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; margin-bottom: 16px; }
  .tiles { gap: 8px; margin-bottom: 16px; }
  .tile { padding: 12px 14px; }
  .tile .v { font-size: 19px; }
  .page-head { margin-bottom: 14px; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn, .page-head .actions > form { flex: 1 1 auto; }
  .page-head .actions > form .btn { width: 100%; }
  .page-head > form.filter-bar { width: 100%; }
  form.card > .actions > .btn, form > .actions > .btn { flex: 1 1 0; }
  section.card .actions > .btn { flex: 1 1 auto; }
  .grid4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
  .grid4 > .field, .grid2 > .field { min-width: 0; }
  input[type=date] { min-width: 0; padding-left: 8px; padding-right: 6px; }
  .filters form { margin-left: 0; flex: 1 1 100%; }
  .filter-bar select { flex: 1 1 120px; min-width: 0; }
  .filter-bar input[type=search] { flex: 1 1 160px; min-width: 0; }
  .filter-bar .btn { flex: 0 0 auto; }
  .upload > * { flex: 1 1 100%; }
  .upload select, .month-form select { width: 100%; }
  .checks { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .kv { gap: 10px; }
  .kv > span:last-child { text-align: right; white-space: nowrap; }
  .statement-summary .kv > span:last-child, .figures .kv > span:last-child { flex: none; }
  .auth-wrap { margin-top: 5vh; }
  .only-stack { display: block; }
  span.only-stack { display: inline; }
  .hide-on-stack { display: none; }

  /* Lists: each row becomes a small block with its name on the left and its figures on the right. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack td { display: block; }
  table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--line); position: relative; }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 1px 0; border: 0; min-width: 0; }
  table.stack td.stack-title { grid-column: 1; grid-row: 1 / span 4; font-weight: 600; overflow-wrap: anywhere; }
  table.stack td.stack-title .small { font-weight: 400; }
  table.stack td.stack-title .only-stack { margin-top: 2px; }
  table.stack td.num { grid-column: 2; font-size: 14px; }
  table.stack td.num.stack-figure { font-size: 16px; font-weight: 600; }
  table.stack td.num-on-stack { grid-column: 2; text-align: right; }
  table.stack td.stack-wide { grid-column: 1 / -1; padding-top: 8px; text-align: left; }
  table.stack td.stack-wide form { display: inline-block; margin: 0 8px 0 0; }
  table.stack td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-weight: 400; }
  table.stack .hide-on-stack { display: none; }
  table.stack a.row-link::after { content: ""; position: absolute; inset: 0; }
  table.stack td form, table.stack td .btn, table.stack td a:not(.row-link) { position: relative; z-index: 1; }
  table.stack tr.statement-total { background: var(--bg); }

  /* The Profit and Loss keeps its names in view and puts the year total beside them; the periods follow with a sideways swipe. */
  table.pnl, table.pnl thead, table.pnl tbody, table.pnl th, table.pnl td { display: block; }
  table.pnl { width: max-content; min-width: 100%; }
  table.pnl tr { display: grid; grid-template-columns: 43vw repeat(var(--pnl-cols, 5), 100px); }
  table.pnl td, table.pnl.dense td { padding: 8px 8px; font-size: 14px; }
  table.pnl th, table.pnl.dense th { padding: 8px 8px; font-size: 11px; white-space: normal; text-align: right; line-height: 1.3; }
  table.pnl tr > :first-child { grid-column: 1; grid-row: 1; position: sticky; left: 0; z-index: 1; background: var(--surface); padding-left: 14px; overflow-wrap: anywhere; }
  table.pnl tr > :last-child:not(:first-child) { grid-column: 2; grid-row: 1; font-weight: 600; }
  table.pnl tr.depth-1 > td:first-child, table.pnl.dense tr.depth-1 > td:first-child { padding-left: 24px; }
  table.pnl tr.depth-2 > td:first-child, table.pnl.dense tr.depth-2 > td:first-child { padding-left: 34px; }
  table.pnl tr.pnl-heading { background: var(--bg); }
  table.pnl tr.pnl-heading td { background: var(--bg); white-space: nowrap; overflow: visible; }
  table.pnl thead th { border-bottom: 1px solid var(--line); }
  .pnl-swipe { display: block; padding: 8px 14px; border-bottom: 1px solid var(--line); }

  /* A document with its month and its remove button: the name on top, the controls under it. */
  table.doc-rows, table.doc-rows tbody, table.doc-rows td { display: block; }
  table.doc-rows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.doc-rows tr:last-child { border-bottom: 0; }
  table.doc-rows td { padding: 0; border: 0; min-width: 0; }
  table.doc-rows td:first-child { grid-column: 1 / -1; margin-bottom: 6px; overflow-wrap: anywhere; }
  table.doc-rows .month-form { display: flex; gap: 8px; }
  table.doc-rows .month-form select { flex: 1; min-width: 0; }
  /* A few short lists inside a card keep their columns but drop the wide gaps. */
  table.list.compact th, table.list.compact td { padding: 10px 12px; }
  table.list.compact td.wraps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

  /* The invoice on screen: one column, with each line's sums under its description. The PDF keeps the full layout. */
  .sheet { padding: 20px 16px; overflow-x: visible; }
  .sheet .invoice-doc { min-width: 0; font-size: 14px; }
  .sheet .invoice-doc .top { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 22px; padding: 18px 18px 22px; }
  .sheet .invoice-doc .business-contact { text-align: left; }
  .sheet .invoice-doc .meta { grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-bottom: 22px; }
  .sheet .invoice-doc .meta > :first-child, .sheet .invoice-doc .meta > .amount-due { grid-column: 1 / -1; }
  .sheet .invoice-doc .amount-due { text-align: left; }
  .sheet .invoice-doc table.lines, .sheet .invoice-doc table.lines tbody, .sheet .invoice-doc table.lines td { display: block; }
  .sheet .invoice-doc table.lines thead { display: none; }
  .sheet .invoice-doc table.lines { border-top: 2px solid #2DB7F5; }
  .sheet .invoice-doc table.lines tr { display: grid; grid-template-columns: auto auto 1fr; column-gap: 6px; padding: 10px 0; border-bottom: 1px solid #e6e9ee; }
  .sheet .invoice-doc table.lines td { padding: 0; border: 0; width: auto; }
  .sheet .invoice-doc table.lines td:first-child { grid-column: 1 / -1; width: auto; margin-bottom: 4px; }
  .sheet .invoice-doc table.lines td:nth-child(2), .sheet .invoice-doc table.lines td:nth-child(3) { color: #6b7686; text-align: left; }
  .sheet .invoice-doc table.lines td:nth-child(3)::before { content: "\00d7\00a0"; }
  .sheet .invoice-doc table.lines td:nth-child(4) { font-weight: 600; }
  .sheet .invoice-doc .totals { width: 100%; }

  /* The invoice editor: description on its own row, then rate, quantity, the line total and its remove button. */
  .lines-editor tr { grid-template-columns: minmax(0, 1fr) 64px minmax(64px, auto) 40px; align-items: center; }
  .lines-editor td.amount { padding-top: 0; }
  .months { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  body { background: #fff; font-size: 12px; }
  .statement table.list th, .statement table.list td { padding: 3px 8px; font-size: 10px; line-height: 1.35; }
  .statement-summary { padding: 10px 8px; font-size: 11px; }
  .nav, .no-print, .tiles { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { border: 0; margin: 0; }
  .card.flush { overflow: visible; }
  h1 { font-size: 18px; }
  .page-head { margin-bottom: 8px; }
  .pnl-title { padding: 6px 8px; }
  table.pnl td, table.pnl th, table.pnl.dense td, table.pnl.dense th { padding: 2px 8px; font-size: 11px; line-height: 1.35; }
  table.pnl.dense td, table.pnl.dense th { padding: 2px 3px; font-size: 8px; }
  .hint { font-size: 10px; margin-top: 8px; }
  table.pnl a { color: inherit; }
  tr { break-inside: avoid; }
}
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
ol.steps { margin: 0; padding-left: 22px; }
ol.steps li { margin-bottom: 10px; }
ol.steps .copy-link { display: block; margin: 8px 0; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
