:root {
  --color-bg: oklch(98% 0.005 250);
  --color-surface: oklch(100% 0 0);
  --color-surface-muted: oklch(94% 0.006 240);
  --color-text: oklch(22% 0.02 240);
  --color-muted: oklch(50% 0.018 240);
  --color-border: oklch(90% 0.008 240);
  --color-accent: oklch(58% 0.16 145);
  --color-accent-strong: oklch(45% 0.12 145);
  --color-danger: #b91c1c;
  --color-danger-strong: oklch(60% 0.2 20);
  --color-success: #166534;
  --color-focus: oklch(58% 0.16 145 / 0.35);

  --bg: var(--color-bg);
  --surface: var(--color-surface);
  --surface-dark: var(--color-surface-muted);
  --fg: var(--color-text);
  --text: var(--color-text);
  --muted: var(--color-muted);
  --border: var(--color-border);
  --accent: var(--color-accent);
  --primary: var(--color-text);
  --primary-hover: oklch(30% 0.02 240);

  --font-display: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --radius-control: 8px;
  --radius-panel: 8px;
  --radius-pill: 9999px;
  --radius-card: 8px;

  --shadow-focus: 0 0 0 3px var(--color-focus);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 1rem;
  overflow-x: clip;
}

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

a:hover {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-focus);
}

img {
  display: block;
  max-width: 100%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Nav --- */
.nav {
  display: block;
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav .container {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 24px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-logo span {
  color: var(--accent);
}

.nav-menu {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 24px;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: auto;
  margin-bottom: auto;
  padding-left: 0;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 0;
}

.nav-menu>.nav-actions:only-child {
  margin-left: auto;
}

.nav-login,
.nav-user {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-user {
  color: var(--fg);
}

.nav-organization {
  max-width: 12rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-bar {
  width: 16px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.nav-cta--primary {
  background: var(--fg);
  color: var(--surface);
  border: 1px solid var(--fg);
}

.nav-cta--primary:hover {
  opacity: 0.85;
}

.nav-spacer {
  margin-left: auto;
}

.nav-logout {
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  transition: all 0.15s;
}

.nav-logout:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* --- Hero --- */
.hero {
  padding: 96px 0 80px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.5vw, 56px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
  max-width: 780px;
  margin: 0 auto 20px;
}

.hero p {
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 580px;
  margin: 0 auto 40px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.35;
  text-decoration: none;
}

.btn--primary,
.btn-primary,
.btn-success {
  background: var(--fg);
  color: var(--surface);
  border-color: var(--fg);
}

.btn--primary:hover,
.btn-primary:hover,
.btn-success:hover,
.btn--primary:focus-visible,
.btn-primary:focus-visible,
.btn-success:focus-visible {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--surface);
  opacity: 0.85;
}

.btn--secondary,
.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--border);
}

.btn--secondary:hover,
.btn-secondary:hover {
  background: var(--surface-dark);
  border-color: var(--border);
  color: var(--fg);
}

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

.btn-danger:hover {
  opacity: 0.9;
  color: var(--surface);
}

.btn:disabled,
button:disabled,
input[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.password-criteria-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.password-criteria-item {
  font-size: 12px;
  line-height: 1.3;
  padding-left: 18px;
  position: relative;
}

.password-criteria-item::before {
  content: "●";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
}

.password-criteria-item--valid {
  color: var(--color-success);
}

.password-criteria-item--valid::before {
  color: #16a34a;
}

.password-criteria-item--invalid {
  color: var(--color-danger);
}

.password-criteria-item--invalid::before {
  color: #ef4444;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  border-radius: var(--radius-control);
  color: var(--fg);
  text-decoration: none;
}

.action-link:hover {
  background: var(--surface-dark);
  color: var(--fg);
}

.action-link--danger {
  color: var(--color-danger);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.status-pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--success {
  color: var(--accent);
}

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

.progress-track {
  height: 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-dark);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-fill {
  min-width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

/* --- Hero Portal Preview --- */
.portal-preview {
  max-width: 880px;
  margin: 56px auto 0;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.portal-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.portal-preview-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 4px 12px;
  flex: 1;
  max-width: 360px;
  margin: 0 16px;
}

.portal-preview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 320px;
}

.portal-form-side {
  padding: 24px;
  border-right: 1px solid var(--border);
}

.portal-map-side {
  padding: 24px;
  background: oklch(94% 0.005 240);
  position: relative;
}

.portal-form-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0;
}

.portal-field {
  margin-bottom: 14px;
}

.portal-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.portal-field-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  color: var(--fg);
  padding: 0 12px;
}

.portal-field-input--select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.portal-search-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--surface);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 20px;
}

.portal-map-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: oklch(92% 0.006 240);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, oklch(90% 0.004 240) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(90% 0.004 240) 1px, transparent 1px);
  background-size: 40px 40px;
}

.map-pins {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 32px;
  align-items: center;
}

.map-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.map-pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 3px oklch(0% 0 0 / 0.2);
}

.map-pin-dot--match {
  background: var(--accent);
}

.map-pin-dot--alt {
  background: var(--muted);
}

.map-pin-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.map-pin-label--match {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Sections --- */
.section {
  padding: 88px 0;
}

.section--alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin-bottom: 12px;
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 560px;
}

.section-header {
  margin-bottom: 56px;
}

.section-header--center {
  text-align: center;
}

.section-header--center .section-desc {
  margin: 0 auto;
}

