/* ==========================================================================
   EvoluChat — base: tokens, reset, tipografia e componentes
   ========================================================================== */

:root {
  /* Marca (único acento de cor) */
  --brand: #234085;
  --brand-hover: #1b3268;
  --brand-light: #3b5ccc;
  --brand-50: #f5f7fc;
  --brand-100: #eef1f8;
  --brand-200: #dfe5f3;
  --brand-300: #c3cde9;

  /* Neutros frios */
  --ink: #0f172a;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --surface: #ffffff;
  --surface-soft: #eef1f8;
  --surface-subtle: #f8fafc;

  /* Semânticas */
  --success: #10b981;
  --success-ink: #047857;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-ink: #b45309;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-ink: #b91c1c;
  --danger-bg: #fef2f2;
  --whatsapp: #25d366;

  /* Séries de gráficos (validadas para daltonismo) */
  --series-1: #3b5ccc;
  --series-2: #7b93e0;
  --series-3: #f2a600;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.22);
  --focus-ring: 0 0 0 3px rgba(59, 92, 204, 0.32);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --header-h: 64px;
  --container: 1200px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}

body.has-modal {
  overflow: hidden;
}

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

svg.icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-hover);
}

table {
  border-collapse: collapse;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 2px;
}

::selection {
  background: var(--brand-200);
}

/* ---------- Acessibilidade ---------- */
.sr-only {
  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;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.15s var(--ease);
}

.skip-link:focus {
  transform: none;
  color: #fff;
}

/* ---------- Tipografia ---------- */
.display {
  font-size: clamp(2.25rem, 4.2vw + 1rem, 4rem);
  line-height: 1.04;
  font-weight: 500;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.h1 {
  font-size: clamp(1.75rem, 2.2vw + 1rem, 2.75rem);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.h2 {
  font-size: clamp(1.375rem, 1vw + 1rem, 1.75rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.h3 {
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink);
}

.lead {
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.25rem);
  line-height: 1.6;
  color: var(--text-2);
}

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

.text-small {
  font-size: 14px;
}

.text-xs {
  font-size: 13px;
}

.text-strong {
  font-weight: 600;
  color: var(--ink);
}

.text-success {
  color: var(--success-ink);
}

.text-danger {
  color: var(--danger-ink);
}

.mono,
code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--ink);
  word-break: break-all;
}

.num,
.tabular {
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--whatsapp);
}

/* ---------- Layout utilitário ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container {
    padding: 0 32px;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cluster-lg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

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

.grid-2 {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mt-1 {
  margin-top: 4px;
}
.mt-2 {
  margin-top: 8px;
}
.mt-3 {
  margin-top: 12px;
}
.mt-4 {
  margin-top: 16px;
}
.mt-6 {
  margin-top: 24px;
}
.mt-8 {
  margin-top: 32px;
}

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 20px 0;
}

/* ---------- Botões ---------- */
.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--btn-h);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease),
    color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

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

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--brand-200);
  color: var(--ink);
}

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

.btn-outline:hover {
  border-color: var(--muted-2);
  background: var(--surface-subtle);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-ink);
  color: #fff;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger-ink);
}

.btn-danger-ghost:hover {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.btn-white {
  background: #fff;
  color: var(--brand);
}

.btn-white:hover {
  background: var(--brand-100);
  color: var(--brand-hover);
}

.btn-outline-light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

.btn-link {
  height: auto;
  padding: 0;
  border-radius: var(--radius-xs);
  color: var(--brand);
  font-weight: 600;
}

.btn-link:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}

.btn-sm {
  --btn-h: 36px;
  padding: 0 14px;
  font-size: 14px;
  gap: 6px;
}

.btn-lg {
  --btn-h: 52px;
  padding: 0 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  --btn-h: 40px;
  width: var(--btn-h);
  padding: 0;
}

.btn-icon.btn-sm {
  --btn-h: 32px;
  width: 32px;
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm {
  width: 16px;
  height: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Formulários ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .span-2 {
    grid-column: span 2;
  }
}

.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.field > legend {
  margin-bottom: 6px;
  padding: 0;
}

.field > label,
.label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.label-optional {
  font-weight: 400;
  color: var(--muted);
}

.field-hint {
  font-size: 13px;
  color: var(--muted);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--danger-ink);
}

.input,
.select,
.textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-light);
  box-shadow: var(--focus-ring);
}

.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
}

