/* nullaudit — invoice.css
   Modern dark cards + hairline dividers.
   No shadows. No rounded corners. No emojis. */

/* ── Page width ────────────────────────────────────────── */
.invoice-main {
  max-width: 820px;
}

/* ── Page header ───────────────────────────────────────── */
.invoice-main .page-title {
  font-size: 1.875rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  line-height: 1.1;
}

.invoice-main .page-sub {
  font-size: 0.9375rem;
  color: var(--fg-muted);
  margin: 0 0 3rem;
  max-width: 60ch;
}

/* ── Sections as cards ─────────────────────────────────── */
.inv-section {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1.75rem 1.75rem 2rem;
  margin-bottom: 1.25rem;
}

.inv-heading {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0 0 1.5rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}

/* ── Field grid ────────────────────────────────────────── */
.inv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
}

.field {
  display: block;
}

.field-wide {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

/* ── Inputs ────────────────────────────────────────────── */
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 100ms ease, background 100ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.5;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--fg-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--fg);
  background: var(--bg-soft);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

/* Select dropdown arrow */
.field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%238a8a8f' stroke-width='1.2' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 10px 6px;
  padding-right: 2.25rem;
}

[data-theme="light"] .field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%236a6a70' stroke-width='1.2' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
}

.field input[type="date"] {
  font-variant-numeric: tabular-nums;
  font-family: inherit;
}

/* ── Logo row ──────────────────────────────────────────── */
.inv-logo-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.field-logo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.field-logo .field-label {
  margin-bottom: 0;
}

.field-logo .muted {
  font-size: 0.8125rem;
  color: var(--fg-muted);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#logo-preview {
  display: block;
  max-width: 140px;
  max-height: 64px;
  border: 1px solid var(--border-strong);
  padding: 0.5rem;
  background: var(--bg);
  object-fit: contain;
}

/* ── Line items ────────────────────────────────────────── */
.items-header,
.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 130px 130px 70px;
  gap: 0.75rem;
  align-items: center;
}

.items-header {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.items-header .col-qty,
.items-header .col-price,
.items-header .col-amount {
  text-align: right;
}

.items-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.item-row input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 100ms ease, background 100ms ease;
}

.item-row input:hover {
  border-color: var(--fg-muted);
}

.item-row input:focus {
  border-color: var(--fg);
  background: var(--bg-soft);
}

.item-row input[type="number"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.item-amount {
  text-align: right;
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  padding-right: 0.75rem;
}

.item-remove {
  background: none;
  border: none;
  color: var(--fg-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-align: right;
}

.item-remove:hover {
  color: var(--danger);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.add-item-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  border-style: dashed;
  color: var(--fg-muted);
  text-align: center;
  border-color: var(--border-strong);
}

.add-item-btn:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
  background: var(--bg);
  opacity: 1;
}

/* ── Totals panel ──────────────────────────────────────── */
.totals-panel {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  padding: 1.25rem 1.5rem;
  margin-top: 0.5rem;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
}

.totals-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.totals-value {
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  font-size: 0.9375rem;
}

.totals-row-grand {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
}

.totals-row-grand .totals-label {
  font-size: 1rem;
  color: var(--fg);
  font-weight: 500;
}

.totals-row-grand .totals-value {
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.tax-input {
  width: 5rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-soft);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  font: inherit;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  transition: border-color 100ms ease;
}

.tax-input:hover {
  border-color: var(--fg-muted);
}

.tax-input:focus {
  border-color: var(--fg);
}

/* ── Notes ─────────────────────────────────────────────── */
.inv-section .field-wide:last-child {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Actions ───────────────────────────────────────────── */
.actions {
  margin-top: 2rem;
}

#download-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── Status ────────────────────────────────────────────── */
.status {
  margin: 1.25rem 0 0;
  text-align: center;
  min-height: 1.25rem;
  font-size: 0.875rem;
}

/* ── Buttons (secondary) ───────────────────────────────── */
.field-logo .btn {
  padding: 0.5rem 0.9rem;
  font-size: 0.8125rem;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .inv-section {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .inv-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .inv-logo-row {
    flex-direction: column;
    align-items: stretch;
  }

  .items-header {
    display: none;
  }

  .item-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem 0;
  }

  .item-row input {
    text-align: left;
  }

  .item-amount {
    text-align: left;
    padding: 0.4rem 0;
  }

  .item-amount::before {
    content: "Amount: ";
    color: var(--fg-muted);
    font-weight: 400;
  }

  .item-remove {
    text-align: left;
    padding: 0.4rem 0;
  }

  .totals-row {
    font-size: 0.875rem;
  }
}