:root {
  --navy: #14263e;
  --navy-deep: #10203a;
  --teal: #55b9c7;
  --teal-deep: #1f7483;
  --canvas: #f3f6f9;
  --surface: #ffffff;
  --ink: #17263b;
  --muted: #5d6f84;
  --border: #dce4eb;
  --selected: #e8f4f6;
  --success: #187a55;
  --warning: #8a5a13;
  --danger: #a5332f;
  --topbar-text: #c3d4e4;
  --warning-surface: #fbf2e2;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.55;
}

h1, h2, h3, p { margin-top: 0; }

a { color: var(--teal-deep); }

:focus-visible {
  outline: 2px solid var(--teal-deep);
  outline-offset: 2px;
}

code {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0 var(--space-xl);
  background: var(--navy);
  border-bottom: 1px solid var(--navy-deep);
  color: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--surface);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover { color: var(--surface); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  color: var(--teal);
  font-size: 1rem;
  letter-spacing: 0;
}

.topbar-meta { display: flex; align-items: center; gap: 1rem; min-width: 0; }

.session-form { display: flex; align-items: center; gap: 1rem; margin: 0; }

.session-action {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--topbar-text);
  background: transparent;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  text-decoration: none;
}

.session-action:hover,
.session-action:focus-visible { color: var(--teal); }

.session-chip {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--topbar-text);
}

.session-scope {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
  max-width: 30rem;
}

