:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #667485;
  --line: #d9e0e7;
  --paper: #ffffff;
  --panel: #f6f8fb;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --navy: #17212b;
  --amber: #b45309;
  --rose: #be123c;
  --blue: #2563eb;
  --soft-green: #e8f4ef;
  --soft-amber: #fff7ed;
  --soft-rose: #fff1f2;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf1f5;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.site-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px clamp(16px, 3vw, 34px);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand,
.nav-link,
.primary-link,
.secondary-link,
.text-link {
  color: inherit;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-weight: 750;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
}

.nav-link {
  border-radius: 7px;
  color: var(--muted);
  font-weight: 850;
  padding: 10px 12px;
}

.nav-link.active {
  background: var(--soft-green);
  color: var(--accent-dark);
}

.header-actions,
.hero-actions,
.preview-toolbar,
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 850;
}

.primary-btn,
.primary-link {
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 7px;
  font-weight: 900;
}

.primary-btn:hover,
.primary-link:hover {
  background: var(--accent-dark);
}

.ghost-btn,
.secondary-btn,
.secondary-link {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0 16px;
}

.secondary-btn {
  width: 100%;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  padding: 0 12px;
  white-space: nowrap;
}

.page {
  display: none;
  padding: 26px clamp(16px, 3vw, 34px) 38px;
}

.page.active {
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.hero-preview,
.info-card,
.pricing-card,
.feature-card,
.editor-panel,
.calculator-panel,
.document-preview,
.results-panel,
.result-card,
.contact-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(24px, 5vw, 48px);
}

.hero-copy p {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
  margin: 18px 0 0;
  max-width: 760px;
}

.hero-actions {
  flex-wrap: wrap;
  margin-top: 24px;
}

.hero-preview {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 13px;
}

.metric-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metric-row span {
  color: var(--muted);
  font-weight: 800;
}

.metric-row strong {
  text-align: right;
}

.section-heading {
  justify-content: space-between;
  margin: 8px 0 14px;
}

.text-link {
  color: var(--accent-dark);
  font-weight: 900;
}

.page-title {
  max-width: 900px;
  margin-bottom: 20px;
}

.page-title p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 12px 0 0;
}

.feature-grid,
.pricing-grid,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.pricing-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card {
  display: grid;
  min-height: 188px;
  padding: 18px;
  align-content: space-between;
  gap: 20px;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.12rem;
}

.feature-card p,
.pricing-card p,
.info-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

.feature-card button {
  justify-self: start;
  background: var(--navy);
  color: #fff;
  padding: 0 14px;
}

.feature-badge {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.tool-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  overflow-x: auto;
  padding: 0 0 16px;
}

.tool-tab {
  min-height: 48px;
  min-width: 185px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 0 14px;
  white-space: nowrap;
}

.tool-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.app-shell,
.calculator-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 470px) minmax(0, 1fr);
  gap: 22px;
}

.hidden {
  display: none !important;
}

.editor-panel,
.preview-panel,
.calculator-panel,
.results-panel {
  min-width: 0;
}

.editor-panel,
.calculator-panel,
.results-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  min-width: 290px;
}

.segment {
  border-radius: 0;
  background: #fff;
  color: var(--muted);
  min-height: 38px;
}

.segment.active {
  background: var(--accent);
  color: #fff;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 0 0 14px;
}

legend {
  padding: 0 7px;
  font-weight: 900;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
  margin-bottom: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  font-weight: 650;
}

textarea {
  resize: vertical;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
}

.details-grid legend {
  grid-column: 1 / -1;
}

.items-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 70px 95px 42px;
  gap: 8px;
  align-items: center;
}

.items-head {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 7px;
}

.item-row {
  margin-bottom: 8px;
}

.item-row input {
  min-width: 0;
}

.remove-btn {
  width: 42px;
  min-height: 42px;
  background: var(--soft-amber);
  color: var(--amber);
  border: 1px solid #fed7aa;
  font-size: 1.15rem;
}

.preview-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.compact {
  display: none;
}

.document-preview {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 42px);
}

.doc-watermark {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  color: rgba(15, 118, 110, 0.07);
  font-size: clamp(5rem, 14vw, 10rem);
  font-weight: 950;
  pointer-events: none;
}

.doc-header,
.billing-row,
.totals {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 0.46fr);
  gap: 28px;
  position: relative;
}

.doc-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 28px;
}

.doc-brand {
  margin-bottom: 10px;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  font-weight: 950;
}

.doc-header p,
.billing-row p,
.notes p {
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.55;
}

.doc-meta {
  text-align: right;
}