/* --- Steps --- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.step {
  padding: 32px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
}

.step-number {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.step h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0;
}

.step p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* --- Portal Showcase --- */
.showcase-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.showcase-text h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 12px;
}

.showcase-text p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 16px;
}

.showcase-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.showcase-list li {
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--fg);
}

.showcase-list li::before {
  content: '✓';
  color: var(--fg);
  font-weight: 600;
  flex-shrink: 0;
}

.showcase-visual {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.showcase-visual-header {
  padding: 12px 16px;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.showcase-visual-body {
  padding: 20px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.result-item:last-child {
  border-bottom: none;
}

.result-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-rank--alt {
  background: var(--surface-dark);
  color: var(--muted);
}

.result-info {
  flex: 1;
}

.result-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.result-detail {
  font-size: 12px;
  color: var(--muted);
}

.result-score {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface-dark);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.result-score--alt {
  background: var(--bg);
  color: var(--muted);
}

/* --- Visibility Cards --- */
.visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.visibility-card {
  padding: 28px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
}

.visibility-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-dark);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.visibility-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--fg);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visibility-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0;
}

.visibility-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.visibility-url {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-control);
  display: inline-block;
}

/* --- Features Grid --- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature {
  padding: 28px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--bg);
}

.feature h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0;
}

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

/* --- Code Block (API advanced) --- */
.api-advanced {
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}

.api-advanced-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface-dark);
  border-bottom: 1px solid var(--border);
}

.api-advanced-header span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.api-advanced-badge {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.api-advanced-body {
  padding: 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
}

.api-advanced-body .comment {
  color: var(--muted);
}

.api-advanced-body .key {
  color: var(--color-accent-strong);
}

.api-advanced-body .string {
  color: oklch(50% 0.018 240);
}

.api-advanced-body .number {
  color: var(--accent);
}

/* --- Docs Preview --- */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.docs-card {
  padding: 28px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
}

.docs-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0;
}

.docs-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 16px;
}

.docs-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-link:hover {
  opacity: 0.7;
}

/* --- Pricing --- */
.pricing {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

.pricing-card {
  padding: 32px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
}

.pricing-card--featured {
  border-color: var(--accent);
  position: relative;
}

.pricing-card--featured::before {
  content: 'Popular';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  background: var(--accent);
  color: var(--surface);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
}

.pricing-name {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 4px;
}

.pricing-price span {
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

.pricing-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.pricing-features li {
  font-size: 14px;
  color: var(--fg);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pricing-features li::before {
  content: '✓';
  color: var(--fg);
  font-weight: 600;
  flex-shrink: 0;
}

.pricing-card .btn {
  width: 100%;
}

.early-access-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 32px;
  align-items: center;
}

.early-access-home h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
  max-width: 720px;
  margin: 0 0 16px;
}

.early-access-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 28px;
}

.early-access-panel h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.early-access-panel .btn {
  width: 100%;
  margin-top: 24px;
}

/* --- CTA --- */
.cta {
  text-align: center;
  padding: 96px 0;
}

.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 16px;
}

.cta p {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 32px;
}

/* --- Footer --- */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--fg);
}

.footer-copy {
  font-size: 13px;
  color: var(--muted);
}

/* --- Plans and checkout funnel --- */
.plans-page,
.checkout-page,
.trial-page {
  background: var(--bg);
}

.plans-hero,
.trial-hero {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 72px 0 48px;
}

.plans-hero__inner,
.trial-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: end;
}

.plans-hero h1,
.trial-hero h1 {
  max-width: 760px;
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
}

.plans-hero p,
.trial-hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
}

.plans-hero__aside,
.trial-hero__panel,
.checkout-summary,
.checkout-card,
.trial-form-card,
.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.plans-hero__aside,
.trial-hero__panel {
  display: grid;
  gap: 4px;
  background: var(--bg);
  padding: 18px;
}

.plans-hero__aside span,
.trial-hero__panel span,
.plan-card__header p,
.plan-card__limits dd,
.plan-card__price span,
.plan-assurance span,
.trial-copy p,
.trial-limits p,
.trial-form-card p,
.trial-confirmation p,
.checkout-summary p,
.checkout-plan span,
.checkout-progress span,
.checkout-card__header p,
.checkout-muted,
.checkout-complete span,
.checkout-status,
.checkout-review dt {
  color: var(--muted);
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  gap: 18px;
  padding-top: 40px;
  padding-bottom: 28px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100%;
  padding: 24px;
}

.plan-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 60%, transparent);
}

.plan-card__badge {
  align-self: flex-start;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
}

.plan-card__header h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
}

.plan-card__header p,
.plan-card__limits,
.plan-card__features,
.checkout-summary p,
.checkout-plan p,
.checkout-review,
.checkout-review dd {
  margin: 0;
}

.plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan-card__price strong {
  font-size: 2rem;
  line-height: 1;
}

.plan-card__limits {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.plan-card__limits div {
  display: grid;
  gap: 2px;
}

.plan-card__limits dt {
  color: var(--fg);
  font-size: 0.82rem;
  font-weight: 700;
}

.plan-card__features {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin-bottom: auto;
}

.plan-card__features li {
  display: flex;
  gap: 8px;
  color: var(--fg);
  font-size: 0.92rem;
}

.plan-card__features li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.plan-card__cta {
  width: 100%;
}

.plan-assurance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 72px;
}

.plan-assurance div {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.trial-hero--compact {
  padding-bottom: 56px;
}

.trial-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: start;
  padding-top: 40px;
  padding-bottom: 72px;
}

