:root {
  /* Paleta alinhada a https://www.orbita.com.br/ */
  --bg: #f5f8fd;
  --bg-soft: #eaf0fa;
  --bg-dark: #15335f;
  --bg-dark-deep: #0d2343;
  --surface: #ffffff;
  --ink: #1a2a44;
  --muted: #516584;
  --primary: #0f5da3;
  --primary-strong: #1891ea;
  --accent: #efbb56;
  --accent-soft: #6dcff4;
  --heading: #0f3b70;
  --danger: #b71c1c;
  --ok: #1b5e20;
  --line: #cfdcf0;
  --radius: 10px;
  --font-display: "Roboto", system-ui, -apple-system, sans-serif;
  --font-body: "Roboto", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

/* ——— App shell (sidebar + content) ——— */
.app-body { background: var(--bg); }
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-dark-deep) 100%);
  color: #e8eef8;
  z-index: 40;
  transition: width 180ms ease, flex-basis 180ms ease;
}
.sidebar-brand {
  padding: 1.15rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: .35rem;
}
.sidebar-brand-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex: 1 1 auto;
}
.sidebar-brand-logo {
  display: block;
  width: 100%;
  max-width: 10.5rem;
  height: auto;
  object-fit: contain;
}
.sidebar-brand-text { display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.sidebar-brand-text .product {
  font-size: .75rem;
  color: rgba(232, 238, 248, 0.65);
}
.sidebar-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: transparent;
  color: rgba(232, 238, 248, 0.8);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sidebar-collapse-icon-expand { display: none; }
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .85rem .7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.nav-section {
  margin-top: .85rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.nav-section-label {
  display: block;
  padding: .35rem .7rem .4rem;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(232, 238, 248, 0.45);
  white-space: nowrap;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .7rem;
  border-radius: 8px;
  color: rgba(232, 238, 248, 0.82);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav-item.is-active {
  background: rgba(24, 145, 234, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary-strong);
}
.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  opacity: .9;
}
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer {
  padding: .9rem 1rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.sidebar-avatar {
  width: 2.1rem;
  height: 2.1rem;
  font-size: .72rem;
}
.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .05rem;
}
.sidebar-user-meta strong {
  font-size: .85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-meta span {
  font-size: .72rem;
  color: rgba(232, 238, 248, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout { margin: 0; }
.sidebar .btn-ghost {
  color: var(--ink);
  background: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}
.sidebar .btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

/* Desktop collapsed: icons + tooltips */
@media (min-width: 961px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
    flex-basis: var(--sidebar-w-collapsed);
  }
  body.sidebar-collapsed .sidebar-brand {
    padding: .9rem .55rem;
    justify-content: center;
  }
  body.sidebar-collapsed .sidebar-brand-link {
    justify-content: center;
    align-items: center;
  }
  body.sidebar-collapsed .sidebar-brand-logo {
    display: block;
    max-width: 100%;
    width: 100%;
  }
  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .sidebar-user-meta {
    display: none;
  }
  body.sidebar-collapsed .sidebar-collapse {
    display: none;
  }
  body.sidebar-collapsed .sidebar-collapse-icon-collapse { display: none; }
  body.sidebar-collapsed .sidebar-collapse-icon-expand { display: block; }
  body.sidebar-collapsed .sidebar-nav {
    padding: .7rem .45rem 1rem;
    align-items: stretch;
  }
  body.sidebar-collapsed .nav-section {
    margin-top: .55rem;
  }
  body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: .7rem .4rem;
    gap: 0;
    box-shadow: none;
  }
  body.sidebar-collapsed .nav-item.is-active {
    box-shadow: inset 0 0 0 1px rgba(24, 145, 234, 0.55);
  }
  body.sidebar-collapsed .sidebar-footer {
    padding: .75rem .45rem 1rem;
    align-items: center;
  }
  body.sidebar-collapsed .sidebar-user {
    justify-content: center;
  }
  body.sidebar-collapsed .sidebar-logout {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
  }
  body.sidebar-collapsed .sidebar-logout .btn {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    position: relative;
  }
  body.sidebar-collapsed .sidebar-logout .btn::before {
    content: attr(data-icon);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    color: inherit;
  }
  body.sidebar-collapsed .sidebar-logout form,
  body.sidebar-collapsed form.sidebar-logout {
    width: auto;
    margin: 0;
  }

  /* Tooltips when collapsed */
  body.sidebar-collapsed .nav-item[data-tooltip]::after,
  body.sidebar-collapsed .sidebar-user[data-tooltip]::after,
  body.sidebar-collapsed .sidebar-logout .btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + .55rem);
    top: 50%;
    transform: translateY(-50%);
    padding: .35rem .55rem;
    border-radius: 6px;
    background: #0d2343;
    color: #fff;
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(8, 24, 48, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    z-index: 60;
  }
  body.sidebar-collapsed .nav-item[data-tooltip]:hover::after,
  body.sidebar-collapsed .nav-item[data-tooltip]:focus-visible::after,
  body.sidebar-collapsed .sidebar-user[data-tooltip]:hover::after,
  body.sidebar-collapsed .sidebar-logout .btn[data-tooltip]:hover::after,
  body.sidebar-collapsed .sidebar-logout .btn[data-tooltip]:focus-visible::after {
    opacity: 1;
  }
  body.sidebar-collapsed .sidebar-user,
  body.sidebar-collapsed .sidebar-logout .btn {
    position: relative;
  }
}
.btn-logout {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--ink);
}
.btn-logout:hover {
  background: var(--bg-soft);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-topbar-title h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--heading);
  font-family: var(--font-display);
}
.app-topbar-title { flex: 1 1 auto; min-width: 0; }
.app-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--heading);
}
.btn-ghost:hover { background: var(--bg-soft); }

