:root {
  --bg: #f3f8f6;
  --surface: #ffffff;
  --ink: #0b1f1e;
  --muted: #4b6670;
  --line: #d5e6e1;
  --brand: #0b6e63;
  --brand-2: #0a8f7a;
  --accent: #1f6fe0;
  --danger: #b42318;
  --ok: #0f6b2d;
  --shadow: 0 18px 50px rgba(11, 31, 30, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(11, 143, 122, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(31, 111, 224, 0.12), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.15;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 16px;
  color: var(--ink);
}

.brand-sub {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-header:not(.site-header-admin) .brand-text {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
}

.site-header:not(.site-header-admin) .brand-title {
  font-size: 17px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(11, 110, 99, 0.35);
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}

.nav-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  background: rgba(11, 110, 99, 0.08);
  text-decoration: none;
  color: var(--brand);
}

.nav-link.is-active {
  background: rgba(11, 110, 99, 0.11);
  color: var(--brand);
  border-color: rgba(11, 110, 99, 0.22);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.nav-divider {
  display: inline-block;
  width: 1px;
  height: 26px;
  background: var(--line);
  flex-shrink: 0;
}

.nav-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.nav-link-btn {
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.nav-link-btn:hover {
  background: rgba(11, 110, 99, 0.06);
  color: var(--brand);
  border-color: rgba(11, 110, 99, 0.25);
}

.nav-link-emphasis {
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff !important;
  border-color: transparent;
}

.nav-link-emphasis:hover {
  filter: brightness(1.06);
  color: #fff !important;
}

.nav-link-emphasis.is-active {
  box-shadow: 0 0 0 2px rgba(11, 110, 99, 0.35);
}

.site-nav-admin .nav-group-main {
  justify-content: flex-end;
}

/* Public site desktop: brand | nav (Sign in, etc.) | Create account */
@media (min-width: 721px) {
  .site-header:not(.site-header-admin) .header-inner > .brand {
    order: 1;
    flex-shrink: 0;
  }

  .site-header:not(.site-header-admin) .header-inner > .site-nav {
    order: 2;
    flex: 1;
    min-width: 0;
  }

  .site-header:not(.site-header-admin) .header-inner > .header-create-mobile {
    order: 3;
    flex-shrink: 0;
  }
}

.header-create-mobile {
  text-align: center;
}

@media (max-width: 720px) {
  .site-header-admin .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .site-header:not(.site-header-admin) .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    align-items: center;
  }

  .site-header:not(.site-header-admin) .header-inner > .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .site-header:not(.site-header-admin) .header-inner > .header-create-mobile {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    padding: 8px 12px;
    font-size: clamp(11px, 3.1vw, 13px);
    white-space: nowrap;
  }

  .site-header:not(.site-header-admin) .header-inner:not(:has(.header-create-mobile)) > .brand {
    grid-column: 1 / -1;
  }

  .site-header:not(.site-header-admin) .header-inner > .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .site-nav {
    flex: none;
    width: 100%;
    min-width: 0;
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(5.75rem, 100%), 1fr));
    gap: 6px;
    align-items: stretch;
  }

  /* Flatten groups so every control is a grid cell (horizontal flow, wraps to new rows) */
  .site-nav .nav-group-main,
  .site-nav .nav-group-account {
    display: contents;
  }

  .nav-divider {
    display: none;
  }

  .site-nav > a.nav-link {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
    font-size: clamp(11px, 2.9vw, 14px);
    line-height: 1.2;
    box-sizing: border-box;
    gap: 0;
  }

  .site-nav > a.nav-link .nav-icon {
    display: none;
  }

  .site-nav > form.nav-form {
    display: flex;
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  .site-nav > form.nav-form .nav-link-btn {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
    font-size: clamp(11px, 2.9vw, 14px);
    line-height: 1.2;
    box-sizing: border-box;
  }

  .site-nav-admin {
    /* Admin has more links — slightly smaller floor so more fit per row on narrow phones */
    grid-template-columns: repeat(auto-fit, minmax(min(5.25rem, 100%), 1fr));
    gap: 5px;
  }
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 20px;
  margin: 0 0 12px;
  padding: 0;
}

.footer-nav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

.footer-admin .footer-inner {
  max-width: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}

.pill.primary {
  border-color: transparent;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
}

.pill.ghost {
  background: transparent;
}

main {
  flex: 1;
  padding: 28px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: stretch;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

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

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

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

@media (max-width: 920px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.field {
  margin-bottom: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(11, 31, 30, 0.06);
  padding: 18px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button,
.button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 800;
  font: inherit;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.danger,
.button.danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.25);
}

.alert {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.25);
  background: rgba(180, 35, 24, 0.06);
  color: var(--danger);
  margin: 0 0 14px;
}

.alert.ok {
  border-color: rgba(15, 107, 45, 0.25);
  background: rgba(15, 107, 45, 0.06);
  color: var(--ok);
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

th,
td {
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f6fbfa;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: #fff;
}

.badge.ok {
  border-color: rgba(15, 107, 45, 0.25);
  color: var(--ok);
}

.badge.bad {
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
}

.badge.neutral {
  color: var(--muted);
}

.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.muted {
  color: var(--muted);
}

.page-main {
  padding-bottom: 8px;
}

.footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 248, 246, 0.98));
  padding: 28px 0 32px;
  color: var(--muted);
  font-size: 13px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--ink);
  font-size: 15px;
}

