:root {
  /* Brand: gold #baa05f, black #000000, white #ffffff */
  --gold: #baa05f;
  --gold-hover: #a88d4c;
  --black: #000000;
  --white: #ffffff;
  --bg: #f7f6f2;
  --surface: var(--white);
  --border: #e6e2d8;
  --border-strong: #d2ccbd;
  --text: var(--black);
  --muted: #6b665c;
  --accent: #806a32;       /* deeper gold for text and links on white (readable) */
  --accent-soft: #f6f1e4;
  --danger: #c4352b;
  --danger-soft: #fdecea;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sidebar: 220px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--gold); color: var(--black); }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.6rem; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 0.9rem; font-weight: 600; margin: 18px 0 6px; color: var(--muted); }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }
.req { color: var(--danger); }

/* Layout -------------------------------------------------------------- */

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  background: var(--black); color: #cfcfcf; border-right: 1px solid #1f1f1f; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: #cfcfcf; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(186, 160, 95, 0.12); color: var(--white); text-decoration: none; }
.sidebar nav a.active { background: rgba(186, 160, 95, 0.18); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }

main { margin-left: var(--sidebar); padding: 28px 32px 60px; max-width: 1280px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.subtitle { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.card-head a { font-size: 0.9rem; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 20px; }

.profile { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-main { min-width: 0; }

/* Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-soft); border-color: var(--gold); text-decoration: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--black); font-weight: 650; }
.btn.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.danger { color: var(--danger); border-color: #f0c4c0; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 10px; font-size: 0.875rem; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); font-size: 1.3rem;
  line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Stats --------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--text);
  box-shadow: var(--shadow);
}
a.stat:hover { border-color: var(--gold); text-decoration: none; }
.stat-label { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 1.55rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.8rem; color: var(--muted); }
.stat.warn .stat-note, .stat.warn .stat-value { color: var(--warn); }
.stats.compact .stat-value { font-size: 1.3rem; }

/* Tables -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table td { white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 180px; }
.table th { white-space: nowrap; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; background: #fbfaf7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--accent-soft); }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 4px; }
.card:not(.flush) .table th { background: transparent; }
.table .muted { font-size: 0.85rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.owed { color: var(--warn); font-weight: 600; }
.table-foot { padding: 12px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; text-align: right; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; max-width: 460px; }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--black); border-bottom-color: var(--gold); }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty p { margin: 0 0 12px; }
.empty.error p { color: var(--danger); }
.loading { padding: 30px; text-align: center; color: var(--muted); }

/* Badges -------------------------------------------------------------- */

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem;
  font-weight: 600; background: #eef0f3; color: #4b5563; white-space: nowrap; vertical-align: middle;
}
h1 .badge { font-size: 0.8rem; }
.lead-new, .ticket-open, .prio-high { background: var(--accent-soft); color: var(--accent); }
.lead-contacted, .ticket-in_progress { background: var(--black); color: var(--gold); }
.lead-qualified, .lead-proposal, .ticket-completed, .inv-unpaid { background: var(--warn-soft); color: var(--warn); }
.lead-lost, .inv-void, .prio-low { background: #eef0f3; color: #6b7280; }
.kind-customer, .ticket-invoiced, .inv-paid { background: var(--ok-soft); color: var(--ok); }
.inv-partial { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1px #f3d19c; }
.inv-overdue, .prio-urgent { background: var(--danger-soft); color: var(--danger); }
.prio-normal { background: transparent; color: var(--muted); padding-left: 0; }

/* Forms --------------------------------------------------------------- */

input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(186, 160, 95, 0.25); }

.form { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 550; color: #374151; }
.form label.block { margin-top: 18px; }
.form .span2 { grid-column: span 2; }
.form.is-customer .lead-only { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.section-title { margin: 26px 0 12px; display: flex; gap: 10px; align-items: baseline; }
.section-title:first-child { margin-top: 0; }
.section-title .muted { font-size: 0.85rem; font-weight: 400; }

.items-editor .table td { padding: 6px 6px; border-bottom: 0; }
.items-editor .table th { padding: 6px; }
.items-editor .qty-col { width: 90px; }
.items-editor .price-col { width: 150px; }
.items-editor .line-total { width: 110px; white-space: nowrap; }
.items-editor .row-action { width: 36px; }
.items-editor .date-col { width: 150px; }
.items-editor td { vertical-align: top; white-space: normal; }
.items-editor td > input, .items-editor td > textarea { display: block; }
.items-editor textarea[name=item_details] { margin-top: 6px; font-size: 0.88rem; color: var(--muted); resize: vertical; }
.items-editor .line-total { padding-top: 14px !important; }
.items-editor input[type=number] { text-align: right; }
.items-editor [data-add-item] { margin-top: 8px; }
.money-input { position: relative; }
.money-input span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 22px; }

.totals { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 14px; }
.totals > div { display: flex; gap: 24px; min-width: 220px; justify-content: space-between; }
.totals .grand { border-top: 1px solid var(--border); padding-top: 6px; font-size: 1.1rem; }

/* Profile ------------------------------------------------------------- */

.fields { margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; }
.field dt { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.field dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.notes { margin: 0 0 18px; }

/* Invoice paper ------------------------------------------------------- */

.invoice-paper {
  position: relative; background: var(--white); color: var(--black);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.07); padding: 0 0 36px; max-width: 880px; overflow: hidden;
  font-size: 14px; line-height: 1.5;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
/* thin gold bar across the top */
.invoice-paper::before { content: ""; display: block; height: 6px; background: linear-gradient(90deg, #a8894a, var(--gold) 35%, #d8cd8c 55%, var(--gold) 75%, #a8894a); }
.invoice-paper > * { margin-left: 48px; margin-right: 48px; }

.inv-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 34px 0 26px; border-bottom: 1px solid var(--border); }
.inv-logo { display: block; width: 300px; max-width: 55%; height: auto; }
.inv-heading { text-align: right; }
.inv-title { font-size: 2.3rem; font-weight: 300; letter-spacing: 0.22em; text-transform: uppercase; line-height: 1; color: var(--black); margin-right: -0.22em; }
.inv-number { margin-top: 8px; font-size: 0.95rem; font-weight: 600; letter-spacing: 0.06em; color: var(--accent); }

.inv-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
.inv-name { font-weight: 700; font-size: 1rem; }
.inv-fine { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.inv-parties { display: grid; grid-template-columns: 1fr 1fr 250px; gap: 28px; padding: 28px 0 30px; color: #2b2b2b; }
.inv-due { background: var(--black); color: var(--white); border-radius: 10px; padding: 18px 20px; align-self: start; }
.inv-due .inv-label { color: var(--gold); margin: 0; }
.inv-due-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.inv-due-amount { font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; color: var(--gold); margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.inv-dates { margin: 0; padding-top: 12px; border-top: 1px solid #2c2c2c; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.inv-dates div { display: flex; justify-content: space-between; }
.inv-dates dt { color: #a9a9a9; }
.inv-dates dd { margin: 0; font-weight: 600; }
.inv-pill { padding: 2px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.inv-pill.paid { background: #1f8a4c; color: #fff; }
.inv-pill.overdue { background: var(--danger); color: #fff; }
.inv-pill.partial { background: var(--gold); color: var(--black); }
.inv-pill.void { background: #555; color: #fff; }

.inv-items { width: calc(100% - 96px); border-collapse: collapse; }
.inv-items th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  color: var(--black); padding: 10px 10px; background: var(--accent-soft); border-bottom: 2px solid var(--gold);
}
.inv-items td { padding: 14px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.inv-items tbody tr:last-child td { border-bottom-color: var(--border-strong); }
.inv-items .inv-n { width: 28px; color: var(--muted); }
.inv-items .inv-date { width: 104px; white-space: nowrap; color: #444; }
.inv-items .num { white-space: nowrap; }
.inv-item { font-weight: 650; }
.inv-details { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }

.inv-bottom { display: grid; grid-template-columns: 1fr 290px; gap: 32px; padding-top: 20px; }
.inv-notes { color: #444; font-size: 0.9rem; }
.inv-totals { display: flex; flex-direction: column; gap: 7px; font-variant-numeric: tabular-nums; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.inv-totals > div > span:first-child { color: var(--muted); }
.inv-total { padding-top: 9px; margin-top: 2px; border-top: 1px solid var(--border); font-weight: 700; }
.inv-total > span:first-child { color: var(--black) !important; }
.inv-balance { margin-top: 6px; padding: 12px 14px; background: var(--black); color: var(--white); border-radius: 8px; font-size: 1.15rem; font-weight: 700; align-items: baseline; }
.inv-balance > span:first-child { color: var(--gold) !important; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.inv-balance small { font-size: 0.7rem; color: #a9a9a9; font-weight: 600; }

.inv-footer {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border);
  text-align: center; color: var(--muted); font-size: 0.8rem; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 10px;
}
.inv-footer span { color: var(--gold); }
.danger-zone { display: flex; gap: 8px; margin-top: 16px; max-width: 860px; justify-content: flex-end; }

.items-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin: 6px 0 16px; }
.items-head p { margin: 6px 0 0; max-width: 640px; }
.section-intro { margin: 0 0 18px; }
.row-action-wide { width: 1%; white-space: nowrap; text-align: right !important; }
.form label small { font-weight: 400; }

/* Work log ------------------------------------------------------------ */

.worklog { list-style: none; margin: 0; padding: 0; position: relative; }
.wl-item {
  display: grid; grid-template-columns: 112px 1fr auto auto; gap: 6px 18px; align-items: start;
  padding: 16px 0 16px 22px; border-bottom: 1px solid var(--border); position: relative;
}
/* timeline line + dot */
.wl-item::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.wl-item::after { content: ""; position: absolute; left: 0; top: 21px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--white); }
.wl-item:first-child::before { top: 24px; }
.wl-item:last-child::before { bottom: auto; height: 24px; }
.wl-item:only-child::before { display: none; }
.wl-item.not-billed::after { background: var(--white); border: 2px solid var(--border-strong); width: 8px; height: 8px; }
.wl-date { color: var(--muted); font-size: 0.9rem; padding-top: 1px; white-space: nowrap; }
.wl-title { font-weight: 650; }
.wl-details { color: #4a4a4a; font-size: 0.92rem; margin-top: 3px; }
.wl-meta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.wl-nb { color: var(--warn); font-weight: 600; }
.wl-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.not-billed .wl-amount { color: var(--muted); font-weight: 400; }
.wl-actions { display: flex; gap: 4px; align-items: center; }
.wl-foot { display: flex; justify-content: space-between; align-items: baseline; padding-top: 14px; }
.wl-foot strong { font-size: 1.1rem; margin-left: 8px; }
.form-hint { margin: 18px 0 0; }
.modal-sub { margin: -10px 0 4px; color: var(--muted); }
.field-row.three { grid-template-columns: 1.3fr 1fr 1fr; }
.action-total { display: flex; justify-content: space-between; align-items: center; padding: 2px 2px 0; }
.action-total strong { font-size: 1.15rem; margin-left: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--black); }
@media screen and (max-width: 760px) {
  .wl-item { grid-template-columns: 1fr auto; }
  .wl-date { grid-column: 1 / -1; }
  .wl-actions { grid-column: 1 / -1; }
  .field-row.three { grid-template-columns: 1fr 1fr; }
}

/* Record payment dialog --------------------------------------------- */

.modal {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; border-radius: 18px;
  padding: 0; background: var(--white); color: var(--black); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.modal-form { padding: 32px 32px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-form h2 { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.modal-facts { margin: 0 0 6px; display: flex; flex-direction: column; gap: 12px; }
.modal-facts dt { font-size: 0.85rem; color: var(--muted); }
.modal-facts dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-box {
  display: flex; flex-direction: column; gap: 2px; position: relative;
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 9px 14px 8px; background: var(--white);
}
.field-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(186, 160, 95, 0.25); }
.field-box > span { font-size: 0.8rem; color: var(--muted); }
.field-box input, .field-box select, .field-box textarea {
  border: 0; padding: 2px 0; background: transparent; font-size: 1.02rem; box-shadow: none !important; border-radius: 0;
}
.field-box textarea { resize: vertical; min-height: 64px; }
.field-money { display: flex; align-items: center; gap: 4px; }
.field-money b { font-weight: 500; }
.field-count { align-self: flex-end; color: var(--muted); font-size: 0.75rem; }
.modal-error { margin: -4px 0 0; min-height: 1.2em; color: var(--danger); font-size: 0.9rem; }
.btn.dark { background: var(--black); border-color: var(--black); color: var(--white); border-radius: 999px; padding: 13px 18px; font-size: 1rem; font-weight: 700; }
.btn.dark:hover { background: #222; border-color: #222; }
.btn.dark:disabled { opacity: 0.6; cursor: default; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; padding: 6px; align-self: center; }
.link-btn:hover { text-decoration: underline; }
.payments { max-width: 880px; margin-top: 20px; }
@media screen and (max-width: 480px) { .field-row { grid-template-columns: 1fr; } .modal-form { padding: 24px 20px 16px; } }

/* Login ------------------------------------------------------------- */

.logout {
  margin-top: auto; background: transparent; border: 0; color: #8a93ab; font: inherit;
  text-align: left; padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.logout:hover { background: rgba(186, 160, 95, 0.12); color: var(--gold); }
body.logged-out { background: var(--black); }
body.logged-out .sidebar { display: none; }
body.logged-out main { margin: 0 auto; max-width: none; min-height: 100vh; display: grid; place-items: center; }
.login { border-color: var(--gold); width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.login-logo { display: block; width: 100%; height: auto; margin: 4px 0 8px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 550; }
.login-error { margin: -6px 0 0; min-height: 1.2em; color: var(--danger); font-size: 0.9rem; }

/* Toast --------------------------------------------------------------- */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--black); color: var(--white); padding: 10px 18px; border: 1px solid var(--gold); border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* Responsive ---------------------------------------------------------- */

@media screen and (max-width: 1000px) {
  .grid2, .profile { grid-template-columns: 1fr; }
}
@media screen and (max-width: 760px) {
  .brand-logo { max-width: 150px; }
  .sidebar { position: static; width: auto; padding: 12px 16px; gap: 10px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; }
  main { margin-left: 0; padding: 20px 16px 48px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form .span2 { grid-column: auto; }
  .invoice-paper > * { margin-left: 20px; margin-right: 20px; }
  .inv-items { width: calc(100% - 40px); }
  .inv-top { flex-direction: column; align-items: flex-start; }
  .inv-heading { text-align: left; }
  .inv-logo { max-width: 100%; }
  .inv-parties, .inv-bottom { grid-template-columns: 1fr; }
  .inv-items .inv-n, .inv-items .inv-date { display: none; }
}

/* Print: just the invoice --------------------------------------------- */

@media print {
  @page { size: letter; margin: 0.5in; }
  body { background: #fff; }
  .no-print, .danger-zone { display: none !important; }
  main { margin: 0; padding: 0; max-width: none; }
  .invoice-paper { border: 0; border-radius: 0; box-shadow: none; max-width: none; font-size: 12.5px; padding-bottom: 0; }
  .invoice-paper > * { margin-left: 0; margin-right: 0; }
  .inv-items { width: 100%; }
  .inv-items tr { break-inside: avoid; }
  .inv-bottom, .inv-footer { break-inside: avoid; }
}
