@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --ink: #1a1b1f;
  --muted: #5e646f;
  --paper: #f6f2ea;
  --paper-strong: #efe7dc;
  --accent: #d46b2e;
  --accent-2: #1f7a8c;
  --shadow: rgba(25, 22, 16, 0.12);
  --stroke: rgba(26, 27, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(212, 107, 46, 0.15), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(31, 122, 140, 0.18), transparent 45%),
    linear-gradient(130deg, #f9f3e7 0%, #f3efe7 45%, #f6f2ea 100%);
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.rail {
  padding: 32px 24px;
  background: rgba(246, 242, 234, 0.95);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* The business's own logo and name. A square logo sits beside the name; a wide one sits above it. */
.brand {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}

.brand img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
}

.brand-initials {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.brand h1 {
  flex: 1 1 110px; /* fits beside a square logo; drops below a wide one */
  min-width: 0;
  font-family: "Fraunces", serif;
  font-size: 22px;
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.05;
}

.brand p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 500;
}

.nav a.active,
.nav a:hover {
  background: var(--paper-strong);
  border-color: var(--stroke);
}

.rail-note {
  margin-top: auto;
  background: var(--paper-strong);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--stroke);
}

.rail-note p {
  font-size: 13px;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.15);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 600;
}

.main {
  padding: 36px 48px 64px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.page-head > div {
  min-width: 0;
}

h2 {
  font-family: "Fraunces", serif;
  font-size: 32px;
  margin: 0 0 6px 0;
}

h3 {
  font-family: "Fraunces", serif;
  margin: 0 0 10px 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
}

.preserve-lines {
  white-space: pre-wrap;
}

.strong {
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(212, 107, 46, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(212, 107, 46, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.card {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 20px;
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 24px var(--shadow);
  animation: floatIn 0.35s ease;
}

.card.highlight {
  border: 1px solid rgba(212, 107, 46, 0.35);
  background: rgba(212, 107, 46, 0.08);
}

.big {
  font-size: 28px;
  margin: 6px 0 4px;
  font-weight: 600;
}

.panel {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--stroke);
  box-shadow: 0 12px 30px var(--shadow);
  margin-bottom: 24px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

/* Two tables side by side only when each gets enough room; otherwise they stack */
.split-wide {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(26, 27, 31, 0.08);
  text-align: left;
  overflow-wrap: break-word; /* break long text between words, not in the middle of them */
  word-break: normal; /* panels allow breaking anywhere; tables shouldn't inherit that */
  vertical-align: top;
}

th {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* Numbers, dates and status badges stay on one line */
td.right,
td:has(> .badge),
td > a:only-child {
  white-space: nowrap;
}

/* A table too wide for its box scrolls sideways inside it instead of squashing */
.panel {
  overflow-x: auto;
}

.right {
  text-align: right;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.badge-paid {
  background: rgba(31, 122, 140, 0.18);
  color: var(--accent-2);
}

.badge-unpaid,
.badge-open {
  background: rgba(212, 107, 46, 0.18);
  color: var(--accent);
}

.badge-overdue {
  background: rgba(180, 52, 52, 0.2);
  color: #b43434;
}

.badge-converted {
  background: rgba(26, 27, 31, 0.1);
  color: var(--ink);
}

.badge-superseded {
  background: rgba(94, 100, 111, 0.14);
  color: var(--muted);
}

.badge-sent {
  background: rgba(52, 122, 52, 0.15);
  color: #2f6b2f;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.span-2 {
  grid-column: span 2;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 14px;
  background: white;
}

textarea {
  resize: vertical;
  min-height: 44px;
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stack {
  display: grid;
  gap: 16px;
}

/* Fixed-width number columns: headings and numbers both sit on the right edge so they line up */
.line-items .qty-cell {
  width: 96px;
}

.line-items .price-cell {
  width: 150px;
}

.line-items .remove-cell {
  width: 1%;
}

.line-items .qty-cell input,
.line-items .price-cell input {
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Price box with a "$" that is always shown and can't be deleted */
.money-input {
  position: relative;
  display: block;
}

.money-input > span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.money-input > input {
  padding-left: 26px;
}

.line-items select {
  margin-bottom: 8px;
  min-width: 180px;
}

.line-items textarea {
  min-width: 180px;
}

.line-items .remove-row {
  padding: 8px 12px;
  white-space: nowrap;
}

.line-items .save-standard {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.line-items .save-standard[hidden] {
  display: none;
}

.add-line-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.add-line-bar select {
  width: auto;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 320px;
}

.line-items .save-standard input {
  width: 16px;
  height: 16px;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
}

.table-wrap {
  display: grid;
  gap: 12px;
}

.link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inline-form {
  display: inline;
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.logo-preview {
  display: grid;
  gap: 12px;
}

.logo-preview img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: white;
  padding: 16px;
}

.link.danger,
.btn.danger {
  color: #b43434;
}

.pdf-frame {
  width: 100%;
  height: 100vh;
  min-height: 900px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: white;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.alert-error {
  border-color: rgba(180, 52, 52, 0.4);
  color: #b43434;
  background: rgba(180, 52, 52, 0.08);
}

.paid-in-full {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.overdue-panel {
  border-color: rgba(180, 52, 52, 0.35);
  background: rgba(255, 246, 244, 0.9);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.filter-bar input[type="search"] {
  flex: 1 1 220px;
  width: auto;
}

.filter-bar select {
  width: auto;
}

.live-totals {
  margin-left: auto;
  min-width: 240px;
  max-width: 320px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: white;
}

.live-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.live-totals .grand {
  font-weight: 700;
  font-size: 18px;
  padding-top: 6px;
  border-top: 1px solid var(--stroke);
}

.small {
  font-size: 12px;
  margin: 4px 0 0;
}

.setup-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 16px 64px;
}

.setup-head {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 24px;
}

.hero-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.setup-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 20px;
}

.setup-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-size: 14px;
}

.setup-steps li span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper-strong);
  font-weight: 600;
  font-size: 12px;
}

.setup-steps li.current {
  color: var(--ink);
  border-color: var(--accent);
  font-weight: 600;
}

.setup-steps li.current span {
  background: var(--accent);
  color: white;
}

.setup-steps li.done span {
  background: var(--accent-2);
  color: white;
}

.setup-logo {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.logo-box {
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--stroke);
  border-radius: 16px;
  background: white;
}

.logo-box img {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
}

.setup-nav {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
}

.centered-page {
  display: grid;
  place-items: center;
  padding: 16px;
}

.panel.narrow {
  max-width: 480px;
  text-align: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--stroke);
  border-radius: 20px;
  background: #fffdf9;
  color: var(--ink);
  box-shadow: 0 24px 60px var(--shadow);
}

.modal::backdrop {
  background: rgba(26, 27, 31, 0.35);
}

.modal h3 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.alert-success {
  border-color: rgba(46, 125, 80, 0.4);
  color: #2e7d50;
  background: rgba(46, 125, 80, 0.08);
}


@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px 16px;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }

  .brand {
    flex-wrap: nowrap;
  }

  .brand img {
    max-width: 120px;
    max-height: 36px;
  }

  .brand-initials {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 14px;
  }

  .brand h1 {
    font-size: 18px;
    overflow-wrap: normal;
  }

  .brand p,
  .rail-note {
    display: none;
  }

  .nav {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav a {
    padding: 8px 12px;
    white-space: nowrap;
  }

  .main {
    padding: 24px;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- web app additions ---------- */

body.setup-mode .shell {
  display: block;
}

body.setup-mode .rail {
  display: none;
}

body.setup-mode .main {
  padding: 0;
}

#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: 0 12px 30px var(--shadow);
  animation: floatIn 0.25s ease;
}

.toast-error {
  background: #b43434;
}

.toggle-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: white;
  cursor: pointer;
}

.toggle-row input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.backup-ok {
  color: #2e7d50;
  font-weight: 500;
}

.file-button {
  cursor: pointer;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: rgba(212, 107, 46, 0.06);
}

.modal textarea {
  min-height: 160px;
}

.toggle-row,
.toggle-row .muted {
  font-weight: 400;
}

.toggle-row strong {
  font-weight: 600;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.toggle-inline input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

/* ---------- Expenses: receipts, jobs, totals ---------- */
.expense-cards {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

a.card-link {
  color: inherit;
  text-decoration: none;
}

a.card-link:hover {
  border-color: var(--accent);
}

.receipt-box {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px dashed var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.scan-status {
  margin: 0;
}

.scan-status.scan-error {
  color: #b43434;
}

.paste-box {
  display: grid;
  gap: 8px;
}

.paste-box[hidden],
.receipt-preview[hidden] {
  display: none;
}

.receipt-preview {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.receipt-preview img {
  max-width: 120px;
  max-height: 160px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  object-fit: cover;
}

.receipt-full {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto 12px;
  border-radius: 8px;
}

input.just-filled,
textarea.just-filled {
  background: #fff6d6;
  transition: background 1.5s ease;
}

.expense-table td:nth-child(3) {
  max-width: 260px;
}

.job-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 28px;
  margin-top: 12px;
}

.job-summary > div {
  display: grid;
  text-align: right;
}

.job-summary strong {
  font-size: 18px;
}

.job-summary .profit strong {
  color: #2e7d50;
}

.job-summary .loss strong {
  color: #b43434;
}

/* ---------- GST settings and alerts ---------- */
.gst-box,
.basis-box {
  display: grid;
  gap: 8px;
  align-self: start;
}

.gst-section {
  gap: 20px;
  max-width: 720px;
}

.gst-rate {
  max-width: 220px;
}

.radio-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: white;
  font-weight: 400;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.radio-card input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.alert-gst {
  display: grid;
  gap: 12px;
}

.alert-gst .actions {
  align-items: center;
}

.alert-gst-over {
  border-color: rgba(180, 52, 52, 0.4);
  background: rgba(180, 52, 52, 0.07);
}

.basis-note {
  align-self: end;
  margin: 0;
}

/* ---------- Reports page ---------- */
.report-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: flex-start;
}

.report-controls select {
  width: auto;
  min-width: 200px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: white;
}

.segmented button {
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: white;
}

.report-cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card-good {
  border-color: rgba(46, 125, 80, 0.35);
  background: rgba(46, 125, 80, 0.06);
}

.report-table tfoot th {
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
  border-top: 2px solid var(--stroke);
}

.eofy-alert {
  display: grid;
  gap: 12px;
}

.print-only {
  display: none;
}

@media print {
  .rail,
  .page-head .actions,
  .report-controls,
  .no-print,
  #toasts {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .print-only {
    display: block;
    margin: 0 0 16px;
  }

  .panel,
  .card {
    box-shadow: none;
    break-inside: avoid;
  }

  body {
    background: white;
  }
}

/* ---------- Sent page ---------- */
.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
}

.sent-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card-alert {
  border-color: rgba(180, 52, 52, 0.35);
  background: rgba(180, 52, 52, 0.06);
}

.sent-item.is-overdue td {
  background: rgba(180, 52, 52, 0.05);
}

.sent-table .pay-actions {
  text-align: right;
  white-space: nowrap;
}

.sent-table .pay-actions .link-button {
  margin-left: 10px;
}

.btn-paid {
  padding: 8px 14px;
  background: #2e7d50;
  border-color: #2e7d50;
  color: white;
}

.btn-paid:hover {
  background: #256843;
}

.other-row > td {
  padding: 4px 8px 18px;
}

.other-payment {
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  background: white;
}

.other-payment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px 16px;
  margin-bottom: 12px;
}

.other-payment .money-input input {
  text-align: right;
}

/* Phones: each waiting invoice becomes a compact card
   INV-00002                 $1,650.00
   Client name          Due 2 Nov 2026
   Sent 3 Oct 2026 (40 days ago)
   [Paid in full]  Other payment ▾  Remind */
@media (max-width: 700px) {
  .sent-table thead {
    display: none;
  }

  .sent-item {
    display: block;
    border-bottom: 1px solid var(--stroke);
  }

  .sent-item > tr:first-child {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 12px 4px;
  }

  .sent-item > tr.other-row:not([hidden]) {
    display: block;
  }

  .sent-item td {
    display: block;
    padding: 0;
    border: 0;
    width: auto;
  }

  .sent-item.is-overdue td {
    background: none;
  }

  .sent-item.is-overdue {
    background: rgba(180, 52, 52, 0.05);
  }

  .sent-item > tr:first-child > td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; }
  .sent-item > tr:first-child > td:nth-child(5) { grid-column: 2; grid-row: 1; }
  .sent-item > tr:first-child > td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .sent-item > tr:first-child > td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; white-space: nowrap; }
  .sent-item > tr:first-child > td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; color: var(--muted); font-size: 13px; }
  .sent-item > tr:first-child > td:nth-child(6) { grid-column: 1 / -1; grid-row: 4; text-align: left; margin-top: 6px; white-space: normal; }

  .sent-item > tr:first-child > td:nth-child(3)::before { content: "Sent "; }
  .sent-item > tr:first-child > td:nth-child(4)::before { content: "Due "; color: var(--muted); }
  .sent-item > tr:first-child > td:nth-child(3) br,
  .sent-item > tr:first-child > td:nth-child(4) br { display: none; }
  .sent-item > tr:first-child > td:nth-child(3) .small::before { content: " ("; }
  .sent-item > tr:first-child > td:nth-child(3) .small::after { content: ")"; }

  .sent-table .pay-actions .btn-paid {
    margin-right: 6px;
  }

  .sent-table .pay-actions .link-button {
    margin-left: 6px;
  }

  .other-row > td {
    padding: 0 0 14px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* "Made by Forster Design" link */
.made-by {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.made-by:hover {
  background: rgba(26, 27, 31, 0.05);
  color: var(--ink);
}

.made-by img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.made-by span {
  display: grid;
  line-height: 1.25;
}

.made-by strong {
  color: var(--ink);
  font-weight: 600;
}

.made-by small {
  font-size: 12px;
}

.setup-foot {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* On phones the menu becomes a slim top bar; the link lives in Settings → About instead */
@media (max-width: 980px) {
  .rail .made-by {
    display: none;
  }
}

/* ---------- phones and narrow windows ---------- */
@media (max-width: 700px) {
  .main {
    padding: 16px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  h2 {
    font-size: 26px;
  }

  .panel {
    padding: 16px;
    overflow-x: auto;
  }

  table {
    table-layout: auto;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .card .big {
    font-size: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Line items become stacked cards instead of a wide table */
  .line-items thead {
    display: none;
  }

  .line-items tr {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--stroke);
  }

  .line-items td {
    padding: 0;
    border: 0;
  }

  .line-items td:first-child {
    grid-column: 1 / -1;
  }

  .line-items td.qty-cell,
  .line-items td.price-cell,
  .line-items td.remove-cell {
    width: auto;
  }

  /* Headings are hidden on phones, so label the boxes instead */
  .line-items td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--muted);
    text-align: right;
  }

  .line-items td.remove-cell {
    align-self: end;
  }

  .line-items input,
  .line-items select,
  .line-items textarea {
    min-width: 0;
  }

  .live-totals {
    max-width: none;
    width: 100%;
  }

  .row-actions {
    flex-wrap: wrap;
  }
}

/* Let the menu scroll sideways on its own rather than widening the page */
.shell > * {
  min-width: 0;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
}
