:root {
  --bg: #f6f3ee;
  --panel: #ffffff;
  --text: #171717;
  --muted: #66615b;
  --line: #ded8cf;
  --accent: #1e6f5c;
  --accent-dark: #164d42;
  --danger: #9b1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
}

.surface-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.surface-admin {
  --bg: #101827;
  --panel: #172235;
  --text: #f7f9fc;
  --muted: #aebbd0;
  --line: #314158;
  --accent: #78a9ff;
  --accent-dark: #b9d2ff;
  background-image: radial-gradient(circle at 85% 0, rgba(62, 105, 180, 0.28), transparent 32rem);
}

.surface-admin .topbar {
  border-bottom-color: #33445e;
  background: rgba(10, 17, 29, 0.92);
}

.surface-admin .surface-badge {
  color: #dbe8ff;
  background: #223653;
  border-color: #42638e;
}

.surface-admin .panel {
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.2);
}

.surface-admin .metric {
  color: #ffffff;
}

.surface-admin .secondary {
  color: #171717;
}

.surface-owner {
  background-image: radial-gradient(circle at 85% 0, rgba(30, 111, 92, 0.1), transparent 30rem);
}

.admin-scope-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: -10px 0 24px;
  border: 1px solid #42638e;
  border-radius: 10px;
  padding: 14px 18px;
  color: #dbe8ff;
  background: #1c2d46;
}

.admin-scope-banner span {
  color: var(--muted);
}

.card-kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.auth-shell {
  min-height: calc(100vh - 144px);
  display: grid;
  place-items: center;
}

.auth-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(24, 20, 16, 0.06);
}

.auth-panel {
  width: min(460px, 100%);
  padding: 32px;
}

