:root {
  --blue: #2563eb;
  --indigo: #3949ab;
  --green: #0f9d68;
  --orange: #b7791f;
  --pink: #a3275c;
  --red: #c0324d;
  --ink: #1f2937;
  --muted: #6b7280;
  --surface: #ffffff;
  --surface-alt: #f4f5f7;
  --border: #e2e4e9;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: var(--surface-alt);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- surface base (antes "glass") ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
}

.card {
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* ---------- header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 30;
  margin: -20px -24px 0;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.progress-badge {
  text-align: right;
}

.progress-value {
  display: block;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--indigo);
}

.progress-label {
  font-size: 10px;
  color: var(--muted);
}

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.stat {
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  border-left: 3px solid transparent;
}

.stat-blue { border-left-color: var(--blue); }
.stat-green { border-left-color: var(--green); }
.stat-orange { border-left-color: var(--orange); }
.stat-pink { border-left-color: var(--pink); }
.stat-red { border-left-color: var(--red); }
.stat-purple { border-left-color: var(--indigo); }

.stat-blue .stat-icon { color: var(--blue); background: rgba(37, 99, 235, 0.1); }
.stat-green .stat-icon { color: var(--green); background: rgba(15, 157, 104, 0.1); }
.stat-orange .stat-icon { color: var(--orange); background: rgba(183, 121, 31, 0.1); }
.stat-pink .stat-icon { color: var(--pink); background: rgba(163, 39, 92, 0.1); }
.stat-red .stat-icon { color: var(--red); background: rgba(192, 50, 77, 0.1); }
.stat-purple .stat-icon { color: var(--indigo); background: rgba(79, 70, 229, 0.1); }

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.stat-icon svg {
  width: 15px;
  height: 15px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

/* ---------- import panel ---------- */
.import-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1.5px dashed rgba(57, 73, 171, 0.35);
}