.trial-copy {
  display: grid;
  gap: 22px;
}

.trial-copy h2,
.trial-form-card h2,
.trial-confirmation h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.trial-steps {
  display: grid;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.trial-steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.trial-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--fg);
  color: var(--surface);
  font-weight: 700;
  flex: 0 0 auto;
}

.trial-steps strong,
.trial-limits strong {
  display: block;
  margin-bottom: 3px;
}

.trial-limits {
  border: 1px solid color-mix(in oklch, var(--accent) 45%, var(--border));
  border-radius: var(--radius-card);
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  padding: 16px;
}

.trial-form-card {
  padding: 24px;
}

.trial-form {
  margin-top: 20px;
}

.trial-confirmation {
  display: grid;
  gap: 18px;
  max-width: 760px;
  padding-top: 40px;
  padding-bottom: 72px;
}

.checkout-page {
  padding: 48px 0 72px;
}

.checkout-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.checkout-summary {
  position: sticky;
  top: 88px;
  padding: 24px;
}

.checkout-back {
  display: inline-flex;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkout-summary h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.checkout-plan,
.checkout-progress {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.checkout-plan strong {
  font-size: 1.2rem;
}

.checkout-plan p {
  color: var(--fg);
  font-size: 1.4rem;
  font-weight: 700;
}

.checkout-plan small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.checkout-steps {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.checkout-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.checkout-step span,
.checkout-card__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.checkout-step--completed span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}

.checkout-step--current {
  color: var(--fg);
}

.checkout-step--current span {
  border-color: var(--fg);
  color: var(--fg);
}

.checkout-main {
  display: grid;
  gap: 16px;
}

.checkout-card {
  padding: 24px;
}

.checkout-card--disabled {
  background: color-mix(in oklch, var(--surface) 70%, var(--bg));
}

.checkout-card__header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.checkout-card__header h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
}

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

.fieldWrapper--hidden {
  display: none;
}

.checkout-complete {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in oklch, var(--accent) 45%, var(--border));
  border-radius: var(--radius-card);
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
  padding: 16px;
}

.checkout-inline-action {
  margin-top: 14px;
}

