/* ==========================================================================
   Film Equipment Rental - design system
   Hand-written because the toolchain has no Node, so no Tailwind build step.
   Everything is driven by custom properties; light and dark are both first-class.
   ========================================================================== */

:root {
  /* Neutrals */
  --c-bg: #f6f7f9;
  --c-surface: #ffffff;
  --c-surface-2: #f0f2f5;
  --c-border: #dfe3e8;
  --c-border-strong: #c6ccd4;
  --c-text: #131820;
  --c-text-muted: #5b6675;
  --c-text-faint: #8792a2;

  /* Accent - a desaturated blue that stays readable on both themes */
  --c-accent: #2f6df0;
  --c-accent-hover: #2559cc;
  --c-accent-soft: #e8effd;
  --c-accent-text: #ffffff;

  /* Status */
  --c-ok: #17864a;
  --c-ok-soft: #e2f5eb;
  --c-warn: #a56b00;
  --c-warn-soft: #fdf1dc;
  --c-danger: #c22e2e;
  --c-danger-soft: #fce9e9;
  --c-info: #1f6f8b;
  --c-info-soft: #e2f0f5;

  /* Shape */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);

  /* Rhythm */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --sidebar-w: 232px;
  --header-h: 56px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0f1319;
    --c-surface: #171c24;
    --c-surface-2: #1e242e;
    --c-border: #2a323e;
    --c-border-strong: #3a4553;
    --c-text: #e7ebf0;
    --c-text-muted: #a0abba;
    --c-text-faint: #6f7c8c;

    --c-accent: #5a8cf7;
    --c-accent-hover: #7aa3f9;
    --c-accent-soft: #1c2942;
    --c-accent-text: #0f1319;

    --c-ok: #4ac585;
    --c-ok-soft: #16301f;
    --c-warn: #e0a33c;
    --c-warn-soft: #33260e;
    --c-danger: #f07171;
    --c-danger-soft: #351a1a;
    --c-info: #5ab6d4;
    --c-info-soft: #142a33;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 var(--sp-3); }

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: 12px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

.muted { color: var(--c-text-muted); }
.faint { color: var(--c-text-faint); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strike { text-decoration: line-through; }
.hidden { display: none !important; }

/* Numeric columns line up only with tabular figures. */
.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4);
  font-weight: 650;
  font-size: 15px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__mark {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: var(--c-accent);
  color: var(--c-accent-text);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}

.nav { padding: var(--sp-3) var(--sp-2); flex: 1; }
.nav__item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--c-text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}
.nav__item:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.nav__item.is-active { background: var(--c-accent-soft); color: var(--c-accent); font-weight: 600; }
.nav__icon { width: 18px; text-align: center; flex: 0 0 18px; opacity: 0.85; }
.nav__section {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-faint);
  font-weight: 600;
}

