:root {
  --canvas: #08090a;
  --surface-1: #101214;
  --surface-2: #16181b;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text-primary: #f7f8f8;
  --text-secondary: #cbd5e1;
  --text-muted: #8b8f97;
  --accent: #00e599;
  --accent-dark: #06281e;
  --accent-glow: rgba(0, 229, 153, 0.14);
  --amber: #f59e0b;
  --danger: #ef4444;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background-color: var(--canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-image: radial-gradient(ellipse at top, rgba(0, 229, 153, 0.06), transparent 60%);
  line-height: 1.5;
  padding-bottom: 64px;
}

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Dynamic Island Status Pill */
.dynamic-island {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(16, 18, 20, 0.9);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: border-color 200ms ease, transform 200ms ease;
}

.dynamic-island[data-state="working"] {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.dynamic-island[data-state="success"] {
  border-color: rgba(0, 229, 153, 0.5);
  color: var(--accent);
}

.island-dot, .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.site-header {
  padding-top: 56px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-glow);
  border: 1px solid rgba(0, 229, 153, 0.35);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
}

.brand-accent { color: var(--accent); }

.header-nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding-inline: 8px;
}

.nav-link:hover { color: var(--text-primary); }

.main-stack {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-top: 24px;
}

/* Bento Grid Assimétrica */
.bento-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .bento-hero {
    grid-template-columns: 8fr 4fr;
  }
}

.bento-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-title {
  margin: 0 0 12px 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.hero-lead {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  max-width: 68ch;
}

.tier-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .tier-strip { grid-template-columns: 1fr 1.3fr; }
}

.tier-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tier-pill-featured {
  border-color: rgba(0, 229, 153, 0.35);
  background: linear-gradient(180deg, rgba(0, 229, 153, 0.06), var(--surface-2));
}

.tier-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tier-tag-emerald { color: var(--accent); }
.tier-price { font-size: 22px; font-family: var(--font-mono); }
.tier-desc { font-size: 13px; color: var(--text-secondary); }

.bento-metrics {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-top: 4px;
}

.metric-sub { margin: 4px 0 0 0; font-size: 13px; color: var(--text-secondary); }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-mini {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.metric-mini-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.metric-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.mono-emerald { font-family: var(--font-mono); color: var(--accent); }

/* Filters */
.radar-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 220px;
}

.filter-sm { flex: 0 1 130px; }
.filter-md { flex: 0 1 220px; }

.filter-label, .field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.control {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

.control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--canvas), 0 0 0 4px var(--accent-glow);
}

/* Buttons (min 44x44px touch target + tactile press) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease, background-color 160ms ease;
}

.btn:active { transform: scale(0.98); }

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

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover { border-color: var(--border-hover); }

.btn-whatsapp {
  background: #12291f;
  color: var(--accent);
  border-color: rgba(0, 229, 153, 0.45);
}

.btn-full { width: 100%; }

/* Responsive Table (modern-web-guidance: container queries + sticky headers) */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(620px, 75vh);
  container-type: inline-size;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.table-caption {
  text-align: left;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.radar-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  --label-1: "Comarca / Processo";
  --label-2: "Categoria";
  --label-3: "Ativo Identificado";
  --label-4: "Valor Estimado";
  --label-5: "Prazo / Edital";
  --label-6: "Ação";
}

.radar-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: var(--surface-2);
}

.radar-table th, .radar-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.radar-table thead th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.radar-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--surface-1);
  font-weight: 600;
}

.cnj-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cat-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.val-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
}

@container (width < 600px) {
  .radar-table, .radar-table thead, .radar-table tbody, .radar-table tr, .radar-table th, .radar-table td {
    display: block;
  }

  .radar-table thead { display: none; }

  .radar-table tbody tr {
    margin: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
  }

  .radar-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: #1b1e23;
  }

  .radar-table td:nth-child(2)::before { content: var(--label-2) ": "; font-weight: 600; color: var(--text-muted); }
  .radar-table td:nth-child(3)::before { content: var(--label-3) ": "; font-weight: 600; color: var(--text-muted); }
  .radar-table td:nth-child(4)::before { content: var(--label-4) ": "; font-weight: 600; color: var(--text-muted); }
  .radar-table td:nth-child(5)::before { content: var(--label-5) ": "; font-weight: 600; color: var(--text-muted); }
}

/* Compliance card */
.compliance-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.compliance-head h2 { margin: 6px 0 8px 0; font-size: 20px; }
.compliance-text { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

/* Native Modal Dialog & Scroll Containment (modern-web-guidance) */
dialog.checkout-dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--border-hover);
  border-radius: 20px;
  background: var(--surface-1);
  color: var(--text-primary);
}

dialog.checkout-dialog:modal {
  overscroll-behavior: contain;
}

dialog.checkout-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-surface { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dialog-title { margin: 4px 0 0 0; font-size: 20px; }

.icon-close-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 16px;
}

.dialog-case-meta {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.checkout-form { display: flex; flex-direction: column; gap: 14px; }

.tier-selector {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tier-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
}

.tier-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(0, 229, 153, 0.08);
}

.tier-option-body { flex: 1; }
.tier-option-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; }
.tier-option-body small { color: var(--text-secondary); font-size: 12px; }

.bump-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.06);
  cursor: pointer;
}

.bump-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: #fde68a; }
.bump-box small { color: var(--text-secondary); font-size: 12px; }

/* Validation after interaction (modern-web-guidance: :user-invalid + fallback) */
.field { display: flex; flex-direction: column; gap: 4px; }
.hint { font-size: 12px; color: var(--text-muted); }

.error-msg {
  display: none;
  color: #fca5a5;
  font-size: 12px;
  margin-top: 2px;
}

:is(input:user-invalid, .control.user-invalid-fallback) {
  border-color: var(--danger);
  background-color: rgba(239, 68, 68, 0.08);
}

:is(input:user-invalid, .control.user-invalid-fallback) + .error-msg {
  display: block;
}

input:user-valid {
  border-color: rgba(0, 229, 153, 0.6);
}

.pix-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.pix-qr {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  background: #ffffff;
  padding: 8px;
}

.pix-copy-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.mono-input { font-family: var(--font-mono); font-size: 12px; }
.pix-status-note { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }

.success-banner {
  background: rgba(0, 229, 153, 0.1);
  border: 1px solid rgba(0, 229, 153, 0.4);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.success-banner p { margin: 4px 0 0 0; font-size: 13px; color: var(--text-secondary); }
.delivery-actions { display: flex; flex-direction: column; gap: 10px; }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}
