:root {
  --portal-night: #050b16;
  --portal-night-2: #0b1425;
  --portal-ink: #091326;
  --portal-ink-soft: #17243c;
  --portal-paper: #f5f2ed;
  --portal-white: #ffffff;
  --portal-muted: #697386;
  --portal-line: rgba(9, 19, 38, 0.12);
  --portal-line-dark: rgba(255, 255, 255, 0.13);
  --portal-purple: #7568ed;
  --portal-purple-soft: #c3baff;
  --portal-cyan: #62d6cb;
  --portal-coral: #ef886f;
  --portal-danger: #c94963;
  --portal-ok: #168365;
  --portal-ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--portal-night); }
body.portal {
  min-height: 100vh;
  margin: 0;
  color: var(--portal-ink);
  background:
    radial-gradient(circle at 82% 7%, rgba(117, 104, 237, 0.22), transparent 30%),
    radial-gradient(circle at 8% 86%, rgba(98, 214, 203, 0.09), transparent 28%),
    var(--portal-night);
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.portal::before {
  content: "";
  position: fixed;
  z-index: -1;
  right: -180px;
  top: 22vh;
  width: 440px;
  height: 440px;
  border: 1px solid rgba(195, 186, 255, 0.12);
  border-radius: 50%;
  box-shadow: inset 0 0 90px rgba(117, 104, 237, 0.06);
}
.portal button,
.portal input,
.portal select,
.portal textarea { font: inherit; }
.portal a { color: inherit; }
.portal-shell {
  width: min(1240px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 34px;
  display: flex;
  flex-direction: column;
}

/* Cabeçalho compartilhado */
.portal-top {
  position: sticky;
  z-index: 40;
  top: 10px;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 15px 13px 21px;
  border: 1px solid var(--portal-line-dark);
  border-radius: 24px;
  color: #fff;
  background: rgba(7, 14, 28, 0.83);
  box-shadow: 0 18px 50px rgba(3, 8, 18, 0.2);
  backdrop-filter: blur(20px) saturate(135%);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
}
.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}
.portal-brand-logo {
  display: block;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 12px rgba(98, 214, 203, 0.12));
}
.portal-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.portal-header-link,
.portal-header-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s, transform .2s var(--portal-ease);
}
.portal-header-link:hover,
.portal-header-button:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
}
.portal-header-button.primary {
  color: var(--portal-ink);
  background: #fff;
}
.portal-header-button.primary:hover { transform: translateY(-2px); }
.portal-user-name {
  max-width: 180px;
  overflow: hidden;
  padding: 0 7px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-logout { display: inline; margin: 0; }

/* Área principal */
.portal-main {
  position: relative;
  flex: 1;
  min-height: 660px;
  margin-top: 14px;
  padding: clamp(34px, 5vw, 62px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 32px;
  background: var(--portal-paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
}
.portal-main::before {
  content: "INTELIGÊNCIA CONTEXTUAL APLICADA";
  position: absolute;
  right: 30px;
  top: 22px;
  color: rgba(9, 19, 38, 0.27);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.portal-content { position: relative; z-index: 2; min-width: 0; }
.portal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 17px;
  color: #6658df;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.portal-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--portal-cyan);
  box-shadow: 0 0 0 6px rgba(98, 214, 203, 0.13);
}
.portal h1 {
  max-width: 860px;
  margin: 0;
  color: var(--portal-ink);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.058em;
}
.portal h2 {
  margin: 0;
  color: var(--portal-ink);
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}
.portal h3 { color: var(--portal-ink); }
.portal p {
  max-width: 760px;
  color: var(--portal-muted);
  font-size: 14px;
  line-height: 1.72;
}

/* Login, recuperação, senha e instalação */
.portal-auth .portal-main,
.portal-installation .portal-main {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(390px, 1.12fr);
  gap: 18px;
  min-height: 710px;
  padding: 18px;
}
.portal-auth .portal-main::before,
.portal-installation .portal-main::before { display: none; }
.portal-auth .portal-content,
.portal-installation .portal-content {
  align-self: center;
  padding: clamp(26px, 4vw, 52px);
}
.portal-auth .portal-content > p:not(.portal-kicker),
.portal-installation .portal-content > p:not(.portal-kicker) { max-width: 520px; }
.portal-visual {
  position: relative;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(9, 19, 38, 0.11);
  border-radius: 25px;
  background: #07101f;
  box-shadow: 0 26px 65px rgba(9, 19, 38, 0.18);
  isolation: isolate;
}
.portal-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  transition: transform .8s var(--portal-ease);
}
.portal-visual:hover img { transform: scale(1.02); }
.portal-visual::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 48%, rgba(4, 9, 20, 0.58) 100%);
}
.portal-visual-note {
  position: absolute;
  z-index: 2;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  color: #fff;
  background: rgba(7, 13, 27, 0.58);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 750;
}
.portal-visual-note span:last-child { color: var(--portal-cyan); font-size: 20px; }