.simulacao-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid #e0a060;
  background: linear-gradient(90deg, #fff8ef 0%, #fff3e0 100%);
  color: #5d3a12;
  box-shadow: 0 2px 10px rgba(93, 58, 18, 0.06);
}
.simulacao-banner-text {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  font-size: .9rem;
  line-height: 1.35;
}
.simulacao-banner-hint {
  font-size: .8rem;
  color: #8a5a22;
}
.simulacao-banner-actions { flex: 0 0 auto; }
.btn-simulacao-exit {
  background: #5d3a12;
  border-color: #5d3a12;
  color: #fff;
}
.btn-simulacao-exit:hover { filter: brightness(1.08); }
body.is-simulating .app-topbar {
  border-bottom-color: #e0a060;
}

@media (max-width: 640px) {
  .simulacao-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  flex: 0 0 auto;
}
.sidebar-toggle:hover {
  background: var(--bg-soft);
}
.sidebar-backdrop {
  display: none;
}
.app-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.35rem 1.5rem 3rem;
}

/* Legacy topbar (login / standalone pages still ok) */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 93, 163, 0.06);
}
.brand-block { display: flex; flex-direction: column; gap: .1rem; }
.brand { font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; color: var(--heading); }
.product { font-size: .85rem; color: var(--muted); }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar a { color: var(--primary); text-decoration: none; font-weight: 500; }
.topbar a:hover { color: var(--primary-strong); }

