/* Cost Real — painel administrativo.
   Tom: painel calmo e profissional. Um destaque (verde = economia); neutros levemente esverdeados.
   Todas as cores são tokens por papel; o tema escuro redefine os mesmos tokens. */

:root {
  color-scheme: light dark;

  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --surface-2: #EFF1EC;
  --surface-3: #E3E7E0;
  --border: #E0E4DC;
  --border-strong: #C9CFC5;
  --input-bg: #FFFFFF;
  --text: #17201A;
  --text-muted: #59645C;
  --accent: #1D7A4B;
  --accent-hover: #166640;
  --accent-soft: #E1F0E6;
  --accent-text: #146038;
  --accent-ring: rgba(29, 122, 75, 0.22);
  --on-accent: #FFFFFF;
  --ok: #1D7A4B;
  --ok-soft: #E1F0E6;
  --warn: #8F5409;
  --warn-soft: #FAEED8;
  --danger: #B5312A;
  --danger-hover: #982620;
  --danger-soft: #FBE7E4;
  --on-danger: #FFFFFF;
  --toast-bg: #1B241E;
  --toast-text: #EEF2EE;
  --backdrop: rgba(10, 14, 12, 0.48);
  --qr-bg: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(20, 32, 24, 0.05);
  --shadow-lg: 0 16px 40px rgba(20, 32, 24, 0.16), 0 2px 6px rgba(20, 32, 24, 0.06);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --card-pad: 24px;
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D110F;
    --surface: #141A16;
    --surface-2: #1A211C;
    --surface-3: #232B25;
    --border: #252E28;
    --border-strong: #354039;
    --input-bg: #101511;
    --text: #E3E9E4;
    --text-muted: #99A49C;
    --accent: #4CBF84;
    --accent-hover: #63CC95;
    --accent-soft: #16301F;
    --accent-text: #74D3A2;
    --accent-ring: rgba(76, 191, 132, 0.28);
    --on-accent: #05190D;
    --ok: #5CC98F;
    --ok-soft: #16301F;
    --warn: #E6A957;
    --warn-soft: #30240F;
    --danger: #F07466;
    --danger-hover: #F48C80;
    --danger-soft: #3A1915;
    --on-danger: #1C0705;
    --toast-bg: #232B25;
    --toast-text: #E3E9E4;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow-sm: none;
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #0D110F;
  --surface: #141A16;
  --surface-2: #1A211C;
  --surface-3: #232B25;
  --border: #252E28;
  --border-strong: #354039;
  --input-bg: #101511;
  --text: #E3E9E4;
  --text-muted: #99A49C;
  --accent: #4CBF84;
  --accent-hover: #63CC95;
  --accent-soft: #16301F;
  --accent-text: #74D3A2;
  --accent-ring: rgba(76, 191, 132, 0.28);
  --on-accent: #05190D;
  --ok: #5CC98F;
  --ok-soft: #16301F;
  --warn: #E6A957;
  --warn-soft: #30240F;
  --danger: #F07466;
  --danger-hover: #F48C80;
  --danger-soft: #3A1915;
  --on-danger: #1C0705;
  --toast-bg: #232B25;
  --toast-text: #E3E9E4;
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow-sm: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; color: var(--text); }
p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, .mono { font-family: var(--font-mono); font-size: 0.88em; }
pre { margin: 0; font-family: var(--font-mono); font-size: var(--fs-xs); white-space: pre-wrap; overflow-wrap: anywhere; }
img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 200;
  background: var(--surface); padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--sp-2); }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Estrutura ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-3) var(--sp-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--sp-3) var(--sp-6);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-group { margin-bottom: var(--sp-5); }
.nav-label {
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-1);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav a {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.main-col { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--topbar-h);
  padding: 0 var(--sp-8);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
  }
}
.topbar .brand { display: none; padding: 0; }
.nav-toggle { display: none; }

.env-badges { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; min-width: 0; }
.env-badges .badge { text-decoration: none; }
.lbl-short { display: none; }
.only-sm { display: none; }

.account { position: relative; flex: none; }
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.account-menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.account-menu button:hover, .account-menu button:focus-visible { background: var(--surface-2); outline: none; }

.global-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  padding: 10px var(--sp-8);
  background: var(--danger);
  color: var(--on-danger);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.global-banner a { color: inherit; }

.view {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  outline: none;
}