.sidebar__footer {
  border-top: 1px solid var(--c-border);
  padding: var(--sp-3);
  font-size: 12px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { font-weight: 600; font-size: 15px; margin: 0; }
.topbar__spacer { flex: 1; }

.content { padding: var(--sp-5); flex: 1; }
.content--narrow { max-width: 820px; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.page-head__text { flex: 1; min-width: 220px; }
.page-head h1 { margin-bottom: 2px; }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* Mobile: sidebar becomes a slide-over, topbar gains a menu button. */
.menu-btn { display: none; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .menu-btn { display: inline-flex; }
  .content { padding: var(--sp-4); }
  .topbar { padding: 0 var(--sp-4); }
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
}

/* --------------------------------------------------------------------------
   Cards, panels
   -------------------------------------------------------------------------- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card__head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.card__head h2, .card__head h3 { margin: 0; }
.card__body { padding: var(--sp-5); }
.card__body--flush { padding: 0; }
.card__foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.card + .card { margin-top: var(--sp-4); }

.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* Stat tiles */
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.stat__label {
  font-size: 12px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
/* Fluid size: a six-figure koruna amount with a minus sign overflows a fixed
   24px in a narrow tile, and a clipped number is worse than a smaller one. */
.stat__value {
  font-size: clamp(17px, 1.9vw, 24px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stat__sub { font-size: 12px; color: var(--c-text-faint); margin-top: 2px; }

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

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th,
table.data td {
  padding: 10px var(--cell-pad, var(--sp-4));
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
table.data th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  font-weight: 600;
  background: var(--c-surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
table.data tbody tr:hover { background: var(--c-surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tfoot td {
  font-weight: 600;
  background: var(--c-surface-2);
  border-top: 2px solid var(--c-border-strong);
}

.row-link { cursor: pointer; }

.empty {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  color: var(--c-text-muted);
}
.empty__title { font-weight: 600; color: var(--c-text); margin-bottom: var(--sp-2); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
  font-weight: 550;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--c-surface-2); text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-text);
}
.btn--primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn--danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--c-text-muted); }
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--lg { padding: 12px 20px; font-size: 15px; }
.btn--block { width: 100%; }

.btn-group { display: inline-flex; gap: var(--sp-2); flex-wrap: wrap; }

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

.field { margin-bottom: var(--sp-4); }
.field > label,
.label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: var(--sp-2);
  color: var(--c-text-muted);
}
.field__hint { font-size: 12px; color: var(--c-text-faint); margin-top: var(--sp-1); }
.field__error { font-size: 12px; color: var(--c-danger); margin-top: var(--sp-1); }

/* Matches every text-like input, including those written without a `type`
   attribute at all -- `input[type="text"]` does not, which silently left most of
   the forms in this app unstyled and half-width. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
select, textarea {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { min-height: 84px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--c-surface-2);
  color: var(--c-text-faint);
}
input::placeholder, textarea::placeholder { color: var(--c-text-faint); }

/* Dark mode: the native date picker indicator is invisible without this. */
@media (prefers-color-scheme: dark) {
  input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }
}

.form-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.check { display: flex; align-items: center; gap: var(--sp-2); font-size: 13.5px; }
.check input { width: auto; margin: 0; }

.input-suffix { position: relative; display: block; }
.input-suffix > span {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12.5px;
  color: var(--c-text-faint);
  pointer-events: none;
}
.input-suffix > input { padding-right: 38px; }

.form-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  padding-top: var(--sp-2);
}
.form-actions .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Filter / search bar
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar input[type="search"], .toolbar select { width: auto; min-width: 150px; }
.toolbar__search { flex: 1; min-width: 200px; }

/* --------------------------------------------------------------------------
   Badges / status pills
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}
.badge--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge--warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge--danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge--info { background: var(--c-info-soft); color: var(--c-info); }
.badge--accent { background: var(--c-accent-soft); color: var(--c-accent); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  margin-bottom: var(--sp-4);
  font-size: 13.5px;
}
.alert--ok { background: var(--c-ok-soft); border-color: var(--c-ok); color: var(--c-ok); }
.alert--warn { background: var(--c-warn-soft); border-color: var(--c-warn); color: var(--c-warn); }
.alert--danger { background: var(--c-danger-soft); border-color: var(--c-danger); color: var(--c-danger); }
.alert--info { background: var(--c-info-soft); border-color: var(--c-info); color: var(--c-info); }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 12, 17, 0.55);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: var(--sp-4);
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal__head { padding: var(--sp-5) var(--sp-5) 0; }
.modal__body { padding: var(--sp-5); }
.modal__foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

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

.toasts {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.toast {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  padding: var(--sp-3) var(--sp-4);
  min-width: 260px;
  font-size: 13.5px;
  animation: toast-in 0.18s ease;
}
.toast--ok { border-left-color: var(--c-ok); }
.toast--danger { border-left-color: var(--c-danger); }
.toast--warn { border-left-color: var(--c-warn); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Auth screen
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--c-bg);
}
.auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-6);
}
.auth__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  font-weight: 650;
  font-size: 16px;
}

/* --------------------------------------------------------------------------
   Typeahead
   Used wherever the list is too long to scroll: equipment, physical items,
   customers. See the component in static/js/app.js.
   -------------------------------------------------------------------------- */

.typeahead { position: relative; }
.typeahead__input { width: 100%; }
/* Room for the × only where there is one -- a search box has none. */
.typeahead:has(.typeahead__clear) .typeahead__input { padding-right: 32px; }

.typeahead__clear {
  position: absolute;
  top: 0;
  right: 0;
  height: 38px;
  width: 30px;
  border: 0;
  background: none;
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.typeahead__clear:hover { color: var(--c-text); }

.typeahead__menu {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
}

.typeahead__option {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  background: none;
  color: var(--c-text);
  cursor: pointer;
  font: inherit;
}
.typeahead__option:hover:not(:disabled),
.typeahead__option.is-active { background: var(--c-accent-soft); }
.typeahead__option:disabled { opacity: 0.5; cursor: not-allowed; }

.typeahead__detail {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--c-text-muted);
}

.typeahead__empty {
  padding: var(--sp-3);
  color: var(--c-text-muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.stack > * + * { margin-top: var(--sp-3); }
.flex { display: flex; align-items: center; gap: var(--sp-2); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-4 { margin-bottom: var(--sp-4); }
.w-full { width: 100%; }

.htmx-indicator { opacity: 0; transition: opacity 0.15s ease; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* --------------------------------------------------------------------------
   The quotation document
   A page the browser prints, rather than a PDF built by a library that would
   have to be installed here and in the deployment image too.
   -------------------------------------------------------------------------- */

.doc {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-6);
}

.doc__head {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--c-text);
}
.doc__title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-text-muted); }
.doc__number { font-size: 24px; font-weight: 650; }

/* Wordmark beside the address, both hanging off the right edge. */
.doc__from { display: flex; align-items: flex-start; gap: var(--sp-5); }
.doc__logo { align-self: center; display: block; }
.doc__logo svg,
img.doc__logo { height: 30px; width: auto; max-width: 280px; display: block; }

@media (max-width: 620px) {
  .doc__from { flex-direction: column; align-items: flex-end; gap: var(--sp-3); }
}

.doc__parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  padding: var(--sp-5) 0;
}
.doc__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-faint);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.doc__lines { width: 100%; }

