/* HSC Connect — camada visual do portal, sobre os tokens de styles.css */

/* O atributo hidden precisa vencer as regras de display do portal (grid/flex). */
.portal-body [hidden] {
  display: none !important;
}

.portal-body {
  min-height: 100vh;
  background: var(--surface);
}

#portal-loading,
.portal-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 274px 1fr;
}

.portal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 30px 24px;
  color: rgba(255, 255, 255, 0.78);
  background: var(--ink);
  border-right: 1px solid rgba(239, 208, 155, 0.16);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.portal-brand strong {
  display: block;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
}
.portal-brand small {
  color: var(--gold-light);
  font-size: 0.64rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.portal-user {
  display: grid;
  gap: 3px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(239, 208, 155, 0.2);
}
.portal-user strong {
  color: #fff;
  font-size: 0.94rem;
}
.portal-user span {
  font-size: 0.8rem;
}
.portal-user small {
  color: var(--gold-light);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.portal-nav {
  display: grid;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.portal-nav a {
  padding: 13px 4px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.87rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.portal-nav a:hover,
.portal-nav a[aria-current="page"] {
  color: var(--gold-light);
}

.portal-sidebar-footer {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.portal-language {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.portal-language button {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.portal-language button.is-current {
  color: var(--gold-light);
}
.portal-exit-link {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
  text-decoration: none;
}
.portal-exit-link:hover {
  color: var(--gold-light);
}
.portal-exit {
  justify-self: start;
  padding: 10px 16px;
  border: 1px solid rgba(239, 208, 155, 0.55);
  background: transparent;
  color: var(--gold-light);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.portal-exit:hover {
  background: rgba(239, 208, 155, 0.1);
}

.portal-main {
  padding: 46px 44px 70px;
  max-width: 1180px;
  /* Sem isto, tabelas largas esticam a coluna e o conteúdo invade o vizinho. */
  min-width: 0;
}

.portal-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}
.portal-heading h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 2.7rem);
}
.portal-heading .eyebrow {
  margin-bottom: 10px;
}
.portal-heading p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.portal-heading-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 348px);
  align-items: start;
  gap: 34px;
}
.portal-columns > div,
.portal-columns > aside {
  display: grid;
  gap: 24px;
  min-width: 0;
}
/*
 * Cadeia de larguras mínimas. Painel, formulário e fieldset são itens de grade
 * ou de flex e, por padrão, nunca encolhem abaixo do próprio conteúdo: sem
 * `min-width: 0` em cada nível, uma tabela larga estica o painel, escapa da
 * coluna e passa por baixo do painel vizinho. O `overflow-x` do invólucro da
 * tabela só funciona quando todos os ancestrais aceitam encolher.
 */
.portal-columns > div > *,
.portal-columns > aside > *,
.portal-panel,
.portal-form,
.portal-form > *,
.portal-grid > * {
  min-width: 0;
}
.portal-fieldset {
  /* Fieldset nasce com `min-inline-size: min-content`; aqui isso transbordaria. */
  min-width: 0;
  min-inline-size: 0;
}
/* O invólucro rolável ocupa a linha inteira do fieldset e pode encolher. */
.portal-fieldset > .portal-fee-table-wrap {
  flex: 1 1 100%;
  min-width: 0;
}
/* Painéis de tabela larga ficam abaixo das colunas, com a largura toda. */
.portal-columns + .portal-panel {
  margin-top: 24px;
}
/* A coluna lateral é estreita: as tabelas de honorários se acomodam nela. */
.portal-columns aside .portal-fee-table {
  font-size: 0.8rem;
}
.portal-columns aside .portal-fee-table th,
.portal-columns aside .portal-fee-table td {
  padding: 8px 6px;
}
.portal-columns aside .portal-panel {
  padding: 22px 22px;
  overflow-wrap: break-word;
}
/* Na coluna lateral não cabem duas colunas de definições nem valor à direita. */
.portal-columns aside .portal-detail {
  grid-template-columns: 1fr;
  gap: 14px;
}
.portal-columns aside .portal-definition dd {
  text-align: left;
}

.portal-panel {
  padding: 26px 28px;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 22px;
}
.portal-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.portal-panel h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin-bottom: 10px;
}
.portal-panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.portal-panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.portal-muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.portal-metric {
  display: grid;
  gap: 6px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
}
.portal-metric span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.portal-metric strong {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
}

.portal-search {
  display: inline-flex;
  align-items: center;
  min-width: 260px;
  border: 1px solid #cfd3d7;
}
.portal-search input {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  font: inherit;
  font-size: 0.9rem;
}
.portal-search input:focus {
  outline: 2px solid rgba(213, 171, 108, 0.5);
  outline-offset: -1px;
}
.portal-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.portal-select {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfd3d7;
  background: #fff;
}
.portal-select select {
  min-width: 210px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: inherit;
  cursor: pointer;
}
.portal-select select:focus-visible {
  outline: 2px solid rgba(213, 171, 108, 0.5);
  outline-offset: -1px;
}
/* Filtro de período: rótulo curto visível ao lado do campo de data. */
.portal-select-date {
  gap: 6px;
  padding-left: 10px;
}
.portal-select-date span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.portal-select-date input {
  padding: 10px 12px 10px 4px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: inherit;
}
.portal-select-date input:focus-visible {
  outline: 2px solid rgba(213, 171, 108, 0.5);
  outline-offset: -1px;
}
.portal-filter-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}
.portal-filter-note button {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: #9a7745;
  text-decoration: underline;
  cursor: pointer;
}
.portal-tabs { display:flex; gap:8px; margin:0 0 18px; border-bottom:1px solid var(--line); }
.portal-tab { padding:10px 14px; border:0; border-bottom:2px solid transparent; background:transparent; color:#6c7482; font:inherit; font-size:.82rem; cursor:pointer; }
.portal-tab strong { margin-left:5px; color:#9a7745; }
.portal-tab:hover, .portal-tab.is-active { color:#172333; border-bottom-color:var(--gold); }
.portal-tab:focus-visible { outline:2px solid rgba(213,171,108,.55); outline-offset:2px; }

.portal-table-wrap {
  overflow-x: auto;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.portal-table th {
  padding: 12px 10px;
  color: #6c7482;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.portal-table td {
  padding: 15px 10px;
  color: #4d5867;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.portal-table a {
  color: #172333;
  text-decoration: none;
}
.portal-table a:hover {
  color: #7b592c;
}
.portal-table strong {
  display: block;
  font-weight: 600;
}
.portal-table small {
  color: #8d949e;
  font-size: 0.76rem;
}
.portal-row {
  cursor: pointer;
}
.portal-row:hover td {
  background: #fbf8f2;
}

.portal-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #6c7482;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.portal-tag-news {
  border-color: rgba(196, 154, 82, 0.5);
  color: #7b592c;
}

.badge {
  display: inline-block;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #3f4854;
  background: #ebe6dd;
  border: 1px solid rgba(21, 34, 51, 0.12);
  white-space: nowrap;
}
.badge-nova,
.badge-new {
  background: #e7eef7;
  color: #24466f;
}
.badge-em-analise,
.badge-under-review {
  background: #fdf3e2;
  color: #8a5f16;
}
.badge-aguardando-cliente,
.badge-awaiting-client {
  background: #f2eef8;
  color: #4b3a75;
}
.badge-aguardando-aprovacao,
.badge-awaiting-approval {
  background: #f8e8e3;
  color: #8c3f22;
}
.badge-respondida,
.badge-answered {
  background: #e9f2ea;
  color: #2f5c3a;
}
.badge-concluida,
.badge-completed {
  background: #e6e9ec;
  color: #414c59;
}
.badge-active {
  background: #e4efe6;
  color: #2f5d3c;
}
.badge-disabled {
  background: #eceef0;
  color: #6c7482;
}

.portal-columns .portal-panel,
.portal-columns .portal-source {
  margin-bottom: 0;
}
.portal-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  white-space: nowrap;
}
.portal-pending {
  display: block;
  margin-top: 5px;
  color: #8d949e;
  font-size: 0.72rem;
}
.portal-empty-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.portal-alert {
  margin: 0 0 18px;
  padding: 13px 16px;
  font-size: 0.88rem;
  border-left: 3px solid var(--gold);
  background: #f6f1e7;
  color: #4b5663;
}
.portal-alert-error {
  border-left-color: #a5402a;
  background: #f9ece8;
  color: #7a3120;
}

.portal-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.portal-form .full {
  grid-column: 1 / -1;
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}
.portal-form label,
.portal-field {
  display: grid;
  gap: 7px;
  color: #303b48;
  font-size: 0.84rem;
  font-weight: 600;
}
.portal-form label small {
  color: #777f89;
  font-weight: 400;
}
.portal-form input,
.portal-form select,
.portal-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd3d7;
  border-radius: 0;
  background: #fff;
  color: #172333;
  font: inherit;
  font-size: 0.94rem;
}
.portal-form select {
  min-height: 43px;
}
.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus {
  outline: 2px solid rgba(213, 171, 108, 0.5);
  outline-offset: 1px;
}
.portal-form input[type="file"] {
  padding: 9px 0;
  border: 0;
}
.portal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
  font-size: 0.88rem;
}
.portal-form .portal-check {
  display: flex;
}
.portal-check input {
  width: auto;
  margin-top: 3px;
}
.portal-check span {
  display: grid;
  gap: 3px;
}
.portal-form .portal-check-restricted {
  display: grid;
  gap: 7px;
}
.portal-check-restricted .portal-check-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.portal-check-restricted .portal-check-title input {
  margin: 0;
}
.portal-check-restricted > small {
  color: #777f89;
  font-weight: 400;
  line-height: 1.55;
}
.portal-check-inline {
  align-items: center;
}
.portal-check-inline input {
  margin-top: 0;
}
.portal-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
}
.portal-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: #fbfaf7;
}
.portal-litigation-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); }
.portal-fieldset legend {
  padding: 0 8px;
  color: #6c7482;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.portal-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.portal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.portal-button:hover {
  background: var(--ink-soft);
}
.portal-button-gold {
  background: var(--gold);
  color: #17120a;
}
.portal-button-gold:hover {
  background: var(--gold-light);
}
.portal-button-secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: #4d5867;
}
.portal-button-secondary:hover {
  background: #f6f1e7;
}
.portal-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.portal-text-button {
  border: 0;
  background: none;
  padding: 0;
  color: #7b592c;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.portal-text-button:hover {
  color: #3d2d16;
}
.portal-text-button-danger {
  color: #9a3d2b;
}
.portal-text-button-danger:hover {
  color: #6f281b;
}
.portal-back {
  display: inline-block;
  margin-bottom: 20px;
  color: #7b592c;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.portal-detail {
  display: grid;
  grid-template-columns: 1.55fr 0.95fr;
  gap: 22px;
  align-items: start;
}
.portal-source {
  display: grid;
  gap: 4px;
  margin-bottom: 20px;
  padding: 16px 18px;
  background: #f6f1e7;
  border-left: 3px solid var(--gold);
  font-size: 0.88rem;
}
.portal-source strong {
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #8a6a33;
}
.portal-source a {
  color: #7b592c;
  word-break: break-all;
}

