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

:root {
  --bg: #f1f4f8;
  --bg-soft: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.20);
  --accent: #1e3a5f;
  --accent-2: #0ea5e9;
  --accent-3: #1D9E75;
  --success: #1f7a5b;
  --danger: #b91c1c;
  --shadow: 0 1px 4px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  /* ── Extended Design Tokens (refactoring additions) ─── */
  
  /* Aliases for backward compat */
  --border:             rgba(15, 23, 42, 0.10);
  --border-soft:        rgba(15, 23, 42, 0.08);
  --border-strong:      rgba(15, 23, 42, 0.20);
  --border-focus:       #0ea5e9;
  --text-primary:       #0f172a;
  --text-secondary:     #64748b;
  --text-tertiary:      #94a3b8;
  --text-inverse:       #ffffff;
  --text-link:          #0284c7;
  --text-main:          #0f172a;
  --text-color:         #0f172a;
  --text:               #0f172a;
  --accent-hover:       #122847;
  --accent-surface:     #f0f5fc;
  --success-bg:         #ecfdf5;
  --danger-bg:          #fef2f2;
  --warning:            #f59e0b;
  --warning-bg:         #fffbeb;
  --info:               #0ea5e9;
  --info-bg:            #f0f9ff;
  --card-bg:            #ffffff;
  --color-background-primary:   #f1f4f8;
  --color-background-secondary: #f8fafc;
  --color-background-tertiary:  #ffffff;
  --color-text-secondary:       #64748b;
  --color-border-secondary:     rgba(15, 23, 42, 0.10);
  --color-border-tertiary:      rgba(15, 23, 42, 0.06);
  --border-color:               rgba(15, 23, 42, 0.10);
  --color-amber-200:    #fde68a;
  --color-blue-200:     #bfdbfe;
  --color-green-200:    #a7f3d0;
  --color-red-200:      #fecaca;

  /* Typography scale */
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --text-2xs:  0.68rem;
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.875rem;
  --text-md:   0.9375rem;
  --text-lg:   1rem;
  --text-xl:   1.125rem;
  --text-2xl:  1.25rem;
  --text-3xl:  1.5rem;
  --text-4xl:  1.875rem;
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;
  --font-black:    800;
  
  /* Spacing */
  --space-0:   0;
  --space-1:   0.25rem;
  --space-1_5: 0.375rem;
  --space-2:   0.5rem;
  --space-2_5: 0.625rem;
  --space-3:   0.75rem;
  --space-3_5: 0.875rem;
  --space-4:   1rem;
  --space-5:   1.25rem;
  --space-6:   1.5rem;
  --space-7:   1.75rem;
  --space-8:   2rem;
  --space-9:   2.25rem;
  --space-10:  2.5rem;
  --space-12:  3rem;
  --space-16:  4rem;

  /* Radius extended */
  --radius-xs:   2px;
  --radius-xl:   12px;
  --radius-2xl:  16px;
  --radius-3xl:  20px;
  --radius-full: 9999px;

  /* Shadows extended */
  --shadow-none: none;
  --shadow-xs:   0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm:   0 1px 3px rgba(15,23,42,0.08);
  --shadow-md:   0 4px 6px rgba(15,23,42,0.07);
  --shadow-lg:   0 10px 15px rgba(15,23,42,0.08);
  --shadow-xl:   0 20px 25px rgba(15,23,42,0.08);
  --shadow-2xl:  0 25px 50px rgba(15,23,42,0.12);
  --shadow-focus: 0 0 0 3px rgba(14,165,233,0.25);

  /* Transitions */
  --ease-out:      cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base:     0;
  --z-raised:   1;
  --z-dropdown: 20;
  --z-sticky:   30;
  --z-fixed:    40;
  --z-drawer:   60;
  --z-modal:    80;
  --z-overlay:  90;
  --z-toast:    100;

  /* Sidebar */
  --sidebar-width:  256px;
  --sidebar-active: rgba(255,255,255,0.13);
  --sidebar-hover:  rgba(255,255,255,0.06);
  --sidebar-border: rgba(255,255,255,0.08);
  --sidebar-accent: #5da2ff;
  --sidebar-muted:  rgba(226,232,240,0.46);

}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1800px, calc(100vw - 32px));
  margin: 24px auto 40px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 28px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #1a4d7a 100%);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.18);
  color: #f1f5f9;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -80px auto;
  width: 240px;
  height: 240px;
  border-radius: 40px;
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.15), rgba(14, 165, 233, 0));
  transform: rotate(24deg);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px;
  box-shadow: 0 18px 30px rgba(10, 18, 30, 0.18);
}

.hero-brand-copy {
  display: grid;
  gap: 4px;
}

.hero-brand-copy .eyebrow {
  margin-bottom: 0;
}

.hero-brand-copy span {
  color: rgba(247, 239, 229, 0.84);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 14px;
  max-width: 14ch;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.98;
}

.hero-text {
  margin: 0;
  max-width: 62ch;
  line-height: 1.6;
  color: rgba(247, 239, 229, 0.86);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-meta span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.92rem;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  z-index: 1;
}

.hero-stat,
.stat-card,
.panel-card,
.filters-card,
.drawer-panel {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hero-stat {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 239, 229, 0.72);
}

.hero-subvalue {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.05rem, 1.6vw, 1.55rem);
  font-weight: 600;
  color: rgba(247, 239, 229, 0.92);
}

.hero-detail {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: rgba(247, 239, 229, 0.72);
}

.hero-stat strong {
  display: block;
  font-size: clamp(1.05rem, 1.6vw, 1.55rem);
  line-height: 1.1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 24px;
}