.container { max-width: 1200px; margin: 1.5rem auto; padding: 0 1rem 3rem; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(26, 42, 68, 0.06);
}
.panel h2 { margin: 0 0 .35rem; font-family: var(--font-display); color: var(--heading); }
.hint { color: var(--muted); margin: 0 0 1rem; font-size: .92rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.data-table td.col-actions {
  vertical-align: middle;
  width: 1%;
  white-space: nowrap;
}
.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  vertical-align: middle;
}
.row-actions form {
  display: inline;
  margin: 0;
}
th.is-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  color: var(--heading);
  transition: color 120ms ease;
}
th.is-sortable:hover,
th.is-sortable:focus-visible {
  color: var(--primary);
  outline: none;
}
th.is-sortable .sort-indicator {
  display: inline-block;
  margin-left: .35rem;
  opacity: .35;
  font-size: .7rem;
  vertical-align: middle;
}
th.is-sortable .sort-indicator::before { content: "↕"; }
th.is-sortable[data-sort-dir="asc"] .sort-indicator {
  opacity: 1;
  color: var(--primary);
}
th.is-sortable[data-sort-dir="asc"] .sort-indicator::before { content: "↑"; }
th.is-sortable[data-sort-dir="desc"] .sort-indicator {
  opacity: 1;
  color: var(--primary);
}
th.is-sortable[data-sort-dir="desc"] .sort-indicator::before { content: "↓"; }
tr.inactive { opacity: .55; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.erro { max-width: 280px; word-break: break-word; color: var(--danger); font-size: .85rem; }

.badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: .78rem;
}
.status-Enviado { background: #e8f5e9; color: var(--ok); }
.status-Falha { background: #ffebee; color: var(--danger); }
.status-FallbackUtilizado { background: #fff8e1; color: #e65100; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .55rem 1.05rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: .01em;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(21, 51, 95, 0.06);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}
a.btn:hover,
a.btn:focus,
a.btn:active {
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(180deg, var(--primary-strong), var(--primary));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(24, 145, 234, 0.28);
}
.btn-danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(183, 28, 28, 0.22);
}
.btn-small { padding: .35rem .85rem; font-size: .8rem; }
.sidebar .sidebar-logout .btn {
  color: var(--ink);
  background: #fff;
}
.sidebar .sidebar-logout .btn:hover {
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: #b5c8e4;
  box-shadow: 0 4px 12px rgba(21, 51, 95, 0.1);
}
.btn-primary:hover {
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(24, 145, 234, 0.35);
}
.btn-danger:hover {
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(183, 28, 28, 0.28);
}
.topbar .btn {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 93, 163, 0.12);
}
.topbar .btn:hover {
  color: var(--primary-strong);
  border-color: var(--primary-strong);
  background: #f3f8fd;
  box-shadow: 0 2px 8px rgba(15, 93, 163, 0.16);
  transform: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem 1rem;
}
.form-config {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}
.form-grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .span-2 { grid-column: span 2; }

.check-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.5rem;
  padding: .75rem .9rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.check-option {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: .55rem;
  margin: 0;
  font-size: .9rem;
  cursor: pointer;
  min-height: auto;
}
.check-option input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
/* asp-for checkbox injeta um hidden sibling — tira do fluxo visual */
.check-option input[type="hidden"] {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.check-option span {
  line-height: 1.2;
  white-space: nowrap;
}
.form-grid .field-hint {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.35;
}
.form-grid .field-hint-inline {
  color: var(--muted);
  font-size: .85rem;
}
.form-grid input:not([type="checkbox"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
}
@media (max-width: 800px) {
  .form-config {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: 1 / -1;
  }
}
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .65rem;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: end;
  margin-bottom: 1rem;
}
.filters label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: .35rem; align-items: center; }
.actions .btn,
.actions .inline-form .btn {
  min-width: 8.75rem;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 35, 67, 0.55);
}
.modal-dialog {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(8, 24, 48, 0.35);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: .35rem;
}
.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--heading);
  font-size: 1.15rem;
}
.modal-close {
  min-width: 2rem;
  padding: .2rem .55rem;
  line-height: 1;
  font-size: 1.2rem;
}
.modal-form { margin-top: .75rem; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: .35rem;
}
.panel-head h2 { margin: 0; }
.form-actions { display: flex; gap: .75rem; align-items: center; }
.readonly-field {
  background: var(--bg-soft);
  color: var(--muted);
  cursor: not-allowed;
}
.form-grid [hidden] { display: none !important; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-ok { background: #e8f5e9; color: var(--ok); }
.alert-error { background: #ffebee; color: var(--danger); }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-dark-deep) 100%);
}
.login-card {
  width: min(400px, 92vw);
  background: var(--surface);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(8, 24, 48, 0.35);
  border: 1px solid rgba(109, 207, 244, 0.2);
}
.login-card .brand {
  color: var(--accent);
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .78rem;
}
.login-logo {
  display: block;
  width: min(220px, 72%);
  height: auto;
  margin: 0 auto .85rem;
}
.login-card h1 { margin: .2rem 0; font-size: 1.8rem; color: var(--heading); }
.login-card .subtitle { color: var(--muted); margin: 0 0 1.25rem; }
.login-card label { display: block; margin: .7rem 0 .3rem; font-size: .9rem; }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 1.1rem; }

/* ——— Página Usuários ——— */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .85rem;
}
.page-header h1 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--heading);
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
}
.page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  box-shadow: 0 4px 14px rgba(26, 42, 68, 0.04);
}
.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.1;
}
.stat-label {
  font-size: .8rem;
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.split-grid > .panel { margin-bottom: 0; }

.form-stack {
  grid-template-columns: 1fr;
}

.panel-head-wrap {
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.panel-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .45rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hint.tight { margin: .25rem 0 0; }

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-pill.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.entity-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.entity-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff 0%, var(--bg) 140%);
}
.entity-card.is-inactive {
  opacity: .72;
  background: var(--bg-soft);
}
.entity-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary-strong), var(--primary));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
  flex: 0 0 auto;
}
.entity-body { flex: 1 1 220px; min-width: 0; }
.entity-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin-bottom: .15rem;
}
.entity-title {
  margin: 0;
  font-size: 1rem;
  color: var(--heading);
  font-weight: 600;
}
.entity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.entity-email {
  margin: 0 0 .65rem;
  color: var(--muted);
  font-size: .9rem;
  word-break: break-word;
}
.entity-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .5rem .85rem;
  margin: 0;
}
.entity-meta div { min-width: 0; }
.entity-meta dt {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .1rem;
}
.entity-meta dd {
  margin: 0;
  font-size: .88rem;
  color: var(--ink);
  word-break: break-word;
}
.entity-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  align-items: stretch;
  flex: 0 0 auto;
  margin-left: auto;
}
.entity-actions .btn {
  width: 100%;
  min-width: 7.5rem;
  justify-content: center;
  display: inline-flex;
}