.portal-timeline {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}
.portal-message {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.portal-message.escritorio {
  background: #f2f5f8;
  border-left: 3px solid #24466f;
}
.portal-message.cliente {
  border-left: 3px solid var(--gold);
}
.portal-message header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.portal-message header strong {
  color: #172333;
  font-size: 0.86rem;
}
.portal-message p {
  margin: 0;
  color: #46505e;
  font-size: 0.93rem;
  white-space: pre-wrap;
}

.portal-files {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}
.portal-files a {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  color: #172333;
  font-size: 0.88rem;
  text-decoration: none;
  background: var(--paper);
}
.portal-files a:hover {
  border-color: var(--gold);
}
.portal-files span {
  color: var(--muted);
  font-size: 0.78rem;
}

.portal-definition {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.portal-definition > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.portal-definition dt {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.portal-definition dd {
  margin: 0;
  color: #172333;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
}

.portal-hours {
  display: grid;
  gap: 12px;
}
.portal-hours > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.portal-hours strong {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
}
.portal-fee-estimate {
  margin-top: 20px;
}
.portal-fee-statement {
  margin: 20px 0;
}
.portal-fee-table-wrap {
  overflow-x: auto;
}
.portal-fee-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
}
.portal-fee-table th,
.portal-fee-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.portal-fee-table thead th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.portal-fee-table tbody th {
  color: #172333;
  font-size: 0.88rem;
}
.portal-fee-table input {
  min-width: 96px;
}
.portal-fee-estimate .portal-fee-table {
  min-width: 780px;
}
.portal-fee-summary {
  min-width: 0;
  font-size: 0.86rem;
}
.portal-fee-summary th,
.portal-fee-summary td {
  padding: 9px 8px;
}
.portal-fee-summary td {
  color: #172333;
  font-weight: 600;
  white-space: nowrap;
}
/* As linhas de saldo vêm prefixadas pela tabela para vencer `td:last-child`. */
.portal-fee-table .portal-fee-balance th,
.portal-fee-table .portal-fee-balance td {
  background: #f6f1e7;
  color: #3e3424;
  font-weight: 700;
}
.portal-fee-table .portal-fee-balance.is-negative th,
.portal-fee-table .portal-fee-balance.is-negative td {
  background: #fbeceb;
  color: #8c2f26;
}
/* Saldo financeiro: pago menos incorrido. Crédito em verde, débito em vermelho. */
.portal-fee-table .portal-fee-settlement th,
.portal-fee-table .portal-fee-settlement td {
  background: #eef1f4;
  color: #2f3947;
  font-weight: 700;
}
.portal-fee-table .portal-fee-settlement.is-credit th,
.portal-fee-table .portal-fee-settlement.is-credit td {
  background: #e7f2e9;
  color: #24603a;
}
.portal-fee-table .portal-fee-settlement.is-negative th,
.portal-fee-table .portal-fee-settlement.is-negative td {
  background: #fbeceb;
  color: #8c2f26;
}
.portal-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dfe4e9;
  color: #3f4854;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.portal-flag.is-credit {
  background: #cfe6d6;
  color: #1f5533;
}
.portal-flag.is-negative {
  background: #f6d7d3;
  color: #7d2a21;
}
.portal-finance-control {
  margin-top: 20px;
}
.portal-finance-table {
  min-width: 520px;
}
/* Tabelas do financeiro: uma linha por empresa ou consulta, valores à direita. */
.portal-finance-grid {
  min-width: 780px;
}
.portal-finance-grid th:not(:first-child),
.portal-finance-grid td:not(:first-child) {
  white-space: nowrap;
}
.portal-finance-grid tbody th {
  color: #172333;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 15px 10px;
  vertical-align: top;
}
.portal-finance-grid .portal-cell-balance {
  background: #f6f1e7;
  color: #3e3424;
  font-weight: 700;
}
.portal-finance-grid .portal-cell-balance.is-negative {
  background: #fbeceb;
  color: #8c2f26;
}
.portal-finance-grid .portal-cell-settlement {
  background: #eef1f4;
  color: #2f3947;
  font-weight: 700;
}
.portal-finance-grid .portal-cell-settlement.is-credit {
  background: #e7f2e9;
  color: #24603a;
}
.portal-finance-grid .portal-cell-settlement.is-negative {
  background: #fbeceb;
  color: #8c2f26;
}
.portal-totals-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.portal-fee-table td:last-child {
  color: #172333;
  font-weight: 600;
  white-space: nowrap;
}
.portal-fee-table tfoot th,
.portal-fee-table tfoot td {
  background: #f6f1e7;
  color: #3e3424;
  font-weight: 700;
}
.portal-note {
  margin: 6px 0 0;
  padding: 12px 14px;
  background: #f6f1e7;
  border-left: 3px solid var(--gold);
  color: #5b4a2c;
  font-size: 0.84rem;
}
.portal-note-ok {
  background: #eaf1ea;
  border-left-color: #3d6b47;
  color: #2f5c3a;
}

.portal-empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: var(--paper);
}