/* Crew, then Transport, then Equipment. A band rather than a heading, so the
   table keeps one grid and the eye can still follow a column down the page. */
.doc__section td {
  background: rgba(255, 217, 50, 0.3);  /* #FFD932 at 30% — 70% transparent */
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.doc__totals { display: flex; justify-content: flex-end; margin-top: var(--sp-4); }
.doc__totals table { width: auto; min-width: 280px; }
/* The parts of the job read as a build-up; the net is where they add up. */
.doc__subtotal td { color: var(--c-text-muted); border-bottom: 0; }
.doc__net td { border-top: 1px solid var(--c-border-strong); font-weight: 600; }
.doc__grand td { border-top: 2px solid var(--c-text); font-size: 16px; }
.doc__foot { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--c-border); }

@media (max-width: 620px) {
  .doc__parties { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .page-head__actions, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  /* The document is the page when printed: no card, no rounded corners, and it
     must not be squeezed into the narrow reading column. */
  .content--narrow { max-width: none; }
  .doc { border: 0; border-radius: 0; padding: 0; background: #fff; }
  .doc__lines tr, .doc__totals tr { page-break-inside: avoid; }
  /* Browsers drop background colours when printing unless told otherwise, which
     would take the section bands out of the PDF -- the one place they matter. */
  .doc__section td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* A heading alone at the foot of a page belongs with what it introduces. */
  .doc__section { break-after: avoid; page-break-after: avoid; }
  /* Paper is white whatever the screen was doing. */
  .doc__logo { color: #000; }
}