.badge-tipo-Admin {
  background: #e3f2fd;
  color: var(--primary);
}
.badge-tipo-Cliente {
  background: #e0f7fa;
  color: #006064;
}

.btn-danger-outline {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 1px 2px rgba(183, 28, 28, 0.08);
}
.btn-danger-outline:hover {
  background: #ffebee;
  border-color: var(--danger);
  box-shadow: 0 3px 10px rgba(183, 28, 28, 0.14);
}

.empty-state {
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: .95rem;
}

.invite-banner { display: flex; flex-direction: column; gap: .55rem; }
.invite-banner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.invite-banner .hint { margin: 0; }
.invite-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.invite-link {
  flex: 1 1 220px;
  display: block;
  padding: .55rem .7rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .82rem;
  word-break: break-all;
  color: var(--ink);
}

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    flex-basis: 260px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 8px 0 28px rgba(8, 24, 48, 0.35);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-collapse { display: none; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 35, 67, 0.45);
    z-index: 35;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .app-content { padding: 1.1rem 1rem 2.5rem; }
  .app-topbar { padding: .75rem 1rem; }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
  }
  .topbar nav {
    width: 100%;
    flex-wrap: wrap;
    gap: .65rem .9rem;
  }
  .container { margin-top: 1rem; padding: 0 .85rem 2.5rem; }
  .panel { padding: 1rem; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .stat-chip { padding: .7rem .8rem; }
  .stat-value { font-size: 1.25rem; }
  .entity-card {
    gap: .75rem;
  }
  .entity-actions {
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .entity-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
  .panel-head-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-pills { width: 100%; }
  .filter-pill { flex: 1; justify-content: center; }
  .notice {
    flex-direction: column;
    align-items: stretch;
  }
  .notice .btn { align-self: flex-start; }
}

/* ——— Dashboard ——— */
.dash-welcome {
  margin-bottom: 1.25rem;
}
.dash-eyebrow {
  margin: 0 0 .2rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
}
.dash-greeting {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  color: var(--heading);
  font-family: var(--font-display);
}
.dash-stats { margin-bottom: 1.25rem; }
.stat-suffix {
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: .15rem;
}
.stat-chip-danger .stat-value { color: var(--danger); }

tr.row-alerta { background: #fff8f8; }
tr.is-selected { outline: 2px solid var(--primary-strong); outline-offset: -2px; }
.badge-alerta { background: #ffebee; color: var(--danger); font-weight: 600; }
.badge-status-novo { background: #e3f2fd; color: var(--primary); }
.badge-status-recorrente { background: var(--bg-soft); color: var(--muted); }
.badge-status-quieto { background: var(--bg-soft); color: var(--muted); }
.badge-resolvida { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.badge-reapareceu { background: #fff3e0; color: #e65100; font-weight: 600; }

.stack-pre {
  overflow: auto;
  max-height: 22rem;
  margin: 0;
  padding: .85rem 1rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.subhead {
  margin: 1.1rem 0 .45rem;
  font-size: .95rem;
}
.message-samples {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.message-samples li {
  margin: .45rem 0;
  display: flex;
  gap: .55rem;
  align-items: flex-start;
}
.message-count {
  flex: 0 0 auto;
  min-width: 2.4rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--muted, #5c6570);
}
.message-variant-body {
  min-width: 0;
  flex: 1;
}
.variant-stack {
  margin: .35rem 0 0;
}
.variant-stack summary {
  cursor: pointer;
  color: var(--muted, #5c6570);
  font-size: .9rem;
}

.stat-chip-prio-muito-alta {
  border-color: #d32f2f;
  background: #fdecea;
}
.stat-chip-prio-muito-alta .stat-value { color: #c62828; }
.stat-chip-prio-muito-alta .stat-label { color: #b71c1c; }

.stat-chip-prio-alta {
  border-color: #ef6c00;
  background: #fff4e5;
}
.stat-chip-prio-alta .stat-value { color: #e65100; }
.stat-chip-prio-alta .stat-label { color: #e65100; }

.stat-chip-prio-normal {
  border-color: var(--primary);
  background: #e8f4fc;
}
.stat-chip-prio-normal .stat-value { color: var(--primary); }
.stat-chip-prio-normal .stat-label { color: var(--primary); }

.stat-chip-prio-baixa {
  border-color: var(--ok);
  background: #e8f5e9;
}
.stat-chip-prio-baixa .stat-value { color: var(--ok); }
.stat-chip-prio-baixa .stat-label { color: var(--ok); }

.section-head {
  margin-bottom: .75rem;
}
.section-head h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--heading);
}

.notice-board { margin-bottom: 1.25rem; }
.notice-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(26, 42, 68, 0.04);
}
.notice-body { min-width: 0; flex: 1 1 auto; }
.notice-body h4 {
  margin: 0 0 .25rem;
  font-size: .95rem;
  color: var(--heading);
}
.notice-body p {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.4;
}
.notice-ok { border-left: 4px solid var(--ok); }
.notice-info { border-left: 4px solid var(--primary); }
.notice-warning { border-left: 4px solid #e65100; background: #fffbf5; }
.notice-danger { border-left: 4px solid var(--danger); background: #fff8f8; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.dash-grid > .panel { margin-bottom: 0; }
.dash-meta { padding: .85rem 1.15rem; }
.dash-meta .hint { margin: 0; }

.quick-links {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.quick-link {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .85rem .95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 160%);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.quick-link:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(15, 93, 163, 0.1);
}
.quick-link strong {
  color: var(--heading);
  font-size: .95rem;
}
.quick-link span {
  color: var(--muted);
  font-size: .85rem;
}

/* ——— Unificador SPED ——— */
.sped-panel { max-width: 720px; }
.sped-form { display: flex; flex-direction: column; gap: 1.1rem; }
.sped-field { display: flex; flex-direction: column; gap: .45rem; }
.sped-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--heading);
}
.sped-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sped-dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff 0%, var(--bg) 160%);
  padding: 1.75rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.sped-dropzone:hover,
.sped-dropzone.is-drag-over,
.sped-dropzone:focus-visible {
  border-color: var(--primary-strong);
  background: #f2f7ff;
  box-shadow: 0 0 0 3px rgba(24, 145, 234, 0.12);
  outline: none;
}
.sped-dropzone-title {
  margin: 0 0 .35rem;
  font-weight: 600;
  color: var(--heading);
}
.sped-dropzone-subtitle {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}
.sped-matriz-fieldset {
  margin: 0;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.sped-matriz-fieldset legend {
  padding: 0 .35rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--heading);
}
.sped-matriz-help {
  margin: 0 0 .75rem;
  font-size: .88rem;
  color: var(--muted);
}
.sped-matriz-lista {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.sped-matriz-item {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.sped-matriz-item:hover {
  border-color: var(--primary);
}
.sped-matriz-item:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 93, 163, 0.12);
  background: #f5faff;
}
.sped-matriz-item input {
  margin-top: .15rem;
  accent-color: var(--primary);
}
.sped-matriz-name {
  font-size: .9rem;
  word-break: break-word;
}
.sped-trust { margin: 0; }
.sped-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.sped-status {
  margin: 0;
  padding: .7rem .9rem;
  border-radius: 8px;
  font-size: .9rem;
  background: var(--bg-soft);
  color: var(--ink);
}
.sped-status--ok {
  background: #e8f5e9;
  color: var(--ok);
}
.sped-status--error {
  background: #ffebee;
  color: var(--danger);
}
.sped-status--busy {
  background: #eef6ff;
  color: var(--primary);
}

/* Indicador de força de senha */
.senha-forca {
  margin: .5rem 0 1rem;
  padding: .75rem .9rem;
  border-radius: 8px;
  background: var(--bg-soft, #f4f7fb);
  border: 1px solid rgba(21, 51, 95, 0.08);
  font-size: .88rem;
}
.senha-forca-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .4rem;
}
.senha-forca-label { color: var(--muted); }
.senha-forca.is-fraca .senha-forca-nivel { color: var(--danger, #c62828); }
.senha-forca.is-media .senha-forca-nivel { color: #e65100; }
.senha-forca.is-forte .senha-forca-nivel { color: var(--ok, #2e7d32); }
.senha-forca-barra {
  height: 6px;
  border-radius: 999px;
  background: rgba(21, 51, 95, 0.12);
  overflow: hidden;
  margin-bottom: .65rem;
}
.senha-forca-barra-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width .2s ease, background-color .2s ease;
  background: var(--danger, #c62828);
}
.senha-forca.is-media .senha-forca-barra-fill { background: #fb8c00; }
.senha-forca.is-forte .senha-forca-barra-fill { background: var(--ok, #2e7d32); }
.senha-forca-reqs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .25rem;
}
.senha-forca-reqs li {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  color: var(--muted);
}
.senha-forca-check {
  flex: 0 0 1rem;
  width: 1rem;
  text-align: center;
}
.senha-forca-reqs li.is-ok { color: var(--ok, #2e7d32); }
.senha-forca-reqs li.is-ok .senha-forca-check::before { content: "✓"; }
.senha-forca-reqs li.is-fail .senha-forca-check::before { content: "·"; }
.senha-forca-req-detail { padding-left: .75rem; font-size: .82rem; }

.senha-toggle {
  position: relative;
  display: block;
  width: 100%;
}
.senha-toggle input {
  width: 100%;
  padding-right: 2.6rem;
}
.senha-toggle-btn {
  position: absolute;
  right: .25rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}
.senha-toggle-btn:hover,
.senha-toggle-btn:focus-visible {
  color: var(--primary);
  background: var(--bg-soft);
  outline: none;
}
.senha-toggle-btn[aria-pressed="true"] {
  color: var(--primary);
}
.login-card .senha-toggle-btn {
  width: 2.1rem;
  margin-top: 0;
}

/* Relatórios admin */
.report-map-panel { margin-bottom: 1.25rem; }
.report-map-note { margin: .85rem 0 0; }

.brasil-mapa {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  grid-template-areas:
    "norte nordeste"
    "centro nordeste"
    "sudeste sul";
  gap: .75rem;
}
.brasil-regiao-norte { grid-area: norte; }
.brasil-regiao-nordeste { grid-area: nordeste; }
.brasil-regiao-centro-oeste { grid-area: centro; }
.brasil-regiao-sudeste { grid-area: sudeste; }
.brasil-regiao-sul { grid-area: sul; }

.brasil-regiao {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .75rem .85rem;
  background: color-mix(in srgb, var(--primary) calc(var(--dens, 0) * 18%), var(--surface));
}
.brasil-regiao-head {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin-bottom: .65rem;
}
.brasil-regiao-head strong {
  color: var(--heading);
  font-size: .95rem;
}
.brasil-regiao-head span {
  color: var(--muted);
  font-size: .78rem;
}

.brasil-ufs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.brasil-uf {
  min-width: 3.4rem;
  padding: .35rem .45rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .05rem;
  line-height: 1.15;
}
.brasil-uf.is-presente {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
  background: color-mix(in srgb, var(--primary) calc(22% + var(--heat, 0) * 45%), #fff);
  color: var(--heading);
}
.brasil-uf.is-vazio {
  opacity: .45;
}
.brasil-uf-sigla {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.brasil-uf-qtd {
  font-size: .78rem;
  color: var(--muted);
}
.brasil-uf.is-presente .brasil-uf-qtd { color: var(--heading); }

.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-wrap-wide {
    height: 280px;
}

.report-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.report-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .85rem;
  margin-bottom: .2rem;
}
.report-bar-meta span { color: var(--heading); }
.report-bar-meta strong { color: var(--muted); font-weight: 600; }
.report-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
}
.report-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.report-ops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.report-ops li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.report-ops li:last-child { border-bottom: 0; }
.report-ops a { color: var(--primary); text-decoration: none; }
.report-ops a:hover { text-decoration: underline; }

.dash-stats {
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
}

.text-right { text-align: right; }

.report-filters { margin-bottom: 1.25rem; }
.report-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .85rem 1.25rem;
}
.report-filters-empresa {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .9rem;
  min-width: min(100%, 280px);
  flex: 1 1 220px;
}
.report-filters-row select {
  display: block;
  width: 100%;
  min-height: 2.4rem;
}
.report-filters-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-left: auto;
  padding-bottom: .15rem;
}
.is-selected-row td {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.modal-dialog-wide {
  width: min(720px, 100%);
}

.data-table td.col-descricao {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 28rem;
}

.suporte-bloco {
  margin-top: .9rem;
}
.suporte-bloco h4 {
  margin: 0 0 .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.suporte-texto {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .92rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .brasil-mapa {
    grid-template-columns: 1fr;
    grid-template-areas:
      "norte"
      "nordeste"
      "centro"
      "sudeste"
      "sul";
  }
}

