/*
 * painel-admin — surface-specific styles only.
 *
 * Tokens, cards, grids, modals and fields come from ./ui/tokens.css and
 * ./ui/layout.css (the shared kit; never edited here). Every colour below is a
 * kit token, so both themes follow. Latão is never used here: the two Latão
 * spots per screen are the kit's primary button and active nav item.
 */

/* The kit styles a few elements with `display`, which beats the UA's
   [hidden] rule; this surface toggles visibility with the attribute. */
[hidden] { display: none !important; }

/* ------------------------------------------------------------ app shell */

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  z-index: 50;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.skip-link:focus { top: var(--space-2); }

/* "Administração": the surface label beside the horizontal signature. */
.brand-surface {
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.app-header .brand-surface { margin-left: calc(-1 * var(--space-3)); }

/*
 * The painel-admin header is Aço in both themes, so an operator never takes
 * this surface for the incorporadora's painel (white header in the light
 * theme, Tinta in the dark). Osso text; the symbol on Aço is a valid brand
 * application (Osso angles, Latão core), and the active item keeps its Latão
 * underline. The kit's tokens are redefined for the header only, so every kit
 * rule inside it (text, muted text, borders, hover, focus, ghost buttons, the
 * badge) follows without a per-element override. The translucent Osso values
 * are the one place this file uses colours outside the tokens.
 */
.app-header {
  --header-bg: var(--inctor-aco);
  --text: var(--inctor-osso);
  --text-muted: rgb(239 235 227 / 0.74);
  --border: rgb(239 235 227 / 0.14);
  --border-strong: rgb(239 235 227 / 0.32);
  --surface-hover: rgb(239 235 227 / 0.1);
  --focus: var(--inctor-osso);
  color: var(--text);
  border-bottom-color: transparent;
}

.operator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

main:focus,
h1[tabindex="-1"]:focus { outline: none; }

@media (max-width: 48rem) {
  .brand-surface,
  .operator__name { display: none; }
}

/* ------------------------------------------------------------ page head */

.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.detail-back {
  align-self: flex-start;
  margin-bottom: calc(-1 * var(--space-3));
}

/* -------------------------------------------------------------- cells */

.alias {
  padding: 0.0625rem 0.3rem;
  border-radius: var(--radius);
  background: var(--surface-sunken);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cell-stack__sub {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.cell-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.cell-link:hover { text-decoration: underline; }

.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------- detail */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 64rem) {
  .detail-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

.detail-section + .detail-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.detail-section__title {
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: 0.8125rem;
  font-variation-settings: normal;
  font-weight: 600;
  letter-spacing: 0;
}

.summary dd { overflow-wrap: anywhere; }

.summary .summary__wide { grid-column: 1 / -1; }

.summary__stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.source-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.source-note--verified { color: var(--success-text); }

.source-note .material-symbols-outlined { font-size: 1rem; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Provisioning steps: a dot per step, done in Concluído, pending in Planejado. */
.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
}

.steps__item[data-done="false"] .steps__label { color: var(--text-muted); }

.steps__when {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--inctor-atraso);
  border-radius: var(--radius);
  background: var(--surface-sunken);
}

.notice--info { border-left-color: var(--inctor-planejado); }

/* The right column of the detail: situação, then the logo. */
.detail-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* ----------------------------------------------------------------- logo */

.logo-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* The preview sits on white in both themes: it is the diary PDF's paper, and
   a transparent PNG must be judged against it. The one non-token colour. */
.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.logo-preview img {
  display: block;
  max-width: 100%;
  max-height: 6rem;
  object-fit: contain;
}

.logo-preview--empty,
.logo-preview--error {
  flex-direction: column;
  gap: var(--space-2);
  border-style: dashed;
  border-color: var(--border-strong);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.logo-preview--error { color: var(--error-text); }

.logo-preview__icon { font-size: 2rem; }

.logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ------------------------------------------------- role choices (users) */

.role-field .choices {
  flex-direction: column;
  gap: var(--space-2);
}

.role-field .choice { align-items: flex-start; }
.role-field .choice input { margin-top: 0.1875rem; }

.choice__text {
  display: flex;
  flex-direction: column;
}

.choice__name { font-weight: 500; }

.choice__desc {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.dev-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.dev-link__title {
  font-size: 0.875rem;
  font-weight: 600;
}

.dev-link__outcome { font-weight: 500; }

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.copy-row .input {
  flex: 1 1 14rem;
  min-width: 0;
  font-size: 0.8125rem;
}

/* ------------------------------------------------------ modal forms */

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-section + .form-section {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.form-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.form-section__title { font-size: 1rem; }

.form-note {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* CNPJ lookup result, beside the CNPJ field. */
.lookup-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: end;
  gap: var(--space-2);
  min-height: var(--control-height);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.lookup-note .material-symbols-outlined { font-size: 1.125rem; }

.lookup-note--verified { color: var(--success-text); font-weight: 500; }
.lookup-note--error { color: var(--error-text); font-weight: 500; }
.lookup-note--registered { color: var(--text); font-weight: 500; }

.alias-status {
  font-size: 0.8125rem;
  font-weight: 500;
}

.alias-status:empty { display: none; }
.alias-status--ok { color: var(--success-text); }
.alias-status--error { color: var(--error-text); }
.alias-status--busy { color: var(--text-muted); }

.alias-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.alias-suggestions:empty { display: none; }

.chip {
  min-height: 2rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  cursor: pointer;
}

.chip:hover { background: var(--surface-hover); }
.chip[aria-pressed="true"] { border-color: var(--text); }

.input[readonly] {
  background: var(--surface-sunken);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- login */

.login-page {
  display: flex;
  flex-direction: column;
}

.login-top {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-3) var(--space-4);
}

.login {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-5);
  width: min(26rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 var(--space-6);
}

/* The mark above the card (.brand-mark) and the background come from
   ui/brand-motion.css, shared with painel/ and site/. */

.login__notice {
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--inctor-planejado);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  font-weight: 500;
}

.login__actions .btn { width: 100%; }

.login__foot {
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* ------------------------------------------------ Referências (ORCAMENTO-017) */

.rf-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.rf-controls .input, .rf-controls .select { width: auto; }
.rf-list { margin: 0; padding-left: 1.25rem; display: grid; gap: var(--space-1); }
.rf-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--space-3) var(--space-5); margin: 0; }
.rf-summary dt { color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; }
.rf-summary dd { margin: var(--space-1) 0 0; }
.rf-break { overflow-wrap: anywhere; }