.session-scope-name,
.session-scope-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-scope-code {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.app-frame {
  flex: 1;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.side-nav {
  padding: var(--space-xl) var(--space-md);
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.nav-group + .nav-group { margin-top: var(--space-xl); }

.nav-label {
  display: block;
  margin: 0 12px var(--space-sm);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-label-stage { color: var(--teal-deep); }

.nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.nav-link:hover { background: var(--canvas); color: var(--navy); }

.nav-link.active {
  background: var(--selected);
  color: var(--teal-deep);
}

.app-main {
  min-width: 0;
  padding: var(--space-xl) clamp(20px, 4vw, 48px) 64px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.note-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-deep);
}

.page-head h1 {
  margin-bottom: var(--space-sm);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-lead {
  max-width: 72ch;
  margin-bottom: 0;
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--navy);
}

.button-ghost:hover { background: var(--selected); color: var(--navy); }

.panel {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel-title {
  margin-bottom: var(--space-md);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.panel-head .panel-title { margin-bottom: 0; }

.panel p { max-width: 72ch; }

.state-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.state-notice-mark {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: var(--radius-pill);
  background: var(--teal-deep);
}

.state-notice-title {
  margin-bottom: var(--space-xs);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.state-notice-body {
  max-width: 72ch;
  margin-bottom: 0;
  color: var(--muted);
}

.metric-grid,
.link-grid,
.module-grid {
  display: grid;
  gap: var(--space-md);
}

.metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.note {
  margin-bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.note p { margin-bottom: 0; color: var(--muted); }

.link-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.link-card {
  display: block;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.link-card:hover {
  border-color: var(--teal);
  background: var(--selected);
}

.link-card-title {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 600;
  color: var(--teal-deep);
}

.link-card-body { display: block; color: var(--muted); }

.count-chip,
.status-chip,
.flag-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.count-chip,
.status-chip {
  background: var(--selected);
  color: var(--teal-deep);
}

.flag-chip { background: var(--canvas); color: var(--muted); }
.flag-chip.flag-on { background: var(--selected); color: var(--teal-deep); }

.status-pending { background: var(--warning-surface); color: var(--warning); }

.table-panel { padding: var(--space-lg); }

.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  padding: var(--space-sm) 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--selected); }
.data-table .numeric { text-align: right; }

.data-table select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.data-table select:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 2px; }

.table-foot {
  margin: var(--space-md) 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.module-card {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.module-card p { margin-bottom: 0; color: var(--muted); }
.module-pending { background: var(--warning-surface); }

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.module-title {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 600;
}

.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-md); }
.filter-chip {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill);
  color: var(--muted); font-size: 0.875rem; font-weight: 600; text-decoration: none;
}
.filter-chip:hover { border-color: var(--teal); color: var(--navy); }
.filter-chip.is-on { background: var(--selected); border-color: var(--teal-deep); color: var(--teal-deep); }

.row-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8125rem; }

.inline-link {
  display: inline-block;
  margin-top: var(--space-sm);
  font-weight: 600;
}

@media (max-width: 960px) {
  .app-frame { grid-template-columns: minmax(0, 1fr); }
  .side-nav {
    display: flex;
    gap: var(--space-lg);
    overflow-x: auto;
    padding: var(--space-sm) var(--space-md);
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-group { display: flex; align-items: center; gap: var(--space-xs); }
  .nav-group + .nav-group { margin-top: 0; }
  .nav-label { display: none; }
  .nav-link { white-space: nowrap; }
  .app-main { padding: var(--space-lg) var(--space-md) 48px; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 var(--space-md); }
  .brand > span { display: none; }
  .topbar-meta { gap: 0.5rem; }
  .session-form { gap: 0.5rem; }
  .session-chip { font-size: 0.6875rem; }
  .session-state { display: none; }
  .session-scope { max-width: 52vw; }
  .session-scope-code { display: none; }
  .page-head { flex-direction: column; }
  .page-head h1 { font-size: 1.75rem; }
  .metric-grid,
  .link-grid,
  .module-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: var(--space-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Forms (cut 21) */
.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: var(--space-xs); }

.field label { font-size: 0.875rem; font-weight: 600; color: var(--ink); }

.field input,
.field select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

.field input:focus-visible,
.field select:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 1px; }

.field-error, .form-error { color: var(--danger); font-size: 0.875rem; margin: var(--space-xs) 0 0; }

.form-actions { display: flex; gap: var(--space-sm); }

.button-primary {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
  color: #fff;
}

.button-primary:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

.issued-link {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--selected);
}

.issued-link p { margin: 0 0 var(--space-sm); }

.issued-link-value {
  width: 100%;
  font: inherit;
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Cut 22: structure screen */
.form-grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.form-grid-5 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.6fr) auto; }
.form-success { color: var(--success); font-size: 0.9375rem; margin: 0 0 var(--space-md); }
.row-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.row-action-form { margin: 0; }
.button-small { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }

@media (max-width: 720px) {
  .form-grid-4, .form-grid-5 { grid-template-columns: 1fr; }
}

/* Cut 23: checkbox field and muted inline text */
.field-check { justify-content: flex-end; }
.field-check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.field-check input { width: auto; padding: 0; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ corte 26
   Superfícies do navegador tematizadas + visão geral útil da unidade.
   Cor é informação: ciano só em assinatura/ação; estado em verde/âmbar/vermelho. */

::selection { background: rgba(85, 185, 199, 0.35); color: var(--navy-deep); }
:root { caret-color: var(--teal-deep); }
html { scrollbar-color: var(--teal) var(--canvas); scrollbar-width: thin; }
a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
body { font-variant-numeric: tabular-nums; }

.state-notice-action { margin-top: var(--space-md); }

.metric-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metric-note {
  display: block;
  margin-top: var(--space-xs);
  color: var(--muted);
  font-size: 0.8125rem;
}

.steps-panel .panel-head { margin-bottom: var(--space-md); }

.step-list { margin: 0; padding: 0; list-style: none; }

.step {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.step:first-child { border-top: 0; padding-top: 0; }

.step-mark { display: grid; place-items: center; margin-top: 2px; }
.step-mark svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.step.is-done .step-mark { color: var(--success); }
.step.is-pending .step-mark { color: var(--muted); }

.step-body { display: grid; gap: 2px; }
.step-title { font-weight: 650; letter-spacing: -0.01em; }
.step-detail { color: var(--muted); font-size: 0.9375rem; }

.step-action { align-self: center; font-weight: 650; white-space: nowrap; }
.step-action.is-primary {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--teal-deep);
  color: var(--surface);
  text-decoration: none;
}
.step-action.is-primary:hover { background: var(--navy); color: var(--surface); }

.steps-ready { margin: 0; color: var(--muted); }

.shortcut-list { margin: 0; padding: 0; list-style: none; }
.shortcut-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.shortcut-list li:first-child { border-top: 0; padding-top: 0; }
.shortcut-list a { font-weight: 650; }
.shortcut-list span { color: var(--muted); font-size: 0.9375rem; text-align: right; }

/* Navegação com ícone: um único conjunto, traço de 1,75, cor herdada. */
.nav-link { display: flex; align-items: center; gap: 10px; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.75; }

@media (max-width: 1020px) {
  .metric-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .metric-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: 24px minmax(0, 1fr); }
  .step-action { grid-column: 2; justify-self: start; margin-top: var(--space-xs); }
  .shortcut-list li { flex-direction: column; gap: 2px; }
  .shortcut-list span { text-align: left; }
}
/* ---------------------------------------------------------- plataforma (27) */
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.invite-panel { border-color: var(--teal); background: var(--selected); }
.invite-note { margin: 0 0 var(--space-md); color: var(--ink); }
.invite-link {
  padding: 12px 14px;
  border: 1px dashed var(--teal-deep);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow-x: auto;
}
.invite-link code { font-size: 0.8125rem; word-break: break-all; }

@media (max-width: 1020px) {
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* -------------------------------------------------------------- escolha (00h) */
.selection-list { display: grid; gap: var(--space-sm); margin-bottom: var(--space-lg); }

.selection-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.selection-option:hover { border-color: var(--teal); background: var(--selected); }
.selection-option:focus-within { outline: 2px solid var(--teal-deep); outline-offset: 2px; }
.selection-option input { flex: 0 0 auto; width: auto; margin: 2px 0 0; }
.selection-option span { display: grid; gap: 4px; min-width: 0; }
.selection-option small { color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .selection-option { padding: 12px; }
}

/* ----------------------------------------------------------- financeiro (34) */
.form-grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field-check { justify-content: end; }
.field-check label { display: flex; align-items: center; gap: 8px; }
.field-check input { width: auto; }

.row-action-form.movement-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.movement-form input[type="number"] { width: 96px; }
.movement-form input[type="date"] { width: 148px; }
.movement-form select { max-width: 180px; }

.table-link { color: var(--teal-deep); font-weight: 600; white-space: nowrap; }
.table-muted { color: var(--muted); }

.receipt-toolbar { align-items: end; }
.receipt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.receipt-sheet {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: #111;
}
.receipt-header { border-bottom: 2px solid #111; padding-bottom: 16px; margin-bottom: 24px; }
.receipt-header h2 { margin: 4px 0; font-size: 1.5rem; }
.receipt-header p { margin: 2px 0; }
.receipt-kicker { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: #555; }
.receipt-code { font-size: 0.8rem; color: #555; }
.receipt-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px;
  margin: 0 0 28px;
}
.receipt-meta dt { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: #555; }
.receipt-meta dd { margin: 2px 0 0; font-weight: 600; }
.receipt-meta .numeric, .receipt-table .numeric { text-align: right; }
.receipt-sheet h3 { margin: 0 0 12px; font-size: 1rem; }
.receipt-table { color: #111; }
.receipt-empty { color: #555; }
.receipt-foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid #bbb; font-size: 0.75rem; color: #555; }

@media (max-width: 720px) {
  .receipt-sheet { padding: 20px; }
  .receipt-actions { width: 100%; }
}

@media print {
  body { background: #fff !important; }
  .topbar, .app-footer, .receipt-actions, .state-notice, .page-head > a { display: none !important; }
  .app-main { padding: 0 !important; max-width: none !important; }
  .receipt-sheet { border: 0; border-radius: 0; padding: 0; max-width: none; }
  .receipt-table th, .receipt-table td { padding: 6px 4px; }
}

/* Tarja global de pagamento (só administração e Master). Cores fixas: contraste AA em claro e escuro. */
.billing-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: center;
}
.billing-banner-pending { background: #fdebc2; color: #4a3000; border-bottom: 2px solid #c98a00; }
.billing-banner-blocked { background: #f8d3d0; color: #5c0f0b; border-bottom: 2px solid #a5332f; }
.billing-banner a { color: inherit; font-weight: 700; text-decoration: underline; }
.billing-banner a:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
