:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #ffedd5;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: min(1100px, calc(100% - 2rem)); margin: 0 auto; }
.container-narrow { width: min(720px, calc(100% - 2rem)); margin: 0 auto; }

.site-header {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s ease;
  background: var(--brand);
  color: white;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: white; }
.btn-secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { background: #f1f5f9; color: var(--ink); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-lg { padding: 0.85rem 1.25rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.hero {
  padding: 4rem 0 3rem;
  background:
    radial-gradient(circle at top right, #99f6e4 0%, transparent 40%),
    radial-gradient(circle at 20% 20%, #bae6fd 0%, transparent 30%),
    var(--bg);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 36rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.hero-note { color: var(--muted); font-size: 0.9rem; }
.preview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.preview-top {
  background: linear-gradient(120deg, #0f766e, #0e7490);
  color: white;
  padding: 1rem 1.15rem;
}
.preview-top small { opacity: 0.85; }
.preview-body { padding: 1.15rem; }
.preview-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
}
.preview-row:last-child { border-bottom: 0; font-weight: 800; color: var(--brand); }
.preview-total { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 2px solid var(--line); }

.section { padding: 3rem 0; }
.section h2 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.section .sub { color: var(--muted); margin: 0 0 1.75rem; }
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.step-num {
  width: 2rem; height: 2rem; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800; margin-bottom: 0.75rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  max-width: 760px;
}
.price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
}
.price-card.featured {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.price-card .badge {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}
.price { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; margin: 0.5rem 0; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 600; }
.price-card ul {
  margin: 1rem 0 1.25rem;
  padding-left: 1.1rem;
  color: var(--muted);
}
.price-card li { margin: 0.35rem 0; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2rem;
}

.flash-wrap { width: min(1100px, calc(100% - 2rem)); margin: 1rem auto 0; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.app-shell { padding: 1.5rem 0 3rem; }
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.app-header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.02em; }
.app-header p { margin: 0.25rem 0 0; color: var(--muted); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.stat .label { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.stat .value { font-size: 1.4rem; font-weight: 800; margin-top: 0.2rem; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
table.data th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #f8fafc; }

.badge-status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.st-draft { background: #f1f5f9; color: #475569; }
.st-sent { background: #e0f2fe; color: #0369a1; }
.st-accepted { background: var(--ok-soft); color: var(--ok); }
.st-declined { background: var(--danger-soft); color: var(--danger); }

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.form-grid .full { grid-column: 1 / -1; }
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #334155;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="color"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: white;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #99f6e4;
  border-color: var(--brand);
}
textarea { min-height: 90px; resize: vertical; }
.help { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.line-items { width: 100%; border-collapse: collapse; }
.line-items th {
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.4rem 0.3rem;
}
.line-items td { padding: 0.3rem; vertical-align: top; }
.line-items input { min-width: 0; }
.line-items .col-desc { width: 50%; }
.line-items .col-qty { width: 15%; }
.line-items .col-price { width: 20%; }
.line-items .col-amt { width: 15%; text-align: right; padding-top: 0.8rem; font-weight: 600; color: var(--muted); }

.totals-box {
  margin-top: 1rem;
  margin-left: auto;
  width: min(280px, 100%);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.totals-box .row {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0;
  color: var(--muted);
}
.totals-box .row.total {
  color: var(--ink);
  font-weight: 800;
  font-size: 1.1rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.share-box {
  background: var(--brand-soft);
  border: 1px solid #99f6e4;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.share-box code, .share-box input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}
.share-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.auth-page {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 1.25rem; }
.auth-card .field { margin-bottom: 0.85rem; }
.auth-card .foot { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* Public quote */
.public-page {
  background:
    radial-gradient(circle at top, #ccfbf1 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
  padding: 2rem 0 3rem;
}
.public-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.public-banner {
  padding: 1.35rem 1.5rem;
  color: white;
}
.public-banner h1 { margin: 0; font-size: 1.5rem; }
.public-banner p { margin: 0.35rem 0 0; opacity: 0.9; }
.public-body { padding: 1.5rem; }
.public-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.public-meta h3 {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.public-meta p { margin: 0.15rem 0; }
.public-items { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.public-items th, .public-items td {
  padding: 0.7rem 0.4rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.public-items th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; }
.public-items td.num, .public-items th.num { text-align: right; }
.public-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}
.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty h3 { margin: 0 0 0.5rem; color: var(--ink); }

@media (max-width: 860px) {
  .hero-grid, .grid-3, .pricing-grid, .stat-row, .public-meta, .form-grid {
    grid-template-columns: 1fr;
  }
  .line-items .col-desc { width: auto; }
}