/* Formulários e botões */
.portal-form {
  width: min(590px, 100%);
  margin: 27px 0 0;
  padding: 25px;
  border: 1px solid var(--portal-line);
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 24px 60px rgba(9, 19, 38, 0.08);
  backdrop-filter: blur(14px);
}
.portal-auth .portal-form,
.portal-installation .portal-form { background: #fff; }
.portal-two > .portal-form { width: 100%; margin-top: 0; }
.portal-field { display: grid; gap: 7px; margin: 0 0 15px; }
.portal-field label { color: #3e4a5f; font-size: 11px; font-weight: 850; }
.portal-field input,
.portal-field select,
.portal-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #d8dbe2;
  border-radius: 12px;
  color: var(--portal-ink);
  background: #f8f8fa;
  font-size: 13px;
}
.portal-field input:focus,
.portal-field select:focus,
.portal-field textarea:focus {
  outline: 0;
  border-color: rgba(101, 88, 223, 0.62);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(117, 104, 237, 0.1);
}
.portal-field textarea { min-height: 240px; resize: vertical; }
.portal-field input[type="checkbox"],
.portal-field input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--portal-purple);
}
.portal-field label:has(input[type="checkbox"]),
.portal-field label:has(input[type="radio"]) { display: flex; align-items: center; gap: 8px; }
.portal-field small {
  color: #7b8495;
  font-size: 10px;
  line-height: 1.5;
}
.portal-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.portal-actions-spaced { margin-top: 27px; }
.portal-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid var(--portal-ink);
  border-radius: 14px;
  color: #fff !important;
  background: var(--portal-ink);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--portal-ease), box-shadow .2s, background .2s;
}
.portal-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(9, 19, 38, 0.18); }
.portal-btn.secondary { color: var(--portal-ink) !important; background: transparent; }
.portal-btn.danger { border-color: var(--portal-danger); background: var(--portal-danger); }

/* Cards, dados e navegação administrativa */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 29px;
}
.portal-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 23px;
  border: 1px solid var(--portal-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 48px rgba(9, 19, 38, 0.07);
}
.portal-card::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -75px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(117, 104, 237, 0.1);
  border-radius: 50%;
}
.portal-card h3 { position: relative; z-index: 1; margin: 0 0 9px; font-size: 18px; }
.portal-card p { position: relative; z-index: 1; margin: 0 0 18px; font-size: 13px; }
.portal-stat { position: relative; z-index: 1; color: var(--portal-ink); font-size: 34px; font-weight: 850; letter-spacing: -0.055em; }
.portal-muted { color: var(--portal-muted); font-size: 12px; }
.portal-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.portal-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 6px;
  border: 1px solid var(--portal-line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.52);
}
.portal-nav a {
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--portal-muted);
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: none;
  transition: .2s;
}
.portal-nav a:hover { color: var(--portal-ink); background: #fff; }
.portal-nav a.active { color: #fff; background: var(--portal-purple); box-shadow: 0 8px 20px rgba(117, 104, 237, 0.2); }
.portal-module-list {
  max-height: 620px;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  overflow: auto;
  margin-top: 15px;
  padding: 8px;
}
.portal-module-heading {
  padding: 13px 9px 5px;
  color: #6658df;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.portal-module-list a { flex: 0 0 auto; }
.portal-title-row,
.portal-card-heading,
.portal-editor-heading,
.portal-publish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.portal-title-row > div,
.portal-editor-heading > div { min-width: 0; }
.portal-title-row h1 { margin-bottom: 8px; }
.portal-title-row p { margin: 0; }
.portal-card-heading h2,
.portal-version-history h2 { margin: 0; }
.portal-card-heading span {
  color: var(--portal-muted);
  font-size: 10px;
  font-weight: 800;
}
.portal-instruction-layout {
  grid-template-columns: minmax(240px, .62fr) minmax(0, 1.75fr);
  align-items: start;
}
.portal-instruction-layout > .portal-card {
  position: sticky;
  top: 104px;
}
.portal-module-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}
.portal-module-list a span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-module-list a small {
  flex: 0 0 auto;
  color: inherit;
  font-size: 8px;
  opacity: .64;
}
.portal-instruction-editor {
  width: 100%;
  max-width: none;
  margin-top: 0;
}
.portal-editor-heading { margin-bottom: 20px; }
.portal-editor-heading h2 { margin: 4px 0 0; }
.portal-status-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(117, 104, 237, .2);
  border-radius: 999px;
  color: #5d52c7;
  background: rgba(117, 104, 237, .08);
  font-size: 9px;
  font-weight: 850;
}
.portal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 13px;
}
.portal-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 2px 0 18px;
}
.portal-check-grid label,
.portal-publish-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #465268;
  font-size: 10.5px;
  font-weight: 800;
}
.portal-check-grid label {
  padding: 9px 11px;
  border: 1px solid var(--portal-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .65);
}
.portal-check-grid input,
.portal-publish-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--portal-purple);
}
.portal-publish-row {
  align-items: flex-end;
  margin-top: 5px;
}
.portal-version-history { margin-top: 16px; }
.portal-version-history .portal-table { min-width: 520px; }
[hidden] { display: none !important; }
.portal-alert {
  max-width: 760px;
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid rgba(117, 104, 237, 0.23);
  border-radius: 14px;
  color: #4c5670;
  background: rgba(117, 104, 237, 0.08);
  font-size: 12px;
  line-height: 1.6;
}
.portal-alert.error { border-color: rgba(201, 73, 99, 0.28); color: #9b2f45; background: rgba(201, 73, 99, 0.07); }
.portal-alert.success { border-color: rgba(22, 131, 101, 0.25); color: #0c6a50; background: rgba(22, 131, 101, 0.07); }
.portal-table-wrap {
  overflow: auto;
  margin-top: 22px;
  border: 1px solid var(--portal-line);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 50px rgba(9, 19, 38, 0.05);
}
.portal-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.portal-table th,
.portal-table td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--portal-line); color: #3c485c; font-size: 11.5px; }
.portal-table th { color: #5e687a; background: #eeece8; }
.portal-table tr:last-child td { border-bottom: 0; }
.portal-table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--portal-purple); }
.portal-code {
  overflow-wrap: anywhere;
  padding: 13px;
  border-radius: 11px;
  color: #cbd2df;
  background: var(--portal-night);
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.portal-inline { display: inline; }
.portal-limit-form { display: flex; align-items: center; gap: 6px; }
.portal-limit-form input {
  width: 70px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--portal-line);
  border-radius: 9px;
  color: var(--portal-ink);
  background: #fff;
}
.portal-mini-btn {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid var(--portal-line);
  border-radius: 9px;
  color: var(--portal-ink);
  background: #fff;
  font-size: 10px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}