body.is-loading::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: loading-bar 1s ease-in-out infinite;
}
@keyframes loading-bar {
  from { background-position: -50% 0; }
  to { background-position: 150% 0; }
}

/* ---------- Cabeçalho de página ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}
.page-head-text { min-width: 0; }
.eyebrow {
  margin-bottom: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.page-head h1 {
  font-size: var(--fs-2xl);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.page-sub { margin-top: var(--sp-2); max-width: var(--measure); color: var(--text-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }

.back-link {
  display: inline-flex;
  margin-bottom: var(--sp-4);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
}
.back-link:hover { color: var(--text); }

/* ---------- Layout ---------- */

.stack { display: flex; flex-direction: column; gap: var(--sp-6); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-xs { display: flex; flex-direction: column; gap: var(--sp-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--sp-4); }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-6); align-items: start; }

/* ---------- Cartões ---------- */

.card {
  min-width: 0;
  padding: var(--card-pad);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.card-head-text { min-width: 0; }
.card-title { font-size: var(--fs-lg); font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; }
.card-sub { margin-top: var(--sp-1); max-width: var(--measure); color: var(--text-muted); font-size: var(--fs-sm); }
.card-section + .card-section { margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: 1px solid var(--border); }
.sep { margin-top: var(--sp-6); padding-top: var(--sp-6); border-top: 1px solid var(--border); }
.section-title { font-size: var(--fs-md); font-weight: 650; margin-bottom: var(--sp-3); }

/* Cartão de métrica */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease-out;
}
a.stat:hover { border-color: var(--border-strong); color: inherit; }
.stat-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stat-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-value small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.stat-lines { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); color: var(--text-muted); min-width: 0; }
.stat-lines .is-bad { color: var(--danger); font-weight: 600; }

/* Manchete do painel */
.headline-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: var(--sp-3);
  border-radius: 50%;
  vertical-align: 0.12em;
  background: var(--text-muted);
}
.headline-dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.headline-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.headline-dot.danger { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

/* ---------- Parada de emergência ---------- */

.kill { border-left: 3px solid var(--danger); }
.kill.is-on { background: var(--danger-soft); border-color: var(--danger); }
.kill-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease-out;
}
.kill-toggle:hover { border-color: var(--danger); }
.kill-toggle:disabled { opacity: 0.6; cursor: progress; }
.kill-knob {
  position: relative;
  flex: none;
  width: 60px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color 0.2s ease-out;
}
.kill-knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease-out;
}
.kill-toggle[aria-checked="true"] .kill-knob { background: var(--danger); border-color: var(--danger); }
.kill-toggle[aria-checked="true"] .kill-knob::after { transform: translateX(26px); }
.kill-toggle-text { display: flex; flex-direction: column; min-width: 0; }
.kill-toggle-text small { font-weight: 400; color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- Selos, chips, callouts ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}
.badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
a.badge:hover { filter: brightness(0.97); }
.badge-lg { height: 26px; padding: 0 11px; font-size: var(--fs-sm); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
}
.chip-neutral { background: var(--surface-2); color: var(--text-muted); }
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }

.callout {
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}
.callout strong { display: block; margin-bottom: 2px; }
.callout-ok { background: var(--ok-soft); border-left-color: var(--ok); }
.callout-warn { background: var(--warn-soft); border-left-color: var(--warn); }
.callout-danger { background: var(--danger-soft); border-left-color: var(--danger); }
.callout a { color: inherit; font-weight: 600; }

.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---------- Botões ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: var(--on-danger); }
.btn-danger-outline { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-muted);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

/* ---------- Formulários ---------- */

.input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.input::placeholder { color: var(--text-muted); opacity: 0.75; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input:disabled { opacity: 0.6; }
textarea.input { resize: vertical; line-height: 1.5; }
textarea.mono, .input.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5) var(--sp-6);
}
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide, .field-json, .field-text, .field-secret { grid-column: 1 / -1; }
.grid-2 .fields { grid-template-columns: minmax(0, 1fr); }
.field-label { font-size: var(--fs-sm); font-weight: 600; }
.field-help { font-size: var(--fs-xs); color: var(--text-muted); }
.field-error { font-size: var(--fs-xs); font-weight: 600; color: var(--danger); }
.field.has-error .input { border-color: var(--danger); }
.field-boolean {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}
.field-boolean .field-text-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-boolean .switch { margin-top: 1px; }

