/* Invoice Draft — companion to Solo Invoice OS. Navy + gold, yellow input / green computed. */

:root {
  --navy: #14243a;
  --navy-2: #1c3352;
  --gold: #c9a227;
  --gold-hover: #b08c1c;
  --cream: #f4f1ea;
  --paper: #ffffff;
  --ink: #1c2430;
  --muted: #5a6573;
  --line: #ddd6c8;
  --yellow: #fff4b0;
  --yellow-border: #e6d36a;
  --green: #d7eedd;
  --green-border: #9cc9aa;
  --max: 78rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--navy-2);
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-weight: 600;
  line-height: 1.22;
  color: var(--navy);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: var(--navy);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: min(100% - 1.5rem, var(--max));
  margin-inline: auto;
}

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid var(--gold);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand:hover {
  color: var(--gold);
}

.brand-sub {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: #c9c3b6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  align-items: center;
}

nav a {
  color: #e8e4d9;
  text-decoration: none;
  font-size: 0.95rem;
}

nav a:hover {
  color: var(--gold);
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  border: 1px solid transparent;
  line-height: 1.3;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--paper);
  color: var(--navy);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

.btn-gold:hover {
  background: var(--gold-hover);
  color: var(--navy);
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-ghost:hover {
  background: var(--navy);
  color: #fff;
}

.btn-ghost-light {
  background: transparent;
  color: #e8e4d9;
  border-color: #8a8376;
}

.btn-ghost-light:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-lg {
  padding: 0.7rem 1.25rem;
  font-size: 1.05rem;
}

.lede-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0 1.15rem;
}

.lede-bar h1 {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  margin: 0 0 0.4rem;
}

.lede-bar p {
  margin: 0 0 0.65rem;
  max-width: 46rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  vertical-align: -0.1rem;
  margin-right: 0.3rem;
  border: 1px solid var(--line);
}

.swatch.yellow {
  background: var(--yellow);
  border-color: var(--yellow-border);
}

.swatch.green {
  background: var(--green);
  border-color: var(--green-border);
}

.layout {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem 0 2rem;
}

@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .preview-col {
    position: sticky;
    top: 4.5rem;
  }
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.1rem 1.2rem;
}

.panel h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.status {
  min-height: 1.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.status.ok {
  color: #1e6b3a;
}

.status.err {
  color: #8a1f1f;
}

.grid-2 {
  display: grid;
  gap: 0.75rem 1rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.field.span-2 {
  grid-column: 1 / -1;
}

label,
.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: var(--paper);
  width: 100%;
}

textarea {
  min-height: 4.2rem;
  resize: vertical;
}

.input-yellow {
  background: var(--yellow) !important;
  border-color: var(--yellow-border) !important;
}

.input-green,
.computed {
  background: var(--green) !important;
  border-color: var(--green-border) !important;
}

.hidden {
  display: none !important;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem 0.9rem;
}

legend {
  font-family: Georgia, "Times New Roman", Times, serif;
  color: var(--navy);
  font-weight: 600;
  padding: 0 0.35rem;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.items-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.25rem 0.3rem;
}

.items-table td {
  padding: 0.25rem 0.3rem;
  vertical-align: middle;
}

.items-table .col-qty,
.items-table .col-rate,
.items-table .col-amt {
  width: 5.6rem;
}

.items-table .col-amt input {
  text-align: right;
}

.items-table .col-x {
  width: 2.2rem;
}

.btn-icon {
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  min-width: 2rem;
}

.totals-box {
  margin: 0.75rem 0 0 auto;
  width: min(18rem, 100%);
}

.totals-box .row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.totals-box input {
  max-width: 8.5rem;
  text-align: right;
}

.helper {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #faf8f3;
  padding: 0.15rem 0.85rem 0.85rem;
}

.helper summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  padding: 0.65rem 0;
}

.helper pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.65rem 0.75rem;
  font-size: 0.78rem;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  max-height: 12rem;
  overflow: auto;
}

.disclaimer {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 1rem 0 0;
  padding: 0.85rem 0.9rem;
  background: var(--cream);
  border-left: 3px solid var(--gold);
}

.disclaimer p {
  margin: 0 0 0.5rem;
}

.disclaimer p:last-child {
  margin-bottom: 0;
}

.upsell {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
}

.upsell p {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
}

.upsell .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.upsell a.btn-ghost {
  color: #fff;
  border-color: #8a8376;
}

.upsell a.btn-ghost:hover {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}

.preview-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.invoice {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 24px rgba(20, 36, 58, 0.08);
}

.invoice.is-sample::after {
  content: "SAMPLE";
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-size: clamp(3rem, 8vw, 4.6rem);
  font-weight: 800;
  color: rgba(201, 162, 39, 0.16);
  pointer-events: none;
  letter-spacing: 0.14em;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.inv-banner {
  background: var(--navy);
  color: #fff;
  padding: 0.7rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  border-bottom: 3px solid var(--gold);
}

.inv-banner strong {
  letter-spacing: 0.04em;
}

.inv-banner .tag {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inv-body {
  padding: 1.15rem 1.25rem 1.35rem;
}

.inv-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.biz-name {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

.biz-meta,
.muted {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.inv-title {
  text-align: right;
}

.inv-title h3 {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
}

.inv-num {
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
}

.inv-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.bill-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.bill-name {
  font-weight: 700;
  color: var(--navy);
}

.dates {
  text-align: right;
  font-size: 0.9rem;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.1rem;
}

.inv-table th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-table th.num,
.inv-table td.num {
  text-align: right;
}

.inv-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.inv-table tbody tr:nth-child(even) {
  background: #f3f6f9;
}

.inv-totals {
  margin-left: auto;
  width: min(18rem, 100%);
}

.inv-totals .row {
  display: flex;
  justify-content: space-between;
  padding: 0.22rem 0;
  font-size: 0.92rem;
}

.inv-totals .grand {
  border-top: 2px solid var(--navy);
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  font-weight: 700;
  color: var(--navy);
  font-size: 1.12rem;
}

.inv-notes {
  margin-top: 1.15rem;
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--navy);
}

.small-supplier {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.site-footer {
  background: var(--navy);
  color: #c9c3b6;
  padding: 1.5rem 0;
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0 0 0.35rem;
}

.site-footer a {
  color: var(--gold);
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .no-print {
    display: none !important;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .wrap {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .preview-col {
    position: static;
  }

  .invoice {
    box-shadow: none;
    border: none;
    border-radius: 0;
  }

  .invoice.is-sample::after {
    color: rgba(201, 162, 39, 0.22);
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  @page {
    margin: 12mm;
    size: letter;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paste-hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.85rem;
  padding: 0.55rem 0.7rem;
  background: var(--cream);
  border: 1px dashed var(--line);
  border-radius: 4px;
}