.checkout-review {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.checkout-review div {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px;
}

.checkout-review dt {
  font-size: 0.82rem;
  font-weight: 700;
}

.checkout-review dd {
  color: var(--fg);
  overflow-wrap: anywhere;
}

.checkout-final-btn {
  width: 100%;
}

@media (max-width: 1080px) {
  .checkout-shell {
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
  }

  .checkout-summary,
  .checkout-card,
  .trial-form-card,
  .plan-card {
    padding: 20px;
  }

  .checkout-summary h1 {
    font-size: 1.65rem;
  }
}

@media (max-width: 960px) {
  .checkout-shell {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
  }

  .checkout-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .checkout-step {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .checkout-step strong {
    font-size: 0.88rem;
    line-height: 1.25;
  }
}

/* --- Responsive --- */
@media (max-width: 860px) {

  .steps,
  .features,
  .pricing {
    grid-template-columns: 1fr;
  }

  .code-grid,
  .docs-grid,
  .visibility-grid,
  .early-access-home {
    grid-template-columns: 1fr;
  }

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

  .portal-preview-body {
    grid-template-columns: 1fr;
  }

  .portal-form-side {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .nav .container {
    min-height: 64px;
    height: auto;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    display: none;
    width: 100%;
    flex: 0 0 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 12px 0 4px;
  }

  .nav-menu.is-open {
    display: flex;
  }

  .nav-links {
    width: 100%;
    flex-direction: column;
    gap: 0;
    margin-left: 0;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a,
  .nav-dropdown-toggle {
    width: 100%;
    min-height: 2.75rem;
    justify-content: space-between;
    padding: 0.5rem 0;
  }

  .nav-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-left: 0;
  }

  .nav-actions .nav-cta,
  .nav-actions .nav-login,
  .nav-actions .nav-logout,
  .nav-inline-form {
    width: 100%;
  }

  .nav-actions .nav-login {
    min-height: 2.375rem;
    display: inline-flex;
    align-items: center;
  }

  .dropdown-menu {
    position: static;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    margin: 0 0 8px;
  }

  .hero {
    padding: 64px 0 48px;
  }

  .section {
    padding: 56px 0;
  }

  .plans-hero {
    padding: 48px 0 32px;
  }

  .plans-hero__inner,
  .trial-hero__inner,
  .plans-grid,
  .plan-assurance,
  .trial-layout,
  .checkout-shell,
  .checkout-form-grid,
  .checkout-review {
    grid-template-columns: 1fr;
  }

  .plans-hero__aside,
  .trial-hero__panel,
  .checkout-summary {
    position: static;
  }

  .checkout-page {
    padding: 28px 0 48px;
  }
}

@media (max-width: 640px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .plans-hero {
    padding: 36px 0 28px;
  }

  .trial-hero {
    padding: 36px 0 28px;
  }

  .plans-hero h1,
  .trial-hero h1 {
    font-size: 2rem;
    line-height: 1.12;
  }

  .plans-hero p,
  .trial-hero p {
    font-size: 1rem;
  }

  .plans-grid {
    gap: 14px;
    padding-top: 24px;
  }

  .plan-card,
  .checkout-summary,
  .checkout-card,
  .trial-form-card {
    padding: 18px;
  }

  .plan-card__price strong {
    font-size: 1.7rem;
  }

  .plan-assurance {
    gap: 14px;
    padding-bottom: 44px;
  }

  .trial-layout,
  .trial-confirmation {
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .checkout-card__header {
    gap: 10px;
  }

  .checkout-card__header h2 {
    font-size: 1.05rem;
  }

  .checkout-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .checkout-inline-action .btn,
  .checkout-card form .btn {
    width: 100%;
  }

  .footer .container,
  .footer-links {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {

  .checkout-summary h1,
  .plans-hero h1,
  .trial-hero h1 {
    font-size: 1.75rem;
  }

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

/* --- Tabular nums --- */
.pricing-price,
.api-advanced-body {
  font-variant-numeric: tabular-nums;
}

/* Estilos extras para a plataforma interna */
.page-content {
  padding: 64px 0;
  min-height: calc(100vh - 64px - 100px);
  /* 100vh - nav - footer */
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 24px;
}

.auth-panel {
  max-width: 28rem;
  margin: 0 auto;
}

.auth-panel h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 1rem;
  text-align: center;
}

.auth-panel__description {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  text-align: center;
}

.auth-panel__link {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1rem 0 0;
  text-align: center;
}

.auth-panel__link a {
  color: var(--fg);
  font-weight: 600;
}

.form-group,
.fieldWrapper {
  margin-bottom: 16px;
}

.fieldWrapper--invalid input,
.fieldWrapper--invalid select,
.fieldWrapper--invalid textarea,
.fieldWrapper--invalid .json-schema-builder {
  border-color: var(--color-danger);
}

.form-group label,
.fieldWrapper label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: 2.375rem;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--fg);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
}

.form-control:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  outline: 0;
}

textarea {
  min-height: 7rem;
}

.field-help,
.field-error-list,
.form-error-summary__list {
  margin: 0;
}

.field-help {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-top: 0.35rem;
}

.field-error-list {
  display: grid;
  gap: 0.25rem;
  list-style: none;
  padding: 0;
  margin-top: 0.4rem;
}

.field-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  line-height: 1.4;
}

.form-error-summary {
  border: 1px solid color-mix(in oklch, var(--color-danger) 45%, var(--border));
  border-radius: var(--radius-card);
  background: color-mix(in oklch, var(--color-danger) 8%, var(--surface));
  color: var(--fg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-error-summary__title {
  color: var(--color-danger);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.form-error-summary__list {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.1rem;
}

.form-error-summary__list a {
  color: var(--color-danger);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.form-actions--full .btn,
.form-actions--full button,
.form-actions--full a {
  width: 100%;
}

@media (max-width: 520px) {
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .btn,
  .form-actions button,
  .form-actions a {
    width: 100%;
  }
}

.json-schema-builder {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg);
  padding: 16px;
}

.json-schema-builder__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.json-schema-builder__title {
  margin: 0 0 4px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
}

.json-schema-builder__description,
.json-schema-builder__empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.json-schema-builder__rows {
  display: grid;
  gap: 10px;
}

.json-schema-builder__row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px 120px auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.json-schema-builder__row--attributes {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
}

.json-schema-builder__field span,
.json-schema-builder__required span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.json-schema-builder__required {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.json-schema-builder__required input {
  width: auto;
  height: auto;
}

.json-schema-builder__required span {
  margin: 0;
}

.json-schema-builder__source {
  display: none;
}

.json-schema-builder__remove {
  padding-left: 16px;
  padding-right: 16px;
}

.portal-config-page {
  max-width: 1180px;
}

.portal-config-heading {
  margin-bottom: 32px;
}

.portal-config-heading h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.portal-config-heading p {
  color: var(--muted);
  margin: 8px 0 0;
}

.portal-config-form {
  display: grid;
  gap: 28px;
}

.portal-config-section {
  display: grid;
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.portal-config-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.portal-config-section__header h2,
.portal-config-section__header h3 {
  color: var(--fg);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
}

.portal-config-section__header h3 {
  font-size: 16px;
}

.portal-config-section__header p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.portal-config-grid {
  display: grid;
  gap: 16px;
}

.portal-config-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-config-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-config-grid--compact {
  gap: 10px 16px;
}

.portal-unit-attribute-visibility {
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 16px;
}

.portal-unit-attribute-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
}

.portal-unit-attribute-options > div {
  min-width: 0;
}

.portal-unit-attribute-options label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 36px;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.portal-unit-attribute-options input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.portal-unit-attribute-visibility__empty {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.portal-theme-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.portal-theme-preset {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 76px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--fg);
  padding: 12px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.portal-theme-preset:hover,
.portal-theme-preset:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.portal-theme-preset strong,
.portal-theme-preset small {
  display: block;
}

.portal-theme-preset strong {
  font-size: 14px;
  font-weight: 700;
}

.portal-theme-preset small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 2px;
}

.portal-theme-preset__swatches {
  display: flex;
  align-items: center;
}

.portal-theme-preset__swatches span {
  width: 18px;
  height: 38px;
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.portal-theme-preset__swatches span:first-child {
  border-radius: 8px 0 0 8px;
}

.portal-theme-preset__swatches span:last-child {
  border-radius: 0 8px 8px 0;
}

.portal-theme-preview {
  --preview-primary: #1D4ED8;
  --preview-secondary: #0F172A;
  --preview-tertiary: #15803D;
  --preview-bg: #F8FAFC;
  --preview-surface: #FFFFFF;
  --preview-fg: #1E293B;
  --preview-muted: #64748B;
  --preview-border: #E2E8F0;
  --preview-radius-card: var(--radius-card);
  --preview-radius-control: var(--radius-control);
  --preview-padding: 18px;
  --preview-gap: 12px;
  --preview-shadow: none;
  display: grid;
  gap: var(--preview-gap);
  margin-top: 18px;
  padding: var(--preview-padding);
  border: 1px solid var(--preview-border);
  border-radius: var(--preview-radius-card);
  background:
    linear-gradient(180deg, color-mix(in oklch, var(--preview-primary) 8%, var(--preview-surface)), var(--preview-bg));
  color: var(--preview-fg);
}

.portal-theme-preview--radius-none {
  --preview-radius-card: 0;
  --preview-radius-control: 0;
}

.portal-theme-preview--radius-small {
  --preview-radius-card: 6px;
  --preview-radius-control: 4px;
}

.portal-theme-preview--radius-large {
  --preview-radius-card: 18px;
  --preview-radius-control: 12px;
}

.portal-theme-preview--density-compact {
  --preview-padding: 14px;
  --preview-gap: 8px;
}

.portal-theme-preview--card-elevated {
  --preview-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.portal-theme-preview--card-flat .portal-theme-preview__card {
  border-color: transparent;
  box-shadow: none;
}

.portal-theme-preview__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--preview-border);
}

.portal-theme-preview--header-hidden .portal-theme-preview__header {
  display: none;
}

.portal-theme-preview--header-logo_only .portal-theme-preview__header {
  justify-content: center;
}

.portal-theme-preview--header-logo_only [data-preview-header-copy] {
  display: none;
}

.portal-theme-preview__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--preview-radius-card);
  background: linear-gradient(135deg, var(--preview-primary), var(--preview-secondary));
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
}

.portal-theme-preview__header p,
.portal-theme-preview__header strong,
.portal-theme-preview__header span,
.portal-theme-preview__card p,
.portal-theme-preview__card span,
.portal-theme-preview__card small,
.portal-theme-preview__recommendation strong,
.portal-theme-preview__powered {
  margin: 0;
}

.portal-theme-preview__header p {
  color: var(--preview-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-theme-preview__header strong {
  color: var(--preview-primary);
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
}

.portal-theme-preview__header span {
  color: var(--preview-muted);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.portal-theme-preview--header-compact .portal-theme-preview__header strong {
  font-size: 17px;
}

.portal-theme-preview__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.82fr);
  gap: var(--preview-gap);
}

.portal-theme-preview--layout-single_column .portal-theme-preview__grid,
.portal-theme-preview--layout-compact .portal-theme-preview__grid {
  grid-template-columns: 1fr;
}

.portal-theme-preview__card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: var(--preview-padding);
  border: 1px solid var(--preview-border);
  border-top: 4px solid var(--preview-primary);
  border-radius: var(--preview-radius-card);
  background: var(--preview-surface);
  box-shadow: var(--preview-shadow);
}

.portal-theme-preview__card--result {
  border-top-color: var(--preview-tertiary);
}

.portal-theme-preview__stack {
  display: grid;
  gap: var(--preview-gap);
  min-width: 0;
}

.portal-theme-preview__card p {
  color: var(--preview-fg);
  font-weight: 800;
}

.portal-theme-preview__card span,
.portal-theme-preview__card small,
.portal-theme-preview__powered {
  color: var(--preview-muted);
  font-size: 13px;
}

.portal-theme-preview__fields {
  display: grid;
  gap: 6px;
}

.portal-theme-preview__fields span {
  display: block;
  min-height: 30px;
  border: 1px solid var(--preview-border);
  border-radius: var(--preview-radius-control);
  background: color-mix(in oklch, var(--preview-surface) 86%, var(--preview-bg));
  color: var(--preview-muted);
  font-size: 12px;
  padding: 6px 8px;
}

.portal-theme-preview__card button {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--preview-tertiary);
  border-radius: var(--preview-radius-control);
  background: var(--preview-tertiary);
  color: #fff;
  font-weight: 800;
  padding: 8px 12px;
}

.portal-theme-preview__recommendation {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--preview-border);
  border-radius: var(--preview-radius-control);
  background: color-mix(in oklch, var(--preview-tertiary) 8%, var(--preview-surface));
}

.portal-theme-preview__recommendation strong {
  color: var(--preview-fg);
  font-size: 13px;
}

.portal-theme-preview__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-theme-preview__metrics span {
  border: 1px solid var(--preview-border);
  border-radius: 999px;
  background: color-mix(in oklch, var(--preview-primary) 8%, var(--preview-surface));
  color: var(--preview-fg);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

.portal-theme-preview__map {
  display: grid;
  place-items: center;
  min-height: 130px;
  border: 1px solid var(--preview-border);
  border-radius: var(--preview-radius-card);
  background:
    repeating-linear-gradient(
      0deg,
      var(--preview-border) 0,
      var(--preview-border) 1px,
      transparent 1px,
      transparent 28px
    ),
    repeating-linear-gradient(
      90deg,
      var(--preview-border) 0,
      var(--preview-border) 1px,
      transparent 1px,
      transparent 28px
    ),
    var(--preview-surface);
  color: var(--preview-muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.portal-theme-preview__powered {
  display: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-theme-preview--powered .portal-theme-preview__powered {
  display: block;
}

@media (max-width: 760px) {
  .portal-config-grid--two,
  .portal-config-grid--three {
    grid-template-columns: 1fr;
  }

  .portal-unit-attribute-options {
    grid-template-columns: 1fr;
  }

  .portal-theme-presets {
    grid-template-columns: 1fr;
  }

  .portal-theme-preview__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {

  .json-schema-builder__header,
  .json-schema-builder__row {
    display: grid;
    grid-template-columns: 1fr;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

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

th {
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-dark);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* Simple Dropdown */
.has-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 2.375rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0;
}

.nav-dropdown-toggle::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s;
}

.has-dropdown.is-open .nav-dropdown-toggle,
.nav-dropdown-toggle:hover {
  color: var(--fg);
}

.has-dropdown.is-open .nav-dropdown-toggle::after {
  transform: translateY(1px) rotate(225deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 8px 0;
  list-style: none;
  min-width: 180px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.has-dropdown.is-open .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu {
  display: block;
}

.dropdown-menu li {
  margin: 0;
}

.dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
}

.dropdown-menu li a:hover {
  background: var(--surface-dark);
}

@media (max-width: 860px) {
  .nav-dropdown-toggle {
    width: 100%;
    min-height: 2.75rem;
    justify-content: space-between;
    padding: 0.5rem 0;
  }

  .dropdown-menu {
    position: static;
    min-width: 0;
    width: 100%;
    box-shadow: none;
    margin: 0 0 8px;
  }
}

/* --- UI normalization on top of Bootstrap --- */
body {
  margin: 0;
  padding: 0 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

.page-content {
  padding: 2.5rem 0;
}

.page-content h1,
.container.page-content h1 {
  font-family: var(--font-display) !important;
  font-size: 2rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  margin-bottom: 0.5rem !important;
}

.page-content h2,
.container.page-content h2 {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
}

.page-content h3,
.container.page-content h3 {
  font-size: 1rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  letter-spacing: 0 !important;
}

.page-content p,
.panel p {
  font-size: 0.95rem;
}

.panel {
  padding: 1.25rem;
  border-radius: var(--radius-card);
}

.fieldWrapper {
  margin-bottom: 1rem;
}

.organization-switcher {
  display: inline-flex;
  align-items: end;
  gap: 0.625rem;
  margin: 0;
}

.organization-switcher label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.organization-switcher select {
  min-width: min(18rem, 64vw);
  min-height: 2.375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--fg);
  padding: 0.45rem 0.75rem;
}

.fieldWrapper label,
.form-group label,
.form-label,
.json-schema-builder__field span,
.json-schema-builder__required span {
  color: var(--muted) !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
  text-transform: none !important;
}

.btn,
.nav-cta,
.nav-logout {
  min-height: 2.375rem;
  padding: 0.5rem 1rem !important;
  border-radius: var(--radius-pill);
  font-size: 0.95rem !important;
  line-height: 1.35 !important;
  gap: 0.4rem;
}

table {
  margin-bottom: 0;
}

th,
td {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  vertical-align: middle;
}

th {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.nav-links {
  align-items: center;
  font-size: 0.95rem;
}

.dropdown-menu li a {
  font-size: 0.95rem;
}

.json-schema-builder__title {
  font-size: 1rem;
}

.json-schema-builder__description,
.json-schema-builder__empty {
  font-size: 0.9rem;
}

.json-schema-builder__required {
  min-height: 2.375rem;
}

@media (max-width: 768px) {
  .page-content {
    padding: 1.5rem 0;
  }

  .page-content h1,
  .container.page-content h1 {
    font-size: 1.75rem !important;
  }
}

/* --- Authenticated dashboard --- */
.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 24px;
}

.dashboard-hero h1,
.dashboard-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.dashboard-hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

.dashboard-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dashboard-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.dashboard-subtitle strong {
  color: var(--fg);
}

.dashboard-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.dashboard-switcher label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.dashboard-switcher select {
  min-width: 180px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-weight: 600;
}

.dashboard-metrics,
.dashboard-grid {
  display: grid;
  gap: 16px;
}

.dashboard-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.dashboard-metric-card {
  min-height: 148px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-card) + 8px);
  background: var(--surface);
  box-shadow: 0 18px 45px oklch(20% 0.02 240 / 0.04);
}

.dashboard-metric-card--accent {
  border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
  background: linear-gradient(135deg, color-mix(in oklch, var(--accent) 12%, var(--surface)), var(--surface));
}

.dashboard-metric-card__label,
.dashboard-metric-card small,
.dashboard-shortcut small,
.dashboard-health-list span,
.dashboard-request-summary span,
.dashboard-recent-list small {
  color: var(--muted);
  font-size: 0.85rem;
}

.dashboard-metric-card strong {
  display: block;
  margin: 12px 0 8px;
  font-family: var(--font-display);
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.dashboard-grid--main {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  margin-bottom: 16px;
}

.dashboard-grid--secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-panel {
  padding: 20px;
  border-radius: calc(var(--radius-card) + 8px);
}

.dashboard-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-request-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-request-summary div,
.dashboard-health-list div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-dark);
}

.dashboard-request-summary strong,
.dashboard-health-list strong {
  display: block;
  font-size: 1.25rem;
}

.dashboard-chart--columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 190px;
  padding-top: 10px;
}

.dashboard-chart__column {
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 6px;
  min-height: 180px;
  text-align: center;
}

.dashboard-chart__bar {
  display: block;
  width: 100%;
  min-height: 8px;
  height: max(8px, var(--bar-size));
  border-radius: var(--radius-pill) var(--radius-pill) 4px 4px;
  background: linear-gradient(180deg, var(--accent), var(--color-accent-strong));
}

.dashboard-chart__column small,
.dashboard-chart__column strong {
  font-size: 0.75rem;
}

.dashboard-shortcuts {
  display: grid;
  gap: 10px;
}

.dashboard-shortcut {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}

.dashboard-shortcut:hover {
  border-color: color-mix(in oklch, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}

.dashboard-shortcut--primary {
  background: var(--fg);
  color: var(--surface);
}

.dashboard-shortcut--primary small,
.dashboard-shortcut--primary .dashboard-shortcut__icon {
  color: color-mix(in oklch, var(--surface) 72%, var(--accent));
}

.dashboard-shortcut__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklch, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

.dashboard-shortcut strong,
.dashboard-shortcut small {
  display: block;
}

.dashboard-bar-list,
.dashboard-health-list,
.dashboard-recent-list {
  display: grid;
  gap: 12px;
}

.dashboard-bar-row__label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.dashboard-bar-row__track {
  display: block;
  overflow: hidden;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-dark);
}

.dashboard-bar-row__track span {
  display: block;
  width: var(--bar-size);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.dashboard-note,
.dashboard-empty {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-map-panel .dashboard-panel__header {
  align-items: center;
  margin-bottom: 10px;
}

.dashboard-map-panel .dashboard-note {
  max-width: 760px;
  margin-top: 0;
  margin-bottom: 16px;
}

.dashboard-recent-list {
  margin: 0;
  padding-left: 20px;
}

.dashboard-recent-list li::marker {
  color: var(--accent);
  font-weight: 700;
}

.dashboard-recent-list span,
.dashboard-recent-list small {
  display: block;
}

@media (max-width: 980px) {
  .dashboard-metrics,
  .dashboard-grid--main,
  .dashboard-grid--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-hero,
  .dashboard-panel__header,
  .dashboard-switcher {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-metrics,
  .dashboard-grid--main,
  .dashboard-grid--secondary,
  .dashboard-request-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-chart--columns {
    gap: 6px;
  }
}

/* --- First-use tutorial --- */
.app-tour-replay {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px 10px 10px;
  border: 1px solid color-mix(in oklch, var(--accent) 45%, var(--border));
  border-radius: 999px;
  background: color-mix(in oklch, var(--surface) 92%, var(--accent) 8%);
  color: var(--fg);
  box-shadow: 0 12px 32px rgb(15 23 42 / 0.18);
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.app-tour-replay:hover {
  transform: translateY(-2px);
  background: var(--surface);
  box-shadow: 0 16px 40px rgb(15 23 42 / 0.24);
}

.app-tour-replay span {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  line-height: 1;
}

.app-tour-replay strong {
  font-size: 13px;
  font-weight: 700;
}

.app-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.app-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(15 23 42 / 0.56);
  pointer-events: auto;
}

.app-tour-highlight {
  position: fixed;
  border: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgb(15 23 42 / 0.56), 0 18px 44px rgb(15 23 42 / 0.28);
  transition: all 180ms ease;
  pointer-events: none;
}

.app-tour-balloon {
  position: fixed;
  width: min(360px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 24px 60px rgb(15 23 42 / 0.26);
  pointer-events: auto;
}

.app-tour-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-dark);
  color: var(--fg);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.app-tour-step {
  margin: 0 36px 8px 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-tour-balloon h2 {
  margin: 0 36px 8px 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
}

.app-tour-text {
  margin: 0 0 18px;
  color: var(--muted);
}

.app-tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .app-tour-replay {
    right: 16px;
    bottom: 16px;
    padding: 10px;
  }

  .app-tour-replay strong {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .app-tour-balloon {
    left: 16px !important;
    right: 16px;
  }
}

.map-page-header,
.dashboard-map-panel {
    margin-bottom: 24px;
}

.map-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.map-page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.unit-map-panel {
    overflow: hidden;
}

.unit-map-help,
.unit-map-missing {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface-dark, #f6f7f9);
    color: var(--muted);
    font-size: 14px;
}

.unit-map-help strong {
    color: var(--fg, var(--text));
}

.unit-map-frame {
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.unit-map-empty {
    display: flex;
    min-height: 320px;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}

.unit-map {
    min-height: 560px;
    background: var(--surface);
}

.unit-map__toolbar {
    display: grid;
    gap: 14px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.unit-map__toolbar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.unit-map__toolbar-heading > div {
    display: grid;
    gap: 2px;
}

.unit-map__toolbar-heading strong {
    color: var(--text);
    font-size: 15px;
}

.unit-map__toolbar-heading span {
    color: var(--muted);
    font-size: 13px;
}

.unit-map__toolbar-grid {
    display: grid;
    grid-template-columns: minmax(240px, 1.5fr) repeat(5, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}

.unit-map__search {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.unit-map__search input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
}

.unit-map__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    min-height: 560px;
}

.unit-map__canvas {
    min-height: 560px;
    background: #dfe7e2;
}

.unit-map .leaflet-container {
    font-family: inherit;
}

.unit-map .leaflet-popup-content {
    margin: 12px;
    color: var(--text);
}

.unit-map .leaflet-popup-content strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.unit-map .leaflet-popup-content p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.unit-map .leaflet-popup-content dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 8px;
}

.unit-map .leaflet-popup-content dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.unit-map .leaflet-popup-content dd {
    margin: 0;
    font-size: 12px;
}

.unit-map .leaflet-popup-content ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.unit-map__sidebar {
    overflow: auto;
    max-height: 560px;
    border-left: 1px solid var(--border);
    background: var(--surface);
}

.unit-map__summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.unit-map__summary strong {
    color: var(--text);
    font-size: 32px;
    line-height: 1;
}

.unit-map__summary span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.unit-map__list {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.unit-map__card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.unit-map__card:hover,
.unit-map__card:focus-visible {
    border-color: rgba(22, 163, 74, 0.5);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    outline: 0;
    transform: translateY(-1px);
}

.unit-map__card h3 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
}

.unit-map__card p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.unit-map__card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 10px;
}

.unit-map__card dl div {
    min-width: 0;
}

.unit-map__card dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.unit-map__card dd {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 13px;
}

.unit-map__card summary {
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.unit-map__card ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 13px;
}

.unit-map-frame--dashboard,
.unit-map-frame--dashboard .unit-map__body,
.unit-map-frame--dashboard .unit-map__canvas {
    min-height: 460px;
}

.unit-map-frame--dashboard .unit-map__sidebar {
    max-height: 460px;
}

.unit-map-frame--dashboard {
    border-radius: calc(var(--radius-card) + 4px);
}

.unit-map--dashboard {
    min-height: 460px;
}

.unit-map--dashboard .unit-map__toolbar {
    align-items: end;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px;
    background:
        linear-gradient(135deg, var(--surface), var(--surface-dark, #f6f7f9));
}

.unit-map__toolbar--compact {
    position: relative;
}

.unit-map__quick-filter,
.unit-map__toolbar--compact .unit-map__search,
.unit-map__toolbar--full .unit-map__search {
    display: grid;
    gap: 6px;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.unit-map__quick-filter select,
.unit-map__toolbar--compact .unit-map__search input,
.unit-map__toolbar--full .unit-map__search input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.unit-map__quick-filter select {
    padding: 0 10px;
}

.unit-map__select--native-enhanced {
    display: none;
}

.unit-map-combobox {
    position: relative;
}

.unit-map-combobox__input {
    width: 100%;
    height: 44px;
    padding: 0 34px 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 18px / 7px 7px no-repeat,
        linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 13px) 18px / 7px 7px no-repeat,
        #fff;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-transform: none;
}

.unit-map-combobox__input:focus {
    border-color: rgba(22, 163, 74, 0.55);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
    outline: 0;
}

.unit-map-combobox__list {
    position: absolute;
    z-index: 460;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: 240px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.unit-map-combobox__option {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-transform: none;
    cursor: pointer;
}

.unit-map-combobox__option:hover,
.unit-map-combobox__option:focus-visible,
.unit-map-combobox__option[aria-selected="true"] {
    background: rgba(22, 163, 74, 0.1);
    color: var(--accent, #15803d);
    outline: 0;
}

.unit-map-combobox__empty {
    padding: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
}

.unit-map__toolbar--compact .unit-map__reset,
.unit-map__toolbar--full .unit-map__reset {
    min-height: 44px;
    white-space: nowrap;
}

.unit-map__active-filters {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.unit-map--dashboard .unit-map__body {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    min-height: 460px;
}

.unit-map--dashboard .unit-map__canvas {
    min-height: 460px;
}

.unit-map--dashboard .unit-map__sidebar {
    max-height: 460px;
}

.unit-map--dashboard .unit-map__summary {
    padding: 14px;
}

.unit-map--dashboard .unit-map__summary strong {
    font-size: 28px;
}

.unit-map--dashboard .unit-map__list {
    gap: 8px;
    padding: 12px;
}

.unit-map--dashboard .unit-map__card {
    padding: 10px;
    box-shadow: none;
}

.unit-map--dashboard .unit-map__card dl {
    display: none;
}

.unit-map--dashboard .unit-map__card details {
    margin-top: 8px;
}

.unit-map__card--visible {
    border-color: color-mix(in oklch, var(--accent) 24%, var(--border));
}

@media (max-width: 1180px) {
    .unit-map__toolbar-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .unit-map__toolbar-grid .unit-map__search {
        grid-column: span 2;
    }
}

@media (max-width: 720px) {
    .unit-map-frame,
    .unit-map__body,
    .unit-map__canvas {
        min-height: 440px;
    }

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

    .unit-map__sidebar {
        max-height: none;
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .unit-map__toolbar-heading {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .unit-map__toolbar-grid .unit-map__search {
        grid-column: auto;
    }

    .unit-map__reset {
        width: 100%;
    }

    .unit-map--dashboard .unit-map__toolbar {
        grid-template-columns: 1fr;
    }

    .unit-map--dashboard .unit-map__body {
        grid-template-columns: 1fr;
    }
}
/* Criterion integrations */
.page-heading,
.integration-heading,
.integration-source__header,
.integration-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: 32px;
  margin: 0;
}

.page-heading p,
.integration-source__header p,
.integration-section-header p {
  color: var(--muted);
  margin: 4px 0 0;
}

.integration-heading__actions,
.integration-source__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.integration-source-list {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.integration-source__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.integration-source__header,
.integration-section-header {
  margin-bottom: 18px;
}

.integration-source__header h2,
.integration-section-header h2 {
  font-size: 20px;
  margin: 0;
}

.integration-form {
  max-width: 900px;
}

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

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

.status-pill--danger {
  background: color-mix(in srgb, var(--color-danger) 12%, transparent);
  color: var(--color-danger);
}

@media (max-width: 760px) {
  .page-heading,
  .integration-heading,
  .integration-source__header,
  .integration-section-header {
    align-items: stretch;
    flex-direction: column;
  }

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