/* ============================================================
   Free GST Bill Maker — BillingFast
   Theme tokens, layout, components, responsive, print

   NOTE: index.html INLINES this entire file in a <style> block
   (perf: removes the render-blocking request). After editing
   here, re-inline into index.html. privacy.html still links
   this file directly.
   ============================================================ */

:root {
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;

  /* light theme */
  --bg: #ffffff;
  --bg-alt: #f4f4f5;
  --surface: #ffffff;
  --text: #1a1714;
  --text-soft: #6b6b6f;
  --text-faint: #9a9aa0;
  --border: #e6e6e9;
  --border-strong: #1a1714;
  --accent: #2b2723;      /* warm near-black button */
  --accent-text: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --maxw: 1200px;
}

[data-theme="dark"] {
  --bg: #131211;
  --bg-alt: #1b1a18;
  --surface: #1d1c1a;
  --text: #f3f1ee;
  --text-soft: #a5a29c;
  --text-faint: #77746f;
  --border: #2f2d2a;
  --border-strong: #f3f1ee;
  --accent: #f3f1ee;
  --accent-text: #131211;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 22px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, background .2s ease, border-color .2s ease, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-dark {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-dark:hover { opacity: .9; }

.btn-ghost { background: var(--surface); }
.btn-ghost:hover { border-color: var(--border-strong); }

.btn-add {
  width: 100%;
  border-style: dashed;
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  padding: 16px;
}
.btn-add:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
}
.logo {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .2s;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--text) 0 50%, transparent 50% 100%);
  border: 2px solid var(--text);
}

/* ---------------- Hero ---------------- */
.hero { text-align: center; padding: 72px 24px 44px; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(42px, 8vw, 84px);
  line-height: 1;
  letter-spacing: -.02em;
  margin: 0 0 22px;
}
.hero-sub {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(17px, 2.4vw, 22px);
  color: var(--text-soft);
}
.hero-sub strong { color: var(--text); font-weight: 700; }

/* ---------------- Tool grid ---------------- */
.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding-bottom: 80px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}
.card-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 14px;
}
.form-card .card-label:not(:first-child) { margin-top: 26px; }

.field {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
  transition: border-color .15s;
}
.field::placeholder { color: var(--text-faint); }
.field:focus { outline: none; border-color: var(--border-strong); }

.field-row { display: flex; gap: 12px; margin-top: 12px; }
.field-row .field { flex: 1; min-width: 0; }

/* item rows */
.items-list { display: flex; flex-direction: column; gap: 12px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr 68px 92px 78px 34px;
  gap: 10px;
  align-items: center;
}
.item-row .field { padding: 14px 14px; }
.item-row .num { text-align: center; }
.item-remove {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.item-remove:hover { color: #d64545; background: var(--bg-alt); }

.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.actions .btn { flex: 0 0 auto; }
.actions .btn-dark { flex: 1 1 auto; }

/* ---------------- Invoice preview ---------------- */
.invoice-card { position: sticky; top: 96px; }
.inv-biz {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -.01em;
  margin: 0 0 6px;
}
.inv-meta { margin: 0 0 6px; color: var(--text-soft); font-size: 14px; letter-spacing: .02em; }
.inv-cust, .inv-gstin { margin: 2px 0 0; color: var(--text-soft); font-size: 14px; }
.mono { font-family: var(--font-mono); }

.inv-table { width: 100%; border-collapse: collapse; margin-top: 22px; }
.inv-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--text-faint);
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
}
.inv-table th.num, .inv-table td.num { text-align: right; }
.inv-table td {
  padding: 15px 0;
  font-size: 15px;
  border-bottom: 1px dashed var(--border);
  vertical-align: top;
}
.inv-table td.num { font-family: var(--font-mono); white-space: nowrap; padding-left: 10px; }
.inv-empty td { color: var(--text-faint); text-align: center; padding: 28px 0; border-bottom: 1px dashed var(--border); }

.inv-totals { margin-top: 8px; }
.inv-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 13px 0;
  font-size: 15px;
  border-bottom: 1px dashed var(--border);
}
.inv-line .mono { font-size: 15px; }
.inv-total {
  border-bottom: none;
  border-top: 2px solid var(--border-strong);
  margin-top: 4px;
  padding-top: 16px;
  font-weight: 700;
  font-size: 19px;
}
.inv-total .mono { font-size: 22px; font-weight: 700; }
.inv-footer { text-align: center; color: var(--text-faint); font-size: 13px; margin: 26px 0 0; }
.inv-footer a { color: inherit; text-decoration: none; }
.inv-footer a:hover { text-decoration: underline; }

/* ---------------- Formats ---------------- */
.formats-section { background: var(--bg-alt); padding: 72px 0; }
.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 5vw, 46px);
  letter-spacing: -.02em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.section-sub { color: var(--text-soft); margin: 0 0 34px; font-size: 17px; }

.formats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.format-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: transform .12s ease, border-color .2s;
}
.format-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.format-emoji { font-size: 28px; }
.format-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 14px 0 6px; }
.format-card p { color: var(--text-soft); font-size: 14px; margin: 0 0 14px; }
.format-load { color: var(--text); font-weight: 700; font-size: 14px; }