.input[aria-invalid='true']:focus,
.textarea[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

.input:disabled,
.select:disabled,
.textarea:disabled,
.input[readonly] {
  background: var(--surface-subtle);
  color: var(--text-2);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
}

.textarea {
  min-height: 108px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.input-sm,
.select-sm {
  min-height: 38px;
  font-size: 14px;
  border-radius: 10px;
}

.code-area {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-right: 48px;
}

.input-group-action {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.input-group-action:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.input-group-action:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.search-input {
  position: relative;
}

.search-input .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input .input {
  padding-left: 42px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
}

/* Checkbox e rádio nativos com a cor da marca */
.check,
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--brand);
}

.check {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
}

.check:disabled {
  cursor: not-allowed;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  line-height: 1.45;
  cursor: pointer;
}

.check-row .check {
  margin-top: 2px;
}

.check-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-row-hint {
  font-size: 13px;
  color: var(--muted);
}

.check-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 640px) {
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Switch (checkbox com role="switch") */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin: 0;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color 0.18s var(--ease);
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s var(--ease);
}

.switch:checked {
  background: var(--brand);
}

.switch:checked::after {
  transform: translateX(16px);
}

.switch:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

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

.switch-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.switch-row-hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.switch-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.badge-xs {
  min-height: 20px;
  padding: 1px 8px;
  font-size: 11px;
}

/* Stepper (quantidade) */
.stepper {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
}

.stepper-btn:hover {
  background: var(--brand-200);
}

.stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stepper-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.stepper-input {
  width: 64px;
  height: 38px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-input:focus {
  outline: none;
}

.stepper:focus-within {
  border-color: var(--brand-light);
  box-shadow: var(--focus-ring);
}

/* Controle segmentado (rádios) */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
}

.segmented-fluid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 18px;
}

@media (min-width: 560px) {
  .segmented-fluid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: var(--radius-pill);
  }
}

.segmented-option {
  position: relative;
  display: flex;
}

.segmented-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.segmented-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background-color 0.15s var(--ease),
    color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.segmented-option input:hover + .segmented-label {
  color: var(--ink);
}

.segmented-option input:checked + .segmented-label {
  background: var(--surface);
  color: var(--ink);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px var(--border);
}

.segmented-option input:focus-visible + .segmented-label {
  box-shadow: var(--focus-ring);
}