.portal-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 60px 24px;
  background: radial-gradient(700px 460px at 80% 40%, rgba(77, 99, 141, 0.3), transparent 68%),
    linear-gradient(135deg, #06101e 0%, #0a182c 54%, #07101f 100%);
}
.portal-login-card {
  width: min(470px, 100%);
  padding: 40px 38px;
  background: #fff;
  border: 1px solid rgba(239, 208, 155, 0.5);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.portal-login-card h1 {
  font-size: 2.05rem;
  margin-bottom: 10px;
}
.portal-login-card .eyebrow {
  color: #a67c45;
}
.portal-login-card > p {
  color: var(--muted);
  font-size: 0.92rem;
}
.portal-login-card form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}
.portal-login-card label {
  display: grid;
  gap: 7px;
  color: #303b48;
  font-size: 0.84rem;
  font-weight: 600;
}
.portal-login-card input {
  width: 100%;
  padding: 12px;
  border: 1px solid #cfd3d7;
  font: inherit;
  font-size: 0.95rem;
}
.portal-login-card input:focus {
  outline: 2px solid rgba(213, 171, 108, 0.5);
  outline-offset: 1px;
}
.portal-login-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}
.portal-login-foot a {
  color: #7b592c;
  text-decoration: none;
  font-weight: 600;
}
.portal-login .portal-language {
  color: #8d949e;
}
.portal-login .portal-language button {
  color: #172333;
}
.portal-login .portal-language button.is-current {
  color: #7b592c;
}

.portal-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(7, 16, 31, 0.62);
  overflow-y: auto;
}
.portal-modal {
  position: relative;
  width: min(660px, 100%);
  margin: auto;
}
.portal-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 1080px) {
  .portal-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .portal-detail {
    grid-template-columns: 1fr;
  }
  .portal-columns {
    grid-template-columns: 1fr;
  }
}

/* A coluna lateral só se justifica com largura útil; abaixo disto, empilha. */
@media (max-width: 1180px) {
  .portal-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }
  .portal-sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(239, 208, 155, 0.16);
  }
  .portal-nav {
    grid-template-columns: repeat(2, 1fr);
    display: grid;
  }
  .portal-main {
    padding: 32px 22px 56px;
  }
  .portal-heading,
  .portal-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .portal-filters {
    width: 100%;
  }
  .portal-filters .portal-search,
  .portal-filters .portal-select,
  .portal-filters .portal-select select,
  .portal-filters .portal-select-date input {
    flex: 1 1 200px;
    min-width: 0;
  }
  .portal-form,
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .portal-metrics {
    grid-template-columns: 1fr;
  }
  .portal-panel {
    padding: 20px 18px;
  }
  .portal-login-card {
    padding: 30px 22px;
  }
}