.import-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.import-text .hint {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- buttons ---------- */
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-outline {
  background: var(--surface);
  color: var(--indigo);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--surface-alt);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-link {
  background: transparent;
  color: var(--indigo);
  padding: 8px 6px;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

/* botões de ação primária (mantém o nome de classe "btn-glass" por compatibilidade, visual agora é sólido) */
.btn-glass {
  color: #fff;
  border: 1px solid transparent;
}
.btn-glass:hover { filter: brightness(1.08); }
.btn-glass:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-glass-blue { background: var(--indigo); }
.btn-glass-orange { background: var(--orange); }

/* ---------- actions row ---------- */
.actions-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  row-gap: 12px;
  flex-wrap: wrap;
}

/* ---------- table panel ---------- */
.table-panel {
  padding: 14px 16px 6px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.tab {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab.active {
  background: rgba(57, 73, 171, 0.12);
  color: var(--indigo);
}
.tab:hover:not(.active) { background: rgba(0, 0, 0, 0.04); }

.search-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  margin-bottom: 8px;
}
.search-input:focus {
  outline: none;
  border-color: var(--indigo);
}

.table-count {
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 6px;
}

.table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(244, 245, 251, 0.95);
  text-align: left;
  padding: 7px 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

tbody tr:hover { background: rgba(57, 73, 171, 0.04); }

td.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-enviado { background: rgba(16, 185, 129, 0.14); color: #047857; }
.badge-pendente { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.badge-falha { background: rgba(225, 29, 72, 0.12); color: #be123c; }
.badge-bloqueado { background: rgba(79, 70, 229, 0.12); color: #4338ca; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(31, 41, 55, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error { background: rgba(225, 29, 72, 0.92); }
.toast.ok { background: rgba(16, 185, 129, 0.92); }

@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .progress-badge { text-align: left; }
  .import-panel { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ================= auth pages (login / setup) ================= */

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 14px;
}

.auth-links a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.auth-links a:hover { text-decoration: underline; }
.auth-link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #2563eb;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth-link-button:hover { text-decoration: underline; }
.auth-success { color: #15803d !important; }
.auth-result-card { text-align: center; }

.user-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chip-success { color: #166534; background: #dcfce7; }
.chip-warning { color: #92400e; background: #fef3c7; }
.chip-danger { color: #991b1b; background: #fee2e2; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-brand img { display: block; border-radius: 6px; }
.auth-brand h1 { margin: 0; font-size: 16px; }
.auth-brand .subtitle { margin: 2px 0 0; font-size: 12px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.15);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field-check input { width: auto; }

.auth-submit {
  justify-content: center;
  text-align: center;
  padding: 10px 14px;
  margin-top: 4px;
}

.auth-error {
  margin: 0;
  min-height: 16px;
  color: var(--red);
  font-size: 12.5px;
  text-align: center;
}

/* ================= app shell (sidebar layout) ================= */

.shell {
  display: grid;
  grid-template-columns: 224px 1fr;
  min-height: 100vh;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-radius: 0;
  border-right: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}
.sidebar-brand img { display: block; }
.sidebar-brand strong { font-size: 13.5px; display: block; line-height: 1.2; }
.sidebar-brand span { font-size: 10.5px; color: var(--muted); }

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.nav-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 10px;
  margin: 4px 0 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 5px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.nav-item svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.nav-item:hover { background: rgba(57, 73, 171, 0.08); }
.nav-item.active { background: rgba(57, 73, 171, 0.1); color: var(--indigo); }
.nav-item.active svg { color: var(--indigo); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px;
  border-radius: 6px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  flex: none;
  overflow: hidden;
}

.avatar img,
.avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-chip-info { min-width: 0; flex: 1; }
.user-chip-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 10.5px; color: var(--muted); text-transform: capitalize; }

.btn-logout {
  width: 100%;
  margin-top: 8px;
  justify-content: center;
  text-align: center;
}

.main {
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.view { display: none; flex-direction: column; gap: 14px; }
.view.active { display: flex; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.view-header h2 { margin: 0; font-size: 16px; }
.view-header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ================= settings cards (sender profiles / users) ================= */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.entity-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entity-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.entity-card-head h3 { margin: 0; font-size: 13.5px; }
.entity-card-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); word-break: break-all; }

.chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  white-space: nowrap;
}
.chip-muted { background: rgba(107, 114, 128, 0.14); color: var(--muted); }
.chip-admin { background: rgba(214, 51, 108, 0.14); color: var(--pink); }

.entity-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
  border-radius: 5px;
}

.btn-danger-ghost {
  background: rgba(225, 29, 72, 0.08);
  color: var(--red);
  border: 1px solid rgba(225, 29, 72, 0.2);
}
.btn-danger-ghost:hover { background: rgba(225, 29, 72, 0.14); }

.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

/* ================= modal ================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 24, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-overlay.show { display: flex; }

.modal {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 14.5px; }

.modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  padding: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ================= profile view ================= */

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  flex: none;
  overflow: hidden;
  cursor: pointer;
}

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

@media (max-width: 780px) {
  .profile-forms { grid-template-columns: 1fr; }
}

.form-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-card h3 { margin: 0 0 2px; font-size: 13px; }

/* ================= activity list ================= */

.activity-list { display: flex; flex-direction: column; }

.activity-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 12.5px;
}
.activity-row:last-child { border-bottom: none; }
.activity-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.activity-actor { font-weight: 700; }

/* ================= misc utilities ================= */

.panel-pad { padding: 14px; }
.panel-pad-tight { padding: 4px 16px; }
.field-sender { min-width: 200px; }
.profile-name { font-weight: 700; font-size: 15px; }
.profile-email { color: var(--muted); font-size: 12px; }
.admin-only { display: none; }
body.is-admin .admin-only { display: inline-flex; }
.btn-self-start { align-self: flex-start; }

/* ================= cobrança / whatsapp ================= */

.wa-connect-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.wa-connect-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.wa-dot-conectado { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }
.wa-dot-aguardando_qr { background: var(--orange); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.wa-dot-iniciando { background: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.wa-dot-falha { background: var(--red); box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18); }
.wa-dot-desconectado { background: var(--muted); }

.wa-status-label { font-weight: 700; font-size: 13px; }
.wa-status-detail { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

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

.wa-limit-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  flex-wrap: wrap;
}
.wa-limit-value { margin-top: 4px; font-size: 14px; }
.wa-limit-value strong { color: var(--indigo); font-size: 20px; }
.wa-limit-form { align-items: end; gap: 8px; flex-wrap: wrap; }
.wa-limit-field { min-width: 150px; }
.wa-limit-field input { width: 150px; }

.wa-optout-card {
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
}
.wa-optout-form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; width: 100%; }
.wa-optout-reason { flex: 1; min-width: 240px; }
.wa-optout-list { display: grid; gap: 6px; width: 100%; }
.wa-optout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.wa-optout-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wa-optout-row strong { font-size: 12px; }
.wa-optout-row span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }

.wa-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}
.wa-qr-card img {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}
.wa-qr-card p {
  margin: 0;
  max-width: 360px;
  font-size: 12px;
  color: var(--muted);
}

/* ================= Portal Vianet ================= */

.portal-page {
  font-family: "Segoe UI Variable Text", Aptos, "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(57, 73, 171, 0.08), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(163, 39, 92, 0.07), transparent 24%),
    #f5f6fa;
  color: #182033;
}

.portal-topbar {
  min-height: 72px;
  padding: 13px max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #ffffff;
  border-bottom: 1px solid #e5e8ef;
  box-shadow: 0 1px 8px rgba(18, 32, 56, 0.04);
  position: sticky;
  top: 0;
  z-index: 20;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}
.portal-brand img { display: block; object-fit: contain; }
.portal-brand strong { display: block; font-size: 16px; line-height: 19px; letter-spacing: -0.02em; }
.portal-brand small { display: block; margin-top: 1px; color: #7a8393; font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }

.portal-account { display: flex; align-items: center; gap: 18px; }
.portal-user { display: flex; align-items: center; gap: 9px; }
.portal-user strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.portal-user span { display: block; margin-top: 2px; color: #7a8393; font-size: 10.5px; }
.portal-avatar { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; flex: none; border-radius: 50%; background: #3949ab; color: #fff; font-size: 11px; font-weight: 800; }
.portal-avatar img { width: 100%; height: 100%; object-fit: cover; }
.portal-logout { padding: 7px 12px; border: 1px solid #dfe3ea; border-radius: 7px; background: #fff; color: #4f596a; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.portal-logout:hover { color: #b42345; border-color: #efc4cd; background: #fff7f8; }
.portal-logout:disabled { opacity: 0.55; cursor: wait; }

.portal-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 54px; }

.portal-hero {
  min-height: 276px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  align-items: center;
  overflow: hidden;
  position: relative;
  border-radius: 16px;
  background: linear-gradient(118deg, #172c49 0%, #213d61 68%, #29476e 100%);
  box-shadow: 0 16px 42px rgba(27, 48, 80, 0.15);
}
.portal-hero::after { content: ""; position: absolute; width: 330px; height: 330px; border-radius: 50%; right: -125px; top: -175px; background: rgba(198, 44, 112, 0.26); filter: blur(4px); }
.portal-hero-copy { padding: 48px 54px; position: relative; z-index: 2; }
.portal-eyebrow { color: #aebfd6; font-size: 11px; font-weight: 600; letter-spacing: .025em; }
.portal-hero h1 { margin: 16px 0 11px; color: #fff; font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: clamp(34px, 4vw, 47px); font-weight: 650; line-height: 1.08; letter-spacing: -0.035em; }
.portal-hero h1 #portal-first-name { font-weight: 760; }
.portal-hero p { max-width: 560px; margin: 0; color: #cbd7e9; font-size: 14px; line-height: 1.65; }
.portal-today { margin-top: 30px; color: #91a7c4; font-size: 11.5px; text-transform: none; }
.portal-hero-art { min-height: 276px; position: relative; display: grid; place-items: center; z-index: 1; }
.portal-art-mark { width: 164px; height: 164px; display: grid; place-items: center; position: relative; z-index: 3; border: 1px solid rgba(255,255,255,.16); border-radius: 30px; background: rgba(255,255,255,.09); box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 24px 55px rgba(5,14,28,.25); transform: rotate(-3deg); backdrop-filter: blur(8px); }
.portal-art-mark img { object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0,0,0,.18)); }
.portal-orbit { position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.portal-orbit-one { width: 250px; height: 250px; }
.portal-orbit-two { width: 340px; height: 340px; }

.portal-systems { margin-top: 48px; }
.portal-section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.portal-section-kicker { display: block; margin-bottom: 6px; color: #a3275c; font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.portal-section-head h2 { margin: 0; font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: 26px; font-weight: 650; letter-spacing: -0.025em; }
.portal-section-head p { margin: 5px 0 0; color: #778092; font-size: 13px; }
.portal-system-count { padding: 0 2px 3px; color: #687386; font-size: 11.5px; font-weight: 500; }
.portal-system-count strong { color: #263d59; font-size: 17px; font-weight: 650; }
.portal-system-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.portal-system-card { min-height: 310px; padding: 27px; display: flex; flex-direction: column; position: relative; overflow: hidden; border: 1px solid #e0e4eb; border-radius: 12px; background: #ffffff; box-shadow: 0 5px 18px rgba(28, 42, 68, 0.045); color: inherit; text-decoration: none; }
.portal-system-active { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.portal-system-active::before { content: ""; width: 3px; height: 44px; position: absolute; top: 27px; left: 0; border-radius: 0 3px 3px 0; background: #a3275c; }
.portal-system-active:hover { transform: translateY(-4px); border-color: #c9cfe1; box-shadow: 0 17px 36px rgba(28, 42, 68, 0.12); }
.portal-card-top { min-height: 16px; display: flex; align-items: center; justify-content: flex-end; margin-bottom: 24px; }
.portal-status, .portal-soon-label { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; }
.portal-status { color: #0b7a53; }
.portal-status i { width: 6px; height: 6px; border-radius: 50%; background: #0f9d68; }
.portal-soon-label { color: #858e9d; }
.portal-card-category { color: #9b3362; font-size: 11px; font-weight: 650; letter-spacing: .01em; }
.portal-system-card h3 { margin: 8px 0 9px; font-family: "Segoe UI Variable Display", "Segoe UI", sans-serif; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.portal-system-card > p { margin: 0; color: #6d7687; font-size: 13px; line-height: 1.65; }
.portal-tags { display: flex; flex-wrap: wrap; gap: 0; margin-top: 20px; }
.portal-tags span { color: #667083; font-size: 10.5px; font-weight: 600; }
.portal-tags span + span::before { content: "·"; padding: 0 9px; color: #b0b5bf; }
.portal-card-action { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 22px; border-top: 1px solid #edf0f4; color: #3949ab; font-size: 12px; font-weight: 800; }
.portal-card-action span { font-size: 20px; transition: transform .2s ease; }
.portal-system-active:hover .portal-card-action span { transform: translateX(4px); }
.portal-system-soon { opacity: .76; background: rgba(250,251,252,.85); }
.portal-card-placeholder { display: flex; gap: 7px; margin-top: auto; padding-top: 24px; border-top: 1px solid #edf0f4; }
.portal-card-placeholder span { display: block; height: 7px; border-radius: 99px; background: #e4e7ec; }
.portal-card-placeholder span:nth-child(1) { width: 32%; }
.portal-card-placeholder span:nth-child(2) { width: 20%; }
.portal-card-placeholder span:nth-child(3) { width: 13%; }
.portal-footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 19px 0 25px; display: flex; justify-content: space-between; border-top: 1px solid #e1e4ea; color: #8a92a0; font-size: 10.5px; }

.sidebar-portal-link { margin: -4px 4px 14px; padding: 8px 9px; display: flex; align-items: center; gap: 8px; border: 1px solid #e2e4e9; border-radius: 6px; color: #596275; background: #fafbfc; text-decoration: none; font-size: 11px; font-weight: 700; }
.sidebar-portal-link svg { width: 14px; height: 14px; color: #3949ab; }
.sidebar-portal-link:hover { border-color: #cdd2df; background: #f3f4fa; color: #3949ab; }

/* Login único do portal */
.auth-page {
  position: relative;
  justify-content: flex-end;
  overflow: auto;
  padding: 48px max(32px, calc((100vw - 1100px) / 2));
  background:
    radial-gradient(circle at 96% 0, rgba(203,45,113,.18), transparent 28%),
    linear-gradient(122deg, #10243d 0%, #193958 58%, #244d73 100%);
}
.auth-page::before {
  content: "";
  position: fixed;
  width: 132px;
  height: 132px;
  top: 30px;
  right: clamp(24px, 4vw, 64px);
  opacity: .13;
  background: url("/logo.png") center / contain no-repeat;
  pointer-events: none;
}
.auth-page::after {
  content: none;
}
.auth-card { max-width: 390px; padding: 30px; overflow: hidden; border-radius: 16px; border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.98); box-shadow: 0 28px 70px rgba(5,16,31,.30); position: relative; z-index: 1; }
.auth-card::before { content: ""; height: 4px; position: absolute; top: 0; left: 0; right: 0; background: linear-gradient(90deg, #245b8b 0 52%, #c62c70 52% 100%); }
.auth-brand { padding-bottom: 15px; margin-bottom: 3px; border-bottom: 1px solid #eceef2; }
.auth-brand img { width: 52px; height: 52px; object-fit: contain; }
.auth-brand h1 { font-size: 19px; letter-spacing: -.02em; }

@media (max-width: 760px) {
  .auth-page {
    justify-content: center;
    padding: 28px 16px;
    background:
      radial-gradient(circle at 100% 0, rgba(203,45,113,.2), transparent 32%),
      linear-gradient(145deg, #10243d, #21496f);
  }
  .auth-page::before { width: 96px; height: 96px; top: 18px; right: 18px; opacity: .09; }
  .portal-topbar { min-height: 64px; padding: 10px 18px; }
  .portal-user > div:not(.portal-avatar) { display: none; }
  .portal-user { padding-left: 0; border-left: 0; }
  .portal-account { gap: 10px; }
  .portal-main { width: min(100% - 24px, 1180px); padding-top: 18px; }
  .portal-hero { min-height: 330px; grid-template-columns: 1fr; }
  .portal-hero-copy { padding: 36px 28px; }
  .portal-hero-art { display: none; }
  .portal-system-grid { grid-template-columns: 1fr; }
  .portal-system-card { min-height: 300px; }
  .portal-section-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .portal-system-count { align-self: flex-start; }
}

@media (max-width: 420px) {
  .portal-brand small { display: none; }
  .portal-brand strong { font-size: 14px; }
  .portal-avatar { display: none; }
  .portal-hero-copy { padding: 32px 23px; }
  .portal-system-card { padding: 23px; }
  .portal-footer { width: calc(100% - 24px); flex-direction: column; gap: 5px; }
}