/* ---------------- Blogs ---------------- */
.blogs-section { padding: 72px 0; }
.blogs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-decoration: none;
  color: var(--text);
  transition: transform .12s ease, border-color .2s;
}
.blog-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.blog-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.blog-card h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 21px;
  line-height: 1.25;
  margin: 12px 0 10px;
}
.blog-card p { color: var(--text-soft); font-size: 14px; margin: 0 0 auto; }
.blog-read { margin-top: 18px; font-weight: 700; font-size: 14px; }
.more-blogs { margin-top: 34px; }

/* ---------------- Invoice type chips ---------------- */
.type-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.chip {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ---------------- Format card actions ---------------- */
.format-card { cursor: default; }
.format-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.format-load {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.format-load:hover { text-decoration: underline; }
.format-download {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
  text-decoration: none;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.format-download:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------------- Rating ---------------- */
.rating-section { padding: 0 24px 72px; }
.rating-box {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  max-width: 460px;
  margin: 0 auto;
}
.rating-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 10px;
}
.rating-stars { display: flex; justify-content: center; gap: 6px; }
.rating-stars .star {
  border: none;
  background: none;
  font-size: 34px;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  padding: 2px;
  transition: color .12s, transform .12s;
}
.rating-stars .star:hover { transform: scale(1.15); }
.rating-stars .star.on { color: #f0a400; }
.rating-summary { color: var(--text-faint); font-size: 14px; margin: 10px 0 0; }

/* ---------------- Hero note ---------------- */
.hero-note {
  margin: 16px auto 0;
  font-size: 14px;
  color: var(--text-faint);
}

/* ---------------- Steps ---------------- */
.steps-section { padding: 72px 0; }
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 34px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  font-weight: 700;
  font-size: 17px;
}
.step-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 16px 0 8px; }
.step-card p { color: var(--text-soft); font-size: 15px; margin: 0; }

/* ---------------- GST guide ---------------- */
.guide-section { background: var(--bg-alt); padding: 72px 0; }
.guide-lead {
  max-width: 820px;
  color: var(--text-soft);
  font-size: 17px;
  margin: 0 0 38px;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.guide-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.guide-col h3 { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin: 0 0 16px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  position: relative;
  padding: 7px 0 7px 30px;
  color: var(--text-soft);
  font-size: 15px;
}
.checklist li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  font-weight: 700;
  color: var(--text);
}
.guide-note { color: var(--text-faint); font-size: 13.5px; margin: 16px 0 0; }
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
}
.rate-table td {
  padding: 11px 14px 11px 0;
  font-size: 15px;
  color: var(--text-soft);
  border-bottom: 1px dashed var(--border);
  vertical-align: top;
}
.rate-table td.mono { color: var(--text); font-weight: 700; white-space: nowrap; }
.rate-table tr:last-child td { border-bottom: none; }

/* ---------------- FAQ ---------------- */
.faq-section { padding: 72px 0; }
.faq-list { max-width: 820px; margin-top: 30px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 22px;
  margin-bottom: 12px;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16.5px;
  padding: 18px 0;
  position: relative;
  padding-right: 34px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-faint);
}
.faq-item[open] summary::after { content: '–'; }
.faq-item p { color: var(--text-soft); font-size: 15px; margin: 0 0 18px; }

/* ---------------- Agents / API ---------------- */
.agents-section { background: var(--bg-alt); padding: 72px 0; }
.agents-p { color: var(--text-soft); font-size: 15px; margin: 0 0 12px; }
.agents-p code, .agents-section code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}
.code-block {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
  white-space: pre;
}
.agents-section a { color: var(--text); font-weight: 700; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 60px 0 28px; }
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr;
  gap: 32px;
  padding-bottom: 40px;
}
.footer-brand .logo { font-size: 24px; display: inline-block; margin-bottom: 12px; }
.footer-brand p { color: var(--text-soft); max-width: 320px; margin: 0; }
.footer-col h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 16px;
}
.footer-col a {
  display: block;
  color: var(--text-soft);
  text-decoration: none;
  padding: 5px 0;
  font-size: 15px;
  transition: color .15s;
}
.footer-col a:hover { color: var(--text); }
.publisher { color: var(--text-soft); font-size: 15px; margin: 0; }
.publisher strong { color: var(--text); font-size: 17px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 940px) {
  .tool { grid-template-columns: 1fr; }
  .invoice-card { position: static; }
  .formats-grid { grid-template-columns: repeat(2, 1fr); }
  .blogs-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .container { padding: 0 18px; }
  .header-inner { height: 64px; }
  .logo { font-size: 22px; }
  .btn-dark { font-size: 13px; padding: 11px 15px; }
  .hero { padding: 48px 18px 32px; }
  .card { padding: 22px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .formats-grid, .blogs-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 400px) {
  .item-row { grid-template-columns: 1fr 52px 68px 60px 30px; gap: 7px; }
  .item-row .field { padding: 12px 8px; font-size: 14px; }
}

/* ============================================================
   Print — only the invoice
   ============================================================ */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .hero, .form-card, .formats-section, .blogs-section,
  .steps-section, .guide-section, .faq-section, .rating-section,
  .agents-section, .site-footer { display: none !important; }
  .inv-footer a { color: inherit; text-decoration: none; }
  main, .tool { display: block; padding: 0; margin: 0; }
  .invoice-card {
    position: static;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: 640px;
    margin: 0 auto;
  }
  .inv-footer { color: #666; }
  @page { margin: 18mm; }
}