.portal-mini-btn.link:hover { border-color: rgba(117, 104, 237, .42); color: #5d52c7; }
.portal-text-link {
  color: #5d52c7 !important;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}
.portal-text-link:hover { text-decoration: underline; }
.portal-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.portal-badge.success {
  color: #0c6a50;
  border-color: rgba(22, 131, 101, .2);
  background: rgba(22, 131, 101, .1);
}
.portal-badge.warning {
  color: #9a5a08;
  border-color: rgba(218, 137, 28, .22);
  background: rgba(232, 159, 58, .12);
}
.portal-badge.danger {
  color: #9b2f45;
  border-color: rgba(201, 73, 99, .22);
  background: rgba(201, 73, 99, .09);
}
.portal-badge.neutral {
  color: #687286;
  border-color: rgba(9, 19, 38, .11);
  background: rgba(9, 19, 38, .045);
}
.portal-badge.accent {
  color: #5d52c7;
  border-color: rgba(117, 104, 237, .2);
  background: rgba(117, 104, 237, .09);
}
.portal-badge.large { min-height: 32px; padding: 6px 12px; font-size: 10px; }
.portal-status-pill.warning { color: #9a5a08; border-color: rgba(218,137,28,.22); background: rgba(232,159,58,.11); }
.portal-status-pill.success { color: #0c6a50; border-color: rgba(22,131,101,.2); background: rgba(22,131,101,.09); }
.portal-search { display: block; min-width: 210px; }
.portal-search input,
.portal-filter-bar select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #d8dbe2;
  border-radius: 11px;
  color: var(--portal-ink);
  background: #fff;
  font-size: 11px;
}
.portal-search input:focus,
.portal-filter-bar select:focus {
  outline: 0;
  border-color: rgba(101, 88, 223, .62);
  box-shadow: 0 0 0 4px rgba(117, 104, 237, .09);
}
.portal-filter-bar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(145px, auto) minmax(145px, auto) auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px;
  border: 1px solid var(--portal-line);
  border-radius: 15px;
  background: rgba(255,255,255,.58);
}
.portal-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}
.portal-compact-stat {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--portal-line);
  border-radius: 17px;
  background: rgba(255,255,255,.7);
  box-shadow: 0 14px 35px rgba(9,19,38,.045);
}
.portal-compact-stat span { color: var(--portal-muted); font-size: 10px; font-weight: 800; }
.portal-compact-stat strong { color: var(--portal-ink); font-size: 22px; }
.portal-compact-stat.success strong { color: var(--portal-ok); }
.portal-compact-stat.warning strong { color: #b26a0e; }
.portal-compact-stat.danger strong { color: var(--portal-danger); }
.portal-focused-editor { margin-top: 20px; overflow: visible; }
.portal-focused-editor::after { pointer-events: none; }
.portal-focused-editor .portal-card-heading > div { min-width: 0; }
.portal-focused-editor .portal-card-heading p { margin: 0 0 5px; }
.portal-focused-editor .portal-card-heading h2 { margin: 0 0 5px; }
.portal-focused-editor .portal-card-heading span { display: block; }
.portal-form-flat {
  width: 100%;
  max-width: none;
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.portal-form-flat textarea { min-height: 130px; }
.portal-form-note {
  max-width: none !important;
  margin: 10px 0 0 !important;
  color: #7b8495 !important;
  font-size: 9.5px !important;
}
.portal-save-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.portal-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--portal-line);
}
.portal-advanced {
  margin: 14px 0 18px;
  padding: 0 15px;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: rgba(248,248,250,.78);
}
.portal-advanced > summary,
.portal-compact-panel > summary,
.portal-version-history > summary {
  position: relative;
  z-index: 2;
  padding: 14px 0;
  color: #3e4a5f;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.portal-advanced > p { margin-top: 0; font-size: 11px; }
.portal-advanced[open] { padding-bottom: 5px; }
.portal-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-compact-panel { margin-top: 12px; padding-top: 6px; padding-bottom: 6px; }
.portal-compact-panel > summary,
.portal-version-history > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.portal-compact-panel > summary span,
.portal-version-history > summary span { color: var(--portal-muted); font-size: 9px; font-weight: 700; }
.portal-data-table td { vertical-align: middle; }
.portal-data-table strong { color: var(--portal-ink); }
.portal-empty {
  padding: 24px;
  color: var(--portal-muted);
  text-align: center;
  font-size: 12px;
}
.portal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--portal-muted);
  font-size: 10px;
  font-weight: 800;
}
.portal-breadcrumb a { color: #5d52c7; text-decoration: none; }
.portal-section { margin-top: 30px; }
.portal-section-heading h2 { font-size: 26px; }
.portal-section-heading p { margin: 5px 0 0; }
.portal-management-grid { align-items: start; }
.portal-management-grid .portal-card { overflow: visible; }

/* Biblioteca de instruções */
.portal-module-panel { padding: 16px; }
.portal-module-panel .portal-search { margin-top: 13px; }
.portal-module-list { max-height: 690px; margin-top: 8px; padding: 0; border: 0; background: transparent; }
.portal-module-group { border-top: 1px solid var(--portal-line); }
.portal-module-group:first-child { border-top: 0; }
.portal-module-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 8px 7px;
  color: #6658df;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
  cursor: pointer;
}
.portal-module-group > summary span {
  color: var(--portal-muted);
  font-size: 8px;
  letter-spacing: 0;
}
.portal-module-list .portal-module-group a {
  min-height: 43px;
  padding: 8px;
  border-radius: 10px;
}
.portal-module-list .portal-module-group a.active { color: var(--portal-ink); background: rgba(117,104,237,.1); box-shadow: none; }
.portal-module-badges { display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; }
.portal-module-list a > span:first-child { font-size: 10px; font-weight: 800; }
.portal-module-list a .portal-badge { font-size: 7px; opacity: 1; }
.portal-instruction-editor .portal-field > textarea { min-height: 390px; }
.portal-version-history { margin-top: 16px; }
.portal-version-history .portal-table-wrap { margin-top: 5px; }
.portal hr { margin: 23px 0; border: 0; border-top: 1px solid var(--portal-line); }
.portal-state {
  max-width: 760px;
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--portal-line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 26px 70px rgba(9, 19, 38, 0.1);
}
.portal-state p:last-of-type { margin-bottom: 25px; }
.portal-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 5px 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Painel administrativo 8.1.1 — hierarquia, leitura e estados */
.portal-admin .portal-main {
  padding: clamp(30px, 3.4vw, 46px);
}
.portal-admin h1 {
  font-size: clamp(40px, 4.2vw, 54px);
  line-height: 1;
}
.portal-admin .portal-title-row {
  align-items: flex-end;
}
.portal-admin .portal-title-row p {
  max-width: 690px;
  font-size: 13px;
  line-height: 1.6;
}
.portal-admin .portal-nav {
  margin-top: 18px;
}
.portal-admin .portal-summary-grid {
  margin-top: 18px;
}
.portal-admin .portal-compact-stat {
  min-height: 78px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
}
.portal-admin .portal-compact-stat span {
  font-size: 9.5px;
  line-height: 1.3;
}
.portal-admin .portal-compact-stat strong {
  font-size: 21px;
  line-height: 1;
}
.portal-admin .portal-filter-bar {
  margin-top: 16px;
}
.portal-admin .portal-data-table td {
  line-height: 1.45;
}
.portal-admin .portal-mini-btn.link {
  border-color: rgba(117, 104, 237, .22);
  color: #574bc6;
  background: rgba(117, 104, 237, .07);
  text-decoration: none;
}