.segmented-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--brand-200);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.segmented-option input:checked + .segmented-label .segmented-badge {
  background: var(--brand);
  color: #fff;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

@media (min-width: 768px) {
  .card {
    padding: 24px;
  }
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-flush .card-header {
  margin: 0;
  padding: 20px 20px 16px;
}

@media (min-width: 768px) {
  .card-flush .card-header {
    padding: 20px 24px 16px;
  }
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.card-subtitle {
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.card-soft {
  background: var(--brand-50);
  border-color: var(--brand-200);
}

/* ---------- Selos ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-neutral {
  background: #f1f5f9;
  color: #475569;
}

.badge-brand,
.badge-info {
  background: var(--brand-100);
  color: var(--brand);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-ink);
}

.badge-success.badge-dot::before {
  background: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.badge-soon {
  min-height: 20px;
  padding: 1px 8px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface-soft);
  color: var(--ink);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Alertas ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.alert > .icon {
  margin-top: 1px;
}

.alert-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.alert-title {
  font-weight: 600;
}

.alert-info {
  background: var(--brand-50);
  border-color: var(--brand-200);
}

.alert-info > .icon {
  color: var(--brand);
}

.alert-success {
  background: var(--success-bg);
  border-color: #a7f3d0;
}

.alert-success > .icon {
  color: var(--success-ink);
}

.alert-warning {
  background: var(--warning-bg);
  border-color: #fde68a;
}

.alert-warning > .icon {
  color: var(--warning-ink);
}

.alert-danger {
  background: var(--danger-bg);
  border-color: #fecaca;
}

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

/* ---------- Tabelas ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  font-size: 14px;
  color: var(--text);
}

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

.table thead th {
  padding-top: 11px;
  padding-bottom: 11px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody tr:hover > * {
  background: #fafbfe;
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.table .actions .cluster {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.table-compact th,
.table-compact td {
  padding: 8px 12px;
}

.cell-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cell-title {
  font-weight: 600;
  color: var(--ink);
}

.cell-sub {
  font-size: 13px;
  color: var(--muted);
}

.cell-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 420px;
  color: var(--text-2);
}

/* Tabela que vira lista de cartões no celular */
@media (max-width: 720px) {
  .table-stack thead {
    display: none;
  }

  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td,
  .table-stack th[scope='row'] {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }

  .table-stack tbody tr:last-child {
    border-bottom: 0;
  }

  .table-stack td,
  .table-stack th[scope='row'] {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: 0;
    text-align: right;
  }

  .table-stack td::before {
    content: attr(data-label);
    flex-shrink: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
  }

  .table-stack td[data-label=''],
  .table-stack td.is-primary {
    display: block;
    text-align: left;
  }

  .table-stack td[data-label='']::before,
  .table-stack td.is-primary::before {
    content: none;
  }

  .table-stack .actions .cluster,
  .table-stack td.actions {
    justify-content: flex-start;
  }

  .table-stack tbody tr:hover > * {
    background: transparent;
  }

  .table-stack .cell-text {
    max-width: none;
  }
}

/* ---------- Avatares ---------- */
.avatar {
  --avatar-size: 36px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--brand-100);
  color: var(--brand);
  font-size: calc(var(--avatar-size) * 0.36);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  --avatar-size: 28px;
}

.avatar-lg {
  --avatar-size: 48px;
}

.avatar-xl {
  --avatar-size: 88px;
}

/* ---------- Estados (carregando, vazio, erro) ---------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
}

.state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand);
}

.state-icon-danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.state-text {
  max-width: 440px;
  font-size: 14px;
}

.state-action {
  margin-top: 8px;
}

.state-loading {
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.state-loading .spinner {
  color: var(--brand-light);
}

.state-loading-skeleton {
  flex-direction: column;
  width: 100%;
  min-height: 250px;
}
.state-loading-label {
  display: flex;
  align-items: center;
  gap: 12px;
}
.state-skeleton {
  width: min(100%, 560px);
  display: grid;
  gap: 20px;
  padding-top: 18px;
}
.state-skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.state-skeleton-row > span {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex-shrink: 0;
}
.state-skeleton-row > div {
  flex: 1;
  display: grid;
  gap: 8px;
}
.state-skeleton-row i {
  height: 10px;
  border-radius: 4px;
  width: 85%;
}
.state-skeleton-row i:last-child {
  width: 60%;
}
.state-skeleton-row > span,
.state-skeleton-row i {
  display: block;
  background: linear-gradient(100deg, #e8edf5 25%, #f5f8fc 50%, #e8edf5 75%);
  background-size: 200% 100%;
  animation: state-skeleton-load 1.5s ease infinite;
}
@keyframes state-skeleton-load {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .state-skeleton-row > span,
  .state-skeleton-row i {
    animation: none;
  }
}

.is-refreshing {
  opacity: 0.6;
  transition: opacity 0.15s var(--ease);
}

/* ---------- Paginação ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-current {
  font-size: 13px;
  white-space: nowrap;
}

/* ---------- Abas ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected='true'] {
  color: var(--ink);
  border-bottom-color: var(--brand);
}

.tab:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: var(--text-2);
  font-size: 12px;
}

/* ---------- Menus ---------- */
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.menu-header {
  padding: 10px 12px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

.menu-item .icon {
  color: var(--muted);
}

.menu-item:hover,
.menu-item:focus-visible {
  outline: none;
  background: var(--surface-soft);
  color: var(--ink);
}

.menu-item-danger,
.menu-item-danger .icon {
  color: var(--danger-ink);
}

.menu-item-danger:hover {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

/* Menu de ações com <details> */
.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu > summary {
  list-style: none;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu .menu {
  min-width: 200px;
}

/* ---------- Medidores ---------- */
.meter-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  list-style: none;
}

.meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
}

.meter-label {
  font-weight: 500;
  color: var(--ink);
}

.meter-value {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meter-of {
  font-weight: 400;
  color: var(--muted);
}

.meter {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: var(--radius-pill);
  background: var(--brand-light);
  transition: width 0.4s var(--ease);
}

.meter.is-warning {
  background: #fdf0d5;
}

.meter.is-warning > span {
  background: var(--warning);
}

.meter.is-danger {
  background: #fde2e2;
}

.meter.is-danger > span {
  background: var(--danger);
}

.meter-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
}

.meter-note.is-warning {
  color: var(--warning-ink);
}

.meter-note.is-danger {
  color: var(--danger-ink);
}

/* ---------- Modais e painéis laterais ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

@media (min-width: 640px) {
  .modal-root {
    align-items: center;
    padding: 24px;
  }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  animation: fade-in 0.16s var(--ease);
}

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - 24px);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s var(--ease);
}

.modal:focus {
  outline: none;
}

.modal-sm {
  max-width: 440px;
}

.modal-lg {
  max-width: 760px;
}

.modal-xl {
  max-width: 1000px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 4px 24px;
}

.modal-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.modal-description {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

.modal-close {
  margin: -4px -4px 0 0;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 16px 24px 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.modal-root.is-drawer {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.modal.drawer {
  max-width: min(640px, 100%);
  max-height: none;
  height: 100dvh;
  border-radius: 0;
  animation: drawer-in 0.22s var(--ease);
}

@media (min-width: 640px) {
  .modal.drawer {
    border-radius: 20px 0 0 20px;
  }
}

.modal-root.is-leaving .modal,
.modal-root.is-leaving .modal-backdrop {
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.confirm-message {
  color: var(--text-2);
}

.confirm-field {
  margin-top: 16px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes drawer-in {
  from {
    transform: translateX(32px);
    opacity: 0;
  }
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast-region {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  padding: 12px 10px 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #f8fafc;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 0.2s var(--ease);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.18s var(--ease),
    transform 0.18s var(--ease);
}

.toast-icon {
  display: inline-flex;
  margin-top: 1px;
}

.toast-success .toast-icon {
  color: #6ee7b7;
}

.toast-error .toast-icon {
  color: #fca5a5;
}

.toast-warning .toast-icon {
  color: #fcd34d;
}

.toast-info .toast-icon {
  color: #a5b8f0;
}

.toast-message {
  flex: 1;
  min-width: 0;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px 0 -4px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Logo ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.brand .logo-mark {
  flex-shrink: 0;
}

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

/* ---------- Pagamento (fatura) ---------- */
.payment-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.payment-box .field {
  width: 100%;
}

.payment-actions {
  display: flex;
  gap: 8px;
}

.payment-fallback {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--text-2);
  font-size: 14px;
}

.payment-fallback .icon {
  color: var(--brand);
  margin-top: 1px;
}

.invoice-details {
  display: grid;
  gap: 10px;
  font-size: 14px;
}

.invoice-details > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.invoice-details dt {
  color: var(--muted);
}

.invoice-details dd {
  text-align: right;
  font-weight: 500;
  color: var(--ink);
}

.invoice-amount {
  font-size: 16px;
  font-weight: 700 !important;
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Alto contraste do sistema ---------- */
@media (forced-colors: active) {
  .btn,
  .badge,
  .chip,
  .meter,
  .segmented-label {
    border: 1px solid CanvasText;
  }
}

/* ==========================================================================
   Seletor de plano, formas de pagamento e resumo do pedido
   (usados no checkout e na troca de plano do painel)
   ========================================================================== */
.picker {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.picker-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.picker-title {
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.picker-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.picker-addon-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

.picker-hint {
  font-size: 13px;
  color: var(--muted);
}

.plan-options {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .plan-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plan-option {
  position: relative;
  display: flex;
  cursor: pointer;
}

.plan-option-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.plan-option-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 18px 18px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    background-color 0.15s var(--ease);
}

.plan-option:hover .plan-option-card {
  border-color: var(--brand-300);
}

.plan-option-input:checked + .plan-option-card {
  border-color: var(--brand);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand);
}

.plan-option-input:focus-visible + .plan-option-card {
  box-shadow:
    0 0 0 1px var(--brand),
    var(--focus-ring);
}

.plan-option-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-right: 24px;
}

.plan-option-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.plan-option-tagline {
  font-size: 13px;
  color: var(--muted);
}

.plan-option-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 6px;
  color: var(--ink);
}

.plan-option-price strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.plan-option-per {
  font-size: 13px;
  color: var(--muted);
}

.plan-option-note {
  font-size: 12.5px;
  color: var(--muted);
}

.plan-option-meta {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.plan-option-check {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  transition:
    background-color 0.15s var(--ease),
    border-color 0.15s var(--ease);
}

.plan-option-input:checked ~ .plan-option-check {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

/* Destaques do plano com ícones (checkout) */
.plan-option-perks {
  display: grid;
  gap: 7px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.plan-perk {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-perk-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--brand-100);
  color: var(--brand);
  flex-shrink: 0;
}

.plan-perk:first-child .plan-perk-icon {
  background: #dcf8e6;
  color: #1c8a4d;
}

.plan-option.is-highlight .plan-option-card {
  position: relative;
}

/* Carrossel de planos no celular: um plano por vez, o do centro fica selecionado. */
.plan-carousel-nav,
.plan-carousel-hint {
  display: none;
}

@media (max-width: 719px) {
  .has-carousel .plan-carousel-hint {
    display: block;
    margin-top: -4px;
  }

  .has-carousel .plan-options {
    position: relative;
    display: flex;
    gap: 12px;
    margin: 0 calc(-1 * var(--picker-bleed, 0px));
    padding: 6px var(--picker-bleed, 0px) 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--picker-bleed, 0px);
    scrollbar-width: none;
  }

  .has-carousel .plan-options::-webkit-scrollbar {
    display: none;
  }

  .has-carousel .plan-option {
    flex: 0 0 86%;
    scroll-snap-align: center;
  }

  .has-carousel .plan-option-card {
    padding: 20px 18px 18px;
    opacity: 0.6;
    transform: scale(0.95);
    transition:
      opacity 0.25s var(--ease),
      transform 0.25s var(--ease),
      border-color 0.15s var(--ease),
      box-shadow 0.25s var(--ease),
      background-color 0.15s var(--ease);
  }

  .has-carousel .plan-option-input:checked + .plan-option-card {
    opacity: 1;
    transform: none;
    box-shadow:
      0 0 0 1px var(--brand),
      0 14px 30px -18px rgba(35, 64, 133, 0.55);
  }

  .has-carousel .plan-option-price strong {
    font-size: 28px;
  }

  .plan-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .plan-carousel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--brand);
    font-size: 14px;
    font-weight: 600;
  }

  .plan-carousel-btn.is-next {
    padding: 0 14px 0 18px;
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
  }

  .plan-carousel-btn:disabled {
    opacity: 0.4;
    cursor: default;
  }

  .plan-carousel-btn.is-next:disabled {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--muted);
  }

  .plan-carousel-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
  }

  .plan-carousel-dots {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .plan-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--border-strong);
    transition:
      width 0.25s var(--ease),
      background-color 0.25s var(--ease);
  }

  .plan-carousel-dot.is-on {
    width: 22px;
    background: var(--brand);
  }
}