.toolbar-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.tab-button,
.ghost-button,
.primary-button,
.icon-button {
  border: 0;
  border-radius: 10px;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.tab-button,
.ghost-button {
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  border: 1px solid rgba(24, 38, 61, 0.1);
  font-weight: 500;
}

.tab-button.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.ghost-button:hover,
.primary-button:hover,
.icon-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.primary-button {
  padding: 9px 18px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(24, 38, 61, 0.07);
  color: var(--ink);
}

.danger-button {
  color: var(--danger);
}

.views {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view {
  display: none;
  animation: rise 320ms ease;
}

.view.is-active {
  display: block;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.card-grid.stage-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-ui .card-grid.stage-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid.ops-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-ui .card-grid.ops-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .card-grid.ops-cards,
  .compact-ui .card-grid.ops-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .card-grid.ops-cards,
  .compact-ui .card-grid.ops-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stat-card,
.panel-card,
.filters-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.stat-card {
  padding: 20px;
}

.stat-card::before {
  display: none;
}

.stat-card h3,
.panel-card h2,
.drawer-head h2 {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

.stat-value-sub {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted, #64748b);
  margin-top: 2px;
  margin-bottom: 2px;
}

.stat-card h3 {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stat-foot {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.dashboard-grid,
.operations-grid,
.finance-grid,
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.payroll-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.payroll-grid .payroll-wide {
  grid-column: span 2;
}

.payroll-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.payroll-form {
  display: grid;
  gap: 18px;
}

.panel-card,
.filters-card {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-separator {
  height: 1px;
  margin: 26px 0;
  background: rgba(24, 38, 61, 0.08);
}

.tab-bar.compact {
  margin-bottom: 16px;
  gap: 8px;
}

.finance-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.finance-filters .span-2 {
  grid-column: span 2;
}

.finance-tab-content {
  display: none;
}

.finance-tab-content.is-active {
  display: block;
}

.compact-table {
  border-collapse: collapse;
  width: 100%;
}

.compact-table thead tr {
  background: var(--color-background-secondary);
}

.compact-table th {
  background: var(--color-background-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  border-bottom: 1.5px solid var(--color-border-secondary);
}

.compact-table tbody tr:nth-child(odd) {
  background: var(--color-background-primary);
}

.compact-table tbody tr:nth-child(even) {
  background: var(--color-background-secondary);
}

.compact-table tbody tr:hover {
  background: var(--color-background-tertiary, rgba(0,0,0,0.04));
  transition: background var(--transition-fast);
}

.compact-table th,
.compact-table td {
  padding: 10px 8px;
  font-size: 0.88rem;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.compact-table td .ghost-button {
  padding: 6px 10px;
}

.company-docs-table td input[type="date"],
.company-docs-table td select {
  width: 100%;
}

.company-docs-table .company-doc-badge {
  display: inline-flex;
  margin-top: 6px;
}

.company-doc-attachments td {
  padding-top: 0;
}

.company-doc-attachments.is-hidden {
  display: none;
}

.company-doc-attachments .attachment-list {
  margin-top: 0;
  background: rgba(15, 34, 60, 0.04);
  border-radius: 14px;
  padding: 10px 14px;
}

.finance-modal {
  max-width: 860px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head h2 {
  font-size: 1.28rem;
}

.stage-overview {
  display: grid;
  gap: 12px;
}

.stage-row {
  display: grid;
  gap: 8px;
}

.stage-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
}

.stage-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(24, 38, 61, 0.08);
}

.stage-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
}

.alert-list,
.stack-list,
.report-list {
  display: grid;
  gap: 12px;
}

.panel-note {
  margin: 6px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.stage-list .kanban-card {
  width: 100%;
}

.stage-metrics {
  margin-bottom: 16px;
}

.alert-item,
.list-item,
.report-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.alert-item strong,
.list-item strong,
.report-item strong {
  display: block;
  margin-bottom: 6px;
}

.alert-item p,
.list-item p,
.report-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(24, 38, 61, 0.07);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Etapas — fundo + texto coloridos */
.badge.stage-ganho_no_valor,
.badge.stage-habilitada {
  background: #E1F5EE;
  color: #085041;
}

.badge.stage-em_habilitacao {
  background: #E6F1FB;
  color: #0C447C;
}

.badge.stage-aguardando_empenho {
  background: #FAEEDA;
  color: #633806;
}

.badge.stage-em_execucao {
  background: #E6F1FB;
  color: #0C447C;
}

.badge.stage-nota_emitida {
  background: #FAEEDA;
  color: #633806;
}

.badge.stage-recebido {
  background: #EAF3DE;
  color: #27500A;
}

.badge.stage-pendencia,
.badge.stage-pendente {
  background: #FCEBEB;
  color: #791F1F;
}

/* Prioridade — fundo + texto coloridos */
.badge.priority-baixa {
  background: #E1F5EE;
  color: #085041;
}

.badge.priority-media {
  background: #FAEEDA;
  color: #633806;
}

.badge.priority-alta {
  background: #FAECE7;
  color: #712B13;
}

.badge.priority-critica {
  background: #FCEBEB;
  color: #791F1F;
}

.filter-row,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.88rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(31, 108, 115, 0.44);
  box-shadow: 0 0 0 4px rgba(31, 108, 115, 0.12);
}

.span-2 {
  grid-column: span 2;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.report-filter-grid-inline {
  margin-top: 16px;
}

.report-filter-field {
  display: grid;
  gap: 8px;
}

.report-multi-filter {
  position: relative;
  display: grid;
  gap: 8px;
}

.report-multi-filter > span {
  font-size: 0.88rem;
  color: var(--muted);
}

.report-multi-trigger {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
}

.report-multi-filter.is-open .report-multi-trigger {
  border-color: rgba(31, 108, 115, 0.44);
  box-shadow: 0 0 0 4px rgba(31, 108, 115, 0.12);
}

.report-multi-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 48px rgba(24, 38, 61, 0.18);
}

.report-multi-filter.is-open .report-multi-panel {
  display: grid;
  gap: 6px;
}

.report-multi-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.report-multi-option:hover {
  background: rgba(24, 38, 61, 0.06);
}

.report-multi-option.is-all {
  border-bottom: 1px solid rgba(24, 38, 61, 0.08);
  margin-bottom: 4px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin: 18px 0;
  overflow: visible;
  padding: 0;
  align-items: start;
}

.pipeline-summary-grid {
  margin-top: 18px;
}

.kanban-column {
  min-height: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.kanban-head h3 {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 500;
}

.kanban-stage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.kanban-count {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(24, 38, 61, 0.07);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.kanban-list {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.kanban-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.kanban-card.is-attention {
  border-color: #bfdbfe;
  border-left: 3px solid #1e3a5f;
}

.kanban-card h4 {
  margin: 8px 0 5px;
  font-size: 0.93rem;
  font-weight: 500;
}

.kanban-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.88rem;
}

.kanban-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.kanban-card .meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.kanban-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.text-button {
  padding: 7px 12px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  border-radius: 8px;
  background: rgba(24, 38, 61, 0.04);
  font-size: 0.85rem;
}

.table-card {
  margin-top: 6px;
}

.table-wrap {
  overflow-x: auto;
}

.is-hidden {
  display: none !important;
}

.stage-table {
  display: none;
}

.compact-ui .compact-hide {
  display: none !important;
}

.compact-ui .stage-list {
  display: none;
}

.compact-ui .stage-table {
  display: block;
}

.compact-ui .operations-grid .stack-list {
  display: none;
}

.compact-ui .panel-card {
  padding: 18px;
}

.panel-card,
.filters-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

.panel-kicker {
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.view {
  max-width: none;
  width: 100%;
  margin: 0;
}

.compact-ui .stat-card {
  padding: 16px;
}

.compact-ui .panel-head {
  margin-bottom: 12px;
}

.compact-ui .panel-head h2 {
  font-size: 1.1rem;
}

.compact-ui .stat-value {
  font-size: 1.5rem;
}

.compact-ui .stat-foot {
  font-size: 0.85rem;
}

.compact-ui .stack-list {
  gap: 8px;
}

.compact-ui .alert-item,
.compact-ui .list-item,
.compact-ui .report-item {
  padding: 10px 12px;
}

.compact-ui .card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-ui #folhaCards {
  display: none;
}

.compact-ui .report-list {
  display: grid;
  gap: 8px;
}

.compact-ui .payroll-admin-grid {
  display: none;
}

#employeeFormCard {
  display: none;
}

body.show-employee-form #employeeFormCard {
  display: block !important;
}

#paymentFormCard {
  display: none;
}

body.show-payment-form #paymentFormCard {
  display: block !important;
}

.process-form-page {
  display: grid;
  gap: 18px;
}

#processFormView .panel-head {
  margin-bottom: 18px;
}

#processFormView .process-form {
  gap: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(24, 38, 61, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.health-meter {
  display: grid;
  gap: 6px;
  min-width: 140px;
}

.health-meter span {
  color: var(--muted);
  font-size: 0.84rem;
}

.health-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(24, 38, 61, 0.08);
}

.health-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-2), var(--success));
}

.list-item.with-action,
.alert-item.with-action,
.report-item.with-action {
  display: grid;
  gap: 12px;
}

.item-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 38, 61, 0.06);
  font-size: 0.84rem;
  color: var(--muted);
}

.month-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 280px;
}

.month-bar {
  display: grid;
  gap: 8px;
  align-items: end;
}

.month-bar-track {
  position: relative;
  height: 220px;
  border-radius: 20px;
  background: rgba(24, 38, 61, 0.08);
  overflow: hidden;
}

.month-bar-revenue,
.month-bar-profit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 18px 18px 0 0;
}

.month-bar-revenue {
  background: linear-gradient(180deg, rgba(31, 108, 115, 0.82), rgba(31, 108, 115, 0.38));
}

.month-bar-profit {
  background: linear-gradient(180deg, rgba(30, 58, 95, 0.85), rgba(30, 58, 95, 0.50));
  width: 74%;
  left: 13%;
}

.month-bar-label,
.month-bar-value {
  text-align: center;
  font-size: 0.82rem;
}

.year-compare {
  display: grid;
  gap: 14px;
}

.year-chart {
  display: grid;
  gap: 14px;
}

.year-chart-row {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(35, 45, 58, 0.08);
}

.year-chart-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: #1f2a36;
}

.year-chart-label strong {
  font-size: 1.05rem;
}

.year-chart-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(32, 45, 60, 0.12);
  overflow: hidden;
}

.year-chart-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #c4944b 0%, #3b5b7a 100%);
}

.year-chart-meta {
  display: flex;
  justify-content: flex-end;
  font-size: 0.85rem;
  color: #5f6c79;
}

.finance-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.finance-list {
  display: grid;
  gap: 12px;
}

.finance-row {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.finance-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.finance-row-grid .drawer-remove {
  align-self: center;
}

.year-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.year-card strong {
  font-size: 1.25rem;
}

.payroll-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
}

.payroll-card h3 {
  margin: 0;
}

.payroll-card p {
  margin: 10px 0 0;
  color: var(--muted);
}

.payroll-table {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
}

.payroll-table table {
  margin-top: 12px;
}

.report-preview-card {
  margin-bottom: 24px;
}

.report-preview-frame {
  width: 100%;
  min-height: 640px;
  border: 1px solid rgba(24, 38, 61, 0.12);
  border-radius: 24px;
  background: #fff;
}

.report-modal {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.report-modal.is-open {
  pointer-events: auto;
}

.report-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 38, 61, 0.45);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.report-modal-panel {
  position: absolute;
  inset: 24px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(247, 244, 238, 0.96);
  box-shadow: 0 24px 80px rgba(24, 38, 61, 0.28);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  transform: translateY(24px);
  opacity: 0;
  transition: opacity 220ms ease, transform 260ms ease;
  overflow: hidden;
}

.report-modal.is-open .report-modal-backdrop {
  opacity: 1;
}

.report-modal.is-open .report-modal-panel {
  opacity: 1;
  transform: translateY(0);
}

.report-modal-panel .report-preview-frame {
  min-height: 100%;
  border-radius: 20px;
}

.employee-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.employee-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-card h3 {
  margin: 0;
  font-size: 1.04rem;
}