/* Biblioteca: navegação clara e botão de criação sempre visível */
.portal-admin .portal-instruction-layout {
  grid-template-columns: minmax(285px, 330px) minmax(0, 1fr);
  gap: 18px;
}
.portal-admin .portal-module-panel {
  padding: 18px;
}
.portal-module-create {
  width: 100%;
  min-height: 42px;
  margin-top: 13px;
  font-size: 10.5px;
}
.portal-admin .portal-module-panel .portal-search {
  min-width: 0;
  margin-top: 10px;
}
.portal-admin .portal-module-list {
  max-height: 670px;
}
.portal-admin .portal-module-group > summary {
  min-height: 36px;
}
.portal-admin .portal-module-list .portal-module-group a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin: 2px 0;
  padding: 8px 9px;
  border: 1px solid transparent;
  text-decoration: none;
}
.portal-admin .portal-module-list .portal-module-group a:hover {
  border-color: rgba(117, 104, 237, .13);
  background: rgba(255, 255, 255, .7);
}
.portal-admin .portal-module-list .portal-module-group a.active {
  border-color: rgba(117, 104, 237, .18);
}
.portal-admin .portal-module-list a > span:first-child {
  overflow: visible;
  font-size: 10px;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
}
.portal-admin .portal-module-badges {
  flex-wrap: wrap;
  max-width: 86px;
}
.portal-admin .portal-module-list a .portal-badge {
  min-height: 19px;
  padding: 3px 6px;
  font-size: 7px;
}
.portal-admin .portal-instruction-editor {
  padding: clamp(20px, 2.6vw, 30px);
}
.portal-admin .portal-instruction-editor .portal-field-wide {
  grid-column: 1 / -1;
}
.portal-admin .portal-instruction-editor .portal-advanced textarea {
  min-height: 104px;
  resize: vertical;
}
.portal-dependency-editor {
  margin: 8px 0 18px;
  padding: 15px;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
}
.portal-dependency-editor > div:first-child strong {
  color: var(--portal-ink);
  font-size: 11px;
}
.portal-dependency-editor > div:first-child p {
  margin: 4px 0 12px;
  color: var(--portal-muted);
  font-size: 9.5px;
}
.portal-dependency-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 13px;
}
.portal-dependency-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  color: #465268;
  background: rgba(248, 248, 250, .76);
  font-size: 9.5px;
  font-weight: 800;
}
.portal-dependency-grid input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--portal-purple);
}
.portal-dependency-grid span {
  min-width: 0;
  line-height: 1.3;
}