@media (max-width: 719px) and (prefers-reduced-motion: reduce) {
  .has-carousel .plan-option-card {
    transform: none;
    transition: none;
  }
}

/* Formas de pagamento */
.pay-options {
  display: grid;
  gap: 10px;
}

@media (min-width: 720px) {
  .pay-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.pay-option {
  position: relative;
  display: flex;
  cursor: pointer;
}

.pay-option-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.pay-option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    background-color 0.15s var(--ease);
}

.pay-option:hover .pay-option-card {
  border-color: var(--brand-300);
}

.pay-option-input:checked + .pay-option-card {
  border-color: var(--brand);
  background: var(--brand-50);
  box-shadow: 0 0 0 1px var(--brand);
}

.pay-option-input:focus-visible + .pay-option-card {
  box-shadow:
    0 0 0 1px var(--brand),
    var(--focus-ring);
}

.pay-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--brand-100);
  color: var(--brand);
}

.pay-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pay-option-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.pay-option-desc {
  font-size: 13px;
  color: var(--muted);
}

.pay-options.is-compact .pay-option-card {
  align-items: center;
}

/* Resumo do pedido */
.summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.summary-plan-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.summary-plan-cycle {
  font-size: 14px;
  color: var(--muted);
}

.summary-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.summary-line dt {
  color: var(--text-2);
}