.doc-meta h3 {
  margin-bottom: 14px;
  color: var(--accent-dark);
  font-size: 1.55rem;
  text-transform: uppercase;
}

.doc-meta p,
.total-box p {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 8px;
}

.doc-meta p {
  justify-content: flex-end;
}

.doc-meta span,
.billing-row span {
  color: var(--muted);
  font-weight: 850;
}

.billing-row {
  margin: 26px 0;
}

.billing-row strong {
  display: block;
  margin: 5px 0 8px;
  font-size: 1.08rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  position: relative;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--navy);
  color: #fff;
  font-size: 0.86rem;
}

th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  text-align: right;
}

.totals {
  margin-top: 26px;
  align-items: start;
}

.total-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.grand-total {
  border-top: 2px solid var(--ink);
  padding-top: 12px;
  font-size: 1.2rem;
}

.tool-description {
  color: var(--muted);
  line-height: 1.55;
  margin: 12px 0 18px;
}

.calc-form {
  display: grid;
  gap: 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.result-card {
  min-height: 126px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.result-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.result-card strong {
  display: block;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.insight-box {
  margin-top: 14px;
  background: var(--soft-green);
  border: 1px solid #b7ded7;
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.pricing-card,
.info-card,
.contact-form,
.auth-panel,
.auth-summary,
.legal-card {
  padding: 22px;
}

.pricing-card strong {
  display: block;
  font-size: 2rem;
  margin: 16px 0 10px;
}

.pricing-card.featured {
  border-color: var(--accent);
  background: var(--soft-green);
}

.payment-message {
  background: var(--soft-amber);
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.5;
  margin: 0 0 16px;
  padding: 14px 16px;
}

.pricing-card button {
  width: 100%;
  margin-top: 18px;
}

.plan-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.contact-grid {
  grid-template-columns: 0.8fr 1.2fr;
}

.contact-form button {
  width: max-content;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(300px, 520px) minmax(260px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.auth-panel,
.auth-summary {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.auth-panel p,
.auth-summary p {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.auth-form button {
  width: 100%;
}

#logoutBtn {
  width: 100%;
  margin-bottom: 14px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.auth-links button {
  min-height: 36px;
  background: transparent;
  color: var(--accent-dark);
  padding: 0;
}

.quota-meter {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.quota-meter span {
  color: var(--muted);
  font-weight: 850;
}

.quota-meter div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.quota-meter i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
}

.auth-message {
  background: var(--soft-amber);
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
}

.legal-card {
  max-width: 960px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.legal-card h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.legal-card p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 20px;
}

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

.legal-card a,
.info-card a {
  color: var(--accent-dark);
  font-weight: 900;
}

@media (max-width: 1050px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .hero-panel,
  .app-shell,
  .calculator-workspace,
  .contact-grid,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .pricing-grid,
  .pricing-grid-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact {
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 700px) {
  .page {
    padding-inline: 14px;
  }

  .header-actions .primary-btn {
    display: none;
  }

  .header-actions,
  .hero-actions,
  .panel-heading,
  .preview-toolbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions button,
  .hero-actions a {
    width: 100%;
    justify-content: center;
  }

  .feature-grid,
  .pricing-grid,
  .pricing-grid-four,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .tool-tab {
    min-width: 172px;
  }

  .segmented {
    min-width: 0;
    width: 100%;
  }

  .details-grid,
  .doc-header,
  .billing-row,
  .totals {
    grid-template-columns: 1fr;
  }

  .doc-meta {
    text-align: left;
  }

  .doc-meta p {
    justify-content: space-between;
  }

  .items-head {
    display: none;
  }

  .item-row {
    grid-template-columns: 1fr 1fr 42px;
  }

  .item-row input:first-child {
    grid-column: 1 / -1;
  }

  .document-preview {
    padding: 18px;
  }

  table {
    font-size: 0.86rem;
  }

  th,
  td {
    padding: 9px 6px;
  }

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

@media print {
  @page {
    margin: 8mm;
  }

  body {
    background: #fff;
  }

  body * {
    visibility: hidden !important;
  }

  #printArea,
  #printArea * {
    visibility: visible !important;
  }

  #printArea {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
  }

  .document-preview {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0.88rem;
    min-height: auto;
    padding: 0;
  }

  .doc-watermark {
    display: none;
  }

  .doc-header {
    padding-bottom: 16px;
  }

  .billing-row {
    margin: 16px 0;
  }

  .totals {
    margin-top: 16px;
  }

  th,
  td {
    padding: 7px 8px;
  }
}