.employee-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.drawer.is-open {
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 38, 61, 0.36);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.drawer-panel {
  position: absolute;
  inset: 16px 16px 16px auto;
  width: min(720px, calc(100vw - 24px));
  padding: 24px;
  border-radius: 32px;
  background: rgba(247, 244, 238, 0.92);
  box-shadow: 0 24px 80px rgba(24, 38, 61, 0.28);
  transform: translateX(110%);
  transition: transform var(--transition-normal);
  overflow-y: auto;
}

.drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.process-form {
  display: grid;
  gap: 18px;
}

.drawer-snapshot {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.process-form-page.is-create-mode .drawer-snapshot {
  display: none;
}

.snapshot-card {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(24, 38, 61, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.snapshot-card strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.snapshot-card span,
.snapshot-card small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.snapshot-card.is-positive strong { color: #166534; }
.snapshot-card.is-danger strong   { color: #b91c1c; }

.drawer-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.stage-guide-card {
  background: linear-gradient(135deg, rgba(203, 167, 76, 0.14), rgba(24, 38, 61, 0.08));
  border-color: rgba(203, 167, 76, 0.26);
}

.stage-section-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  padding: 6px 0;
}

/* Seta entre os botões */
.stage-section-tabs .stage-tab-button:not(:last-child)::after {
  content: "›";
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  pointer-events: none;
  position: absolute;
  right: -14px;
}

.stage-section-tabs .stage-tab-button {
  position: relative;
  margin-right: 18px;
}
.stage-section-tabs .stage-tab-button:last-child {
  margin-right: 0;
}

.stage-tab-group {
  display: grid;
  gap: 8px;
}

.stage-tab-group-title {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage-tab-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stage-tab-group-support {
  padding-top: 10px;
  border-top: 1px dashed rgba(24, 38, 61, 0.12);
}

.stage-tab-button {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
  cursor: pointer;
}

.stage-tab-button.is-active {
  background: rgba(31, 108, 115, 0.1);
  border-color: rgba(31, 108, 115, 0.3);
  color: #0F6E56;
}

.stage-tab-button.is-current-flow {
  border-color: rgba(203, 167, 76, 0.42);
}

.stage-tab-button.is-complete {
  color: #1f7a5b;
}

.stage-tab-button.is-upcoming {
  color: var(--muted);
}

.stage-tab-button.is-support-section {
  border-style: dashed;
  color: var(--muted);
}

.process-stage-section {
  display: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.process-stage-section.is-visible {
  display: grid;
}

.process-stage-section.is-current {
  border-color: rgba(31, 108, 115, 0.28);
  box-shadow: 0 14px 30px rgba(24, 38, 61, 0.08);
  transform: translateY(-1px);
}

.process-stage-section.is-complete {
  border-color: rgba(31, 122, 91, 0.16);
}

.process-stage-section.is-upcoming {
  opacity: 0.72;
}

.process-stage-section.is-support-section:not([data-stage-section="historico"]) .drawer-section-head h3:first-child::after {
  content: "Modulo de apoio";
  display: inline-flex;
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(24, 38, 61, 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

/* Aba Historico: sem label "Modulo de apoio" */
[data-stage-section="historico"].is-support-section .drawer-section-head h3::after {
  content: none;
}

.inline-form-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(24, 38, 61, 0.04);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.cost-section {
  background: rgba(31, 108, 115, 0.06);
  border-color: rgba(31, 108, 115, 0.2);
}

.cost-section.is-highlight {
  border-color: rgba(31, 108, 115, 0.42);
  box-shadow: 0 16px 30px rgba(31, 108, 115, 0.16);
}

.cost-section.is-alert-medium {
  border-color: rgba(14, 165, 233, 0.5);
}

.cost-section.is-alert-high {
  border-color: rgba(30, 58, 95, 0.6);
}

.cost-section.is-alert-critical {
  border-color: rgba(156, 75, 58, 0.72);
  box-shadow: 0 16px 30px rgba(156, 75, 58, 0.2);
}

.cost-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cost-summary-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.cost-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.cost-summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.04rem;
}

.cost-alerts {
  display: grid;
  gap: 8px;
}

.cost-alert {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(24, 38, 61, 0.12);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  color: var(--muted);
}

.cost-alert.is-medium {
  border-color: rgba(14, 165, 233, 0.5);
  color: #7b5c1c;
  background: rgba(14, 165, 233, 0.08);
}

.cost-alert.is-high {
  border-color: rgba(30, 58, 95, 0.6);
  color: #8b3f20;
  background: rgba(30, 58, 95, 0.08);
}

.cost-alert.is-critical {
  border-color: rgba(156, 75, 58, 0.72);
  color: #7e2e22;
  background: rgba(156, 75, 58, 0.12);
}

.cost-compare {
  display: grid;
  gap: 8px;
}

.cost-compare-bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(24, 38, 61, 0.1);
  overflow: hidden;
}

.cost-compare-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(31, 108, 115, 0.75), rgba(31, 108, 115, 0.35));
}

.cost-compare-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}

.cost-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cost-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(24, 38, 61, 0.08);
  background: rgba(255, 255, 255, 0.68);
}

.cost-meta strong {
  font-size: 0.92rem;
}

.drawer-row-grid.cost-grid-top {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.drawer-row-grid.cost-grid-middle {
  grid-template-columns: 1.6fr 1.2fr 1fr 1fr;
}

.drawer-row-grid.cost-grid-bottom {
  grid-template-columns: 1.8fr 1fr;
  align-items: start;
}

.drawer-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-section-head h3 {
  margin: 0 0 6px;
  font-size: 1.04rem;
}

.drawer-section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.drawer-collection {
  display: grid;
  gap: 10px;
}

.drawer-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.drawer-row-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.2fr auto;
  gap: 10px;
  align-items: center;
}

.process-item-grid-top {
  grid-template-columns: 0.9fr 1.8fr auto;
}

.process-item-grid-bottom {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.field input[readonly],
.field select[readonly],
.field textarea[readonly] {
  background: repeating-linear-gradient(
    -45deg,
    rgba(24, 38, 61, 0.03),
    rgba(24, 38, 61, 0.03) 4px,
    rgba(24, 38, 61, 0.07) 4px,
    rgba(24, 38, 61, 0.07) 8px
  );
  color: var(--muted, #64748b);
  cursor: not-allowed;
  border-color: rgba(24, 38, 61, 0.08);
  font-style: italic;
}

/* Label de campo readonly — indica que é preenchido automaticamente */
.field:has(input[readonly]) > span::after,
.field:has(textarea[readonly]) > span::after {
  content: " (auto)";
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted, #94a3b8);
  font-style: normal;
}

.field-static {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(24, 38, 61, 0.12);
  background: rgba(24, 38, 61, 0.04);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.25;
}

.field-static.is-warning {
  border-color: rgba(14, 165, 233, 0.5);
  background: rgba(14, 165, 233, 0.10);
}

.field-static.is-danger {
  border-color: rgba(156, 75, 58, 0.7);
  background: rgba(156, 75, 58, 0.16);
}

.company-doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #7b5c1c;
  background: rgba(14, 165, 233, 0.10);
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.company-doc-badge.is-danger {
  color: #7e2e22;
  background: rgba(156, 75, 58, 0.18);
  border-color: rgba(156, 75, 58, 0.5);
}

.drawer-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.drawer-remove {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  border-radius: 14px;
  background: rgba(24, 38, 61, 0.04);
}

.drawer-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(24, 38, 61, 0.04);
  border: 1px solid rgba(24, 38, 61, 0.08);
}

.attachment-copy {
  display: grid;
  gap: 4px;
}

.attachment-copy strong {
  font-size: 0.94rem;
}

.attachment-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-entry-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

/* Timeline — container da lista */
.drawer-collection #timelineList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.timeline-item {
  display: grid;
  gap: 5px;
  padding: 10px 14px 10px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(24, 38, 61, 0.07);
  border-left: 3px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: box-shadow 140ms;
}

.timeline-item:hover {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Cores por tipo */
.timeline-item--etapa       { border-left-color: #1e3a5f; }
.timeline-item--financeiro  { border-left-color: #1D9E75; }
.timeline-item--nota        { border-left-color: #BA7517; }
.timeline-item--recebimento { border-left-color: #1D9E75; }
.timeline-item--execucao    { border-left-color: #0369a1; }
.timeline-item--controle    { border-left-color: #E24B4A; }
.timeline-item--documento   { border-left-color: #7c3aed; }
.timeline-item--followup    { border-left-color: #0ea5e9; }
.timeline-item--habilitacao { border-left-color: #059669; }
.timeline-item--cadastro    { border-left-color: #94a3b8; }

.timeline-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-icon {
  font-size: 0.8rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.timeline-time {
  color: var(--muted, #64748b);
  font-size: 0.76rem;
  flex-shrink: 0;
}

.timeline-author {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1e3a5f;
  background: rgba(30, 58, 95, 0.07);
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: auto;
  white-space: nowrap;
}

.timeline-text {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink, #0f172a);
}

.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(24, 38, 61, 0.96);
  color: #fff7ef;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.is-hidden {
  display: none !important;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(24, 38, 61, 0.05);
  color: var(--muted);
  text-align: center;
}

.config-shell {
  display: grid;
  gap: 18px;
}

.config-hero-card {
  padding-bottom: 20px;
}

.config-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.config-card {
  min-height: 100%;
}

.config-users-panel {
  display: grid;
  gap: 12px;
}

.config-users-toolbar {
  flex-wrap: wrap;
}

.config-users-table td strong,
.config-users-table td small {
  display: block;
}

.config-users-table td small,
.config-users-muted,
.config-users-feedback {
  color: var(--muted, #60708a);
}

.config-users-feedback {
  margin: 0;
  font-size: 0.92rem;
}

.config-form {
  display: grid;
  gap: 18px;
}

.config-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-identity {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(24, 38, 61, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 245, 240, 0.86)),
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.06), transparent 48%);
}

.config-identity-company {
  align-items: start;
}

.config-avatar-wrap,
.config-logo-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.config-avatar {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  color: #fff8f0;
  background: linear-gradient(135deg, rgba(24, 38, 61, 0.94), rgba(31, 108, 115, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.config-avatar.has-image {
  background: rgba(24, 38, 61, 0.08);
}

.config-avatar img,
.config-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.config-logo-preview {
  width: 110px;
  height: 86px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(24, 38, 61, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 240, 0.92)),
    radial-gradient(circle at top left, rgba(31, 108, 115, 0.08), transparent 52%);
  color: var(--muted);
  font-weight: 600;
}

.config-logo-preview.has-image {
  border-style: solid;
  border-color: rgba(24, 38, 61, 0.08);
}

.config-identity-copy {
  display: grid;
  gap: 4px;
}

.config-identity-copy strong {
  font-size: 1.02rem;
}

.config-identity-copy span {
  color: var(--ink);
}

.config-identity-copy small {
  color: var(--muted);
  line-height: 1.55;
}

.config-form input:disabled,
.config-form select:disabled {
  background: rgba(24, 38, 61, 0.05);
  color: rgba(24, 38, 61, 0.76);
  cursor: not-allowed;
}

.feedback-text {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(156, 75, 58, 0.22);
  background: rgba(156, 75, 58, 0.08);
  color: #8f3b2b;
  font-size: 0.88rem;
}

.tender-reader-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 18px;
}

.tender-file-card,
.tender-item-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(24, 38, 61, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.tender-file-card textarea {
  min-height: 108px;
  resize: vertical;
}

.tender-file-meta,
.tender-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tender-file-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(24, 38, 61, 0.08);
  color: var(--ink);
  font-size: 0.78rem;
}

.tender-file-status.is-warning {
  background: rgba(30, 58, 95, 0.10);
  color: #99521f;
}

.tender-file-status.is-success {
  background: rgba(31, 122, 91, 0.14);
  color: #1f6b50;
}

.tender-file-status.is-muted {
  background: rgba(24, 38, 61, 0.06);
  color: var(--muted);
}

.tender-item-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.9fr repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.tender-item-grid .drawer-remove {
  align-self: center;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .hero,
  .dashboard-grid,
  .operations-grid,
  .finance-grid,
  .report-grid,
  .payroll-grid,
  .payroll-admin-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row,
  .form-grid,
  .card-grid,
  .drawer-snapshot,
  .drawer-row-grid,
  .cost-summary,
  .cost-meta-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .hero {
    padding: 24px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .month-bars {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .timeline-entry-form {
    grid-template-columns: 1fr;
  }

  .config-grid,
  .config-form-grid,
  .config-identity,
  .tender-reader-grid {
    grid-template-columns: 1fr;
  }

  .config-avatar-wrap,
  .config-logo-wrap {
    justify-items: start;
  }

  .tender-item-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 16px, 1400px);
    margin-top: 12px;
  }

  .hero-brand {
    align-items: flex-start;
  }

  .hero-logo {
    width: 72px;
    height: 72px;
  }

  .hero h1 {
    max-width: none;
  }

  .month-bars {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .drawer-panel {
    inset: auto 8px 8px 8px;
    width: auto;
    max-height: calc(100vh - 16px);
  }
}
:root {
  --sidebar-bg: #0f172a;
  --sidebar-active: #1e3a5f;
  --sidebar-text: #e2e8f0;

  /* ── Escala tipográfica padronizada ── */
  --text-xs:   0.72rem;   /* labels, badges, kickers */
  --text-sm:   0.82rem;   /* textos secundários, tabelas */
  --text-base: 0.92rem;   /* texto padrão de interface */
  --text-md:   1rem;      /* texto de destaque */
  --text-lg:   1.1rem;    /* subtítulos */
  --text-xl:   1.3rem;    /* títulos de seção */
  --text-2xl:  1.6rem;    /* títulos principais */

  /* ── Espaçamento de linha padronizado ── */
  --leading-tight:  1.2;
  --leading-normal: 1.45;
  --leading-loose:  1.6;

  /* ── Transições padronizadas ── */
  --transition-fast:   140ms ease;
  --transition-normal: 220ms ease;
  --transition-slow:   320ms ease;

  /* ── Z-index organizados ── */
  --z-dropdown:  20;
  --z-sticky:    30;
  --z-drawer:    60;
  --z-modal:     80;
  --z-overlay:   99;
  --z-toast:     200;
  --surface: #ffffff;
  --surface-muted: #f1f4f8;
  --border-soft: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #1e3a5f;
  --alert-bg: #fef2f2;
  --alert-border: #fca5a5;
}

body {
  background: var(--surface-muted);
  color: var(--text-main);
}

body.is-auth-checking .login-view,
body.is-auth-checking .app-shell {
  display: none;
}

body.is-authenticated .login-view {
  display: none;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 520px);
  background:
    linear-gradient(135deg, rgba(12, 32, 56, 0.92), rgba(18, 71, 111, 0.78)),
    radial-gradient(circle at top left, rgba(77, 145, 214, 0.24), transparent 42%),
    var(--surface-muted);
}

.login-brand-panel {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 48px;
}

.login-brand-card {
  width: 100%;
  max-width: 720px;
  border-radius: 32px;
  padding: 48px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 80px rgba(3, 13, 25, 0.32);
  color: #f7fafc;
  display: grid;
  align-content: center;
  gap: 18px;
}

.login-brand-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  padding: 10px;
}

.login-brand-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: rgba(247, 250, 252, 0.72);
}

.login-brand-card h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.05;
}

.login-brand-text {
  max-width: 520px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(247, 250, 252, 0.86);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 249, 251, 0.94));
}

.login-card {
  width: min(100%, 420px);
  border-radius: 28px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(24, 38, 61, 0.08);
  box-shadow: 0 24px 70px rgba(21, 37, 59, 0.16);
  display: grid;
  gap: 24px;
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.login-card-head img {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(15, 76, 129, 0.08);
  padding: 8px;
}

.login-card-head h2 {
  margin: 2px 0 0;
  font-size: 1.5rem;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-submit {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
}

.login-feedback {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(198, 40, 40, 0.08);
  border: 1px solid rgba(198, 40, 40, 0.18);
  color: #8d1c1c;
  font-size: 0.92rem;
}

.login-feedback.is-hidden {
  display: none;
}

.session-chip.is-strong {
  background: rgba(15, 76, 129, 0.1);
  color: #0f4c81;
  font-weight: 600;
}

.first-access-panel {
  inset: auto;
  width: min(100vw - 32px, 480px);
  max-height: calc(100vh - 40px);
  margin: auto;
}

.first-access-form {
  margin-top: 12px;
}

@media (max-width: 960px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    padding: 24px 24px 0;
  }

  .login-brand-card {
    padding: 28px;
  }

  .login-panel {
    padding: 24px;
  }
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 18px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.sidebar-brand img {
  width: 42px;
  height: 42px;
}

.sidebar-brand strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

.sidebar-brand span {
  font-size: 0.75rem;
  color: rgba(238, 243, 248, 0.7);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legacy-nav {
  display: none;
}

.sidebar-nav .tab-button {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  background: transparent;
  color: inherit;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.sidebar-nav .tab-button.is-active {
  background: var(--sidebar-active);
  color: #ffffff;
}

.nav-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.nav-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.nav-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
}

.nav-subicon {
  display: inline-flex;
  width: 14px;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  opacity: 0.6;
}

.nav-group summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group[open] summary {
  background: rgba(255, 255, 255, 0.06);
}

.nav-group-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 12px 18px;
}

.nav-group-links .tab-button {
  padding: 8px 10px;
  font-size: 0.9rem;
}

.nav-subgroup-title {
  margin: 8px 10px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.main-area {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.session-chip {
  background: #eef1f5;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.api-status-chip {
  font-weight: 700;
}

.api-status-chip.status-online {
  background: rgba(32, 138, 82, 0.14);
  color: #1b7b4a;
}

.api-status-chip.status-offline {
  background: rgba(198, 40, 40, 0.12);
  color: #a22626;
}

.api-status-chip.status-reconnecting {
  background: rgba(217, 143, 33, 0.16);
  color: #9b6a12;
}

.api-status-chip.status-expired {
  background: rgba(73, 58, 164, 0.14);
  color: #4d3aa8;
}

.ghost-button.is-hidden {
  display: none;
}

.is-api-disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
}

.content-area {
  padding: 24px;
  background: var(--surface-muted);
  flex: 1;
}

.alert-panel {
  background: var(--alert-bg);
  border-left: 4px solid var(--alert-border);
  padding: 6px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.alert-panel-head {
  font-weight: 600;
  margin-bottom: 4px;
  color: #8b1e1e;
}

.alert-panel.is-hidden {
  display: none;
}

.alert-table table {
  width: 100%;
}

.alert-table td strong {
  color: #7b1b1b;
  font-weight: 600;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-strip .stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  padding: 12px 14px;
}

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px;
}

.detail-panel h2 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.detail-item strong {
  color: var(--text-main);
  font-weight: 600;
}
.alert-table .table-wrap,
.alert-table table {
  margin-top: 4px;
}

.alert-table .compact-table th,
.alert-table .compact-table td {
  padding: 4px 8px;
}

.alert-table .compact-table th {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.alert-table .compact-table td {
  font-size: 0.9rem;
  line-height: 1.2;
}

.config-users-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-select {
  min-width: 150px;
  border: 1px solid var(--border-color, #d8e0ea);
  border-radius: 999px;
  background: #fff;
  color: var(--text-color, #172033);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  outline: none;
}

.compact-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.config-users-permissions {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

/* Modal de permissões */
#userPermissionsModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#userPermissionsModal.is-hidden { display: none; }
#userPermissionsModal .modal-panel {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

/* Badges coloridos */
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fef2f2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Tabela de usuários compacta */
.config-users-table td { vertical-align: middle; }
.config-users-table td strong { font-size: 0.88rem; }
.config-users-table td small  { font-size: 0.75rem; color: var(--muted); }

/* Grid de permissões no modal */
.permission-micro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.permission-module-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}
.permission-module-card .permission-option-module {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.permission-action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 8px;
}
.permission-option-action {
  font-size: 0.78rem;
  font-weight: 400;
  border: none;
  background: none;
  padding: 2px 4px;
  border-radius: 4px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.permission-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border, #dce3ee);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #17243a);
}

.permission-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent, #285a68);
}

.is-access-hidden {
  display: none !important;
}


/* Filtros multiseleção - Em planejamento */
#stageExecucaoView .filter-row {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  align-items: end;
}
#stageExecucaoView .filter-row .field:first-child {
  grid-column: span 1;
}
.execucao-multi-host {
  position: relative;
  min-width: 0;
}
.execucao-multi-filter {
  position: relative;
}
.execucao-multi-trigger {
  width: 100%;
  min-height: 42px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(24, 38, 61, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.execucao-multi-trigger:after {
  content: "▾";
  float: right;
  color: var(--muted);
}
.execucao-multi-panel {
  display: none;
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(24, 38, 61, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(24, 38, 61, 0.16);
}
.execucao-multi-filter.is-open .execucao-multi-panel {
  display: grid;
  gap: 4px;
}
.execucao-multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
}
.execucao-multi-option:hover {
  background: rgba(24, 38, 61, 0.06);
}
.execucao-multi-option.is-all {
  font-weight: 700;
  border-bottom: 1px solid rgba(24, 38, 61, 0.08);
  margin-bottom: 4px;
}
.execucao-multi-option input {
  width: auto;
  padding: 0;
}
.execucao-multi-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}
.execucao-multi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(24,38,61,0.08);
  margin-bottom: 4px;
  padding-bottom: 4px;
}
.execucao-multi-header .execucao-multi-option.is-all {
  border-bottom: none;
  margin-bottom: 0;
}
.execucao-multi-clear {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.execucao-multi-clear:hover {
  color: var(--danger, #E24B4A);
  background: rgba(226,75,74,0.07);
}
input[type="checkbox"]:indeterminate + span::before {
  content: "–";
}
@media (max-width: 1100px) {
  #stageExecucaoView .filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  #stageExecucaoView .filter-row {
    grid-template-columns: 1fr;
  }
}

/* Execução parcial por quantitativo */
.partial-execution-open {
  overflow: hidden;
}
.partial-execution-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}
.partial-execution-modal.is-visible {
  display: block;
}
.partial-execution-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.partial-execution-card {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  overflow: auto;
  background: var(--surface, #fff);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}
.partial-execution-header,
.partial-execution-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.partial-execution-header h3 {
  margin: 8px 0 4px;
}
.partial-execution-header p {
  margin: 0;
  color: var(--muted, #64748b);
}
.partial-execution-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.partial-execution-summary article {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 14px;
  background: rgba(248, 250, 252, 0.8);
}
.partial-execution-summary span {
  display: block;
  color: var(--muted, #64748b);
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.partial-execution-summary strong {
  font-size: 1.15rem;
}
.partial-execution-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  margin-bottom: 16px;
}
.partial-execution-table td,
.partial-execution-table th {
  vertical-align: top;
}
.partial-execution-table small {
  display: block;
  color: var(--muted, #64748b);
  max-width: 380px;
}
.partial-execution-qty {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  font: inherit;
}
.partial-execution-footer {
  margin-top: 16px;
  justify-content: flex-end;
}
@media (max-width: 820px) {
  .partial-execution-summary {
    grid-template-columns: 1fr;
  }
  .partial-execution-header,
  .partial-execution-footer {
    align-items: stretch;
    flex-direction: column;
  }
}


/* Busca nas etapas de processos */
.stage-search-row {
  grid-template-columns: minmax(280px, 420px);
  align-items: end;
  margin-top: 12px;
  margin-bottom: 8px;
}

.stage-search-field {
  max-width: 420px;
}


/* Sidebar corporativa SICO */
.sidebar{width:260px;padding:20px 16px;display:flex;flex-direction:column;gap:14px;background:linear-gradient(180deg,#172333 0%,#1f2a36 100%);box-shadow:16px 0 40px rgba(15,23,42,.10)}
.sidebar-brand{margin-bottom:2px;padding:8px 6px 12px;border-bottom:1px solid rgba(255,255,255,.08)}
.sidebar-brand img{width:38px;height:38px;border-radius:10px;background:#fff;padding:3px}.sidebar-brand span{display:block}
.sidebar-cta{display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;border:none;border-radius:14px;padding:12px 14px;color:#fff;background:linear-gradient(135deg,#2d6cdf,#3f8cff);box-shadow:0 14px 24px rgba(45,108,223,.25);font-weight:800;cursor:pointer}.sidebar-cta svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}.sidebar-nav{gap:6px;padding-right:2px}.nav-group{border-radius:14px}.nav-group summary{min-height:42px;padding:10px 12px;border-radius:14px;transition:background .18s ease,color .18s ease}.nav-group summary:hover,.nav-group[open] summary{background:rgba(255,255,255,.075)}.nav-icon{width:22px;height:22px;min-width:22px;border-radius:0;background:transparent;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;opacity:.92}.nav-label{flex:1;font-size:.93rem;letter-spacing:-.01em}.nav-chevron{width:8px;height:8px;border-right:2px solid rgba(255,255,255,.56);border-bottom:2px solid rgba(255,255,255,.56);transform:rotate(45deg);transition:transform .2s ease;margin-left:auto}.nav-group[open] .nav-chevron{transform:rotate(225deg)}.nav-group-links{gap:3px;margin:6px 0 10px 6px;padding-left:8px;border-left:1px solid rgba(255,255,255,.10)}.nav-group-links .tab-button,.sidebar-nav .tab-button{min-height:34px;padding:8px 10px;border-radius:12px;font-size:.86rem;transition:background .18s ease,transform .18s ease,color .18s ease}.sidebar-nav .tab-button:hover{background:rgba(255,255,255,.06);transform:translateX(1px)}.sidebar-nav .tab-button.is-active{background:rgba(255,255,255,.13);box-shadow:inset 3px 0 0 #5da2ff}.nav-sub{gap:9px}.nav-subicon{width:7px;min-width:7px;height:7px;border-radius:999px;background:rgba(255,255,255,.42);font-size:0;opacity:1}.nav-subgroup-title{margin:10px 10px 4px;color:rgba(255,255,255,.46)}.nav-badge{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:rgba(239,68,68,.95);color:#fff;font-size:.68rem;font-weight:800;line-height:1}.nav-badge[hidden],.nav-badge.is-empty{display:none!important}.nav-badge[id="navBadgePagar"]{background:rgba(245,158,11,.95)}.sidebar-footer{margin-top:auto;display:flex;align-items:center;gap:10px;padding:14px 10px 4px;border-top:1px solid rgba(255,255,255,.09)}.sidebar-user-avatar{width:36px;height:36px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;background:rgba(255,255,255,.12);color:#fff;font-weight:800;font-size:.78rem}.sidebar-user-meta{min-width:0;display:flex;flex-direction:column;gap:2px}.sidebar-user-meta strong{font-size:.82rem;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sidebar-user-meta span{font-size:.72rem;color:rgba(238,243,248,.62);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.backup-action-grid{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}.danger-button{color:#b42318;border-color:rgba(180,35,24,.22);background:rgba(180,35,24,.06)}.main-area{margin-left:260px}

/* ==========================================================================
   SUPORTE MOBILE — breakpoint principal em 768px
   ========================================================================== */

/* Botão hamburguer — visível só em mobile */
.sidebar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  font-size: 22px;
  flex-shrink: 0;
}

/* Overlay escuro atrás da sidebar em mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

@media (max-width: 768px) {

  /* Sidebar vira overlay ao toque */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    width: 260px !important;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Conteúdo ocupa tela toda */
  .main-area {
    margin-left: 0 !important;
  }

  /* Topbar com hamburguer */
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }

  .sidebar-hamburger {
    display: flex;
  }

  /* Topbar actions empilham em mobile */
  .topbar-actions {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }

  /* Esconde chips menos importantes em mobile */
  #heroUpdated,
  #heroSource {
    display: none;
  }

  /* Hero em coluna única */
  .hero {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 16px;
  }

  .hero-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Card grids em 2 colunas → 1 coluna */
  .card-grid,
  .card-grid.stage-metrics,
  .compact-ui .card-grid.stage-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* Formulários e filtros em 1 coluna */
  .filter-row,
  .form-grid,
  .finance-filters,
  .config-form-grid,
  .report-filter-grid,
  .payroll-admin-grid {
    grid-template-columns: 1fr !important;
  }

  .finance-filters .span-2,
  .form-grid .span-2,
  .filter-row .span-2 {
    grid-column: 1;
  }

  /* Drawer do processo ocupa tela toda */
  .drawer-row-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .drawer-row-grid > *:last-child {
    grid-column: 1 / -1;
    justify-self: end;
  }

  /* Tabelas com scroll horizontal */
  .table-wrap,
  .table-card,
  .finance-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 540px;
  }

  /* Grids de dashboard em coluna única */
  .dashboard-grid,
  .operations-grid,
  .finance-grid,
  .report-grid,
  .payroll-grid {
    grid-template-columns: 1fr;
  }

  .payroll-grid .payroll-wide {
    grid-column: 1;
  }

  /* Kanban scroll horizontal */
  .kanban-board {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    overflow-x: auto;
  }

  /* Process form em 1 coluna */
  .process-form .form-grid {
    grid-template-columns: 1fr;
  }

  /* Botões da toolbar em coluna */
  .toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* Esconde coluna lateral em telas pequenas */
  .compact-hide {
    display: none !important;
  }

  /* Page shell sem margem lateral excessiva */
  .page-shell {
    width: calc(100vw - 16px);
    margin: 8px auto 24px;
  }
}

@media (max-width: 480px) {

  /* Card grid em 1 coluna em telas muito pequenas */
  .card-grid,
  .card-grid.stage-metrics,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  /* Topbar mais compacta */
  .topbar-title {
    font-size: 0.95rem;
  }

  /* Drawer ocupa tela toda */
  .drawer-panel,
  .process-form-page {
    padding: 12px;
  }

  /* Botões menores */
  .ghost-button,
  .primary-button,
  .tab-button {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   PAINEL PRINCIPAL — melhorias visuais
   ========================================================================== */

/* Alertas em cards compactos */
.alert-cards-grid {
  display: grid;
  gap: 4px;
}

/* Cartao base */
.alert-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: background 140ms ease;
  cursor: default;
}

.alert-card:hover {
  background: rgba(15, 23, 42, 0.04);
}

/* Variantes por severidade */
.alert-card--critical {
  border-left-color: #E24B4A;
  background: rgba(226, 75, 74, 0.04);
}
.alert-card--critical:hover {
  background: rgba(226, 75, 74, 0.08);
}
.alert-card--warning {
  border-left-color: #BA7517;
}
.alert-card--info {
  border-left-color: #c8ccd2;
}

.alert-card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.alert-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink, #18263d);
  white-space: nowrap;
}

/* Descricao compacta — aparece inline, truncada */
.alert-card-desc {
  font-size: 0.78rem;
  color: var(--muted, #53627a);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
}

.alert-card-btn {
  padding: 3px 10px;
  font-size: 0.78rem;
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}

/* Bloco colapsavel de alertas secundarios */
.alert-collapse-wrap {
  margin-top: 4px;
}

.alert-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 12px;
  font-size: 0.78rem;
  color: var(--muted, #53627a);
  border-radius: 6px;
  transition: background 140ms;
  width: 100%;
  text-align: left;
}

.alert-collapse-toggle:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ink, #18263d);
}

.alert-collapse-icon {
  font-size: 0.7rem;
  line-height: 1;
}

.alert-collapse-body {
  margin-top: 2px;
}

.alert-collapse-body.is-hidden {
  display: none;
}

/* Resumo institucional com barras */
.detail-item-new {
  padding: 8px 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  margin-bottom: 4px;
}

.detail-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.detail-item-label {
  font-size: 0.88rem;
  color: var(--muted, #53627a);
}

.detail-item-value {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink, #18263d);
  white-space: nowrap;
}

.detail-item-bar {
  height: 3px;
  background: rgba(24,38,61,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.detail-item-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 400ms ease;
}

/* ==========================================================================
   RANKING DA EQUIPE
   ========================================================================== */

.ranking-panel {
  margin-top: 12px;
}

.ranking-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ranking-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ranking-subtitle {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}

.ranking-item {
  margin-bottom: 10px;
}

.ranking-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.ranking-medal {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.ranking-pos {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  flex-shrink: 0;
}

.ranking-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink, #0f172a);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-chips {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.ranking-chip {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.chip-plan {
  background: #e0f2fe;
  color: #0369a1;
}

.chip-exec {
  background: #dcfce7;
  color: #166534;
}

.chip-emp {
  background: #fef9c3;
  color: #854d0e;
}

.ranking-valor {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  flex-shrink: 0;
}

.ranking-pct {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.ranking-bar-wrap {
  height: 5px;
  background: rgba(15, 23, 42, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.ranking-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #1e3a5f, #0ea5e9);
  transition: width 500ms ease;
}
/* ==========================================================================
   RANKING DE PRODUÇÃO EM EXECUÇÃO — novos componentes
   ========================================================================== */

.ranking-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ranking-sort-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ranking-sort-label {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}

.ranking-sort-btn {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  font-weight: 500;
  transition: background 150ms, color 150ms, border-color 150ms;
  white-space: nowrap;
}

.ranking-sort-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink, #0f172a);
}

.ranking-sort-btn.is-active {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

.ranking-item-execucao {
  padding-bottom: 6px;
}

.ranking-exec-count {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}

.ranking-exec-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 700;
}

.ranking-exec-label {
  font-size: 0.75rem;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.ranking-pct-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
  white-space: nowrap;
  flex-shrink: 0;
}

.ranking-bar-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
}

.ranking-bar-meta-start,
.ranking-bar-meta-end {
  font-size: 0.7rem;
  color: var(--muted, #94a3b8);
}



/* ==========================================================================
   MEUS PROCESSOS EM PLANEJAMENTO (bloco do colaborador no dashboard)
   ========================================================================== */

.meus-planejamentos-grid {
  gap: 12px;
  margin-top: 10px;
}

.detail-panel .mpl-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  background: #fff;
  border-left: 3px solid #378ADD;
  padding: 14px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: box-shadow 150ms, transform 150ms;
  width: 100%;
}

.mpl-card:hover {
  box-shadow: 0 4px 16px rgba(55, 138, 221, 0.15);
  transform: translateY(-1px);
}

.mpl-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mpl-dispensa {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mpl-valor {
  font-size: 0.95rem;
  font-weight: 700;
  color: #378ADD;
  white-space: nowrap;
  flex-shrink: 0;
}

.mpl-orgao {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mpl-objeto {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mpl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.mpl-chip {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.07);
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.mpl-chip-emp {
  background: #fef9c3;
  color: #854d0e;
}

.mpl-chip-stage {
  background: #dbeafe;
  color: #1e40af;
}

/* ==========================================================================
   GRÁFICO DE VOLUME POR RESPONSÁVEL
   ========================================================================== */

.vol-chart {
  display: grid;
  gap: 10px;
}

.vol-chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.vol-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}

.vol-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.vol-row {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  align-items: center;
  gap: 10px;
}

.vol-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.vol-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vol-count {
  font-size: 0.72rem;
  color: var(--muted, #64748b);
}

.vol-bars {
  flex: 1;
}

.vol-bar-stack {
  display: flex;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.05);
  gap: 1px;
}

.vol-bar-seg {
  height: 100%;
  transition: width 500ms ease;
  min-width: 2px;
}

.vol-total {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink, #0f172a);
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .vol-row {
    grid-template-columns: 1fr 80px;
    grid-template-rows: auto auto;
  }
  .vol-bars {
    grid-column: 1 / -1;
  }
}


/* Variantes de cor para o ranking de planejamento */
.ranking-exec-badge.plan-badge {
  background: #e0f2fe;
  color: #0369a1;
}

.ranking-pct-pill.plan-pct {
  background: rgba(3, 105, 161, 0.1);
  color: #0369a1;
}

.ranking-bar-fill.plan-bar-fill {
  background: linear-gradient(90deg, #0369a1, #38bdf8);
}

/* ==========================================================================
   MÓDULO DESPESAS FIXAS
   ========================================================================== */

.finance-despesas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.finance-despesas-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.despesas-summary-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.despesa-cat-badge {
  display: inline-block;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.despesa-status-badge {
  display: inline-block;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.badge-pago {
  background: #dcfce7;
  color: #166534;
}

.badge-pendente {
  background: #fef2f2;
  color: #991b1b;
}

/* Modal de despesa */
.despesa-modal {
  border: none;
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  padding: 0;
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}

.despesa-modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.despesa-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  margin-bottom: 16px;
}

.despesa-modal-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.despesa-modal form {
  padding: 0 24px 24px;
}

.despesa-modal .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.despesa-modal .field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.despesa-modal .field-wrap label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #64748b);
}

.despesa-modal .field-wrap input,
.despesa-modal .field-wrap select,
.despesa-modal .field-wrap textarea {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink, #0f172a);
}

.despesa-modal .field-wrap textarea {
  resize: vertical;
}

.despesa-modal .span-2 {
  grid-column: 1 / -1;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 8px 0;
}

.despesa-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 480px) {
  .despesa-modal .form-grid {
    grid-template-columns: 1fr;
  }
  .despesas-summary-cards {
    grid-template-columns: 1fr;
  }
}

/* Melhoria Folha - Etapa 1 */
.payroll-card {
  border-left: 4px solid rgba(20, 35, 65, 0.18);
}
.payroll-card-primary { border-left-color: #315efb; }
.payroll-card-success { border-left-color: #18a058; }
.payroll-card-warning { border-left-color: #f59e0b; }
.payroll-card-danger { border-left-color: #dc2626; }

.payroll-status-badge,
.payroll-balance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.payroll-status-pendente,
.payroll-status-aguardando_aprovacao,
.payroll-balance.is-open {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}
.payroll-status-aprovado {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.payroll-status-pago,
.payroll-balance.is-ok {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.payroll-status-cancelado {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.actions-menu {
  position: relative;
  display: inline-block;
}
.actions-menu > summary {
  cursor: pointer;
  list-style: none;
  border: 1px solid rgba(20, 35, 65, 0.16);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  background: #ffffff;
  color: #24324d;
  box-shadow: 0 6px 18px rgba(20, 35, 65, 0.08);
}
.actions-menu > summary::-webkit-details-marker { display: none; }
.actions-menu[open] > summary {
  background: #f7f9fc;
}
.actions-menu-list {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 180px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(20, 35, 65, 0.12);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(20, 35, 65, 0.18);
}
.actions-menu-list button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  color: #24324d;
  font-weight: 600;
  cursor: pointer;
}
.actions-menu-list button:hover {
  background: #f1f5f9;
}
.actions-menu-list .danger-button {
  color: #b91c1c;
}
.actions-menu-list .danger-button:hover {
  background: rgba(185, 28, 28, 0.07);
  color: #b91c1c;
}
.actions-menu-list .danger-text {
  color: #b91c1c;
}
/* Separador visual antes de ações destrutivas */
.actions-menu-list .danger-button:first-of-type {
  margin-top: 4px;
  border-top: 1px solid rgba(185, 28, 28, 0.12);
  padding-top: 10px;
}

.payroll-salary-hint {
  margin: -0.25rem 0 0.4rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.07);
  color: #1e3a8a;
  font-size: 0.86rem;
  line-height: 1.35;
}

.payroll-salary-hint.is-warning {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.payroll-balance.is-warning {
  border-color: rgba(217, 119, 6, 0.4);
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}

.payroll-balance.is-info {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
}

/* Estabilização dos botões da folha: mantém menus e formulários clicáveis após renderizações dinâmicas. */
#folhaView .payroll-table .table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}
#folhaView .payroll-table,
#folhaView .compact-table td:last-child {
  overflow: visible;
}
#folhaView .actions-menu-list {
  z-index: 80;
}

/* Melhoria dashboard: responsabilidades por colaborador */
.ranking-item-button {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border-color, #dfe5ee);
  background: var(--card-bg, #fff);
  text-align: left;
  cursor: pointer;
}
.ranking-item-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}
.ranking-count {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.ranking-item .ranking-chips {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ranking-chip {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.4;
  background: #eef4ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ==========================================================================
   RESPONSIVIDADE MOBILE — blocos adicionados (ranking execucao, planejamento)
   ========================================================================== */

@media (max-width: 720px) {
  .ranking-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ranking-sort-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .ranking-sort-btn {
    flex: 1;
    text-align: center;
  }

  .ranking-item-head {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .ranking-name {
    flex: 1 1 100%;
    order: -1;
  }

  .ranking-exec-count {
    order: 1;
  }

  .ranking-valor {
    order: 2;
    font-size: 0.95rem;
  }

  .ranking-pct-pill {
    order: 3;
  }

  .ranking-bar-meta {
    display: none;
  }

  .meus-planejamentos-grid {
    grid-template-columns: 1fr !important;
  }

  .mpl-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .mpl-valor {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .ranking-sort-label {
    display: none;
  }

  .ranking-exec-label {
    display: none;
  }

  .ranking-header-left h2 {
    font-size: 0.95rem;
  }
}

/* ==========================================================================
   RESPONSIVIDADE MOBILE — DASHBOARD COMPLETO
   Cobre: alertas, summary-strip, despesas, ranking, planejamento
   ========================================================================== */

/* Tablet (ate 1024px): summary-strip vira 2 colunas */
@media (max-width: 1024px) {
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile largo (ate 720px) */
@media (max-width: 720px) {
  /* Summary strip: 1 coluna */
  .summary-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Alertas: texto nao trunca, vira bloco */
  .alert-card {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .alert-card-body {
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }

  .alert-card-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: 100%;
  }

  .alert-card-btn {
    margin-left: 0;
    margin-top: 4px;
    align-self: flex-start;
  }

  /* Despesas fixas: 1 coluna */
  .detail-panel > .card-grid {
    grid-template-columns: 1fr;
  }

  /* Ranking: header empilha, ja coberto mas reforco aqui */
  .ranking-panel .ranking-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ranking-sort-controls {
    width: 100%;
  }

  .ranking-sort-btn {
    flex: 1;
    text-align: center;
  }

  /* Ranking items: empilha valor e pct */
  .ranking-item-head {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .ranking-name {
    flex: 1 1 60%;
  }

  .ranking-valor {
    font-size: 0.88rem;
  }

  .ranking-bar-meta {
    display: none;
  }
}

/* Mobile estreito (ate 480px) */
@media (max-width: 480px) {
  /* Cards do summary: padding menor */
  .summary-strip .stat-card {
    padding: 10px 12px;
  }

  /* Stat card valor: fonte menor */
  .stat-card h3 {
    font-size: 1.3rem !important;
  }

  /* Alertas: titulo em linha propria */
  .alert-card-title {
    white-space: normal;
  }

  /* Collapse toggle: texto mais curto */
  .alert-collapse-label {
    font-size: 0.75rem;
  }

  /* Ranking: oculta label "em execucao / em planejamento" */
  .ranking-exec-label {
    display: none;
  }

  /* detail-panel: padding menor */
  .detail-panel {
    padding: 12px;
  }

  .ranking-sort-label {
    display: none;
  }

  /* Pct pill: menor */
  .ranking-pct-pill {
    font-size: 0.7rem;
    padding: 1px 6px;
  }
}

/* ==========================================================================
   BADGE DE DIAS EM PLANEJAMENTO
   ========================================================================== */

.dias-plan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  vertical-align: middle;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.dias-plan-badge--novo {
  background: #1e3a5f;
}

.dias-plan-badge--atencao {
  background: #BA7517;
}

.dias-plan-badge--parado {
  background: #E24B4A;
}

/* Botao Pagar em contas a pagar */
.btn-pagar-conta {
  color: #1D9E75 !important;
  border-color: #1D9E75 !important;
  font-weight: 600 !important;
}

.btn-pagar-conta:hover {
  background: #1D9E75 !important;
  color: #fff !important;
}

/* Etapa Desclassificada */
.timeline-item--desclassificada { border-left-color: #888780; }

.stage-tag--desclassificada {
  background: #F1EFE8;
  color: #5F5E5A;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ==========================================================================
   MELHORIAS MOBILE — sticky footer, swipe, topbar compacta
   ========================================================================== */

/* ── 1. Botões de ação fixos no rodapé do formulário em mobile ─────────────
   Em desktop ficam no fluxo normal. Em mobile (<768px) ficam grudados
   na base da tela para o usuário não precisar rolar até o fim para salvar.  */
@media (max-width: 768px) {

  /* O form precisa de padding inferior para o conteúdo não ficar atrás do bar */
  .process-form {
    padding-bottom: 80px;
  }

  .drawer-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border-soft, #e2e8f0);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom)); /* iPhone notch */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  }

  /* Botão Salvar ocupa o máximo de espaço */
  .drawer-actions .primary-button {
    flex: 1;
  }

  /* Botão Desclassificar fica menor, à esquerda */
  .drawer-actions .danger-button {
    flex-shrink: 0;
  }
}

/* ── 2. Topbar: esconde elementos secundários em telas < 400px ────────────── */
@media (max-width: 400px) {

  /* Esconde "Compacto" checkbox na topbar — ocupa espaço demais */
  .topbar .compact-toggle-wrap,
  .topbar label:has(#compactToggle) {
    display: none !important;
  }

  /* Título mais curto */
  .topbar-title {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Status Online menor */
  .connection-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* ── 3. Kanban cards mais confortáveis em mobile ─────────────────────────── */
@media (max-width: 768px) {

  /* Cards da lista empilhada com mais espaço para toque */
  .stack-list .kanban-card {
    padding: 14px 16px;
  }

  /* Botão Ações com área de toque maior */
  .kanban-card .ghost-button[data-action],
  .actions-menu-btn,
  .stage-actions-btn {
    min-height: 40px;
    min-width: 72px;
  }

  /* Menu dropdown de ações — largura mínima maior para toque */
  .actions-menu,
  .dropdown-menu {
    min-width: 160px;
  }

  .actions-menu button,
  .dropdown-menu button {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
}

/* ── 4. Drawer do processo: cabeçalho com botão Fechar acessível ─────────── */
@media (max-width: 768px) {

  .panel-head {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface, #fff);
    padding: 12px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-soft, #e2e8f0);
  }

  /* Seções do formulário com menos padding lateral */
  .drawer-section {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ── 5. Processo form page: padding inferior para não ficar atrás do bar ─── */
@media (max-width: 768px) {
  .process-form-page {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* ── 6. Tabela de configurações de usuários — scroll horizontal ──────────── */
@media (max-width: 768px) {
  .config-users-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* ── Relatórios: novos elementos ─────────────────────────── */

/* Cabeçalho de relatório: meta info (timestamp + aside) */
.report-header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}
.report-timestamp {
  font-size: 0.78rem;
  color: #7c8fa0;
  white-space: nowrap;
}

/* Tabelas ordenáveis */
th[data-sort-dir] {
  user-select: none;
}
th[data-sort-dir="asc"]::after  { content: " ↑"; opacity: .7; }
th[data-sort-dir="desc"]::after { content: " ↓"; opacity: .7; }
th:hover { background: rgba(0,0,0,.04); }

/* Agrupamento por categoria */
.report-category-summary {
  margin-bottom: 20px;
  border: 1px solid #e7dfd0;
  border-radius: 12px;
  overflow: hidden;
}
.report-category-summary > summary {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: #f5f0e8;
  color: #5f5340;
  list-style: none;
}
.report-category-summary > summary::after {
  content: " ▾";
  float: right;
}
.report-category-summary[open] > summary::after { content: " ▴"; }
.category-table { margin: 0; border-radius: 0; border: 0; }
.category-table th { background: #faf6ef; }

/* Linha destacada no relatório de recebidos */
tr.is-highlight td { background: #eefaf2 !important; font-weight: 600; }

/* Botão CSV nos modais */
.btn-export-csv {
  font-size: 0.82rem;
  padding: 6px 12px;
  border: 1px solid rgba(24,38,61,0.15);
  border-radius: 8px;
  background: #fff;
  color: #17314e;
  cursor: pointer;
}
.btn-export-csv:hover { background: #f1f5f9; }


/* ── Padronização de fonte para relatórios gerados ─── */
.report-content,
.report-content * {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif !important;
}

/* ── Timeline: ícones semânticos substituindo emojis ─────── */
.timeline-icon-documento::before    { content: "📎"; font-style: normal; }
.timeline-icon-financeiro::before   { content: "💰"; font-style: normal; }
.timeline-icon-nota::before         { content: "🧾"; font-style: normal; }
.timeline-icon-recebimento::before  { content: "✅"; font-style: normal; }
.timeline-icon-execucao::before     { content: "⚙"; font-style: normal; }
.timeline-icon-followup::before     { content: "📅"; font-style: normal; }
.timeline-icon-habilitacao::before  { content: "🏷"; font-style: normal; }
.timeline-icon-controle::before     { content: "⚠"; font-style: normal; }
.timeline-icon-cadastro::before     { content: "➕"; font-style: normal; }
.timeline-icon-etapa::before        { content: "↗"; font-style: normal; }
/* Nota: emojis mantidos no JS para compatibilidade — migrável futuramente para SVG */

/* ── Foco acessível — visível para navegação por teclado ─── */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
/* Remove outline para clique com mouse (mantém para teclado) */
:focus:not(:focus-visible) {
  outline: none;
}

/* ── Skip link para acessibilidade ────────────────────────── */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}


/* ── Refactoring fixes ───────────────────────────────────── */

/* Fix: .is-active on nav-sub must not force display:block */
.nav-sub.is-active,
.sidebar-nav .tab-button.is-active {
  display: flex;
  background: var(--sidebar-active);
  color: #ffffff;
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

/* Fix: nav-badge hidden state */
.nav-badge[hidden],
.nav-badge.is-empty {
  display: none !important;
}

/* Fix: action menu animation */
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Fix: focus-visible accessibility */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Fix: skip link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 8px;
  z-index: 110;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: top 150ms ease;
}
.skip-link:focus { top: 8px; }

/* Fix: toast improved */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 1.5rem));
  z-index: 100;
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 20px 25px rgba(15,23,42,0.15);
  transition: transform 240ms cubic-bezier(0.34,1.56,0.64,1), opacity 200ms ease;
  opacity: 0;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}
.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Despesas fixas — badge vencida ─────────────────────── */
.despesa-status-badge.badge-vencida {
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
  border-color: var(--color-red-200, #fecaca) !important;
  font-weight: 600;
}

/* ── Dashboard: cards de receita e lucro ────────────────── */
.hero-profit-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hero-profit-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.hero-profit-card.is-profit {
  border-color: var(--color-green-200);
  background: var(--success-bg);
}

.hero-profit-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.hero-profit-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.hero-profit-card.is-profit .hero-profit-value {
  color: var(--success);
}

.hero-profit-foot {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .hero-profit-strip {
    grid-template-columns: 1fr;
    padding: var(--space-3) var(--space-4);
  }
}

/* ── Financeiro: coluna de ações sem quebra de linha ────── */
.finance-table td:last-child,
.payables-table td:last-child,
.receivables-table td:last-child,
#payablesList td:last-child,
#receivablesList td:last-child {
  white-space: nowrap;
  width: 1%;
}

#payablesList .table-actions,
#receivablesList .table-actions,
.finance-table .table-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ── Despesas fixas — badge vigência futura ─────────────── */
.despesa-status-badge.badge-neutro {
  background: var(--color-neutral-100);
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ── Cabeçalho ACOES e OBSERVACAO centralizados na linha ── */
.compact-ui table th,
.compact-ui table td {
  vertical-align: middle;
}

/* ── Impressão do DRE ───────────────────────────────────── */
@media print {
  /* Oculta tudo exceto o conteúdo da DRE */
  body.printing-dre .sidebar,
  body.printing-dre .topbar,
  body.printing-dre #dreExportBtn,
  body.printing-dre #drePrintBtn,
  body.printing-dre .panel-card:first-of-type,
  body.printing-dre #dreIndicadores > *:empty {
    display: none !important;
  }

  /* Quando imprimindo DRE: oculta todo o resto */
  body.printing-dre .view:not(#dreView) {
    display: none !important;
  }

  body.printing-dre #dreView {
    display: block !important;
    margin: 0;
    padding: 0;
  }

  /* Oculta barra de ações e filtros */
  body.printing-dre #dreView > div:first-child,
  body.printing-dre #dreView > div:nth-child(2) {
    display: none !important;
  }

  /* Cabeçalho de impressão */
  body.printing-dre #dreView::before {
    content: "DRE — Demonstração do Resultado do Exercício";
    display: block;
    font-size: 18pt;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
  }

  body.printing-dre .main-area,
  body.printing-dre .app-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  body.printing-dre .panel-card {
    border: 1px solid #ccc;
    box-shadow: none;
    margin: 0 0 16px 0 !important;
    page-break-inside: avoid;
  }

  body.printing-dre #dreIndicadores {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  body.printing-dre table th,
  body.printing-dre table td {
    font-size: 9pt;
    padding: 4px 8px;
  }

  body.printing-dre #dreGrafico {
    page-break-inside: avoid;
  }
}

/* ── Sidebar: labels sem quebra de linha ─────────────────── */
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-sub span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
}

/* Garante que o grupo não quebre */
.nav-group summary {
  white-space: nowrap;
}

/* ── Módulo de Medições ─────────────────────────── */
.medicao-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.medicao-summary article {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.medicao-summary article span {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}
.medicao-summary article strong {
  font-size: 1rem;
  color: var(--text);
}