.summary-line dd {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.summary-line.is-discount dd {
  color: var(--success-ink);
}

.summary-total {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.summary-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
  color: var(--ink);
}

.summary-total-row strong {
  font-size: 24px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.summary-equivalent {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.summary-trial {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--success-bg);
  color: var(--success-ink);
  font-size: 14px;
  font-weight: 600;
}

.summary-note {
  font-size: 12.5px;
  color: var(--muted);
}

.is-updating {
  opacity: 0.7;
  transition: opacity 0.15s var(--ease);
}

/* Menu de ações flutuante (posicionado por bindActionMenus): não é cortado por tabelas/cards. */
.menu.menu-floating {
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 900;
}

/* ---------- Balão de detalhes (popover) ---------- */
.popover-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.detail-popover {
  position: fixed;
  z-index: 1150;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popover-in 0.14s ease-out;
}

.detail-popover-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.detail-popover-title {
  flex: 1;
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.detail-popover-body {
  flex: 1;
  min-height: 0;
  padding: 12px 14px 14px;
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 13px;
}

.detail-popover-body pre {
  max-width: none;
  max-height: none;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-popover.is-sheet {
  top: auto;
  right: 8px;
  bottom: 8px;
  left: 8px;
  width: auto;
  max-height: 72dvh;
  border-radius: 18px;
  animation-name: popover-sheet-in;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes popover-sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail-popover {
    animation: none;
  }
}