/* Remoção recuperável de entregas */
.portal-danger-zone,
.portal-info-zone {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 15px 16px;
  border: 1px solid rgba(201, 73, 99, .2);
  border-radius: 15px;
  background: rgba(201, 73, 99, .055);
}
.portal-danger-zone > div,
.portal-info-zone {
  min-width: 0;
}
.portal-danger-zone strong,
.portal-info-zone strong {
  display: block;
  color: var(--portal-ink);
  font-size: 11px;
}
.portal-danger-zone span,
.portal-info-zone span {
  display: block;
  margin-top: 3px;
  color: var(--portal-muted);
  font-size: 10px;
  line-height: 1.45;
}
.portal-danger-zone form {
  flex: 0 0 auto;
  margin: 0;
}
.portal-danger-zone .portal-btn {
  min-height: 42px;
  font-size: 10.5px;
}
.portal-info-zone {
  align-items: flex-start;
  flex-direction: column;
  gap: 0;
  border-color: rgba(117, 104, 237, .18);
  background: rgba(117, 104, 237, .06);
}

/* Diagnóstico: verde para pronto, amarelo para revisão */
.portal-diagnostic-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.portal-diagnostic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.portal-diagnostic-card {
  min-height: 145px;
  padding: 18px;
  border-width: 1px;
  box-shadow: 0 14px 35px rgba(9, 19, 38, .045);
}
.portal-diagnostic-card.is-ok {
  border-color: rgba(22, 131, 101, .2);
  background: linear-gradient(145deg, rgba(255,255,255,.8), rgba(22,131,101,.055));
}
.portal-diagnostic-card.needs-review {
  border-color: rgba(218, 137, 28, .24);
  background: linear-gradient(145deg, rgba(255,255,255,.8), rgba(232,159,58,.075));
}
.portal-diagnostic-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.portal-diagnostic-heading > .portal-muted {
  font-size: 10px;
  font-weight: 800;
}
.portal-diagnostic-card h3 {
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.2;
}
.portal-diagnostic-note {
  margin: 9px 0 0 !important;
  color: #7b6a49 !important;
  font-size: 9.5px !important;
  line-height: 1.45;
}
.portal-diagnostic-state {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
}
.portal-diagnostic-state.is-ok {
  color: #075c43;
  border-color: rgba(22, 131, 101, .24);
  background: #dff5ec;
}
.portal-diagnostic-state.needs-review {
  color: #87500a;
  border-color: rgba(218, 137, 28, .28);
  background: #fff0c9;
}

