@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --text: #1a1a1a;
  --muted: #666;
  --muted-soft: #888;
  --border: #e1e1e1;
  --accent: #2541b2;
  --accent-strong: #1d3596;
  --primary: #234a82;
  --primary-hover: #2c5a9c;
  --alfa: #e0a800;
  --alfa-bg: #fffbe6;
  --header: #0B1F3B;
}

* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       margin: 0; color: var(--text); background: var(--bg); line-height: 1.5; }

.topbar { background: var(--header); border-bottom: 1px solid #081729; padding: .7rem 1rem;
          display: flex; align-items: center; gap: 1rem; }
.topbar .brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
}
.brand-logo { height: 50px; width: auto; display: block; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.topnav a { color: rgba(255, 255, 255, .86); font-size: .95rem; text-decoration: none; }
.topnav a:hover { color: #fff; text-decoration: underline; }
.nav-dropdown { position: relative; }
.nav-dropdown-trigger {
  background: none;
  border: none;
  font: inherit;
  color: rgba(255, 255, 255, .86);
  cursor: pointer;
  padding: 0;
}
.nav-dropdown-trigger:hover { color: #fff; text-decoration: underline; }
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: .6rem;
  min-width: 170px;
  display: none;
  z-index: 30;
}
.nav-dropdown-menu-inner {
  background: var(--header);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  padding: .4rem 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}
.nav-dropdown-menu-inner a { display: block; padding: .5rem .9rem; white-space: nowrap; }
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.public-topbar .btn-ghost { display: inline-block; background: none; color: #fff;
                           border: 1px solid rgba(255, 255, 255, .35); border-radius: 4px;
                           padding: .45rem 1rem; font-size: .95rem; text-decoration: none; }
.public-topbar .btn-ghost:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.topbar #main-nav { display: flex; gap: .85rem; flex-wrap: wrap; flex: 1; align-items: center; }
.topbar a { color: rgba(255, 255, 255, .86); text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }
#logout-btn { background: none; color: #fff; border: 1px solid rgba(255, 255, 255, .35);
              padding: .42rem .85rem; font-size: .92rem; }
#logout-btn:hover { background: rgba(255, 255, 255, .12); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 1rem; flex: 0 0 auto; }
.lang-switch { display: inline-flex; align-items: center; gap: .34rem;
               color: rgba(255,255,255,.55); font-size: .85rem; letter-spacing: .02em; white-space: nowrap; }
.lang-switch a { color: rgba(255,255,255,.82); text-decoration: none; }
.lang-switch a:hover { color: #fff; text-decoration: underline; }
.lang-switch strong { color: #fff; font-weight: 700; }
.lang-switch > * + *::before { content: "·"; color: rgba(255,255,255,.55); margin-right: .34rem; font-weight: 400; }
.assistant-bubble {
  position: fixed;
  z-index: 80;
  width: min(300px, calc(100vw - 1.5rem));
  padding: .78rem .82rem .72rem;
  border: 2px solid #0B1F3B;
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 36px rgba(11, 31, 59, .24);
}
.assistant-bubble::after {
  content: "";
  position: absolute;
  left: var(--assistant-arrow-left, 220px);
  width: 18px;
  height: 18px;
  border-right: 2px solid #0B1F3B;
  border-bottom: 2px solid #0B1F3B;
  background: #fff;
  transform: rotate(45deg);
}
.assistant-bubble.is-above-target::after { top: auto; bottom: -11px; }
.assistant-bubble.is-below-target::after {
  bottom: auto;
  top: -11px;
  transform: rotate(225deg);
}
.assistant-bubble[hidden] { display: none; }
.assistant-step { display: block; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.assistant-title { display: block; margin-top: .12rem; padding-right: 1.8rem; color: var(--header); font-size: .98rem; line-height: 1.3; }
.assistant-body { margin: .32rem 0 .62rem; font-size: .84rem; line-height: 1.4; }
.assistant-close {
  position: absolute;
  top: .45rem;
  right: .55rem;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #44546a;
  font-size: 1.45rem;
  line-height: 1;
}
.assistant-nav { display: flex; justify-content: flex-end; gap: .55rem; }
.assistant-target { position: relative; outline: 3px solid #e0a800; outline-offset: 3px; transition: outline-color .2s ease; }
.assistant-session-notice { position: fixed; z-index: 95; right: 1rem; bottom: 1rem; display: flex; align-items: center; gap: .8rem; width: min(520px, calc(100vw - 2rem)); padding: .75rem .9rem; border: 1px solid #b8c5d5; border-left: 4px solid var(--primary); border-radius: 4px; background: #fff; box-shadow: 0 10px 30px rgba(11, 31, 59, .2); font-size: .86rem; }
.assistant-session-notice span { flex: 1; }
.assistant-session-notice button { flex: 0 0 auto; font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .assistant-target { transition: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
           overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* A navegacao (#main-nav) comeca vazia no HTML; o app.js injeta os links
   apenas apos confirmar a sessao. Sem login, o container fica vazio (invisivel)
   e nao ha links no DOM — nem para bots. */

main { max-width: 900px; margin: 1.6rem auto; padding: 0 1rem; }
h1 { font-size: 1.5rem; color: var(--header); line-height: 1.25; }
h2 { font-size: 1.1rem; margin-top: 0; color: var(--header); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
        padding: 1rem 1.2rem; margin-bottom: 1rem; }
#account-card { position: relative; }
.account-summary-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .65fr) 190px; gap: 1.4rem; align-items: start; }
.account-identity { min-width: 0; }
.account-name-line { display: flex; align-items: center; gap: .35rem; margin: 0 0 .15rem; }
.account-sessions-link { margin-top: .55rem; font-size: .82rem; }
.account-edit-name { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 4px; border: 0; border-radius: 50%; background: transparent; color: var(--primary); }
.account-edit-name:hover:not(:disabled) { background: #edf2f8; color: var(--primary-hover); }
.account-edit-name svg { width: 17px; height: 17px; fill: currentColor; }
.account-assistant-preference { min-width: 0; }
.account-assistant-preference > strong { display: block; margin-bottom: .25rem; color: var(--header); font-size: 1rem; line-height: 1.5; }
.account-assistant-preference small { display: block; margin-top: .35rem; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.switch-control { display: flex; align-items: center; gap: .55rem; margin: .2rem 0; cursor: pointer; font-size: .9rem; }
.switch-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; width: 38px; height: 21px; flex: 0 0 auto; border-radius: 999px; background: #9aa5b3; transition: background .18s ease; }
.switch-track span { position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease; }
.switch-control input:checked + .switch-track { background: #21864a; }
.switch-control input:checked + .switch-track span { transform: translateX(17px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid rgba(37, 65, 178, .28); outline-offset: 2px; }
.switch-control input:disabled + .switch-track { opacity: .55; }
.trusted-device-help { margin: .35rem 0 0; font-size: .78rem; }
.sessions-modal-panel { position: relative; display: flex; flex-direction: column; width: min(760px, 100%); max-height: calc(100vh - 2rem); overflow: hidden; }
.sessions-modal-panel #sessions-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: .35rem; }
.sessions-modal-close { position: absolute; top: .7rem; right: .8rem; z-index: 1; width: 2rem; min-width: 2rem; height: 2rem; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 1.7rem; font-weight: 400; line-height: 1; }
.sessions-modal-close:hover { background: var(--surface-muted); }
.sessions-modal-panel > h2 { padding-right: 2.5rem; }
.session-filters { display: flex; gap: .4rem; margin: .7rem 0; }
.session-filters button:not(.is-active) { background: #eef1f4; color: var(--text); }
.session-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.session-item small { display: block; margin-top: .25rem; color: var(--muted); line-height: 1.4; }
.session-expiration-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; white-space: nowrap; }
.session-expiration-row strong { color: var(--text); font-weight: 600; }
.session-item.is-active-session .session-expiration-row { color: #18733b; }
.session-item.is-active-session .session-expiration-row strong { color: #18733b; }
.session-item:not(.is-active-session) .session-expiration-row { color: #a72d2d; }
.session-item:not(.is-active-session) .session-expiration-row strong { color: #a72d2d; }
.session-remove-trust { display: inline-block; margin-top: .3rem; padding: 0; font-size: .76rem; }
.session-trash { flex: 0 0 auto; min-width: 2rem; padding: .3rem .45rem; border: 1px solid #d7b8b8; background: transparent; color: #8b3030; font-size: 1rem; line-height: 1; }
.session-trash:hover { background: #faeaea; }
.api-key-trash { min-width: 2rem; padding: .3rem .45rem; border: 1px solid #d7b8b8; background: transparent; color: #8b3030; font-size: 1rem; line-height: 1; }
.api-key-trash:hover:not(:disabled) { background: #faeaea; }
.token-table th:last-child, .token-table td:last-child { width: 3rem; text-align: center; }
.account-mode-compact { width: 190px; margin: 0; padding: 0; border: 0; text-align: left; }
.account-mode-compact legend { position: relative; left: -3px; margin-bottom: .25rem; color: var(--header); font-size: 1rem; line-height: 1.5; font-weight: 700; }
.account-mode-compact label { display: flex; align-items: center; gap: .35rem; margin: .2rem 0; font-size: .9rem; font-weight: 500; cursor: pointer; }
.account-mode-compact input { width: auto; margin: 0; }
.account-mode-status { display: block; min-height: 1.1rem; margin-top: .25rem; color: var(--muted); font-size: .76rem; max-width: 180px; }
.muted { color: var(--muted); }
.stub { border-left: 3px solid var(--alfa); background: var(--alfa-bg); }
.badge { display: inline-block; font-size: .72rem; padding: .1rem .5rem;
         border-radius: 10px; background: #eee; vertical-align: middle; }

label { display: block; margin: .6rem 0 .2rem; font-weight: 600; }
input[type=text], input[type=email], input[type=date], input[type=number], select { width: 100%; padding: .5rem;
         border: 1px solid #bbb; border-radius: 4px; font-size: 1rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(37, 65, 178, .28); outline-offset: 1px; border-color: var(--accent); }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
.account-request-secondary { margin: .9rem 0 0; max-width: 100%; }
.account-request-secondary summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: .45rem; }
.account-request-secondary-body { margin-left: 1.8rem; max-width: calc(100% - 1.8rem); }
.account-request-secondary-body label { margin-top: .85rem; }
.actions { margin-top: 1rem; display: flex; gap: .8rem; align-items: center; }
button { padding: .55rem 1.1rem; border: 1px solid transparent; border-radius: 4px;
         background: var(--primary); color: #fff; font-size: 1rem; cursor: pointer; }
button:hover:not(:disabled) { background: var(--primary-hover); }
button:disabled, input[type="submit"]:disabled { opacity: .6; cursor: not-allowed; }
button.is-processing, input[type="submit"].is-processing { cursor: wait; filter: saturate(.55); }
button.link { background: none; color: var(--accent); padding: 0; border: 0; }
button.link:hover { background: none; color: var(--accent-strong); text-decoration: underline; }
button.small { padding: .3rem .7rem; font-size: .85rem; }
button.danger { background: #b22525; }

@media (max-width: 640px) {
  .account-summary-row { grid-template-columns: 1fr; gap: .8rem; }
  .account-assistant-preference, .account-mode-compact { width: 100%; margin-top: .2rem; padding-top: .75rem; border-top: 1px solid var(--border); }
  .assistant-session-notice { align-items: flex-start; }
}

.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab { background: #eee; color: #333; }
.tab.is-active { background: var(--primary); color: #fff; }

.hidden { display: none; }

.msg { padding: .6rem 1rem; border-radius: 4px; margin-top: 1rem; }
.cnpj-company-lookup { margin-top: .55rem; padding: .65rem .8rem; border: 1px solid #c9d8eb; border-radius: 5px; background: #f4f8fd; color: #173b68; }
.cnpj-company-lookup p { margin: 0; }
.cnpj-company-lookup .document-alternative { margin-top: .45rem; font-size: .92rem; }
.cnpj-company-lookup .actions { margin-top: .55rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.cnpj-company-lookup button.secondary { background: #fff; color: #173b68; border: 1px solid #8aa7c9; }
.cnpj-company-lookup button.secondary.is-probable { background: #fff8e8; border-color: #cda34e; }
.document-probable-label { display: inline-block; margin-left: .35rem; padding: .08rem .35rem; border-radius: 999px; background: #ead39b; color: #513b09; font-size: .76em; font-weight: 700; }
.msg.info { background: #eef4ff; border-left: 3px solid var(--primary); }
.msg.error { background: #fde8e8; border-left: 3px solid #b22525; }
.msg.success { background: #e7f6ec; border-left: 3px solid #2b7a3d; }
.screening-progress-log { margin: 0; padding-left: 1.3rem; }
.screening-progress-log li { margin: .2rem 0; }
.screening-progress-log .is-running { font-weight: 600; }
.screening-progress-log .is-retrying { color: #8a5a00; }
.screening-progress-log .is-failed { color: #9f1d1d; font-weight: 600; }
.screening-queue-state { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: baseline; margin-bottom: .45rem; }
.screening-queue-state small { color: var(--muted); }
.screening-queue-actions { margin-top: .65rem; }

/* Superficie publica: identidade visual da landing orvyan.com.br. */
body[data-page="validarrelatorio"] main { max-width: 820px; }
body[data-page="validarrelatorio"] h1 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin: .1rem 0 .8rem;
  color: var(--header);
}
body[data-page="validarrelatorio"] .card { padding: 1.2rem 1.4rem; }
body[data-page="validarrelatorio"] .card > .muted { margin: 0 0 1rem; }
body[data-page="validarrelatorio"] input[type=file] {
  width: 100%;
  padding: .55rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
body[data-page="validarrelatorio"] input[type=file]:focus {
  outline: 2px solid rgba(37, 65, 178, .28);
  outline-offset: 1px;
  border-color: var(--accent);
}
body[data-page="validarrelatorio"] input[type=file]::file-selector-button {
  margin-right: .8rem;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
body[data-page="validarrelatorio"] input[type=file]::file-selector-button:hover {
  background: var(--primary-hover);
}
body[data-page="validarrelatorio"] .actions button {
  padding: .6rem 1.2rem;
}
body[data-page="validarrelatorio"] .actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #eee;
         font-size: .9rem; vertical-align: top; overflow-wrap: break-word; word-break: break-word; }
th { color: #3d4b5f; font-weight: 600; }
.num,
.extrato-table th:nth-child(4),
.extrato-table th:nth-child(5),
.extrato-table td:nth-child(4),
.extrato-table td:nth-child(5),
.compact-table th:nth-child(2),
.compact-table th:nth-child(3),
.compact-table td:nth-child(2),
.compact-table td:nth-child(3) { text-align: right; }
.token-table th:nth-child(5),
.token-table td:nth-child(5) { text-align: right; }
.token-table-scroll { max-width: 100%; }
.balance-card-heading { display: grid; grid-template-columns: minmax(150px, .42fr) minmax(0, 1.8fr); gap: 1rem; align-items: baseline; }
.balance-card-heading h2 { margin-bottom: .25rem; }
.balance-card-chart-title { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(330px, 1.35fr); gap: 1rem; min-width: 0; }
.balance-card-chart-title strong { grid-column: 2; text-align: center; font-size: .86rem; }
.balance-summary-layout { display: grid; grid-template-columns: minmax(150px, .42fr) minmax(0, 1.8fr); gap: 1rem; align-items: start; margin: .25rem 0 .8rem; }
.balance-overview { padding: .15rem .75rem 0 0; border-right: 1px solid #e1e4e8; }
.balance-overview p { margin: 0 0 .65rem; }
.balance-overview p:first-child strong { display: block; font-size: 1.55rem; line-height: 1.1; }
.balance-overview .muted strong { color: var(--text); font-weight: 600; }
.balance-visuals { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(330px, 1.35fr); gap: 1rem; align-items: center; min-width: 0; }
.balance-rings { display: grid; grid-template-columns: 132px minmax(105px, 1fr); gap: .55rem; align-items: center; }
.balance-rings svg { width: 132px; height: 132px; overflow: visible; }
.balance-ring-value { fill: var(--text); font-size: 20px; font-weight: 700; }
.balance-ring-label { fill: #596579; font-size: 8px; }
.balance-ring-legend { display: grid; gap: .65rem; font-size: .86rem; }
.balance-ring-legend span { display: grid; grid-template-columns: 10px 1fr; column-gap: .4rem; align-items: center; }
.balance-ring-legend strong { grid-column: 2; font-size: .82rem; }
.balance-ring-legend i, .balance-bars-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.balance-ring-legend .weekly, .balance-bars-legend .current { background: #d0a64f; }
.balance-ring-legend .monthly { background: #0b1d34; }
.balance-bars { min-width: 0; }
.balance-chart-heading { position: relative; min-height: 1.2rem; font-size: .86rem; margin-bottom: .25rem; }
.balance-chart-heading span { position: absolute; right: 0; color: #596579; font-size: .8rem; }
.balance-bars svg { display: block; width: 100%; height: 142px; }
.balance-bar-label { fill: #687386; font-size: 8px; }
.balance-week-total-label { fill: #3d4b5f; font-size: 8px; font-weight: 600; }
.balance-week-total-line { stroke: #7a8799; stroke-width: 1; stroke-dasharray: 4 4; }
.balance-week-limit-line { stroke: #21864a; stroke-width: 1.4; stroke-dasharray: 4 4; }
.balance-gap-under-stroke { stroke: rgba(33, 134, 74, .42); stroke-width: 3; }
.balance-gap-over-stroke { stroke: rgba(190, 47, 47, .48); stroke-width: 3; }
.balance-axis { stroke: #cfd5dd; stroke-width: 1; }
.balance-week-divider { stroke: #d8dce2; stroke-width: 1; }
.balance-bars-legend { display: flex; justify-content: center; gap: 1.1rem; color: #596579; font-size: .76rem; }
.balance-bars-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.balance-bars-legend .previous { background: #9aa8bd; }
.balance-bars-legend .limit { background: #21864a; }
@media (max-width: 900px) {
  .balance-card-heading { grid-template-columns: 1fr; }
  .balance-card-chart-title { display: block; text-align: center; }
  .balance-summary-layout { grid-template-columns: 1fr; }
  .balance-overview { display: flex; justify-content: space-between; gap: 1rem; padding: 0 0 .5rem; border-right: 0; border-bottom: 1px solid #e1e4e8; }
}
@media (max-width: 680px) {
  .balance-visuals { grid-template-columns: 1fr; }
  .balance-rings { justify-content: center; grid-template-columns: 156px minmax(120px, 180px); }
  .balance-rings svg { width: 156px; height: 156px; }
  .balance-bars svg { height: auto; }
  .balance-chart-heading { display: grid; gap: .2rem; }
  .balance-chart-heading span { position: static; text-align: center; }
}

.filters { display: grid; grid-template-columns: minmax(120px, 150px) minmax(145px, 170px) minmax(145px, 170px) minmax(220px, 1fr); gap: .8rem;
           align-items: end; margin: .8rem 0 1rem; }
.filters label { display: flex; flex-direction: column; gap: .25rem; margin: 0; min-width: 0; }
.filters label span { font-weight: 600; }
.api-key-heading { display: flex; align-items: baseline; gap: .65rem; flex-wrap: wrap; }
.api-key-heading h2 { margin-bottom: 0; }
.api-key-heading .muted { font-size: .78rem; }
.api-key-mobile-hint, .api-key-mobile-label { display: none; }
.token-menu { margin: 0; padding: 0; white-space: nowrap; font-size: inherit; }
.date-more { margin-left: 1px; cursor: help; color: #555; }
.copy-text { cursor: copy; text-decoration: underline dotted #999; text-underline-offset: 2px; }
.copy-text.copied { background: #d4edda; border-radius: 3px; }
.copy-text,
.more-info { white-space: nowrap; }
.more-info { margin-left: 1px; cursor: help; color: #555; text-decoration: underline dotted #999; text-underline-offset: 2px; }
.token-value { display: block; padding: .55rem; background: #f4f5f7; border: 1px solid #e1e1e1;
               border-radius: 4px; overflow-wrap: anywhere; }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.35);
         display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-panel { width: min(520px, 100%); background: #fff; border-radius: 6px;
               padding: 1rem 1.2rem; box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.modal-close { float: right; }

.plan-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.plan-summary section { min-width: 0; overflow-wrap: anywhere; }
.plan-summary h3 { margin-top: 0; }
.plan-heading { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.plan-addons { border-left: 1px solid var(--border); padding-left: 1.5rem; }
.funding-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.5rem; }
.funding-balances, .funding-entries { min-width: 0; overflow-wrap: anywhere; }
.funding-balances .stat-value, .funding-entries h3 { margin-top: 0; }
.funding-entries table { table-layout: fixed; }
.funding-entries th:nth-child(2) { width: 37%; }
.funding-controls { margin-top: 1.25rem; border-top: 1px solid var(--border); }
.funding-controls select { max-width: 26rem; }
.funding-controls .actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.funding-deposit-modal { border: 1px solid var(--border); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.funding-deposit-modal::backdrop { background: rgba(0,0,0,.35); }
.funding-deposit-modal h2 { clear: both; }
@media (max-width: 640px) {
  .funding-summary { grid-template-columns: 1fr; gap: 1rem; }
  .funding-entries th, .funding-entries td { font-size: .75rem; padding: .35rem .2rem; }
  .funding-entries th:first-child { width: 24%; }
  .funding-entries th:nth-child(2) { width: 36%; }
  .plan-summary { grid-template-columns: 1fr; gap: 1rem; }
  .plan-addons { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 1rem; }
}

/* Resultado comum segue a densidade visual do resumo de vínculos QSA. */
.hits-table { width: 100%; table-layout: fixed; font-size: .82rem; }
.hits-table th, .hits-table td { padding: .38rem .32rem; font-size: inherit; vertical-align: top; }
.hits-table th:nth-child(1), .hits-table td:nth-child(1) { width: 16%; }  /* Fonte */
.hits-table th:nth-child(2), .hits-table td:nth-child(2) { width: 15%; }  /* Nome */
.hits-table th:nth-child(3), .hits-table td:nth-child(3) { width: 27%; }  /* Categoria/Motivo */
.hits-table th:nth-child(4), .hits-table td:nth-child(4) { width: 10%; }  /* Risco */
.hits-table th:nth-child(5), .hits-table td:nth-child(5) { width: 16%; }  /* Correspondência */
.hits-table th:nth-child(6), .hits-table td:nth-child(6) { width: 6%; }   /* Score */
.hits-table th:nth-child(7), .hits-table td:nth-child(7) { width: 10%; white-space: nowrap; } /* Cidade/UF */
.hits-table th:nth-child(n+4), .hits-table td:nth-child(n+4) { text-align: center; }
.hits-table td:nth-child(4), .hits-table td:nth-child(5), .hits-table td:nth-child(6) { white-space: nowrap; }
.hits-table .status, .screening-correspondence { border-radius: 0; padding: .1rem .2rem; font-size: inherit; font-weight: 400; }

.status { font-size: .75rem; padding: .1rem .5rem; border-radius: 10px; background: #eee; white-space: nowrap; }
.status.screening-correspondence { white-space: normal; overflow-wrap: anywhere; }
.sources-table-scroll table { table-layout: fixed; }
.sources-table-scroll th:nth-child(1),
.sources-table-scroll td:nth-child(1) { width: 62%; }
.sources-table-scroll th:nth-child(2),
.sources-table-scroll td:nth-child(2) { width: 21%; }
.sources-table-scroll th:nth-child(3),
.sources-table-scroll td:nth-child(3) { width: 17%; }
.sources-table-scroll td:nth-child(3) { white-space: nowrap; }
.status.PENDING { background: #fff3cd; }
.status.APPROVED { background: #d4edda; }
.status.REJECTED, .status.FAILED, .status.ERROR { background: #f8d7da; color: #721c24; }
.status.PROCESSING { background: #cfe2ff; }
.status.CANCELLED { background: #e2e3e5; }
.status.SUCCESS { background: #d4edda; color: #155724; }
.status.WARNING { background: #fff3cd; color: #856404; }
.status.INFO { background: #e9ecef; color: #495057; }
.account-state-warning { color: #d99a00; cursor: help; font-size: 1rem; margin-left: .3rem; vertical-align: middle; }
.status.active { background: #d4edda; color: #155724; }
.status.inactive { background: #f8d7da; color: #721c24; }

textarea { width: 100%; padding: .5rem; border: 1px solid #bbb; border-radius: 4px;
           font-size: 1rem; font-family: inherit; }

fieldset.groups { border: 1px solid #ddd; border-radius: 4px; margin-top: .8rem; padding: .5rem .8rem; }
fieldset.groups legend { font-weight: 600; padding: 0 .3rem; }
label.inline { display: inline-flex; align-items: center; gap: .3rem; margin-right: 1rem; font-weight: 400; }
label.inline input { width: auto; }
.scope-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.scope-option { display: flex; align-items: flex-start; gap: .55rem; min-height: 78px; margin: 0; padding: .75rem; border: 1px solid #ccd4df; border-radius: 7px; background: #fff; cursor: pointer; font-weight: 400; }
.scope-option:hover { border-color: #7890b1; background: #f8faff; }
.scope-option.is-selected { border-color: var(--accent); background: #f2f6fd; box-shadow: 0 0 0 1px var(--accent); }
.scope-option input, .source-group-card input { width: auto; margin: .18rem 0 0; flex: 0 0 auto; }
.scope-option strong, .source-group-card strong { display: block; color: var(--primary); }
.scope-option small, .source-group-card small { display: block; margin-top: .2rem; color: #596575; line-height: 1.35; }
.source-groups-custom { margin-top: .9rem; padding-top: .15rem; border-top: 1px solid #e4e8ee; }
.source-groups-custom h3 { margin: .8rem 0 .45rem; font-size: .95rem; color: #445064; }
.source-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.source-group-card { display: flex; align-items: flex-start; gap: .55rem; margin: 0; padding: .7rem; border: 1px solid #d9dfe7; border-radius: 6px; background: #fff; cursor: pointer; font-weight: 400; }
.source-group-card:hover { border-color: #9aaabd; }
.source-group-card.is-selected { border-color: #7890b1; background: #f7f9fc; }
.source-group-card em { display: block; margin-top: .4rem; color: #536987; font-size: .78rem; font-style: normal; font-weight: 600; }
.source-group-card.is-disabled { cursor: not-allowed; opacity: .6; background: #f2f3f5; }
.online-sources-toggle { display: inline-flex; align-items: center; gap: .4rem; margin: .15rem 0 .75rem; padding-left: .75rem; cursor: pointer; font-weight: 400; }
.online-sources-toggle input { width: auto; margin: 0; }
.online-sources-toggle.is-disabled { cursor: not-allowed; opacity: .6; }
.online-sources-notice { width: min(520px, calc(100% - 2rem)); }
.online-sources-notice::backdrop { background: rgba(8, 23, 41, .46); }
.screening-reuse-query { width: min(620px, calc(100% - 2rem)); border: 1px solid var(--border); }
.screening-reuse-query::backdrop { background: rgba(8, 23, 41, .46); }
.screening-reuse-query button.secondary { background: #fff; color: var(--primary); border-color: #8aa7c9; }
.screening-reuse-query button.secondary:hover { background: #eef4fc; }
.screening-reuse-actions { flex-wrap: wrap; }
.scope-source-details { margin-top: .8rem; border: 1px solid #d9dfe7; border-radius: 6px; background: #f7f8fa; }
.scope-source-details summary { padding: .7rem .8rem; color: var(--primary); cursor: pointer; font-weight: 600; }
.scope-source-details[open] summary { border-bottom: 1px solid #d9dfe7; }
.scope-source-details-content { padding: .2rem .85rem .8rem; }
.scope-source-details-content h4 { margin: .75rem 0 .35rem; font-size: .9rem; color: #445064; }
.scope-source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1rem; margin: 0; padding-left: 1.15rem; }
.scope-source-list li { color: #26364b; line-height: 1.35; }
.scope-source-list code { color: #68778c; font-size: .75rem; }
.scope-source-list .scope-source-unavailable { color: #a42323; }
.scope-source-list .scope-source-unavailable .scope-source-name { font-style: italic; text-decoration: line-through; }
.scope-source-list .scope-source-unavailable code { color: inherit; }
.scope-source-list .scope-source-unavailable small { font-style: normal; font-weight: 600; }
.advanced-options { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid #eee; }
.inline.is-disabled,
.tab.is-disabled,
.req-form.is-disabled {
  color: #7d8590;
  opacity: .62;
}
.inline.is-disabled,
.tab.is-disabled {
  cursor: not-allowed;
}
.inline.is-disabled input,
.tab.is-disabled {
  cursor: not-allowed;
}
.premium-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin-top: .35rem; }
.premium-row .qsa-toggle { margin: .6rem 0 .2rem; }
.qsa-options { margin: 0; }
.qsa-options span { display: inline-block; font-weight: 600; margin-bottom: .2rem; }
.help-inline { margin: .35rem 0 0; font-size: .9rem; }
.qsa-feature { margin-top: .9rem; padding: 1rem; border: 1px solid #d9bd7d; border-left: 4px solid #b97800; border-radius: 7px; background: linear-gradient(135deg, #fff8e8, #fffdf7); box-shadow: 0 2px 8px rgba(143, 95, 0, .08); }
.qsa-feature-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.qsa-feature h2 { margin: .1rem 0 0; font-size: 1.25rem; }
.qsa-feature > p { margin: .65rem 0; max-width: 780px; color: #3f4e61; }
.eyebrow { margin: 0 !important; color: #b97800 !important; font-size: .78rem; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; }
.feature-switch { display: inline-flex; align-items: center; gap: .4rem; margin: .15rem 0 0; padding: .48rem .7rem; border: 1px solid #6687bd; border-radius: 5px; background: #eef4fc; color: var(--primary); font-weight: 700; white-space: nowrap; cursor: pointer; }
.feature-switch:hover { background: #e6effb; border-color: #5176b1; }
.feature-switch.is-selected { background: #d8e6f8; border-color: #416ba8; color: #0d315f; }
.feature-switch input { width: auto; }
.feature-switch.is-disabled { opacity: .58; cursor: not-allowed; }
.qsa-path { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-top: .6rem; }
.qsa-path span { padding: .35rem .55rem; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; font-size: .82rem; }
.qsa-path .qsa-path-risk { border-color: #d98b8b; background: #fdeaea; color: #8b2323; }
.qsa-path .feature-switch span { padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; }
.qsa-path b { color: #718096; }
.qsa-investigation-options { margin-top: .8rem; padding-top: .75rem; border-top: 1px solid #ead9b4; }
.qsa-investigation-options label { max-width: 520px; margin: 0; }
.qsa-investigation-options select { margin-top: .25rem; }
.advanced-controls { margin-top: .8rem; padding: .15rem .1rem; }
.advanced-controls > .inline { margin-bottom: .25rem; }
.screening-api-code-card { padding: 1rem 1.2rem; }
.screening-api-code-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.screening-api-code-header h2 { margin-bottom: .25rem; }
.screening-api-code-controls { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(150px, .7fr)); gap: .8rem; margin-top: .85rem; }
.screening-api-code-controls label { margin: 0; }
.screening-api-code-controls select { margin-top: .2rem; }
.screening-api-code-key-field { display: flex; flex-direction: column; gap: .2rem; }
.screening-api-code-key-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.screening-api-code-explicit { display: inline-flex; align-items: center; gap: .35rem; margin: 0; color: var(--primary); font-size: .86rem; font-weight: 600; white-space: nowrap; }
.screening-api-code-explicit input { width: auto; margin: 0; }
.screening-api-code-key-static { min-height: 2.35rem; display: flex; align-items: center; padding: .45rem .65rem; border: 1px solid #c8ced8; border-radius: 4px; background: #f7f8fa; }
.screening-api-code-key-summary { margin: .75rem 0 0; }
.screening-api-code-note { margin-top: .8rem; }
.screening-api-code-toolbar { display: flex; justify-content: flex-end; margin-top: .75rem; }
.screening-api-code-toolbar button { padding: .35rem .75rem; font-size: .85rem; }
.screening-api-code-pre { margin: .4rem 0 0; padding: .9rem; border: 1px solid #d9dfe7; border-radius: 5px; background: #111827; color: #e5edf8; overflow-x: auto; font: .82rem/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; white-space: pre; }
.info-dot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
            border-radius: 50%; background: #eef0f3; color: var(--accent); font-size: .75rem; font-weight: 700;
            margin-left: .25rem; cursor: help; }
.cost-estimate { margin-top: .8rem; border: 1px solid #eee; border-radius: 4px; background: #fafbfc; }
.cost-estimate-summary { padding: .75rem .9rem; cursor: pointer; }
.cost-estimate-summary-closed { display: inline-flex; gap: .45rem; align-items: baseline; }
.cost-estimate-summary-open { display: none; }
.cost-estimate[open] .cost-estimate-summary-closed { display: none; }
.cost-estimate[open] .cost-estimate-summary-open { display: inline-grid; width: calc(100% - 1.4rem); grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; align-items: baseline; vertical-align: top; }
.cost-estimate-body { padding: 0 .9rem .75rem; }
.cost-estimate h2 { margin: 0; font-size: 1rem; }
.cost-balance { grid-column: 2; display: flex; justify-content: space-between; gap: .8rem; color: #555; }
.cost-breakdown { margin: .55rem 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem .9rem; }
.cost-breakdown > div { display: flex; justify-content: space-between; gap: .8rem; padding: .15rem 0; min-width: 0; }
.cost-estimate dt { color: #555; }
.cost-estimate dd { margin: 0; font-weight: 700; text-align: right; }
.cost-breakdown .total { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; align-items: baseline; border-top: 1px solid #ddd; padding-top: .55rem; }
.cost-breakdown .total-value { display: flex; justify-content: space-between; gap: .8rem; }
.cost-breakdown .total #sc-cost-note { grid-column: 2 / -1; margin: 0; text-align: right; }
.qsa-summary { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.qsa-entity { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid #eee; }
.qsa-card-list { display: grid; gap: .55rem; margin-top: .55rem; }
.qsa-card-list-compact { gap: .45rem; }
.qsa-card { border: 1px solid #eee; border-radius: 4px; padding: .6rem .7rem; background: #fff; }
.qsa-card-compact { background: #fafbfc; }
.qsa-card-title { font-weight: 700; overflow-wrap: anywhere; }
.qsa-card-meta { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-top: .35rem; }
.qsa-card-line { margin-top: .35rem; overflow-wrap: anywhere; }
.screening-matches-short { display: none; }
.occurrence-detail-link { display: block; margin-top: .35rem; padding: 0; text-align: left; font-size: inherit; font-weight: 600; }
.occurrence-modal { z-index: 30; background: rgba(8, 23, 41, .46); backdrop-filter: blur(2px); }
.occurrence-modal-panel { position: relative; width: min(980px, 100%); max-height: calc(100vh - 2rem); overflow: hidden; display: flex; flex-direction: column; padding: 0; background: var(--surface); border: 1px solid rgba(118, 88, 31, .28); border-radius: 8px; box-shadow: 0 28px 75px rgba(8, 23, 41, .30), 0 3px 12px rgba(8, 23, 41, .16); }
.occurrence-modal-panel > h2 { margin: 0; padding: 1.15rem 4rem 1rem 1.4rem; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, rgba(199, 163, 90, .13), rgba(255, 250, 241, .45)); }
.occurrence-modal-panel > .sessions-modal-close { top: .85rem; right: 1rem; }
.occurrence-modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1.15rem 1.4rem 1.4rem; scrollbar-color: #8d8d8d transparent; }
.occurrence-modal-heading { display: flex; flex-direction: column; gap: .2rem; padding: .75rem .9rem; background: rgba(199, 163, 90, .08); border: 1px solid rgba(118, 88, 31, .16); border-left: 4px solid var(--alfa); border-radius: 3px; }
.occurrence-modal-summary { margin: .8rem 0 0; padding-left: 1.2rem; }
.occurrence-modal-summary li + li { margin-top: .25rem; }
.modal-open { overflow: hidden; }
.source-occurrence-details { margin: .65rem 0 0; }
.source-occurrence-details > div { display: grid; grid-template-columns: minmax(8rem, 11rem) 1fr; gap: .5rem; padding: .2rem 0; }
.source-occurrence-details dt { font-weight: 600; }
.source-occurrence-details dd { margin: 0; overflow-wrap: anywhere; }
.source-occurrence-publication { display: block !important; }
.source-occurrence-publication dd { margin-top: .25rem; }
.source-publication-text { margin-top: .4rem; padding: .8rem .9rem; border: 1px solid rgba(118, 88, 31, .14); border-left: 3px solid var(--alfa); border-radius: 2px; background: rgba(244, 239, 229, .58); white-space: pre-wrap; max-height: 24rem; overflow: auto; }
.mobile-heading-tip { display: none; }

@media (max-width: 640px) {
  .api-key-mobile-hint, .api-key-mobile-label { display: inline; }
  .api-key-heading { display: block; }
  .api-key-heading .muted { display: block; margin-top: .25rem; }
  .api-key-heading .api-key-desktop-hint, .api-key-desktop-action { display: none; }
  .topbar { flex-wrap: wrap; gap: .5rem .8rem; padding: .55rem .8rem; }
  .brand-logo { height: 38px; }
  .topnav a { font-size: .9rem; }
  .public-topbar .brand { order: 1; }
  .public-topbar .btn-ghost { order: 2; margin-left: auto; font-size: .9rem; }
  .public-topbar .topnav { order: 3; width: 100%; margin-left: 0; gap: .5rem .9rem; flex-wrap: wrap; }
  .topbar #main-nav { order: 3; width: 100%; flex-basis: 100%; gap: .55rem .9rem; }
  .topbar a, #logout-btn { font-size: .9rem; }
  .top-actions { margin-left: auto; gap: .8rem; }
  .assistant-bubble { width: min(290px, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); overflow-y: auto; }
  .footer-main { flex-direction: column; gap: .15rem; }
  .footer-main .muted { text-align: left; white-space: normal; }
  body[data-page="validarrelatorio"] h1 { font-size: 1.3rem; }
  .filters { grid-template-columns: 1fr; }
  .premium-row { grid-template-columns: 1fr; gap: .35rem; align-items: stretch; }
  .screening-api-code-header { flex-direction: column; }
  .screening-api-code-controls { grid-template-columns: 1fr; }
  .qsa-feature-heading { flex-direction: column; }
  .qsa-path { flex-direction: column; justify-content: center; align-items: center; gap: .3rem; }
  .qsa-path > span { text-align: center; }
  .qsa-path > b { font-size: 0; line-height: 1; }
  .qsa-path > b::after { content: "↓"; font-size: 1rem; color: #718096; }
  .scope-presets, .source-group-grid, .scope-source-list { grid-template-columns: 1fr; }
  .cost-estimate[open] .cost-estimate-summary-open { grid-template-columns: 1fr; gap: .35rem; }
  .cost-balance { grid-column: auto; max-width: 14rem; }
  .cost-breakdown { grid-template-columns: 1fr; }
  .cost-breakdown .total { grid-template-columns: 1fr; }
  .cost-breakdown .total #sc-cost-note { grid-column: auto; text-align: left; }
  .token-table-scroll {
    overflow-x: auto;
    padding-bottom: .35rem;
    scrollbar-color: #718096 #e8edf3;
    scrollbar-width: auto;
    -webkit-overflow-scrolling: touch;
  }
  .token-table-scroll::-webkit-scrollbar { height: 10px; }
  .token-table-scroll::-webkit-scrollbar-track { background: #e8edf3; border-radius: 999px; }
  .token-table-scroll::-webkit-scrollbar-thumb { background: #718096; border-radius: 999px; }
  .token-table-scroll .token-table { min-width: 760px; }
  .screening-table-scroll {
    box-sizing: border-box;
    display: block;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .35rem;
    scrollbar-color: #718096 #e8edf3;
    scrollbar-width: auto;
    -webkit-overflow-scrolling: touch;
  }
  .screening-table-scroll::-webkit-scrollbar { height: 10px; }
  .screening-table-scroll::-webkit-scrollbar-track { background: #e8edf3; border-radius: 999px; }
  .screening-table-scroll::-webkit-scrollbar-thumb { background: #718096; border-radius: 999px; }
  .screening-source-scroll .source-checks-table { min-width: 560px; }
  .screening-hits-scroll .hits-table { min-width: 1120px; }
  #sc-result,
  #sc-result .card,
  #sc-result .qsa-card-list,
  #sc-result .qsa-card,
  #sc-result .qsa-card-body,
  #sc-result .qsa-source-checks,
  #sc-result .source-group,
  #sc-result .qsa-entity,
  #sc-result .discarded { box-sizing: border-box; max-width: 100%; min-width: 0; }
  #sc-result .source-group { overflow: hidden; }
  .screening-matches-full { display: none; }
  .screening-matches-short { display: inline; white-space: nowrap; cursor: pointer; text-decoration: underline dotted #718096; text-underline-offset: 3px; }
  .mobile-heading-tip.is-visible {
    display: block;
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
    padding: .45rem .7rem;
    border-radius: 4px;
    color: #fff;
    background: #26364d;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
    font-size: .85rem;
    white-space: nowrap;
  }
  .mobile-table-scroll {
    display: block;
    max-width: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: .35rem;
    scrollbar-color: #718096 #e8edf3;
    scrollbar-width: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-table-scroll::-webkit-scrollbar { height: 10px; }
  .mobile-table-scroll::-webkit-scrollbar-track { background: #e8edf3; border-radius: 999px; }
  .mobile-table-scroll::-webkit-scrollbar-thumb { background: #718096; border-radius: 999px; }
  .requests-table-scroll table { min-width: 820px; }
  .statement-table-scroll table { min-width: 680px; }
  .sources-table-scroll table { min-width: 620px; }
  .admin-users-table-scroll table { min-width: 1050px; }
  .admin-signup-table-scroll table { min-width: 880px; }
  .admin-requests-table-scroll table { min-width: 1050px; }
  .admin-support-table-scroll table { min-width: 850px; }
}
.quick a { margin-right: 1rem; }

.result-line { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .4rem 0; }
.screening-result-widgets { display: grid; gap: 1rem; }
.screening-result-widgets > .card { margin-bottom: 0; }
.screening-sources-widget > h3 { margin-top: 0; }
.screening-query-charge { margin: 1rem 0 0; padding-top: .8rem; border-top: 1px solid var(--border); }
.screening-relationship-counts { margin-top: 1rem; padding: .8rem 1rem; border: 1px solid #9aa9bc; border-radius: 4px; background: #e1e8f0; }
.screening-relationship-overview { padding: .15rem 0; }
.screening-relationship-overview a { font-weight: 600; }
.screening-relationship-counts p { margin: .25rem 0; }
.screening-relationship-counts details.discarded { margin-top: .55rem; }
.screening-relationship-result .screening-relationship-summary { margin-top: .7rem; }
.screening-relationship-summary { margin-top: .8rem; padding: .8rem 1rem; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 4px; background: #f8fafc; }
.screening-relationship-summary h3 { margin-top: 0; }
.screening-relationship-summary p { margin: .35rem 0; }
.screening-relationship-link { font-weight: 600; }
.screening-links-widget:focus { outline: 3px solid rgba(37, 65, 178, .28); outline-offset: 3px; }
.screening-taxonomy-widget > h2,
.screening-links-widget > h3 { margin-top: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
details.discarded { margin-top: 1rem; padding: .15rem 0; }
details.discarded summary { cursor: pointer; font-weight: 600; }
.screening-list-name-group { margin: .45rem 0 0 .75rem; }
.screening-linked-entity-group { margin: .55rem 0 0 .75rem; }
.screening-hit-name-group { margin: .4rem 0 0 1rem; }
.screening-process-group,
.screening-hit-name-group > .screening-table-scroll { margin: .4rem 0 0 1rem; }
.screening-list-name-group summary,
.screening-linked-entity-group summary,
.screening-hit-name-group summary,
.screening-process-group summary { cursor: pointer; }
details.source-group { margin-top: .55rem; border: 1px solid #eee; border-radius: 4px; padding: .45rem .7rem; }
details.source-group summary { cursor: pointer; font-weight: 600; }
.source-checks-table { table-layout: fixed; }
.source-checks-table th:nth-child(1), .source-checks-table td:nth-child(1) { width: 24%; }
.source-checks-table th:nth-child(2), .source-checks-table td:nth-child(2) { width: 30%; }
.source-checks-table th:nth-child(3), .source-checks-table td:nth-child(3) { width: 27%; text-align: center; }
.source-checks-table th:nth-child(4), .source-checks-table td:nth-child(4) { width: 19%; text-align: center; }
.source-checks-table tr.source-match-medium td:first-child { border-left: 4px solid #d49b00; }
.source-checks-table tr.source-match-high td:first-child { border-left: 4px solid #b42318; }
.source-checks-table .source-result-highlight { display: inline-block; border-radius: 999px; padding: .16rem .45rem; font-weight: 600; }
.source-checks-table tr.source-match-medium .source-result-highlight { background: #fff3cd; color: #856404; }
.source-checks-table tr.source-match-high .source-result-highlight { background: #f8d7da; color: #721c24; }
.qsa-taxonomy .table-wrap { overflow-x: hidden; }
.qsa-detailed-hits { width: 100%; table-layout: fixed; font-size: .82rem; }
.qsa-detailed-hits th, .qsa-detailed-hits td { white-space: normal; overflow-wrap: anywhere; padding: .38rem .32rem; text-align: left !important; font-size: inherit; vertical-align: top; }
.qsa-detailed-hits th:nth-child(1), .qsa-detailed-hits td:nth-child(1) { width: 17%; }
.qsa-detailed-hits th:nth-child(2), .qsa-detailed-hits td:nth-child(2) { width: 18%; }
.qsa-detailed-hits th:nth-child(3), .qsa-detailed-hits td:nth-child(3) { width: 21%; }
.qsa-detailed-hits th:nth-child(4), .qsa-detailed-hits td:nth-child(4) { width: 20%; }
.qsa-detailed-hits th:nth-child(5), .qsa-detailed-hits td:nth-child(5) { width: 9%; text-align: center !important; }
.qsa-detailed-hits th:nth-child(6), .qsa-detailed-hits td:nth-child(6) { width: 15%; text-align: center !important; font-size: inherit; }
.qsa-detailed-hits-compact th:nth-child(1), .qsa-detailed-hits-compact td:nth-child(1) { width: 31%; }
.qsa-detailed-hits-compact th:nth-child(2), .qsa-detailed-hits-compact td:nth-child(2) { width: 31%; }
.qsa-detailed-hits-compact th:nth-child(3), .qsa-detailed-hits-compact td:nth-child(3) { width: 14%; }
.qsa-detailed-hits-compact th:nth-child(4), .qsa-detailed-hits-compact td:nth-child(4) { width: 24%; text-align: left !important; }
.qsa-summary-cell-ellipsis { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qsa-summary-entity-link { display: block; min-width: 0; font-weight: 600; }
.qsa-hit-source { display: block; }
.qsa-hit-source + .qsa-hit-source { margin-top: .25rem; }
.qsa-hit-detail { display: block; margin-top: .25rem; color: var(--muted); font-size: .75rem; }
.qsa-detailed-hits .qsa-hit-confirmed-text,
.qsa-detailed-hits .qsa-risk-potential { display: inline-block; border-radius: 0; padding: .1rem .2rem; background: #fff3cd; color: #856404; font-size: inherit; font-weight: 400; }
.qsa-detailed-hits .status { border-radius: 0; padding: .1rem .2rem; font-size: inherit; font-weight: 400; }
@media (max-width: 640px) {
  .qsa-taxonomy .table-wrap { overflow-x: auto; }
  .qsa-detailed-hits { min-width: 650px; }
}

.msg.stub-inline { background: var(--alfa-bg); border-left: 3px solid var(--alfa); }
.status.CLEAR { background: #d4edda; }
.status.LOW { background: #e8f5e9; color: #2e7d32; }

.regulatory-taxonomy-list .risk-high { color: #b42318; font-weight: 700; }
.status.MEDIUM { background: #fff3cd; }
.status.HIGH { background: #f8d7da; color: #721c24; }
.status.CLEAR { color: #155724; }
.status.MEDIUM { color: #856404; }

.site-footer { max-width: 900px; margin: 1.4rem auto 2.4rem; padding: 0 1rem;
               color: var(--muted-soft); font-size: .8rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--header); text-decoration: underline; }
.public-footer { max-width: 820px; }
.footer-main { display: flex; justify-content: space-between; gap: 1rem; }
.footer-main .muted { text-align: right; white-space: nowrap; }
.footer-links { display: flex; gap: .7rem; margin-top: .25rem; flex-wrap: wrap; }

/* Admin: stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
              gap: .75rem; margin-bottom: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
             padding: .8rem 1rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: #555; margin-top: .25rem; }

/* Admin: inline form in table */
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .4rem 0; }
.inline-form label { font-weight: 400; margin: 0; display: flex; align-items: center; gap: .4rem; }
.inline-form input[type=text] { width: 220px; }

.admin-filters { margin-bottom: .8rem; display: flex; align-items: center; gap: .5rem; }
.admin-filters label { margin: 0; font-weight: 400; }
.admin-filters select { width: auto; }
.admin-filters input[type="search"] { width: min(22rem, 100%); }
.admin-pagination { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .8rem; }
.admin-pagination .actions { display: flex; align-items: center; gap: .5rem; margin: 0; }
.billing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.billing-grid .card { min-width: 0; }
.billing-account-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.billing-account-groups section { border: 1px solid var(--border); padding: .8rem; background: #fffdf8; }
.billing-account-groups p { margin-bottom: 0; }
@media (max-width: 800px) {
  .billing-grid, .billing-account-groups { grid-template-columns: 1fr; }
}
.request-filters { flex-wrap: wrap; }
@media (max-width: 640px) {
  .request-filters { align-items: stretch; }
  .request-filters label { width: 100%; }
  .request-filters select { width: 100%; }

  /* Aproxima as duas acoes mais procuradas sem alterar a ordem no desktop. */
  body[data-page="requests"] .tabs .tab[data-tab="credit"] { order: 1; }
  body[data-page="requests"] .tabs .tab[data-tab="support"] { order: 2; }
  body[data-page="requests"] .tabs .tab[data-tab="limit"] { order: 3; }
  body[data-page="requests"] .tabs .tab[data-tab="api-token"] { order: 4; }
  body[data-page="requests"] .tabs .tab[data-tab="cancel"] { order: 5; }
}

td.support-detail { background: #f9f9f9; padding: .5rem 1rem; border-left: 3px solid var(--accent); font-size: .85rem; }

tr.nar-detail td { background: #fafbfc; padding-top: .2rem; padding-bottom: .5rem; color: #555; }

.status.ANSWERED { background: #cfe2ff; }

/* Chat de suporte */
.chat-msg { margin: .6rem 0; display: flex; flex-direction: column; max-width: 80%; }
.chat-user  { align-items: flex-start; }
.chat-admin { align-items: flex-end; margin-left: auto; }
.chat-bubble { padding: .5rem .8rem; border-radius: 10px; font-size: .9rem; line-height: 1.4; }
.chat-user  .chat-bubble { background: #eef0f3; border-bottom-left-radius: 2px; }
.chat-admin .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 2px; }
.chat-meta { font-size: .72rem; color: #999; margin-top: .2rem; }

.form-meta-field {
  position: absolute !important;
  left: -10000px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

button.btn-icon { width: 28px; height: 28px; padding: 0; border-radius: 50%; color: #fff; font-size: .95rem;
                  display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
button.btn-icon-ok  { background: #28a745; }
button.btn-icon-del { background: #dc3545; }
button.btn-icon-reply { background: var(--primary); width: auto; padding: .3rem .7rem; border-radius: 4px; font-size: .85rem; }

/* Login: lupa que "examina" o link de solicitacao de acesso (so cosmetico). */
.signup-hint { position: relative; display: inline-block; }
.signup-hint > a { position: relative; border-radius: 3px; padding: 1px 4px;
                   animation: signup-link-pulse 2.2s ease-in-out infinite; }
.lupa-hint { position: absolute; left: 0; top: 50%; width: 60px; height: 60px;
             margin-top: -30px; pointer-events: none; transform-origin: center;
             animation: lupa-scan 4.2s ease-in-out infinite; }
@keyframes lupa-scan {
  0%   { transform: translateX(-6px) rotate(-6deg); }
  50%  { transform: translateX(96px) rotate(4deg); }
  100% { transform: translateX(-6px) rotate(-6deg); }
}
@keyframes signup-link-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 65, 178, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(37, 65, 178, 0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .lupa-hint, .signup-hint > a { animation: none; }
}
.screening-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.screening-document-row > div {
  min-width: 0;
}

.screening-document-row input,
.screening-document-row select {
  width: 100%;
  height: 2.5rem;
  box-sizing: border-box;
  padding: .5rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 1rem;
}

.document-classification-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: end;
}

.document-classification-fields.has-passport {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.document-classification-fields > div {
  min-width: 0;
}

.document-type-field::before {
  content: '\00a0';
  display: block;
  margin: .6rem 0 .2rem;
  font-weight: 600;
}

@media (max-width: 680px) {
  .screening-document-row {
    grid-template-columns: 1fr;
  }

  .document-classification-fields.has-passport {
    grid-template-columns: 1fr;
  }
}

#sc-document-type:disabled {
  opacity: .7;
}

.feature-switch.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Identidade Orvyan — camada exclusivamente visual. */
:root {
  --bg: #f4efe5;
  --surface: #fffaf1;
  --text: #142234;
  --muted: #5d6976;
  --muted-soft: #6f7780;
  --border: #d9d1c5;
  --accent: #76581f;
  --accent-strong: #4e3914;
  --primary: #081729;
  --primary-hover: #143250;
  --alfa: #c7a35a;
  --alfa-bg: #fff7df;
  --header: #081729;
}

body {
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 88% 8%, rgba(199, 163, 90, .10), transparent 28rem),
    var(--bg);
}

h1, h2, h3, legend, .stat-value {
  font-family: "Manrope", "DM Sans", system-ui, sans-serif;
  letter-spacing: -.025em;
}

.topbar {
  min-height: 76px;
  padding: .72rem clamp(1rem, 3vw, 2.5rem);
  gap: clamp(.9rem, 2vw, 1.7rem);
  background: #081729;
  border-bottom: 1px solid rgba(199, 163, 90, .48);
  box-shadow: 0 8px 30px rgba(8, 23, 41, .12);
}

.topbar .brand { min-width: 210px; }
.brand-logo { width: 210px; height: 35px; object-fit: contain; object-position: left center; }

.topbar #main-nav { gap: clamp(.55rem, 1.4vw, 1.1rem); }
.topbar #main-nav a,
.topnav a,
.nav-dropdown-trigger {
  padding: .35rem 0;
  border-bottom: 1px solid transparent;
  font-size: .9rem;
  font-weight: 500;
}
.topbar #main-nav a:hover,
.topbar #main-nav a[aria-current="page"],
.topnav a:hover,
.nav-dropdown-trigger:hover {
  color: #f5d896;
  border-bottom-color: #c7a35a;
  text-decoration: none;
}

.public-topbar .btn-ghost,
#logout-btn {
  border-color: rgba(199, 163, 90, .72);
  border-radius: 2px;
  color: #f5d896;
}
.public-topbar .btn-ghost:hover,
#logout-btn:hover {
  background: #c7a35a;
  color: #081729;
  text-decoration: none;
}

.lang-switch strong { color: #f5d896; }
.lang-switch > * + *::before { color: rgba(199, 163, 90, .7); }

main { max-width: 1120px; margin: clamp(1.5rem, 4vw, 3rem) auto; padding: 0 clamp(1rem, 3vw, 2rem); }
body[data-page="login"] main { max-width: 760px; }
body[data-page="validarrelatorio"] main { max-width: 900px; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); margin: 0 0 1.25rem; }
h2 { font-size: clamp(1.08rem, 2vw, 1.3rem); }

.card,
.stat-card {
  background: rgba(255, 250, 241, .94);
  border-color: var(--border);
  border-radius: 2px;
  box-shadow: 0 14px 36px rgba(8, 23, 41, .06);
}
.card { padding: clamp(1rem, 2.4vw, 1.5rem); margin-bottom: 1.15rem; }
.stub { border-left-color: var(--alfa); }

input[type=text], input[type=email], input[type=date], input[type=number],
input[type=search], input[type=password], input[type=file], select, textarea {
  border-color: #bdb5a8;
  border-radius: 2px;
  background: #fffdf8;
  color: var(--text);
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline-color: rgba(199, 163, 90, .34);
  border-color: #9c7734;
}

button {
  border-radius: 2px;
  background: #c7a35a;
  color: #081729;
  font-family: inherit;
  font-weight: 650;
}
button:hover:not(:disabled) { background: #d5b66f; }
button.danger { background: #b22525; color: #fff; }
button.link { color: var(--accent); }

.tabs { gap: .5rem; padding-bottom: .2rem; }
.tab {
  border: 1px solid var(--border);
  background: #fffaf1;
  color: #384655;
}
.tab:hover:not(:disabled) { background: #eee5d5; }
.tab.is-active { border-color: #081729; background: #081729; color: #fffaf1; }

table { background: rgba(255, 250, 241, .72); }
th { color: #081729; }

.assistant-target { outline-color: #c7a35a; }
.assistant-bubble { border-color: #081729; border-radius: 4px; background: #fffaf1; }
.assistant-bubble::after { border-color: #081729; background: #fffaf1; }

.site-footer { max-width: 1120px; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.public-footer { max-width: 900px; }
.site-footer a { color: #5f481e; }
.site-footer a:hover { color: #081729; }

@media (max-width: 920px) {
  .topbar { flex-wrap: wrap; }
  .topbar #main-nav { order: 3; flex-basis: 100%; }
  .public-topbar .topnav { order: 3; width: 100%; margin-left: 0; }
}

@media (max-width: 640px) {
  .topbar { min-height: 68px; padding: .6rem 1rem; }
  .topbar .brand { min-width: 170px; }
  .brand-logo { width: 170px; height: 29px; }
  .top-actions { gap: .55rem; }
  .topbar #main-nav,
  .public-topbar .topnav { gap: .5rem 1rem; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .15rem; }
  .topbar #main-nav a,
  .topnav a { flex: 0 0 auto; }
  .public-topbar .btn-ghost { margin-left: auto; }
  main { margin: 1.5rem auto; padding: 0 .9rem; }
  .actions { align-items: stretch; flex-wrap: wrap; }
  .actions button { max-width: 100%; }
  .footer-main { flex-direction: column; }
  .footer-main .muted { text-align: left; white-space: normal; }
  .screening-list-name-group { margin-left: .45rem; }
  .screening-linked-entity-group { margin-left: .45rem; }
  .screening-hit-name-group,
  .screening-process-group,
  .screening-hit-name-group > .screening-table-scroll { margin-left: .7rem; }
}

/* Source Control supplies the level. Color is redundant with the visible label. */
.source-health-label { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.source-health { display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid #87939f; border-radius: 4px; flex: 0 0 auto; }
.source-health i { display: block; width: 6px; height: 15px; border-radius: 1px;
  background: #e0e5e9; }
.source-health[data-level="4"] .filled,
.source-health[data-level="3"] .filled { background: #23834b; }
.source-health[data-level="2"] .filled { background: #bf8900; }
.source-health[data-level="1"] .filled { background: #c73d3d; }
