/* =============================================
   INVOICEAI — style.css
   Light scheme · DM Serif Display + DM Sans
   ============================================= */

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

:root {
  --bg: #f7f7f5;
  --white: #ffffff;
  --ink: #0f0f0e;
  --ink-soft: #3a3a38;
  --ink-muted: #7a7a75;
  --border: #e2e2de;
  --accent: #111110;
  --accent-light: #f0ede8;
  --green: #1a7a4a;
  --green-bg: #eaf5ef;
  --red: #b03030;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.10);
  --radius: 14px;
  --radius-sm: 8px;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--ink);
  min-height: 100vh;
}

/* ─── LAYOUT ─── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── HEADER ─── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 28px 0 24px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 1rem;
  color: var(--ink-muted);
  font-weight: 400;
  max-width: 480px;
  line-height: 1.5;
}

/* ─── STEP BAR ─── */
.steps-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--white);
  border: 1.5px solid var(--border);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.3s ease;
}

.step.active {
  color: var(--ink);
  border-color: var(--ink);
  background: var(--white);
}

.step.active span {
  background: var(--ink);
  color: var(--white);
}

.step.done {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-bg);
}

.step.done span {
  background: var(--green);
  color: var(--white);
}

.step-line {
  width: 32px;
  height: 1.5px;
  background: var(--border);
  flex-shrink: 0;
}

/* ─── CARD ─── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
  border: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.card-sub {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 28px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ─── FORM ─── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.hint {
  font-weight: 400;
  color: var(--ink-muted);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15,15,14,0.07);
}

input::placeholder,
textarea::placeholder {
  color: #b0b0aa;
}

textarea {
  resize: vertical;
}

/* ─── LINE ITEMS ─── */
.item-row {
  display: grid;
  grid-template-columns: 2fr 80px 110px 110px 36px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
}

.item-row input {
  font-size: 0.85rem;
  padding: 9px 12px;
}

.item-row .item-line-total {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
  min-width: 80px;
}

.item-col-headers {
  display: grid;
  grid-template-columns: 2fr 80px 110px 110px 36px;
  gap: 10px;
  margin-bottom: 8px;
}

.item-col-headers span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
}

.item-col-headers span:last-child,
.item-col-headers span:nth-child(3) {
  text-align: right;
}

.btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #c0bebb;
  font-size: 1.1rem;
  transition: color 0.2s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.btn-remove:hover {
  color: var(--red);
  background: #fdf0f0;
}

/* ─── BUTTONS ─── */
.btn-row {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn-primary {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 12px 28px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: #2a2a28;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--accent-light);
}

/* ─── TOTALS SUMMARY CARDS ─── */
.totals-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  text-align: center;
}

.summary-card .s-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.summary-card .s-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
}

.summary-card.highlight {
  background: var(--ink);
  border-color: var(--ink);
}

.summary-card.highlight .s-label {
  color: rgba(255,255,255,0.6);
}

.summary-card.highlight .s-value {
  color: var(--white);
}

/* ─── INVOICE PREVIEW ─── */
.invoice-preview {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.88rem;
  background: var(--white);
}

.inv-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 36px 40px 28px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
  flex-wrap: wrap;
}

.inv-top-left .inv-logo-img {
  max-height: 48px;
  max-width: 140px;
  object-fit: contain;
  margin-bottom: 10px;
}

.inv-biz-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.inv-biz-details {
  color: var(--ink-muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

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

.inv-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--ink);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 12px;
}

.inv-meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.9;
}

.inv-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.inv-bill-section {
  display: flex;
  justify-content: space-between;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
  flex-wrap: wrap;
}

.inv-bill-to .bill-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.inv-bill-to .bill-name {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.inv-bill-to .bill-detail {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
}

.inv-table thead tr {
  background: var(--ink);
  color: var(--white);
}

.inv-table thead th {
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
}

.inv-table thead th:not(:first-child) {
  text-align: right;
}

.inv-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.inv-table tbody tr:hover {
  background: var(--bg);
}

.inv-table tbody td {
  padding: 13px 16px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.inv-table tbody td:not(:first-child) {
  text-align: right;
}

.inv-totals-block {
  display: flex;
  justify-content: flex-end;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
}

.inv-totals-table {
  width: 280px;
}

.inv-totals-table tr td {
  padding: 6px 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.inv-totals-table tr td:last-child {
  text-align: right;
  font-weight: 500;
}

.inv-totals-table tr.total-final td {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  padding-top: 10px;
  font-weight: 700;
}

.inv-totals-table tr.discount-row td {
  color: var(--green);
}

.inv-footer-row {
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.inv-notes {
  max-width: 400px;
}

.inv-notes .note-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.inv-notes p {
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.6;
}

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

.inv-payment .note-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.inv-payment p {
  font-size: 0.82rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.inv-stamp {
  display: inline-block;
  margin-top: 12px;
  border: 2.5px solid var(--green);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  border-radius: 4px;
  transform: rotate(-3deg);
  display: inline-block;
}

/* ─── STEP SECTIONS ─── */
.step-section {
  display: none;
}

.step-section.active {
  display: block;
  animation: fadeInUp 0.35s ease;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── FOOTER ─── */
.site-footer {
  text-align: center;
  padding: 32px 24px;
  margin-top: 20px;
  color: var(--ink-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .card {
    padding: 24px 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: 1;
  }

  .item-row {
    grid-template-columns: 1fr 60px 90px 90px 30px;
    gap: 6px;
  }

  .item-col-headers {
    grid-template-columns: 1fr 60px 90px 90px 30px;
    gap: 6px;
  }

  .inv-top {
    flex-direction: column;
    padding: 24px;
  }

  .inv-top-right {
    text-align: left;
  }

  .inv-bill-section {
    padding: 20px 24px;
  }

  .inv-table thead th,
  .inv-table tbody td {
    padding: 10px 12px;
    font-size: 0.78rem;
  }

  .inv-totals-block,
  .inv-footer-row {
    padding: 20px 24px;
  }

  .btn-row {
    justify-content: stretch;
    flex-direction: column;
  }

  .btn-primary, .btn-ghost {
    width: 100%;
    text-align: center;
  }
}