/* Visão geral operacional */
.portal-system-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 18px;
}
.portal-system-chip {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--portal-line);
  border-radius: 13px;
  color: var(--portal-ink);
  background: rgba(255,255,255,.62);
  text-decoration: none;
  transition: transform .2s var(--portal-ease), border-color .2s, background .2s;
}
.portal-system-chip:hover {
  transform: translateY(-1px);
}
.portal-system-chip span {
  color: var(--portal-muted);
  font-size: 9.5px;
  font-weight: 800;
}
.portal-system-chip strong {
  font-size: 10px;
  font-weight: 900;
}
.portal-system-chip.is-ok {
  border-color: rgba(22, 131, 101, .2);
  background: rgba(223, 245, 236, .7);
}
.portal-system-chip.is-ok strong { color: #075c43; }
.portal-system-chip.needs-review {
  border-color: rgba(218, 137, 28, .24);
  background: rgba(255, 240, 201, .72);
}
.portal-system-chip.needs-review strong { color: #87500a; }
.portal-overview-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.portal-overview-stats .portal-compact-stat {
  min-height: 112px;
  color: var(--portal-ink);
  text-decoration: none;
  transition: transform .2s var(--portal-ease), border-color .2s, box-shadow .2s;
}
.portal-overview-stats .portal-compact-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(117, 104, 237, .2);
  box-shadow: 0 18px 40px rgba(9,19,38,.075);
}
.portal-overview-stats .portal-compact-stat small {
  color: var(--portal-muted);
  font-size: 9px;
  line-height: 1.4;
}
.portal-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}
.portal-operations-card {
  padding: 20px;
  overflow: visible;
}
.portal-operations-card::after { pointer-events: none; }
.portal-operations-card .portal-card-heading {
  margin-bottom: 12px;
}
.portal-operations-card .portal-kicker {
  margin-bottom: 8px;
}
.portal-ops-list,
.portal-compact-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
}
.portal-ops-list a,
.portal-compact-list a {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(9, 19, 38, .08);
  border-radius: 12px;
  color: var(--portal-ink);
  background: rgba(255,255,255,.62);
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.portal-ops-list a:hover,
.portal-compact-list a:hover {
  border-color: rgba(117, 104, 237, .22);
  background: #fff;
}
.portal-ops-list a > span,
.portal-compact-list a > span {
  min-width: 0;
}
.portal-ops-list strong,
.portal-compact-list strong {
  display: block;
  overflow: hidden;
  color: var(--portal-ink);
  font-size: 10.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-ops-list small,
.portal-compact-list small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--portal-muted);
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-ops-list b {
  display: inline-flex;
  min-width: 28px;
  min-height: 28px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #5d52c7;
  background: rgba(117, 104, 237, .1);
  font-size: 10px;
}
.portal-compact-list em {
  flex: 0 0 auto;
  color: var(--portal-muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}
.portal-quick-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.portal-quick-actions a {
  min-height: 84px;
  padding: 14px;
  border: 1px solid rgba(117, 104, 237, .15);
  border-radius: 13px;
  color: var(--portal-ink);
  background: linear-gradient(145deg, rgba(255,255,255,.85), rgba(117,104,237,.05));
  text-decoration: none;
  transition: transform .2s var(--portal-ease), border-color .2s;
}
.portal-quick-actions a:hover {
  transform: translateY(-2px);
  border-color: rgba(117, 104, 237, .34);
}
.portal-quick-actions span {
  display: block;
  font-size: 11px;
  font-weight: 900;
}
.portal-quick-actions small {
  display: block;
  margin-top: 5px;
  color: var(--portal-muted);
  font-size: 8.5px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .portal-auth .portal-main,
  .portal-installation .portal-main { grid-template-columns: 1fr; }
  .portal-auth .portal-content,
  .portal-installation .portal-content { padding: 36px 26px; }
  .portal-visual { min-height: 460px; }
  .portal-grid { grid-template-columns: 1fr 1fr; }
  .portal-two { grid-template-columns: 1fr; }
  .portal-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-filter-bar { grid-template-columns: 1fr 1fr; }
  .portal-filter-bar .portal-search { grid-column: 1 / -1; }
  .portal-grid-three { grid-template-columns: 1fr; }
  .portal-instruction-layout > .portal-card { position: relative; top: auto; }
  .portal-admin .portal-instruction-layout { grid-template-columns: 1fr; }
  .portal-diagnostic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .portal-shell { width: min(100% - 18px, 1240px); padding-top: 8px; }
  .portal-top { top: 5px; min-height: 66px; padding: 10px 10px 10px 14px; border-radius: 18px; }
  .portal-brand { font-size: 15px; }
  .portal-brand-logo { width: 29px; height: 29px; }
  .portal-user-name,
  .portal-header-link:first-child { display: none; }
  .portal-header-link,
  .portal-header-button { min-height: 38px; padding: 0 10px; font-size: 10px; }
  .portal-main { min-height: 600px; margin-top: 9px; padding: 44px 18px 28px; border-radius: 22px; }
  .portal-main::before { display: none; }
  .portal-auth .portal-main,
  .portal-installation .portal-main { padding: 10px; }
  .portal-auth .portal-content,
  .portal-installation .portal-content { padding: 30px 15px; }
  .portal h1 { font-size: clamp(36px, 11vw, 48px); }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-form { padding: 19px; }
  .portal-title-row,
  .portal-editor-heading,
  .portal-publish-row { align-items: flex-start; flex-direction: column; }
  .portal-form-grid { grid-template-columns: 1fr; }
  .portal-dependency-grid { grid-template-columns: 1fr; }
  .portal-summary-grid { grid-template-columns: 1fr 1fr; }
  .portal-compact-stat { min-height: 70px; padding: 13px; }
  .portal-compact-stat strong { font-size: 18px; }
  .portal-filter-bar { grid-template-columns: 1fr; }
  .portal-filter-bar .portal-search { grid-column: auto; }
  .portal-save-actions,
  .portal-editor-footer { align-items: stretch; flex-direction: column; }
  .portal-save-actions .portal-btn,
  .portal-editor-footer .portal-btn { width: 100%; }
  .portal-card-heading { align-items: flex-start; flex-direction: column; }
  .portal-danger-zone { align-items: stretch; flex-direction: column; }
  .portal-danger-zone .portal-btn { width: 100%; }
  .portal-diagnostic-grid { grid-template-columns: 1fr; }
  .portal-system-strip,
  .portal-overview-stats,
  .portal-dashboard-grid { grid-template-columns: 1fr; }
  .portal-quick-actions { grid-template-columns: 1fr 1fr; }
  .portal-visual { min-height: 340px; border-radius: 18px; }
  .portal-visual-note { left: 14px; right: 14px; bottom: 14px; padding: 15px; font-size: 11px; }
  .portal-footer { display: block; padding-bottom: 5px; }
  .portal-footer span { display: block; margin-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Voz da Marca por entrega */
.portal-voice-layout {
  display: grid;
  grid-template-columns: minmax(250px, .72fr) minmax(0, 1.8fr);
  align-items: start;
  gap: 16px;
  margin-top: 22px;
}
.portal-voice-list {
  position: sticky;
  top: 104px;
  max-height: calc(100vh - 125px);
  overflow: auto;
}
.portal-voice-items {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}
.portal-voice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--portal-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .58);
  text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s var(--portal-ease);
}
.portal-voice-item:hover,
.portal-voice-item.active {
  border-color: rgba(117, 104, 237, .42);
  background: rgba(117, 104, 237, .07);
}
.portal-voice-item:hover { transform: translateY(-1px); }
.portal-voice-item > span:first-child { min-width: 0; }
.portal-voice-item strong,
.portal-voice-item small { display: block; }
.portal-voice-item strong {
  overflow: hidden;
  color: var(--portal-ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-voice-item small {
  overflow: hidden;
  margin-top: 4px;
  color: var(--portal-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-voice-editor { overflow: visible; }
.portal-voice-heading { margin-bottom: 18px; }
.portal-voice-source-bar,
.portal-voice-delivery-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid rgba(117, 104, 237, .16);
  border-radius: 13px;
  background: rgba(117, 104, 237, .055);
}
.portal-voice-source-bar strong,
.portal-voice-source-bar span,
.portal-voice-delivery-link strong,
.portal-voice-delivery-link span { display: block; }
.portal-voice-source-bar strong,
.portal-voice-delivery-link strong { color: var(--portal-ink); font-size: 11px; }
.portal-voice-source-bar span,
.portal-voice-delivery-link span { margin-top: 4px; color: var(--portal-muted); font-size: 9px; }
.portal-form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-voice-editor .portal-textarea-small { min-height: 100px; }
.portal-voice-editor .portal-textarea-compact { min-height: 115px; }
.portal-voice-editor .portal-textarea-list { min-height: 130px; }
.portal-voice-editor .portal-textarea-sample { min-height: 280px; line-height: 1.65; }
.portal-voice-actions { margin-top: 22px; }
.portal-voice-restore { margin-top: 22px; }
.portal-voice-empty {
  display: grid;
  min-height: 290px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  text-align: center;
}
.portal-voice-empty strong { color: var(--portal-ink); font-size: 20px; }
.portal-voice-empty span { color: var(--portal-muted); font-size: 11px; }
.portal-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }

@media (max-width: 980px) {
  .portal-voice-layout { grid-template-columns: 1fr; }
  .portal-voice-list { position: relative; top: auto; max-height: none; }
  .portal-voice-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-form-grid-three { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .portal-voice-items { grid-template-columns: 1fr; }
  .portal-voice-source-bar,
  .portal-voice-delivery-link { align-items: stretch; flex-direction: column; }
  .portal-voice-source-bar .portal-mini-btn,
  .portal-voice-delivery-link .portal-mini-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-voice-item { transition: none !important; }
}

/* Contex AI 8.3.1 — consumo e diagnóstico técnico */
.portal-ai-title {
  gap: 24px;
}
.portal-ai-title .portal-button {
  flex: 0 0 auto;
}
.portal-ai-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}
.portal-ai-summary .portal-compact-stat {
  min-height: 110px;
  border-color: rgba(117, 104, 237, .14);
}
.portal-ai-summary .portal-compact-stat small {
  color: var(--portal-muted);
  font-size: 8.5px;
  line-height: 1.45;
}
.portal-ai-summary .portal-compact-stat.has-warning {
  border-color: rgba(218, 137, 28, .3);
  background: rgba(255, 247, 232, .78);
}
.portal-ai-summary .portal-compact-stat.has-success {
  border-color: rgba(22, 131, 101, .22);
  background: rgba(236, 250, 245, .7);
}
.portal-ai-panel {
  margin-top: 18px;
  padding: clamp(20px, 2.6vw, 30px);
}
.portal-ai-panel .portal-section-heading {
  align-items: flex-start;
  margin-bottom: 15px;
}
.portal-ai-panel .portal-section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(24px, 2.6vw, 34px);
}
.portal-ai-panel .portal-section-heading p:not(.portal-kicker) {
  max-width: 740px;
  margin: 7px 0 0;
  color: var(--portal-muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.portal-ai-usage-table {
  min-width: 1040px;
}
.portal-ai-error-table {
  min-width: 1120px;
}
.portal-ai-retrieval-table {
  min-width: 980px;
}
.portal-ai-retrieval-table td {
  vertical-align: top;
}
.portal-knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 650px;
}
.portal-knowledge-tags span {
  display: inline-flex;
  padding: 4px 7px;
  border: 1px solid rgba(117, 104, 237, .13);
  border-radius: 999px;
  color: #574bc6;
  background: rgba(117, 104, 237, .065);
  font-size: 7.5px;
  line-height: 1.25;
}
.portal-ai-error-table td {
  vertical-align: top;
}
.portal-ai-error-table td:nth-child(3) {
  width: 33%;
}
.portal-ai-error-table p {
  margin: 7px 0 4px;
  font-size: 10px;
  line-height: 1.5;
}
.portal-ai-error-table small {
  display: block;
  color: var(--portal-muted);
  font-size: 8.5px;
  line-height: 1.45;
}
.portal-error-code {
  display: inline-flex;
  margin: 5px 0 0 5px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #574bc6;
  background: rgba(117, 104, 237, .08);
  font-size: 8px;
}
.portal-ai-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.portal-ai-guide-grid article {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .7);
}
.portal-ai-guide-grid code,
.portal-ai-guide-grid strong {
  display: block;
}
.portal-ai-guide-grid code {
  overflow-wrap: anywhere;
  color: #665bd4;
  font-size: 8px;
}
.portal-ai-guide-grid strong {
  margin-top: 7px;
  color: var(--portal-ink);
  font-size: 10px;
}
.portal-ai-guide-grid p {
  margin: 6px 0 0;
  color: var(--portal-muted);
  font-size: 8.5px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .portal-ai-summary,
  .portal-ai-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  .portal-ai-title {
    align-items: stretch;
  }
  .portal-ai-title .portal-button {
    width: 100%;
  }
  .portal-ai-summary,
  .portal-ai-guide-grid {
    grid-template-columns: 1fr;
  }
}

/* Contex AI 8.4.2 — histórico por cliente e diagnóstico recolhido */
.portal-ai-usage-table {
  min-width: 1160px;
}
.portal-ai-usage-table tr.is-selected td {
  background: rgba(117, 104, 237, .045);
}
.portal-ai-usage-table td:last-child {
  width: 118px;
  text-align: right;
}
.portal-ai-client-detail {
  scroll-margin-top: 100px;
}
.portal-ai-client-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 2px 0 23px;
}
.portal-ai-client-stats > span,
.portal-ai-call-metrics > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--portal-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .68);
}
.portal-ai-client-stats small,
.portal-ai-call-metrics small {
  color: var(--portal-muted);
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.portal-ai-client-stats strong,
.portal-ai-call-metrics strong {
  color: var(--portal-ink);
  font-size: 14px;
}
.portal-ai-history-heading {
  padding-top: 4px;
  border-top: 1px solid rgba(9, 19, 38, .07);
}
.portal-ai-history-heading h3 {
  margin: 20px 0 0;
  color: var(--portal-ink);
  font-size: 18px;
}
.portal-ai-call-list {
  display: grid;
  gap: 8px;
}
.portal-ai-call {
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .7);
}
.portal-ai-call > summary,
.portal-ai-diagnostic > summary,
.portal-ai-error-guide > summary {
  list-style: none;
  cursor: pointer;
}
.portal-ai-call > summary::-webkit-details-marker,
.portal-ai-diagnostic > summary::-webkit-details-marker,
.portal-ai-error-guide > summary::-webkit-details-marker {
  display: none;
}
.portal-ai-call > summary {
  position: relative;
  display: grid;
  grid-template-columns: 130px minmax(160px, .75fr) minmax(210px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 11px 42px 11px 15px;
  color: #3c485c;
  font-size: 10px;
}
.portal-ai-call > summary::after {
  content: "+";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #665bd4;
  font-size: 19px;
  font-weight: 700;
}
.portal-ai-call[open] > summary::after {
  content: "−";
}
.portal-ai-call[open] > summary {
  border-bottom: 1px solid var(--portal-line);
  background: rgba(117, 104, 237, .035);
}
.portal-ai-call-time,
.portal-ai-call-size,
.portal-ai-call-count {
  color: var(--portal-muted);
}
.portal-ai-call-direction strong,
.portal-ai-call-direction small {
  display: block;
}
.portal-ai-call-direction strong {
  color: var(--portal-ink);
  font-size: 10.5px;
}
.portal-ai-call-direction small {
  margin-top: 3px;
  color: var(--portal-muted);
  font-size: 8.5px;
}
.portal-ai-call-count {
  white-space: nowrap;
}
.portal-ai-call-body {
  padding: 14px 15px 16px;
}
.portal-ai-call-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 13px;
}
.portal-ai-call-metrics > span {
  padding: 9px 11px;
}
.portal-ai-call-metrics strong {
  font-size: 11px;
}
.portal-ai-call-body .portal-knowledge-tags {
  max-width: none;
}
.portal-ai-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.portal-ai-pagination > span {
  color: var(--portal-muted);
  font-size: 9.5px;
  font-weight: 800;
}
.portal-ai-diagnostic {
  padding: 0;
}
.portal-ai-diagnostic > summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 114px;
  padding: clamp(20px, 2.6vw, 30px) 66px clamp(20px, 2.6vw, 30px) clamp(20px, 2.6vw, 30px);
}
.portal-ai-diagnostic > summary::after {
  content: "+";
  position: absolute;
  right: 27px;
  top: 50%;
  transform: translateY(-50%);
  color: #665bd4;
  font-size: 22px;
  font-weight: 700;
}
.portal-ai-diagnostic[open] > summary::after {
  content: "−";
}
.portal-ai-diagnostic[open] > summary {
  border-bottom: 1px solid var(--portal-line);
}
.portal-ai-diagnostic > summary h2 {
  margin: 3px 0 0;
  color: var(--portal-ink);
  font-size: clamp(24px, 2.6vw, 34px);
}
.portal-ai-diagnostic > summary p:not(.portal-kicker) {
  max-width: 740px;
  margin: 7px 0 0;
  color: var(--portal-muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.portal-ai-diagnostic-body {
  padding: 0 clamp(20px, 2.6vw, 30px) clamp(20px, 2.6vw, 30px);
}
.portal-ai-error-guide {
  margin-top: 15px;
  border: 1px solid var(--portal-line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .5);
}
.portal-ai-error-guide > summary {
  position: relative;
  padding: 13px 42px 13px 15px;
  color: var(--portal-ink);
  font-size: 10px;
  font-weight: 850;
}
.portal-ai-error-guide > summary::after {
  content: "+";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #665bd4;
  font-size: 17px;
}
.portal-ai-error-guide[open] > summary::after {
  content: "−";
}
.portal-ai-error-guide .portal-ai-guide-grid {
  padding: 0 13px 13px;
}

@media (max-width: 900px) {
  .portal-ai-client-stats,
  .portal-ai-call-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-ai-call > summary {
    grid-template-columns: 110px 1fr auto;
  }
  .portal-ai-call-size {
    grid-column: 2 / 3;
  }
  .portal-ai-call-count {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 650px) {
  .portal-ai-client-stats,
  .portal-ai-call-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .portal-ai-call > summary {
    grid-template-columns: 1fr;
    gap: 5px;
    padding-right: 42px;
  }
  .portal-ai-call-size,
  .portal-ai-call-count {
    grid-column: auto;
    grid-row: auto;
  }
  .portal-ai-diagnostic > summary {
    align-items: flex-start;
    flex-direction: column;
    padding-right: 52px;
  }
  .portal-ai-diagnostic > summary::after {
    right: 20px;
  }
}