.input-group { display: flex; gap: var(--sp-2); align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .btn { flex: none; }

.secret-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.form-status { margin-right: auto; font-size: var(--fs-sm); color: var(--warn); font-weight: 600; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.inline-form .field { flex: 1 1 200px; }

/* Interruptor */
.switch { position: relative; display: inline-flex; flex: none; width: 42px; height: 24px; }
.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background-color 0.18s ease-out, border-color 0.18s ease-out;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease-out;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: 0.5; }
.switch-danger input:checked + .switch-track { background: var(--danger); border-color: var(--danger); }

/* Controle segmentado */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.segmented a, .segmented button {
  padding: 6px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented [aria-current="page"], .segmented [aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.segmented .count { margin-left: 4px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.toolbar .input { max-width: 340px; }
.toolbar .spacer { flex: 1; }
.supplier-list-actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.supplier-list-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* Cartões de rádio (provedor de IA) */
.radio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-3); }
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease-out, background-color 0.15s ease-out;
}
.radio-card:hover { border-color: var(--text-muted); }
.radio-card input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
.radio-card.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.radio-card-title { font-weight: 650; }
.radio-card-sub { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Tabelas ---------- */

.table-wrap { position: relative; margin-inline: calc(-1 * var(--card-pad)); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: break-word; }
.table th:first-child, .table td:first-child { padding-left: var(--card-pad); }
.table th:last-child, .table td:last-child { padding-right: var(--card-pad); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; overflow-wrap: normal; }
.table .actions { text-align: right; white-space: nowrap; overflow-wrap: normal; }
.table .actions .btn + .btn { margin-left: 4px; }
.table .w-min { width: 1%; white-space: nowrap; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover td { background: var(--surface-2); }
.table tr.is-best td { background: var(--accent-soft); }
.table tr.is-muted td { opacity: 0.6; }
.table tr.detail-row td { background: var(--surface-2); padding-top: var(--sp-4); padding-bottom: var(--sp-5); }
.table tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; font-weight: 650; }
.table a.cell-link { color: var(--text); font-weight: 600; text-decoration: none; }
.table a.cell-link:hover { color: var(--accent-text); text-decoration: underline; }
.cell-sub { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--text-muted); }
.cell-strong { font-weight: 650; }
.rank {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.is-best .rank { background: var(--accent); color: var(--on-accent); }
.neg { color: var(--accent-text); }

.breakdown { width: 100%; max-width: 520px; border-collapse: collapse; font-size: var(--fs-sm); }
.breakdown td { padding: 4px 0; border-bottom: 1px dashed var(--border); }
.breakdown td.num { text-align: right; padding-left: var(--sp-4); font-variant-numeric: tabular-nums; white-space: nowrap; }
.breakdown tr.total td { border-bottom: 0; border-top: 1px solid var(--border-strong); padding-top: 8px; font-weight: 650; }
.breakdown tr.effective td { border-bottom: 0; font-weight: 700; color: var(--accent-text); font-size: var(--fs-md); }

/* Lista chave/valor */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: var(--sp-2) var(--sp-6); margin: 0; }
.kv dt { color: var(--text-muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv pre { font-size: var(--fs-xs); }

/* ---------- Estados vazios / resultados ---------- */

.empty-state { padding: var(--sp-10) var(--sp-4); text-align: center; color: var(--text-muted); }
.empty-title { margin-bottom: var(--sp-1); font-weight: 650; color: var(--text); }
.empty-inline { padding: var(--sp-4) 0; color: var(--text-muted); font-size: var(--fs-sm); }

.result-box {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.result-box.ok { background: var(--ok-soft); }
.result-box.bad { background: var(--danger-soft); }
.result-box .result-head { font-weight: 650; margin-bottom: 4px; }
.result-box .result-body { white-space: pre-wrap; overflow-wrap: anywhere; }

.results { list-style: none; margin: var(--sp-4) 0 0; padding: 0; }
.results li { padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); min-width: 0; }
.results li:last-child { border-bottom: 0; }
.results .r-title { font-weight: 600; overflow-wrap: anywhere; }
.results .r-url { font-size: var(--fs-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.results .r-snippet { margin-top: 4px; font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-sm); }

/* ---------- WhatsApp ---------- */

.wa-status { display: flex; flex-direction: column; gap: var(--sp-3); }
.wa-number { font-size: var(--fs-lg); font-weight: 650; overflow-wrap: anywhere; }
.qr-wrap { display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: flex-start; }
.qr-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 264px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--qr-bg);
  color: #59645C;
  font-size: var(--fs-sm);
  text-align: center;
}
.qr-box img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.qr-side { flex: 1 1 240px; min-width: 0; }
.code-big {
  display: block;
  margin: var(--sp-2) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: 0.14em;
  overflow-wrap: anywhere;
}

/* ---------- Linha do tempo ---------- */

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.tl-item {
  min-width: 0;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tl-item[data-dir="out"] { border-left-color: var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: var(--fs-xs); color: var(--text-muted); }
.tl-head strong { color: var(--text); font-size: var(--fs-sm); }
.tl-subject { margin-top: 6px; font-weight: 600; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.tl-body { margin-top: 6px; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-event { padding: 4px 14px; background: transparent; border-left-style: dashed; font-size: var(--fs-xs); color: var(--text-muted); }
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Mensagens não roteadas ---------- */

.inbox { display: flex; flex-direction: column; gap: var(--sp-4); }
.inbox-body {
  margin: var(--sp-3) 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Simulador (chat) ---------- */

.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--card-pad);
  border-bottom: 1px solid var(--border);
}
.chat-log {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  height: min(64vh, 720px);
  min-height: 320px;
  padding: var(--sp-5) var(--card-pad);
  overflow-y: auto;
  background: var(--bg);
  overscroll-behavior: contain;
}
.msg-row { display: flex; flex-direction: column; max-width: min(620px, 86%); min-width: 0; }
.msg-row.right { align-self: flex-end; align-items: flex-end; }
.msg-row.left { align-self: flex-start; align-items: flex-start; }
.msg-row.center { align-self: center; align-items: center; max-width: 90%; }
.msg {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-me { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.msg-bot { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-sup-out { background: var(--surface-2); border: 1px dashed var(--border-strong); border-bottom-left-radius: 4px; }
.msg-sup-in { background: var(--surface-3); border: 1px dashed var(--border-strong); border-bottom-right-radius: 4px; }
.msg-system { background: transparent; color: var(--text-muted); font-size: var(--fs-xs); text-align: center; }
.msg-label { margin-bottom: 4px; font-size: var(--fs-xs); font-weight: 650; color: var(--text-muted); white-space: normal; }
.msg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 0.6875rem; color: var(--text-muted); }
.msg-meta .chip { font-size: 0.6875rem; padding: 0 6px; }
.msg-attachment { margin-top: var(--sp-2); font-size: 0.8125rem; }
.msg-attachment summary { cursor: pointer; }
.msg-attachment pre { max-height: 14rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-actions { margin-top: 6px; }
.msg-reply {
  width: min(520px, 100%);
  margin-top: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.msg-reply .btn-row { margin-top: var(--sp-2); justify-content: flex-end; }
.msg-reply .field { margin-top: var(--sp-2); }
.chat-typing { display: inline-flex; align-self: flex-start; align-items: center; gap: var(--sp-2); padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-empty { margin: auto; max-width: 440px; text-align: center; color: var(--text-muted); font-size: var(--fs-sm); }
.chat-empty .btn-row { justify-content: center; margin-top: var(--sp-4); }
.chat-empty .btn { white-space: normal; text-align: left; height: auto; padding-block: 8px; }
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--card-pad) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-composer textarea { flex: 1; min-width: 0; max-height: 160px; resize: none; }
.chat-hint { padding: 0 var(--card-pad) var(--sp-3); font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface); }

/* ---------- Diálogos e avisos ---------- */

dialog.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: var(--backdrop); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal-head { padding: var(--sp-6) var(--sp-6) 0; }
.modal-head h2 { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.modal-body { padding: var(--sp-3) var(--sp-6) var(--sp-2); overflow-y: auto; font-size: var(--fs-sm); }
.modal-body > p + p, .modal-body > p + ol, .modal-body > ol + p { margin-top: var(--sp-3); }
.modal-body ol { margin: var(--sp-3) 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-4) var(--sp-6) var(--sp-6); }

.toasts {
  position: fixed;
  right: var(--sp-4);
  bottom: var(--sp-4);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 12px 12px 12px 14px;
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.toast-ok { border-left-color: #4CBF84; }
.toast-warn { border-left-color: #E6A957; }
.toast-error { border-left-color: #F07466; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x {
  flex: none;
  width: 24px;
  height: 24px;
  margin: -2px -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.toast-x:hover { opacity: 1; }
.toast.leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */

.login-page { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: var(--sp-6) var(--sp-4); }
.login-wrap { width: min(400px, 100%); }
.login-card {
  padding: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.login-card .brand { padding: 0 0 var(--sp-8); }
.login-card h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; line-height: 1.2; }
.login-card .page-sub { margin-bottom: var(--sp-6); }
.login-card form { display: flex; flex-direction: column; gap: var(--sp-3); }
.login-card .btn { margin-top: var(--sp-2); min-height: 42px; }
.login-foot { margin-top: var(--sp-5); text-align: center; font-size: var(--fs-xs); color: var(--text-muted); }

/* ---------- Responsivo ---------- */

@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .fields-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --card-pad: 16px; }
  .shell { display: block; }
  .sidebar {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    z-index: 40;
    height: auto;
    max-height: calc(100dvh - var(--topbar-h));
    padding: var(--sp-4) var(--sp-3);
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .sidebar > .brand { display: none; }
  body.nav-open .sidebar { display: block; }
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 35;
    background: var(--backdrop);
  }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .nav-label { grid-column: 1 / -1; }
  .nav a { min-height: 44px; }
  .topbar { padding: 0 var(--sp-3) 0 var(--sp-2); gap: var(--sp-2); }
  .topbar .brand { display: flex; font-size: var(--fs-md); }
  .nav-toggle {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }
  .nav-toggle:hover { background: var(--surface-2); }
  .burger, .burger::before, .burger::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  }
  .burger { position: relative; }
  .burger::before, .burger::after { content: ""; position: absolute; left: 0; }
  .burger::before { top: -6px; }
  .burger::after { top: 6px; }
  body.nav-open .burger { background: transparent; }
  body.nav-open .burger::before { transform: translateY(6px) rotate(45deg); }
  body.nav-open .burger::after { transform: translateY(-6px) rotate(-45deg); }
  .global-banner { padding: 10px var(--sp-4); }
  .view { padding: var(--sp-5) var(--sp-4) var(--sp-12); }
  .page-head { margin-bottom: var(--sp-6); }
  .page-head h1 { font-size: var(--fs-xl); }
  .fields, .fields-3 { grid-template-columns: minmax(0, 1fr); }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .input { min-height: 44px; font-size: 16px; }
  textarea.mono, .input.mono { font-size: 14px; }
  .toolbar .input { max-width: none; flex: 1 1 100%; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .form-status { flex: 1 1 100%; }
  .chat-log { height: calc(100dvh - 300px); min-height: 300px; }
  .msg-row { max-width: 92%; }
  .toasts { left: var(--sp-4); right: var(--sp-4); width: auto; }
  .kill-toggle { margin-top: var(--sp-4); }
}

@media (max-width: 720px) {
  .hide-sm { display: none; }
  .table td.actions { white-space: normal; }
  .only-sm { display: inline; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: block; padding: var(--sp-3) var(--card-pad); border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; padding: 2px 0 !important; border: 0 !important; }
  .table-stack td.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding-top: var(--sp-2) !important; text-align: left; }
  .table-stack td.actions .btn { margin: 0 !important; }
  .table-stack tr.detail-row { background: var(--surface-2); }
  .table-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: var(--fs-xs); }
  .table-stack td.num { text-align: left; }
  .table-stack td.w-min { float: left; width: auto; margin-right: var(--sp-3); }
  .table-stack tr.is-best { background: var(--accent-soft); }
  .table-stack tr.row-link:hover { background: var(--surface-2); }
  .table-stack tr.is-best td, .table-stack tr.row-link:hover td { background: transparent; }
  .table td.actions .btn { margin: 2px 0 2px 4px; }
  .table .actions .btn + .btn { margin-left: 4px; }
}

@media (max-width: 520px) {
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .topbar .brand-name { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: var(--sp-2); }
  .grid-cards { grid-template-columns: minmax(0, 1fr); }
  .qr-box { width: 100%; }
  .login-card { padding: var(--sp-6); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Seção recolhível (provedor opcional) */
.details-card > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.details-card > summary::-webkit-details-marker { display: none; }
.details-card > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
}
.details-card[open] > summary::before { transform: rotate(90deg); }
.details-card[open] > summary { margin-bottom: 1rem; }