.page-header {
  margin-bottom: 32px;
}

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

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.lede {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.email-address-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.email-address-field span {
  color: var(--muted);
  font-weight: 700;
}

.compact-form {
  display: grid;
  min-width: 260px;
  gap: 8px;
  padding-top: 10px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(160px, 0.5fr) minmax(220px, 1fr) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.table-scroll {
  overflow-x: auto;
}

@media (max-width: 720px) {
  .filter-bar,
  .email-address-field {
    grid-template-columns: 1fr;
  }
}

label {
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

.button,
.link-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: white;
}

.danger-button {
  color: white;
  background: var(--danger);
}

.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

.link-button {
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.user-chip {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stat-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card strong {
  font-size: 1.8rem;
}

.panel {
  padding: 24px;
}

.wide {
  margin-top: 16px;
}

.page-header--split,
.section-heading,
.payment-setup,
.action-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-header--split > * {
  min-width: 0;
}

.section-heading {
  align-items: center;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

.muted,
.helper-text {
  color: var(--muted);
}

.helper-text {
  max-width: 320px;
  margin: 0;
  font-size: 0.85rem;
}

.text-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(30, 111, 92, 0.35);
  text-underline-offset: 3px;
}

.metric {
  margin-bottom: 10px;
  font-size: 1.75rem;
  font-weight: 850;
}

.credentials {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.credentials p {
  margin-bottom: 6px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 20px 0 0;
}

.facts div {
  display: grid;
  gap: 2px;
}

.facts dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  font-weight: 800;
}

.button-stack {
  display: grid;
  min-width: 220px;
  gap: 10px;
}

.button-stack form,
.button-stack .button {
  width: 100%;
}

.callout {
  max-width: 700px;
  margin: 20px 0 0;
  border-radius: 8px;
  padding: 12px 14px;
}

.warning {
  color: #704d00;
  background: #fff6d8;
  border: 1px solid #ead18a;
}

.notice {
  color: #155b45;
  background: #eef9f4;
  border: 1px solid #b8ddcf;
}

.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  background: white;
  border: 1px solid var(--line);
}

.alert {
  color: var(--danger);
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  color: #56504a;
  background: #eeeae4;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.2;
}

.status--active,
.status--subscribed,
.status--paid,
.status--processed,
.status--delivered,
.status--synced,
.status--verified {
  color: #155b45;
  background: #dcf4e9;
}

.status--pending,
.status--provisioning,
.status--syncing,
.status--awaiting-dns,
.status--received,
.status--processing,
.status--ignored,
.status--new-order,
.status--confirmed,
.status--preparing,
.status--ready-to-ship,
.status--shipped {
  color: #65530c;
  background: #fff2bd;
}

.status--failed,
.status--conflict,
.status--rejected,
.status--unsubscribed,
.status--invalid,
.status--restricted,
.status--action-required,
.status--disputed,
.status--canceled {
  color: #8a1f1f;
  background: #fce2e2;
}

.status--refunded,
.status--partially-refunded {
  color: #3e4d73;
  background: #e7ebf7;
}

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

.table-scroll {
  overflow-x: auto;
}

td code {
  overflow-wrap: anywhere;
}

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

.task-list {
  margin-bottom: 0;
  padding-left: 20px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.compact-form {
  gap: 12px;
  margin-top: 18px;
}

.section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.section-tabs a {
  margin-bottom: -1px;
  padding: 10px 14px;
  color: var(--muted);
  font-weight: 800;
}

.section-tabs a.active {
  color: var(--accent-dark);
  border-bottom: 3px solid var(--accent);
}

.mailing-preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 18px;
}

.preview-panel {
  min-width: 0;
  padding: 20px;
}

.mailing-preview-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mailing-text-preview {
  min-height: 300px;
  color: #25211d;
  background: #f7f4ef;
}

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

.filters {
  grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(180px, 1fr)) auto auto;
  align-items: end;
  margin-bottom: 20px;
  padding: 16px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 10px;
  min-height: 46px;
}

.checkbox-field input {
  width: auto;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
}

.metric-small {
  font-size: 1.3rem;
}

.action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.timeline {
  display: grid;
  gap: 16px;
  margin: 0;
  padding-left: 20px;
}

.timeline li::marker {
  color: var(--accent);
}

.timeline span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.kanban {
  display: grid;
  grid-auto-columns: minmax(250px, 1fr);
  grid-auto-flow: column;
  gap: 12px;
  margin: 0 calc((100vw - min(1120px, calc(100vw - 32px))) / -2) 24px;
  padding: 0 max(16px, calc((100vw - 1120px) / 2));
  overflow-x: auto;
}

.kanban-column {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.45);
}

.kanban-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.kanban-column h2 {
  margin: 0;
}

.count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #e8e2da;
  font-size: 0.78rem;
  font-weight: 800;
}

.kanban-cards {
  display: grid;
  gap: 10px;
}

.order-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  box-shadow: 0 6px 18px rgba(24, 20, 16, 0.05);
}

.order-card a {
  display: grid;
  gap: 5px;
}

.order-card a > span:not(.status) {
  color: var(--muted);
  font-size: 0.86rem;
}

.order-card .order-card-total {
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
}

.kanban-action {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--accent-dark);
  background: #f7faf9;
  font-weight: 800;
  cursor: pointer;
}

.shopfront-hero {
  max-width: 720px;
  padding: 48px 0 28px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.product-card {
  display: grid;
  align-content: space-between;
  gap: 20px;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  background: white;
  box-shadow: 0 14px 36px rgba(24, 20, 16, 0.06);
}

.product-card h2 {
  font-size: 1.55rem;
}

.product-price {
  margin: 0;
  font-size: 2rem;
  font-weight: 850;
}

.quantity-field {
  max-width: 120px;
}

.result-panel {
  max-width: 720px;
  margin: 80px auto;
  padding: 48px;
  text-align: center;
}

.result-panel .status {
  margin: 0 auto 24px;
}

.code-block {
  max-height: 520px;
  overflow: auto;
  border-radius: 8px;
  padding: 16px;
  color: #e5e7eb;
  background: #15191f;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
  }

  .topbar nav {
    flex-wrap: wrap;
  }

  .brand-lockup,
  .admin-scope-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

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

  .page-header--split,
  .section-heading,
  .payment-setup,
  .order-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .mailing-preview-layout {
    grid-template-columns: 1fr;
  }

  .button-stack {
    min-width: 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