.footer-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 6px 16px rgba(11, 110, 99, 0.28);
}

.footer-copy {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.footer-meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6b858f;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

.hero-primary h1 {
  margin-top: 0;
}

.trust-inline {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  font-size: 14px;
  color: var(--muted);
}

.trust-inline li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trust-inline li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-2);
  opacity: 0.85;
}

.features-panel {
  padding: 26px 28px;
}

.features-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.features-grid {
  margin-top: 8px;
}

.feature-item {
  padding: 16px 4px 8px;
  border-top: 1px solid var(--line);
}

.feature-item:first-of-type {
  border-top: 0;
}

@media (min-width: 921px) {
  .feature-item {
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 12px 20px;
  }

  .feature-item:first-of-type {
    border-left: 0;
    padding-left: 0;
  }
}

.feature-item h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-item p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(11, 110, 99, 0.12);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.ref-num {
  font-weight: 600;
}

.card-payment h2 {
  font-size: 18px;
}

/* Checkout: single-column form */
.checkout-page {
  max-width: 560px;
  margin: 0 auto;
}

.checkout-intro {
  margin-top: 10px;
  margin-bottom: 0;
}

.checkout-form {
  margin-top: 22px;
}

.checkout-section {
  margin-bottom: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.checkout-section:last-of-type {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.checkout-section-card {
  margin-top: 8px;
  margin-bottom: 24px;
  padding: 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafcfb;
}

.checkout-section-title {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-stack .field {
  margin-bottom: 14px;
}

.form-stack .field:last-child {
  margin-bottom: 0;
}

.label-optional {
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: #6b858f;
  font-size: 12px;
}

.checkout-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
}

.checkout-actions .button {
  text-align: center;
}

.checkout-submit {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 800;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  color: #fff;
}

.checkout-submit:hover {
  filter: brightness(1.05);
}

.checkout-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.split-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
}

.admin-tab:hover {
  text-decoration: none;
  color: var(--brand);
  border-color: rgba(11, 110, 99, 0.35);
}

.admin-tab.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-2));
  border-color: transparent;
}

.typeahead-wrap {
  position: relative;
}

.typeahead-results {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow-y: auto;
}

.typeahead-results li {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  border-bottom: 1px solid rgba(213, 230, 225, 0.6);
}

.typeahead-results li:last-child {
  border-bottom: 0;
}

.typeahead-results li:hover {
  background: rgba(11, 110, 99, 0.06);
}

.typeahead-meta {
  font-size: 12px;
  color: var(--muted);
}

.invoice-scope-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: 600;
}

.customer-picked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(11, 110, 99, 0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(11, 110, 99, 0.2);
}

.button-tiny {
  padding: 6px 12px !important;
  font-size: 13px !important;
}
