:root {
  --bg: #09090a;
  --bg-soft: #0e0e10;
  --panel: #121317;
  --panel-hover: #191b20;
  --panel-alt: #0f1013;
  --line: #2a2d34;
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #ffffff;
  --text-soft: #a1a7b3;
  --text-faint: #6b7280;
  --blue: #4f7cff;
  --blue-strong: #2563eb;
  --blue-soft: rgba(79, 124, 255, 0.14);
  --green: #22c55e;
  --red: #ef4444;
  --pos: #4ade80;
  --neg: #f87171;
  --amber: #f59e0b;
  --cyan: #14b8a6;
  --violet: #8b5cf6;
  --radius: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  position: absolute;
}

html {
  color-scheme: dark;
  /* Base dos rem: subiu de 16px (implícito) p/ 17px, escalando todo o texto ~6%
     sem tocar em nenhum layout (largura/padding/gap usam px, não rem). */
  font-size: 17px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #09090a;
}

body.auth-only .app-layout {
  display: none;
}

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

.auth-shell {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 124, 255, 0.1), transparent 24%),
    linear-gradient(180deg, #09090a 0%, #111214 100%);
}

.auth-shell.active {
  display: grid;
}

.auth-panel {
  width: min(440px, 100%);
  padding: 32px;
  border-radius: 24px;
  background: rgba(17, 18, 20, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 22px;
}

.auth-copy {
  display: grid;
  gap: 10px;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.auth-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-text {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-setpw-intro {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.4;
}

/* Campo de senha com olhinho (mostrar/ocultar) */
.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-password-wrap input {
  width: 100%;
  padding-right: 42px;
}
.auth-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.12s;
}
.auth-password-toggle:hover { color: var(--text); }
.auth-password-toggle.active { color: var(--blue); }

.auth-actions {
  display: flex;
  justify-content: center;
}

.auth-actions .primary-button {
  min-width: 132px;
}

.auth-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.auth-feedback.is-error {
  color: var(--red);
}

.auth-feedback.is-ok {
  color: var(--green);
}

.app-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  background: #09090a;
  border-right: none;
  padding: 22px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: opacity 180ms ease, width 180ms ease, padding 180ms ease;
}

.sidebar.collapsed {
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: grid;
  gap: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  padding: 6px 8px;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.brand-logo-auth {
  height: 62px;
}

.brand-logo-sidebar {
  height: 40px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand-mark-large {
  width: 44px;
  height: 44px;
}

.brand-kicker {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-title {
  margin: 2px 0 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.profile-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease;
}

.profile-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.avatar-block,
.profile-photo-preview {
  aspect-ratio: 1;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: #334155;
  background-size: cover;
  background-position: center;
  color: var(--text);
  font-weight: 700;
}

.avatar-block {
  width: 48px;
}

.avatar-block.has-photo,
.profile-photo-preview.has-photo {
  color: transparent;
}

.avatar-block.is-silhouette,
.profile-photo-preview.is-silhouette {
  color: transparent;
  background-image: url("avatar.png");
  background-size: cover;
  background-position: center;
}

.avatar-block.is-silhouette::before,
.profile-photo-preview.is-silhouette::before { content: none; }

.user-copy {
  min-width: 0;
}

.user-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nav-panel {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.menu-group {
  display: grid;
  gap: 6px;
  align-content: start;
}

.menu-button,
.submenu-button {
  width: 100%;
  border: 0;
  text-align: left;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.menu-button {
  padding: 11px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-button:hover,
.submenu-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.menu-button.active {
  color: var(--text);
  background: rgba(79, 124, 255, 0.12);
}

.menu-button--soon {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}

.menu-item {
  font-weight: 500;
}

.menu-button-leading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-stack {
  display: grid;
  gap: 6px;
}

.menu-button-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-caret {
  color: var(--text-faint);
  font-size: 0.95rem;
}

.menu-submenu {
  display: none;
  gap: 4px;
  padding-left: 10px;
}

.menu-submenu.open {
  display: grid;
}

.submenu-button {
  padding: 8px 10px 8px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.submenu-button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}


.nav-icon,
.submenu-icon,
.header-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.nav-icon {
  color: var(--blue);
}

.submenu-icon,
.header-icon {
  color: currentColor;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px 0;
  background: #09090a;
  flex: 0 0 auto;
}

.logout-button {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
}

.logout-button-round {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 1rem;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 14px 18px 16px;
}

.main-header {
  background: rgba(12, 14, 18, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.content-card {
  background: rgba(12, 14, 18, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.main-header {
  height: 60px;
  min-height: 60px;
  max-height: 60px;
  border-radius: 18px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  overflow: visible;
  flex-shrink: 0;
}

.header-left,
.header-search-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.icon-button,
.header-icon-button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-button span {
  display: block;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: var(--text-soft);
  margin: 1.25px 0;
}

/* Logo no header — aparece só quando a sidebar está colapsada */
.header-brand-logo {
  display: none;
  height: 28px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.app-layout.sidebar-collapsed .header-brand-logo { display: block; }

.header-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 10px;
  transition: color 150ms, background 150ms;
}

.header-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.hamburger-icon {
  display: block;
}

.header-search {
  max-width: 240px;
  width: 240px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-soft);
  flex: 0 0 auto;
  position: relative;
  overflow: visible;
}

.header-search:focus-within {
  border-color: rgba(79, 124, 255, 0.5);
  background: rgba(79, 124, 255, 0.05);
}

.header-search-compact {
  max-width: 220px;
  min-width: 220px;
}

.header-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
  padding: 0;
  font-size: 0.8rem;
  font-family: inherit;
}

.header-search input::placeholder {
  color: var(--text-faint);
}

.header-search-icon,
.header-search-key {
  color: var(--text-faint);
  font-size: 0.7rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.header-view-inline {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 auto;
}

.header-view-kicker,
.header-view-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.header-view-kicker {
  color: var(--text-faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.header-view-separator {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.header-icon-button {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
}

.header-icon-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.header-select {
  min-width: 160px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

.header-select-small {
  min-width: 112px;
}

.period-picker {
  position: relative;
  flex: 0 0 auto;
}

.period-trigger {
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.period-trigger-kicker,
.period-trigger-month {
  color: var(--text-soft);
  font-size: 0.66rem;
}

.period-trigger-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.period-trigger strong,
.period-trigger-combined {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.header-left .header-search {
  display: none;
}

.header-actions > .header-select:not(.header-select-small) {
  display: none;
}

.period-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 248px;
  padding: 12px;
  border-radius: 14px;
  background: #111214;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  z-index: 20;
}

.period-popover[hidden] {
  display: none !important;
}

.period-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.period-popover-header strong {
  font-size: 0.84rem;
  font-weight: 600;
}

.period-popover-caption {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.period-nav-button {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
}

.period-nav-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.period-month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 118px;
}

.period-month-button {
  height: 34px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.76rem;
}

.period-month-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.period-month-button.active {
  background: rgba(79, 124, 255, 0.14);
  border-color: rgba(79, 124, 255, 0.22);
  color: #dbe5ff;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(79, 124, 255, 0.08);
  color: #c6d3ff;
  border: 1px solid rgba(79, 124, 255, 0.16);
  font-size: 0.7rem;
  font-weight: 600;
}

.sync-status-sidebar {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}

.sync-status-sidebar.is-error {
  color: #fecaca;
}

.sync-status-sidebar.is-warn {
  color: #fde68a;
}

.sync-status.is-error {
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.14);
}

.sync-status.is-warn {
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.14);
}

.content-view {
  display: none;
  /* gap: 18px entre blocos internos da view (kpi-grid, dashboard-grid, etc).
     No dashboard, somado ao gap:14px do .main-panel entre ticker e content-view,
     resulta em 32px efetivos de separação — intencional. */
  gap: 18px;
}

.content-view.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
}

#dashboard-view.content-view.active {
  --dashboard-card-gap: 16px;
  gap: var(--dashboard-card-gap);
  box-sizing: border-box;
}

.page-kicker,
.section-kicker {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.page-title {
  margin: 0;
  font-size: clamp(1.34rem, 1.8vw, 1.72rem);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
  font-size: 0.9rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--dashboard-card-gap, 16px);
}

.kpi-card,
.content-card,
.dashboard-panel,
.placeholder-card,
.tree-panel,
.editor-panel,
.profile-card {
  border-radius: var(--radius);
}

.kpi-card {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  gap: 6px;
  transition: background 180ms ease, border-color 180ms ease;
}

.kpi-card:hover,
.content-card:hover {
  background: var(--panel-hover);
}

.kpi-label {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.kpi-value {
  font-size: 1.36rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
  white-space: nowrap;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.kpi-currency {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-soft);
  transform: translateY(2px);
}

.kpi-number {
  display: inline-block;
  font-size: 1.36rem;
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.kpi-trend {
  font-size: 0.72rem;
}

.kpi-trend.positive,
.positive-text {
  color: var(--green);
}

.kpi-trend.negative,
.negative-text {
  color: var(--red);
}

.kpi-trend.neutral {
  color: #c4b5fd;
}

.sparkline {
  height: 24px;
  border-radius: 999px;
  opacity: 0.95;
}

.sparkline-blue,
.sparkline-green,
.sparkline-violet,
.sparkline-amber,
.sparkline-cyan {
  background: none;
  clip-path: none;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--dashboard-card-gap, 16px);
  align-items: stretch;
}

.dashboard-grid > * {
  min-width: 0;
}
/* ─── CARD OPEX UNIFICADO ───────────────────────────────────────────────── */
.dash-opex-unified {
  border-radius: 18px;
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: background 150ms ease;
}

.dash-opex-unified-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.dash-opex-unified-kicker {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-transform: none;
  flex: 1 1 auto;
  min-width: 0;
}

.dash-opex-unified-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* Select do filtro — tema escuro correto */
.dash-opex-filter {
  flex-shrink: 0;
}

.dash-opex-filter select,
.dash-opex-filter-select {
  height: 32px;
  padding: 0 30px 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background-color: var(--panel-alt);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--text);
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  min-width: 130px;
  transition: border-color 120ms ease;
}

.dash-opex-filter select:hover,
.dash-opex-filter-select:hover {
  border-color: rgba(79,124,255,0.45);
}

.dash-opex-filter select:focus,
.dash-opex-filter-select:focus {
  border-color: var(--blue);
}

.dash-opex-filter select option,
.dash-opex-filter-select option {
  background: #1a1d26;
  color: var(--text);
}

.dash-opex-unified-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  color: var(--text-faint);
}

.dash-legend-bar {
  width: 10px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  background: #4f7cff;
}

.dash-legend-line {
  width: 16px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
  background: #93c5fd;
}

/* Grid dos 3 subgráficos */
.dash-opex-charts-row {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px 1fr;
  gap: 0;
  align-items: stretch;
}

.dash-opex-divider {
  width: 1px;
  background: var(--line);
  margin: 0 6px;
  align-self: stretch;
}

.dash-opex-subchart {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px;
  min-width: 0;
}

.dash-opex-subchart:first-child {
  padding-left: 0;
}

.dash-opex-subchart:last-child {
  padding-right: 0;
}

.dash-opex-subchart-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: -0.01em;
}

.dash-opex-chart-area {
  width: 100%;
  height: 120px;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

.dash-opex-chart-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dash-opex-chart-area--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-faint);
  font-size: 0.7rem;
  text-align: center;
}

.dash-card-sub {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin: 2px 0 0;
}

/* Tooltip hover OPEX */
.dash-opex-tt {
  pointer-events: none;
  transition: opacity 80ms ease;
}
/* ─── FIM CARD OPEX UNIFICADO ────────────────────────────────────────────── */

/* ─── DASH BOTTOM ROW: dois cards 50/50 ─────────────────────────────────── */
.dash-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--dashboard-card-gap, 16px);
  padding-bottom: var(--dashboard-card-gap, 16px);
}

.dashboard-bottom-spacer {
  display: none;
}

/* ── Card Gastos Operacionais (donut) ────────────────────────────────────── */
.dash-opex-donut-card {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
}

.dash-opex-donut-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dash-opex-donut-kicker {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.dash-opex-donut-mtd {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 500;
}

.dash-opex-donut-body {
  display: flex;
  flex: 1;
  gap: 6px;
  align-items: center;
  min-height: 0;
}

.dash-opex-donut-area {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  position: relative;
}

.dash-opex-donut-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dash-opex-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.dash-opex-legend-row {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 4px;
  transition: background 100ms;
}

.dash-opex-legend-row:hover {
  background: rgba(255,255,255,0.04);
}

.dash-opex-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-opex-legend-name {
  font-size: 0.71rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-opex-legend-pct {
  font-size: 0.70rem;
  color: var(--text-faint);
  text-align: right;
  white-space: nowrap;
}

.dash-opex-legend-val {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  min-width: 56px;
}

.dash-opex-donut-footer {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

/* ── Card Headcount ───────────────────────────────────────────────────────── */
.dash-hc-card {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
}

.dash-hc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dash-hc-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.dash-hc-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
  min-height: 0;
}

.dash-hc-kpi-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 16px;
}

.dash-hc-kpi-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.dash-hc-kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.dash-hc-kpi-value {
  font-size: 2.0rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}

.dash-hc-kpi-colab {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}

.dash-hc-kpi-cpp {
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: -0.01em;
}

.dash-hc-line-area {
  flex: 1;
  min-height: 100px;
  position: relative;
  overflow: visible;
}

.dash-hc-line-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dash-opex-donut-footer {
  display: none;
}

@media (max-width: 900px) {
  .dash-bottom-row {
    grid-template-columns: 1fr;
  }
}
/* ─── FIM DASH BOTTOM ROW ────────────────────────────────────────────────── */



/* wrapper que empilha MP + EBITDA verticalmente na mesma coluna */
.dash-charts-stack {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: var(--dashboard-card-gap, 16px);
  min-width: 0;
}

/* ── DRE Bullet Chart ──────────────────────────────────────────────────────── */
.dash-dre-bullet { display: flex; flex-direction: column; gap: 0; min-height: 0; }

.dash-bullet-empty { color: var(--text-faint); font-size: 0.78rem; padding: 20px 0; text-align: center; }

.dash-bullet-legend {
  display: flex; gap: 14px; margin-bottom: 10px;
}
.dash-bullet-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.6rem; color: var(--text-soft);
}
.dash-bullet-legend-budget {
  width: 20px; height: 7px; background: var(--blue-soft); border-radius: 2px; border: 1px solid var(--blue);
  opacity: 0.6;
}
.dash-bullet-legend-marker {
  width: 2px; height: 12px; background: var(--text-soft); border-radius: 1px;
}

.dash-bullet-list { display: flex; flex-direction: column; gap: 1px; }

.dash-bullet-row {
  display: grid;
  grid-template-columns: 148px 1fr 130px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.dash-bullet-row--sub {
  padding: 8px 6px;
  margin: 2px -6px;
  background: color-mix(in srgb, var(--bg-soft) 60%, transparent);
  border-radius: 6px;
  border-bottom: none;
}
.dash-bullet-row--result .dash-bullet-label { font-weight: 700; }

.dash-bullet-label {
  font-size: 0.7rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-bullet-row--sub .dash-bullet-label {
  color: var(--text);
  font-weight: 600;
}

.dash-bullet-track {
  position: relative;
  height: 8px;
  background: var(--bg-inset, #1a1a2e);
  border-radius: 4px;
  overflow: visible;
}
.dash-bullet-budget {
  position: absolute; left: 0; top: 0;
  height: 100%; border-radius: 4px;
  background: var(--blue); opacity: 0.18;
}
.dash-bullet-real {
  position: absolute; left: 0; top: 0;
  height: 100%; border-radius: 4px;
  transition: width 0.3s ease;
  opacity: 0.82;
}
.dash-bullet-marker {
  position: absolute; top: -4px;
  width: 2px; height: 16px;
  background: var(--text-soft);
  border-radius: 1px;
  transform: translateX(-50%);
  z-index: 2;
}

.dash-bullet-vals {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.dash-bullet-real-val {
  font-size: 0.68rem; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dash-bullet-pct {
  font-size: 0.62rem; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  min-width: 46px; text-align: right;
}
.dash-bullet-var--pos { color: #22c55e; }
.dash-bullet-var--neg { color: #ef4444; }

/* ── DRE mode toggle (Mês / Acumulado) ────────────────────────────────────── */
.dre-mode-toggle { display: flex; gap: 2px; margin: 2px 0 6px; }
.dre-mode-toggle--inline { margin: 0; }
.dre-mode-btn {
  background: none; border: none; border-radius: 4px;
  color: var(--text-faint); cursor: pointer;
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.02em;
  padding: 2px 8px; transition: color 0.15s, background 0.15s;
}
.dre-mode-btn:hover { color: var(--text-main); }
.dre-mode-btn.active { background: var(--bg-inset, #1a1a2e); color: var(--text-main); font-weight: 600; }

/* ── Ver DRE — link discreto ──────────────────────────────────────────────── */
#dash-ver-dre { font-size: 0.68rem; font-weight: 500; opacity: 0.45; padding: 2px 8px; }
#dash-ver-dre:hover { opacity: 1; }

/* ── DRE Gauge Rings ───────────────────────────────────────────────────────── */
.dash-dre-gauges { padding-top: 8px; margin-top: 4px; }
.dash-gauge-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 8px;
}
.dash-gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.dash-gauge-svg { width: 100%; max-width: 96px; }
.dash-gauge-label {
  font-size: 0.6rem;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
}

.dashboard-panel {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  gap: 16px;
}

.dashboard-panel-compact {
  align-content: start;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h3 {
  margin: 0 0 4px;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.76rem;
}

.ghost-button {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
/* ─── Badge acumulado nos cards Matéria-prima / EBITDA ──────────────────── */
.dash-accum-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.dash-accum-val {
  color: var(--text);
  font-weight: 600;
}

.dash-accum-sep {
  color: var(--text-faint);
  font-size: 0.65rem;
}

.dash-accum-pct {
  color: var(--text-soft);
}
/* ─────────────────────────────────────────────────────────────────────────── */


.table-shell {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: left;
}

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
}

.data-table td {
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
}

.data-table td:not(:first-child),
.data-table th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table td:first-child,
.data-table th:first-child {
  width: 22%;
  word-break: break-word;
}

.data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.chart-placeholder {
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    #111318;
  border: 1px solid rgba(255, 255, 255, 0.04);
  min-height: 250px;
  position: relative;
  overflow: hidden;
}

.chart-bars::before {
  content: "";
  position: absolute;
  inset: 16px;
  background:
    linear-gradient(to top, rgba(79, 124, 255, 0.8) 0 38%, transparent 38%) 2% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.72) 0 44%, transparent 44%) 12% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.78) 0 54%, transparent 54%) 22% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.7) 0 62%, transparent 62%) 32% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.82) 0 49%, transparent 49%) 42% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.74) 0 57%, transparent 57%) 52% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.9) 0 69%, transparent 69%) 62% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.75) 0 64%, transparent 64%) 72% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.82) 0 67%, transparent 67%) 82% 100% / 7% 100% no-repeat,
    linear-gradient(to top, rgba(79, 124, 255, 0.78) 0 60%, transparent 60%) 92% 100% / 7% 100% no-repeat;
  opacity: 0.92;
}

.chart-line::before {
  content: "";
  position: absolute;
  inset: 18px;
  background: linear-gradient(90deg, rgba(79, 124, 255, 0.18), rgba(20, 184, 166, 0.14));
  clip-path: polygon(0 72%, 8% 68%, 16% 64%, 24% 66%, 32% 56%, 40% 54%, 48% 58%, 56% 44%, 64% 38%, 72% 40%, 80% 30%, 88% 24%, 100% 18%, 100% 100%, 0 100%);
}

.chart-line::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-bottom: 2px solid rgba(79, 124, 255, 0.86);
  clip-path: polygon(0 72%, 8% 68%, 16% 64%, 24% 66%, 32% 56%, 40% 54%, 48% 58%, 56% 44%, 64% 38%, 72% 40%, 80% 30%, 88% 24%, 100% 18%);
}

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

.alert-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.alert-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.alert-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.alert-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
}

.alert-dot.warning {
  background: var(--amber);
}

.alert-dot.danger {
  background: var(--red);
}

.alert-dot.positive {
  background: var(--green);
}

.content-card {
  padding: 20px;
}

.placeholder-card {
  background: var(--panel);
  border: 1px solid var(--line);
}

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

.placeholder-box {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.placeholder-box strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.placeholder-box p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.placeholder-step {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: rgba(79, 124, 255, 0.12);
  color: #c6d3ff;
  font-size: 0.66rem;
  font-weight: 600;
}

.reports-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-content: start;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.reports-summary-card,
.reports-table-shell-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  overflow: hidden;
}

.reports-catalog-card {
  background: transparent;
  border: none;
  box-shadow: none;
  min-width: 0;
  padding: 20px 24px 24px;
}

.reports-table-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

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

.reports-catalog-head h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
  font-weight: 600;
}

.reports-catalog-copy {
  max-width: 320px;
  margin: 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  line-height: 1.45;
}

.reports-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  min-width: 0;
  width: 100%;
}

/* ── Novo card de relatório ─────────────────────────────────────────────── */
.reports-report-card {
  padding: 16px 18px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top-width: 3px;
  background: linear-gradient(160deg, rgba(255,255,255,0.03) 0%, transparent 60%), var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  position: relative;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}
.reports-report-card:active { cursor: pointer; }
.reports-report-card.rrc-dragging {
  opacity: 0.4;
  transform: scale(0.97);
}
.reports-report-card.rrc-drag-over {
  border-color: rgba(79,124,255,0.55) !important;
  box-shadow: 0 0 0 2px rgba(79,124,255,0.25);
}

.reports-report-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(5, 10, 18, 0.38);
}

.reports-report-card.active {
  box-shadow: 0 0 0 1px rgba(79, 124, 255, 0.30), 0 16px 36px rgba(5, 10, 18, 0.38);
}

/* Cores por categoria — via data-report-id */
[data-report-id^="dre"] { border-top-color: #4f7cff; }
[data-report-id^="dre"]:hover { border-color: rgba(79,124,255,0.35); border-top-color: #4f7cff; }
[data-report-id^="dre"].active { border-color: rgba(79,124,255,0.70); border-top-color: #4f7cff; }

[data-report-id^="opex"] { border-top-color: #f59e0b; }
[data-report-id^="opex"]:hover { border-color: rgba(245,158,11,0.30); border-top-color: #f59e0b; }
[data-report-id^="opex"].active { border-color: rgba(245,158,11,0.65); border-top-color: #f59e0b; }

[data-report-id^="headcount"] { border-top-color: #22c55e; }
[data-report-id^="headcount"]:hover { border-color: rgba(34,197,94,0.28); border-top-color: #22c55e; }
[data-report-id^="headcount"].active { border-color: rgba(34,197,94,0.65); border-top-color: #22c55e; }

/* Ícones coloridos por categoria */
[data-report-id^="dre"] .rrc-icon-wrap {
  background: rgba(79,124,255,0.12);
  border-color: rgba(79,124,255,0.22);
  color: #4f7cff;
}
[data-report-id^="opex"] .rrc-icon-wrap {
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.22);
  color: #f59e0b;
}
[data-report-id^="headcount"] .rrc-icon-wrap {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.22);
  color: #22c55e;
}

.reports-report-card--soon {
  opacity: 0.50;
  cursor: default;
  pointer-events: none;
}

/* Linha superior: ícone | favorito */
.rrc-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rrc-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  transition: background 140ms, border-color 140ms, color 140ms;
}

.rrc-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.rrc-fav {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-faint);
  line-height: 1;
  border-radius: 6px;
  transition: color 100ms, background 100ms;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.rrc-fav svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.rrc-fav:hover {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.10);
}

.rrc-fav.is-fav {
  color: #f59e0b;
}

.rrc-fav.is-fav svg {
  fill: #f59e0b;
  stroke: #f59e0b;
}

.reports-report-card strong {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

.rrc-subtitle {
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.4;
  flex: 1;
}
.rrc-subtitle:empty { display: none; }

.rrc-edit-btn {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: color 120ms, background 120ms;
  z-index: 2;
}
.rrc-edit-btn svg { width: 13px; height: 13px; pointer-events: none; }
.rrc-edit-btn:hover { color: var(--text); background: rgba(255,255,255,0.12); }

body.can-edit-reports .reports-report-card .rrc-edit-btn { display: inline-flex; }

/* Botão Reorganizar */
#reports-reorder-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#reports-reorder-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
#reports-reorder-btn.active { background: rgba(99,142,255,0.15); color: var(--blue); border-color: var(--blue); }
.rrc-reorder-mode { cursor: grab; }
.rrc-reorder-mode:active { cursor: grabbing; }
.rrc-dragging { opacity: 0.45; }
.rrc-drag-over { outline: 2px dashed var(--blue); outline-offset: 3px; }

/* Popover de edição inline */
.rrc-edit-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  z-index: 100;
}
.rrc-edit-popover input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.78rem;
  padding: 6px 8px;
  outline: none;
}
.rrc-edit-popover input:focus { border-color: var(--blue); }
.rrc-edit-popover input::placeholder { color: var(--text-faint); }
.rrc-edit-popover-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.rrc-edit-popover-actions button {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: var(--panel-hover);
  color: var(--text-soft);
  transition: background 120ms, color 120ms;
}
.rrc-edit-popover-actions button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.rrc-edit-popover-actions button:hover { color: var(--text); }

.rrc-soon-badge {
  display: inline-block;
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  align-self: flex-start;
}

/* ── legacy kicker (mantido para compatibilidade) ───────────────────────── */
.reports-report-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(79, 124, 255, 0.14);
  color: #c6d3ff;
  font-size: 0.72rem;
  font-weight: 700;
}

.reports-detail-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  color: var(--text-soft);
}

.reports-detail-empty strong {
  color: var(--text);
  font-size: 1rem;
}

.reports-detail-empty p {
  max-width: 460px;
  margin: 0;
  line-height: 1.55;
}

.reports-detail-screen {
  display: grid;
  gap: 16px;
}

.reports-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.reports-summary-head,
.reports-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.reports-summary-head h3,
.reports-table-head strong {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.reports-table-head p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.74rem;
}

.reports-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.reports-summary-box {
  min-height: 82px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.reports-summary-box span {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.reports-summary-box strong {
  font-size: 0.88rem;
  line-height: 1.35;
}

.reports-table-wrap {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 14, 24, 0.52);
}

.reports-dre-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.reports-dre-table th,
.reports-dre-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.74rem;
}

.reports-dre-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #101722;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.col-frozen-1 {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #101722;
}
.col-frozen-2 {
  position: sticky;
  left: 110px;
  z-index: 3;
  background: #101722;
}
.col-frozen-3 {
  position: sticky;
  left: 450px;
  z-index: 3;
  background: #101722;
}
thead .col-frozen-1,
thead .col-frozen-2,
thead .col-frozen-3 {
  z-index: 5;
}

.reports-dre-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.reports-dre-table tbody tr:hover .col-frozen {
  background: #12192a;
}
.reports-dre-table tr.is-synthetic td {
  background: rgba(79, 124, 255, 0.06);
}
.reports-dre-table tr.is-synthetic .col-frozen {
  background: #111a2e;
}

.reports-code-cell,
.reports-class-cell {
  white-space: nowrap;
}

.reports-code-cell {
  font-variant-numeric: tabular-nums;
  color: #d7deef;
}

.reports-label-cell {
  padding-left: calc(12px + (var(--depth, 0) * 16px));
}

.reports-label-cell span {
  display: inline-block;
  white-space: nowrap;
}

.reports-value-cell {
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reports-total-cell {
  font-weight: 700;
  color: #f8fafc;
}

/* ─── Column resize handle ───────────────────────────────────────────────── */
.reports-dre-table th {
  position: relative;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  user-select: none;
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 2px;
  width: 2px;
  height: 60%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  transition: background 0.15s;
}
.col-resizer:hover::after,
.col-resizer:active::after {
  background: rgba(79, 124, 255, 0.7);
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* ─── DRE Gerencial ──────────────────────────────────────────────────────── */
.reports-ger-table .ger-label-col {
  padding-left: 14px;
  white-space: nowrap;
}

.reports-ger-table tr.ger-row-subtotal td {
  background: rgba(79, 124, 255, 0.10);
  font-weight: 700;
  color: #e8eeff;
  border-top: 1px solid rgba(79, 124, 255, 0.25);
  border-bottom: 1px solid rgba(79, 124, 255, 0.15);
}
.reports-ger-table tr.ger-row-subtotal .col-frozen {
  background: #111a2e;
}
.reports-ger-table tr.ger-row-result-final td {
  background: rgba(79, 124, 255, 0.18);
  font-weight: 700;
  color: #c2d5ff;
  border-top: 2px solid rgba(79, 124, 255, 0.5);
}
.reports-ger-table tr.ger-row-result-final .col-frozen {
  background: #0e1828;
}
.reports-ger-table tr.ger-row-percent td {
  color: var(--text-soft);
  font-size: 0.64rem;
  font-style: italic;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.reports-ger-table tr.ger-row-percent .col-frozen {
  background: #101722;
}
.reports-ger-table tr.ger-row-detail td {
  color: rgba(200, 210, 230, 0.65);
  padding-left: 22px;
}
.reports-ger-table tr.ger-row-normal td {
  color: #d0d8ec;
}
.reports-ger-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025) !important;
}
.reports-ger-table tbody tr:hover .col-frozen {
  background: #12192a !important;
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* ─── Market Ticker ────────────────────────────────────────────────────────── */
.market-ticker {
  height: 30px;
  min-height: 30px;
  border-radius: 12px;
  background: rgba(12, 14, 18, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.market-ticker::before,
.market-ticker::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  z-index: 2;
  pointer-events: none;
}
.market-ticker::before {
  left: 0;
  background: linear-gradient(to right, rgba(12,14,18,0.95), transparent);
}
.market-ticker::after {
  right: 0;
  background: linear-gradient(to left, rgba(12,14,18,0.95), transparent);
}
.market-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll 30s linear infinite;
  height: 30px;
}
.market-ticker-track:hover {
  animation-play-state: paused;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-25%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  border-right: 1px solid rgba(255,255,255,0.06);
  height: 30px;
  cursor: pointer;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: background 120ms ease;
}
.ticker-item:last-child { border-right: 0; }
.ticker-item:hover { background: rgba(255,255,255,0.04); }
.ticker-item:focus-visible {
  outline: none;
  background: rgba(79,124,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(79,124,255,0.45);
}
.ticker-label {
  color: var(--text-faint);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ticker-value {
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ticker-change {
  font-size: 0.62rem;
  font-weight: 500;
}
.ticker-change.up   { color: #22c55e; }
.ticker-change.down { color: #f87171; }
.ticker-change.flat { color: var(--text-faint); }
.ticker-stale { opacity: 0.58; }
.ticker-mock .ticker-value { color: var(--text-soft); }
.ticker-mock .ticker-label { opacity: 0.6; }

.ticker-link-popover {
  position: fixed;
  z-index: 9999;
  width: min(320px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 14px;
  background: rgba(12, 14, 18, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.ticker-link-popover[hidden] {
  display: none;
}

.ticker-link-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticker-link-popover-head strong {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.ticker-link-popover-close {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  width: 24px;
  height: 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.ticker-link-popover-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.ticker-link-popover-copy {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  line-height: 1.45;
}

.ticker-link-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
/* ─────────────────────────────────────────────────────────────────────────── */

.opex-audit-popover { width: 820px; max-width: calc(100vw - 32px); }
.opex-drillable { cursor: pointer; transition: background 120ms ease; }
.opex-drillable:hover { background: rgba(79,124,255,0.12) !important; color: var(--blue) !important; }
.opex-drillable-active { background: rgba(79,124,255,0.18) !important; color: var(--blue) !important; font-weight: 600; }

.opex-gap-table .gap-code  { width: 80px;  min-width: 80px; }
.opex-gap-table .gap-name  { width: 180px; min-width: 140px; }
.opex-gap-table .gap-date  { width: 90px;  min-width: 90px;  white-space: nowrap; }
.opex-gap-table .gap-history { width: 300px; min-width: 200px; }
.opex-gap-table .gap-val   { width: 110px; min-width: 90px;  text-align: right; }

/* ─── OPEX Real ────────────────────────────────────────────────────────────── */
.opex-header-filter {
  display: flex;
  align-items: center;
  gap: 7px;
}
.opex-report-wrap { display: flex; flex-direction: column; }

.opex-report-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}
.opex-report-period {
  font-size: 0.7rem;
  color: var(--text-faint);
  font-weight: 500;
}
.opex-report-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.opex-filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
}
.opex-filter-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.opex-filter-select option {
  background: #1a2438;
  color: var(--text);
}
.opex-filter-select:focus { outline: none; border-color: var(--blue); }

.reports-opex-table .opex-code-col { width: 110px; }
.reports-opex-table .opex-name-col { width: 260px; }

.reports-opex-table tr.opex-row-grand td {
  background: rgba(79,124,255,0.10);
  font-weight: 700;
  border-top: 1px solid rgba(79,124,255,0.3);
  border-bottom: 1px solid rgba(79,124,255,0.3);
}
.reports-opex-table tr.opex-row-section td {
  background: rgba(255,255,255,0.03);
  color: var(--text-soft);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-top: 10px;
  padding-bottom: 4px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.reports-opex-table tr.opex-row-group td {
  font-weight: 600;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.reports-opex-table tr.opex-row-account td {
  color: var(--text-soft);
}
.reports-opex-table tr.opex-row-account:hover td { background: rgba(255,255,255,0.03); }
.soc-drillable { cursor: pointer; }
.soc-drillable:hover { background: rgba(79,124,255,0.08) !important; color: var(--blue) !important; }
.opex-code { font-family: monospace; font-size: 0.68rem; color: var(--text-faint); }
.reports-opex-table tr td,
.reports-opex-table tr th { text-decoration: none !important; }
/* ─────────────────────────────────────────────────────────────────────────── */

/* ─── Search dropdown ──────────────────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 320px;
  background: #1a2438;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
  overflow: hidden;
}
.search-result-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.search-result-item:last-child { border-bottom: 0; }
.search-result-item:hover,
.search-result-item.active {
  background: rgba(79,124,255,0.12);
}
.search-result-label {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.search-result-sub {
  color: var(--text-faint);
  font-size: 0.65rem;
  white-space: nowrap;
  flex: 0 0 auto;
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* ─── DRE DFs ──────────────────────────────────────────────────────────────── */
.reports-ger-table .dfs-label-col {
  padding-left: 14px;
  white-space: nowrap;
}
.reports-ger-table tr.dfs-row-section td {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 10px;
  padding-bottom: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
/* ─────────────────────────────────────────────────────────────────────────── */

.actuals-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.actuals-intake-card,
.actuals-batch-card,
.actuals-detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.actuals-intake-card,
.actuals-batch-card {
  align-self: stretch;
}

.actuals-batch-card {
  display: flex;
  flex-direction: column;
}

.actuals-detail-card {
  grid-column: 1 / -1;
}

.actuals-upload-form {
  align-items: end;
}

.actuals-intake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.actuals-intake-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.actuals-period-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  cursor: pointer;
  min-width: 90px;
}

.actuals-period-kicker {
  color: var(--text-faint);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.actuals-period-trigger strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.actuals-mode-select {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
}

.actuals-scope-panel {
  display: none;
}

.actuals-scope-card {
  display: none;
}

.actuals-scope-button {
  display: none;
}

.input-button {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.actuals-upload-feedback {
  min-height: 18px;
  margin-top: 12px;
  font-size: 0.74rem;
  color: var(--text-faint);
}

.actuals-upload-feedback.is-error {
  color: var(--red);
}

.actuals-upload-feedback.is-ok {
  color: var(--green);
}

.actuals-upload-feedback.is-warn {
  color: var(--amber);
}

.inline-card-title {
  margin: 4px 0 0;
  font-size: 0.96rem;
  font-weight: 600;
}

.actuals-batch-list {
  display: grid;
  gap: 10px;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.actuals-batch-item {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}

.actuals-batch-item.active,
.actuals-batch-item:hover {
  border-color: rgba(79, 124, 255, 0.28);
  background: rgba(79, 124, 255, 0.08);
  color: var(--text);
}

.actuals-batch-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.actuals-batch-item strong {
  font-size: 0.8rem;
}

.actuals-batch-item span {
  font-size: 0.72rem;
}

.actuals-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.actuals-badge.is-ok {
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.16);
}

.actuals-badge.is-error {
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.16);
}

.actuals-badge.is-warn {
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.16);
}

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

.actuals-detail-title {
  margin-bottom: 0;
}

.actuals-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actuals-summary-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.actuals-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.actuals-summary-card span {
  color: var(--text-faint);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.actuals-summary-card strong {
  font-size: 0.82rem;
}

.actuals-log-shell {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.actuals-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.actuals-log-head strong {
  font-size: 0.8rem;
}

.actuals-log-head span {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.actuals-error-log {
  display: grid;
  gap: 8px;
}

.actuals-error-log:empty {
  display: none;
}

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

.actuals-error-line {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.16);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  cursor: pointer;
}

.actuals-error-item,
.actuals-success-box,
.actuals-empty {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.74rem;
}

.actuals-error-item {
  display: grid;
  gap: 6px;
  border-color: rgba(239, 68, 68, 0.14);
  background: rgba(239, 68, 68, 0.06);
}

.actuals-success-box {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.14);
  background: rgba(34, 197, 94, 0.06);
}

.actuals-table-shell {
  overflow: auto;
}

.actuals-table {
  table-layout: auto;
  min-width: 860px;
}

.actuals-table th,
.actuals-table td {
  text-align: left;
  vertical-align: middle;
  padding: 8px 6px;
}

.actuals-table td {
  font-size: 0.72rem;
}

.actuals-table td:not(:first-child),
.actuals-table th:not(:first-child) {
  text-align: left;
}

.actuals-table td:first-child,
.actuals-table th:first-child {
  width: auto;
}

.actuals-field {
  width: 100%;
  min-width: 100%;
  padding: 7px 8px;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.actuals-col-row {
  width: 32px;
  min-width: 32px;
  padding-left: 6px;
  font-weight: 600;
}

.actuals-col-date {
  width: 92px;
  min-width: 92px;
  padding-left: 2px;
  padding-right: 4px;
}

.actuals-col-branch {
  width: 42px;
  min-width: 42px;
  padding-left: 2px;
  padding-right: 4px;
}

.actuals-col-account {
  width: 120px;
  min-width: 120px;
  padding-left: 2px;
  padding-right: 2px;
}

.actuals-col-cc {
  width: 82px;
  min-width: 82px;
}

.actuals-col-history {
  min-width: 130px;
}

.actuals-col-lot {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
  overflow: hidden;
}

.actuals-col-amount {
  min-width: 140px;
  width: 140px;
}

.actuals-col-status {
  min-width: 82px;
  padding-right: 2px;
}

.actuals-col-action {
  width: 28px;
  min-width: 28px;
  padding-left: 2px;
}

.actuals-field-date {
  width: 100%;
  min-width: 0;
  text-align: right;
  padding-left: 6px;
  padding-right: 6px;
}

.actuals-field-branch {
  width: 100%;
  min-width: 0;
  text-align: right;
  padding-left: 3px;
  padding-right: 6px;
}

.actuals-field-account {
  width: 100%;
  min-width: 0;
  margin-left: auto;
  text-align: right;
  padding-left: 4px;
  padding-right: 5px;
}

.actuals-field-cc {
  width: 100%;
  min-width: 0;
  margin-left: auto;
  text-align: right;
  padding-left: 4px;
  padding-right: 6px;
}

.actuals-field-history {
  min-width: 114px;
}

.actuals-field-lot {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.actuals-field-amount {
  min-width: 0;
  width: 100%;
  text-align: right;
}

.actuals-status-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.actuals-error-trigger {
  cursor: pointer;
}

.actuals-error-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 240px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.16);
  background: #1a1416;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  color: #fecaca;
  text-align: left;
}

.actuals-error-popover strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.74rem;
}

.actuals-error-popover ul {
  margin: 0;
  padding-left: 16px;
}

.actuals-error-popover li {
  margin: 0 0 6px;
  font-size: 0.72rem;
  line-height: 1.4;
}

.table-icon-button {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.16);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  cursor: pointer;
}

.table-icon-button-only {
  width: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  margin-left: -2px;
}

.table-icon-button-only svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.dre-workspace {
  display: grid;
  grid-template-columns: minmax(300px, var(--dre-left-width, 38%)) 10px minmax(340px, 1fr);
  gap: 0;
  align-items: stretch;
}

.tree-panel,
.editor-panel,
.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
}

.tree-panel {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.editor-panel {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.card-toolbar,
.editor-header,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-toolbar {
  margin-bottom: 16px;
}

.toolbar-note {
  color: var(--text-faint);
  font-size: 0.7rem;
}

.editor-header {
  align-items: flex-start;
  flex-direction: column;
  margin-bottom: 18px;
}

.editor-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.full-span {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.74rem;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(79, 124, 255, 0.9);
}

input[disabled],
select[disabled],
textarea[disabled] {
  color: var(--text-faint);
  background: #121418;
}

.primary-button {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: var(--blue);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(1.08);
}

.compact-button {
  height: 34px;
  padding-inline: 12px;
  font-size: 0.82rem;
}

.delete-button {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.08);
  color: #fecaca;
  cursor: pointer;
}

.dre-resizer {
  position: relative;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}

.dre-resizer::before {
  content: "";
  position: absolute;
  inset: 18px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.dre-resizer:hover::before,
.dre-resizer.is-dragging::before {
  background: rgba(79, 124, 255, 0.52);
}

.dre-tree {
  overflow: auto;
  max-height: 660px;
  padding-right: 6px;
}

.tree-node {
  position: relative;
}

.tree-children {
  margin-left: 16px;
  padding-left: 12px;
  border-left: 1px dashed rgba(255, 255, 255, 0.08);
}

.tree-row {
  display: grid;
  grid-template-columns: 24px 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 150ms ease, outline-color 150ms ease;
}

.tree-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tree-row.selected {
  background: rgba(79, 124, 255, 0.08);
  outline: 1px solid rgba(79, 124, 255, 0.16);
}

.tree-row.dragging {
  opacity: 0.45;
}

.tree-row.drop-target {
  background: rgba(79, 124, 255, 0.12);
}

.tree-toggle {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
}

.tree-toggle.empty {
  border-color: transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.2);
  cursor: default;
}

.tree-bullet {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--text-faint);
}

.tree-bullet.synthetic {
  background: var(--text-soft);
}

.tree-bullet.analytic {
  background: var(--blue);
}

.tree-bullet.actual {
  background: var(--cyan);
}

.tree-label strong {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.35;
}

.tree-label span {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 0.64rem;
}

.profile-card {
  padding: 22px;
}

.profile-form {
  max-width: 920px;
}

.profile-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-photo-preview {
  width: 84px;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
}

.profile-preview-copy {
  display: grid;
  gap: 6px;
}

.profile-preview-copy strong {
  font-size: 0.92rem;
  font-weight: 600;
}

.profile-preview-copy span {
  color: var(--text-soft);
  font-size: 0.76rem;
}

.photo-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#profile-photo-file {
  padding: 8px 10px;
}

.avatar-picker-wrap {
  display: grid;
  gap: 12px;
}

.avatar-picker-header {
  display: grid;
  gap: 4px;
}

.avatar-picker-header strong {
  color: var(--text);
  font-size: 0.82rem;
}

.avatar-picker-header span {
  color: var(--text-faint);
  font-size: 0.72rem;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 74px));
  gap: 12px;
}

.avatar-option {
  width: 74px;
  height: 74px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background-color: var(--panel-alt);
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.avatar-option.active {
  border-color: rgba(79, 124, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(79, 124, 255, 0.16);
}

.empty-row td {
  color: var(--text-faint);
}

@media (max-width: 1360px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .dashboard-grid > :nth-child(1),
  .dashboard-grid > :nth-child(2),
  .dashboard-grid > :nth-child(3),
  .dashboard-grid > :nth-child(4) {
    grid-column: auto;
  }

  .dash-opex-charts-row {
    grid-template-columns: 1fr 1px 1fr;
  }
  .dash-opex-subchart:last-child {
    display: none;
  }

  .actuals-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reports-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reports-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 1120px) {
  .app-layout,
  .app-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .main-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-left,
  .header-actions {
    width: 100%;
  }

  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .header-search-compact {
    min-width: 180px;
    width: 100%;
    max-width: 240px;
  }

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

  .actuals-scope-button {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .dre-workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .dre-resizer {
    display: none;
  }

  .tree-panel,
  .editor-panel {
    border-radius: var(--radius);
  }

  .kpi-grid,
  .placeholder-grid,
  .reports-summary-grid {
    grid-template-columns: 1fr;
  }

  .actuals-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-panel {
    padding: 14px 14px 48px;
  }

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

  .photo-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actuals-detail-head,
  .actuals-detail-actions,
  .actuals-log-head {
    flex-direction: column;
    align-items: stretch;
  }

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

  .actuals-summary-grid {
    grid-template-columns: 1fr;
  }

  .reports-summary-head,
  .reports-table-head {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Actuals Catalog ─────────────────────────────── */
.actuals-catalog {
  width: 100%;
}

/* ── Novo catálogo de carga ──────────────────────────────────────────────── */
.load-catalog-header {
  margin-bottom: 20px;
}

.load-catalog-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.load-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.load-catalog-card {
  padding: 16px 18px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top-width: 3px;
  background: linear-gradient(160deg, rgba(255,255,255,0.03) 0%, transparent 60%), var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.load-catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(5, 10, 18, 0.38);
}

.load-catalog-card--soon {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* Cores por tipo */
.load-catalog-card--blue  { border-top-color: #4f7cff; }
.load-catalog-card--blue:hover  { border-color: rgba(79,124,255,0.35); border-top-color: #4f7cff; }
.load-catalog-card--blue  .lcc-icon-wrap { background: rgba(79,124,255,0.12); border-color: rgba(79,124,255,0.22); color: #4f7cff; }

.load-catalog-card--purple { border-top-color: #8b5cf6; }
.load-catalog-card--purple .lcc-icon-wrap { background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.22); color: #8b5cf6; }

.load-catalog-card--cyan  { border-top-color: #14b8a6; }
.load-catalog-card--cyan  .lcc-icon-wrap { background: rgba(20,184,166,0.12); border-color: rgba(20,184,166,0.22); color: #14b8a6; }

.load-catalog-card--amber { border-top-color: #f59e0b; }
.load-catalog-card--amber .lcc-icon-wrap { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.22); color: #f59e0b; }

.load-catalog-card--green { border-top-color: #22c55e; }
.load-catalog-card--green:hover { border-color: rgba(34,197,94,0.28); border-top-color: #22c55e; }
.load-catalog-card--green .lcc-icon-wrap { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.22); color: #22c55e; }

.lcc-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.lcc-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.load-catalog-card strong {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* ─── SCROLLBAR FLUTUANTE (tabelas DRE) ─────────────────────────────────── */
.floating-hscroll {
  position: fixed;
  bottom: 0;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
  height: 10px;
  display: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.floating-hscroll-inner { height: 1px; }
.floating-hscroll::-webkit-scrollbar { height: 6px; }
.floating-hscroll::-webkit-scrollbar-track { background: transparent; }
.floating-hscroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.floating-hscroll::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ─── TRILHA DE AUDITORIA — DRE GERENCIAL ────────────────────────────────── */
.ger-drillable {
  cursor: pointer;
  transition: background 120ms ease;
}
.ger-drillable:hover {
  background: rgba(79, 124, 255, 0.13) !important;
  color: var(--blue) !important;
}

.ger-audit-popover {
  position: fixed;
  z-index: 200;
  width: 520px;
  max-width: calc(100vw - 24px);
  background: #14161d;
  border: 1px solid rgba(79, 124, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(79, 124, 255, 0.08);
  overflow: hidden;
  font-size: 0.78rem;
  animation: gap-appear 130ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gap-appear {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.gap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(79, 124, 255, 0.06);
}

.gap-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gap-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(79, 124, 255, 0.18);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.gap-close {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 100ms, color 100ms;
}
.gap-close:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.gap-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.gap-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.gap-table thead tr {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1a1d26;
}

.gap-table th {
  padding: 7px 10px;
  color: var(--text-faint);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.gap-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-soft);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gap-table tbody tr:last-child td {
  border-bottom: none;
}

.gap-table tbody tr:hover td {
  background: var(--panel-hover);
  color: var(--text);
}

.gap-table .gap-code {
  width: 110px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.gap-table .gap-name {
  color: var(--text-soft);
}

.gap-table .gap-val {
  width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.gap-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: rgba(79, 124, 255, 0.05);
}

.gap-footer-label {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gap-footer-val {
  font-weight: 700;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.gap-footer-val.gap-neg { color: var(--red); }
.gap-footer-val.gap-pos { color: var(--green); }

.gap-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.78rem;
}
/* ─── FIM TRILHA DE AUDITORIA ─────────────────────────────────────────────── */

/* ─── DASHBOARD DINÂMICO ────────────────────────────────────────────────────── */
.dash-chart-area {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: flex-end;
}
.dash-chart-area svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.dash-bar-real { fill: var(--blue); opacity: 0.85; }
.dash-bar-budget { fill: rgba(79,124,255,0.22); }
.dash-bar-real:hover, .dash-bar-budget:hover { opacity: 1; }
.dash-chart-label {
  font-size: 9px;
  fill: var(--text-faint);
  text-anchor: middle;
}
.dash-chart-zero {
  stroke: var(--line);
  stroke-width: 1;
}
.dash-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.78rem;
}
/* ─── FIM DASHBOARD DINÂMICO ─────────────────────────────────────────────── */

/* ─── COMBO CHART CARD ───────────────────────────────────────────────────── */
.dash-combo-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.dash-combo-block {
  padding: 14px 16px 10px;
  flex: 1;
}
.dash-combo-divider {
  height: 1px;
  background: var(--line);
  margin: 0;
}
.dash-combo-header {
  margin-bottom: 8px;
}
.dash-combo-header h3 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
}
.dash-combo-header p {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin: 0;
}
.dash-chart-area--combo {
  height: 120px;
}
/* second axis label */
.dash-axis-label {
  font-size: 8.5px;
  fill: var(--text-faint);
}
.dash-line-pct {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-dot {
  r: 2.5;
}
/* ─── FIM COMBO CHART CARD ───────────────────────────────────────────────── */

/* ─── COMBO CHART — TOOLTIP & INTERACTIVITY ─────────────────────────────── */
.dash-tt-label {
  font-size: 9px;
  fill: var(--text-faint);
  text-anchor: middle;
  dominant-baseline: auto;
}
.dash-tt-val {
  font-size: 10px;
  fill: var(--text);
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: auto;
}
.dash-bar-interactive { transition: opacity 100ms; }
.dash-dot-interactive  { transition: r 100ms; }
.dash-combo-card {
  padding: 14px 16px 10px;
  gap: 8px;
}
.dash-chart-area--combo {
  height: 140px;
}

/* Search hardening: mantém a busca clicável após mover para o header-actions. */
.header-actions .header-search-wrap {
  flex: 0 0 auto;
  min-width: auto;
  position: relative;
}

.header-actions .header-search {
  display: flex;
}

.header-search-icon {
  cursor: pointer;
  user-select: none;
}

.search-result-item {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
}

/* ── PROFILE DIALOG ────────────────────────────────────────────────────────── */

.profile-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
}

.profile-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.profile-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Header ── */
.profile-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.profile-dialog-header .section-kicker {
  margin: 0 0 4px;
}

.profile-dialog-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.profile-dialog-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  border: 1px solid transparent;
  background: transparent;
  flex-shrink: 0;
  transition: background 150ms, color 150ms, border-color 150ms;
}

.profile-dialog-close:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: var(--text);
}

/* ── Preview (avatar + nome) ── */
.profile-dialog-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
}

.profile-dialog-preview .profile-photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.08);
  transition: border-color 150ms, opacity 150ms;
  font-size: 1rem;
}

.profile-dialog-preview .profile-photo-preview:hover {
  border-color: rgba(79, 124, 255, 0.6);
  opacity: 0.85;
}

.profile-upload-hint {
  position: absolute;
  left: 24px;
  bottom: -8px;
  font-size: 0.64rem;
  color: var(--text-faint);
  background: var(--panel);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms;
}

.profile-dialog-preview:hover .profile-upload-hint {
  opacity: 1;
}

/* ── Formulário ── */
.profile-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-dialog-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 20px 24px 16px;
}

.profile-field-full {
  grid-column: 1 / -1;
}

.profile-field-half {
  grid-column: span 1;
}

.profile-dialog-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-badge {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-faint);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: none;
  letter-spacing: 0;
}

.profile-field-readonly input {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.02) !important;
}

/* ── Avatar picker section ── */
.profile-dialog-avatar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-dialog-avatar-section .ghost-button {
  align-self: flex-start;
  font-size: 0.74rem;
}

/* ── Footer ── */
.profile-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: var(--panel);
  position: sticky;
  bottom: 0;
}

/* body lock quando dialog aberto */
body.dialog-open {
  overflow: hidden;
}

/* ── Responsivo mobile ── */
@media (max-width: 600px) {
  .profile-dialog {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 20px 20px 0 0;
    margin: auto auto 0;
  }

  .profile-dialog-fields {
    grid-template-columns: 1fr;
  }

  .profile-field-half {
    grid-column: 1 / -1;
  }
}
/* ── FIM PROFILE DIALOG ──────────────────────────────────────────────────── */

/* ── AVATAR PICKER COMPACTO (dentro do dialog) ─────────────────────────────── */

.profile-dialog-avatar-compact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-dialog-avatar-compact .avatar-picker {
  grid-template-columns: repeat(auto-fill, minmax(58px, 58px));
  gap: 8px;
}

.profile-dialog-avatar-compact .avatar-option {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.profile-dialog-avatar-compact .ghost-button {
  align-self: flex-start;
  font-size: 0.74rem;
}

/* ── ACESSOS DISPONÍVEIS ────────────────────────────────────────────────────── */

.profile-dialog-access-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-access-header {
  display: grid;
  gap: 3px;
}

.profile-access-header strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.profile-access-header span {
  font-size: 0.7rem;
  color: var(--text-faint);
}

.profile-access-trees {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Cada árvore ── */
.access-tree {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.access-tree-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms;
  gap: 8px;
}

.access-tree-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.access-tree-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 600;
}

.access-tree-icon {
  display: flex;
  align-items: center;
  color: var(--text-soft);
  flex-shrink: 0;
}

.access-tree-count {
  font-size: 0.64rem;
  font-weight: 500;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.access-tree-caret {
  color: var(--text-faint);
  flex-shrink: 0;
  transition: transform 200ms ease;
}

/* corpo recolhido por padrão */
.access-tree-body {
  display: none;
  flex-direction: column;
  padding: 0 0 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.access-tree.open .access-tree-body {
  display: flex;
}

.access-tree.open .access-tree-caret {
  transform: rotate(180deg);
}

.access-tree-empty {
  padding: 10px 14px;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin: 0;
}

/* ── Cada linha de acesso ── */
.access-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  font-size: 0.74rem;
  color: var(--text-soft);
  cursor: default;
  user-select: none;
}

.access-row-all {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 2px;
  padding-bottom: 7px;
  margin-top: 4px;
  color: var(--text);
  font-weight: 500;
}

.access-checkbox {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-faint);
}

.access-checkbox-on {
  background: rgba(79, 124, 255, 0.18);
  border-color: rgba(79, 124, 255, 0.55);
  color: #7fa4ff;
}

.access-row-label {
  line-height: 1.3;
}

/* ── FIM ACESSOS DISPONÍVEIS ────────────────────────────────────────────────── */

/* ── ACTUALS ROWS TOOLBAR (busca + contador) ────────────────────────────────── */

.actuals-rows-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0 8px;
}

.actuals-rows-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 340px;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text-soft);
  cursor: text;
  transition: border-color 150ms;
}

.actuals-rows-search:focus-within {
  border-color: rgba(79, 124, 255, 0.45);
  color: var(--text);
}

.actuals-rows-search svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.actuals-rows-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.74rem;
  font-family: inherit;
  padding: 0;
}

.actuals-rows-search input::placeholder {
  color: var(--text-faint);
}

.actuals-rows-count {
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
  margin-left: auto;
}

/* ── PAGINAÇÃO DAS LINHAS ────────────────────────────────────────────────────── */

.actuals-rows-pagination {
  padding: 10px 0 4px;
}

.rows-pagination-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.rows-pagination-info {
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.rows-pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rows-pagination-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 130ms, border-color 130ms, color 130ms;
  white-space: nowrap;
}

.rows-pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.rows-pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.rows-pagination-page.active {
  background: rgba(79, 124, 255, 0.18);
  border-color: rgba(79, 124, 255, 0.5);
  color: #7fa4ff;
  font-weight: 600;
  cursor: default;
}

.rows-pagination-ellipsis {
  font-size: 0.72rem;
  color: var(--text-faint);
  padding: 0 2px;
  user-select: none;
}

/* ── FIM PAGINAÇÃO ───────────────────────────────────────────────────────────── */

/* ── FEEDBACK VISUAL DE EDIÇÃO DE LINHA ─────────────────────────────────────── */

@keyframes row-save-flash {
  0%   { background-color: transparent; }
  20%  { background-color: rgba(34, 197, 94, 0.12); }
  100% { background-color: transparent; }
}

@keyframes row-error-flash {
  0%   { background-color: transparent; }
  20%  { background-color: rgba(239, 68, 68, 0.12); }
  100% { background-color: transparent; }
}

tr.row-saving td {
  opacity: 0.5;
  transition: opacity 150ms;
}

tr.row-saved {
  animation: row-save-flash 1.8s ease forwards;
}

tr.row-save-error {
  animation: row-error-flash 3s ease forwards;
}

/* ── FIM FEEDBACK EDIÇÃO ─────────────────────────────────────────────────────── */

/* ── FIX 2026-06-11: isolamento da Central de Relatórios ─────────────────────
   Corrige vazamento visual dos cards entre telas. A causa principal era HTML
   inválido com botão de favorito dentro de button.reports-report-card; os
   favoritos agora são spans clicáveis e os containers abaixo travam overflow/min-size.
*/
html,
body {
  min-width: 0;
  overflow-x: hidden;
}

/* ── Layout raiz: app ocupa exatamente a viewport, sem scroll na página ──── */
html,
body {
  height: 100%;
}

body:not(.auth-only) {
  overflow: hidden;
}

.app-layout {
  position: relative;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
  grid-template-rows: 100vh; /* uma linha que ocupa exatamente a viewport */
  align-items: stretch;
}

/* ── Borda inferior decorativa fixada no frame (não no conteúdo scrollável) */
.app-layout::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.16), rgba(255,255,255,0.08));
  z-index: 2147483647;
  pointer-events: none;
}

/* ── Painel principal: consolidado no bloco único acima (linha ~458) ── */

/* ── Sidebar: mesma altura do pai, não rola fora do nav-panel interno ────── */
.sidebar {
  height: 100vh;
}

/* ── Content views: apenas min-width/min-height para evitar overflow ──────── */
.content-view,
.content-view.active,
.reports-layout,
.reports-catalog-card,
.reports-table-card,
.reports-card-grid,
.reports-report-card {
  min-width: 0;
  min-height: 0;
}

.content-view.active {
  overflow: visible;
}

.reports-layout {
  overflow: visible;
}


.reports-catalog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.reports-catalog-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.reports-catalog-subtitle {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-faint);
}

.reports-card-grid {
  overflow: hidden;
  align-items: stretch;
}

@media (max-height: 900px) {
  .reports-card-grid {
    gap: 13px;
  }

  .reports-report-card {
    min-height: 158px;
    padding: 16px 18px 18px;
    gap: 10px;
  }

  .rrc-icon-wrap {
    width: 36px;
    height: 36px;
  }

  .reports-report-card strong {
    font-size: 0.88rem;
  }

  .reports-report-card p {
    font-size: 0.74rem;
    line-height: 1.45;
  }
}

@media (max-height: 820px) {
  .reports-card-grid {
    gap: 10px;
  }

  .reports-report-card {
    min-height: 144px;
    padding: 14px 16px 16px;
    gap: 8px;
  }

  .rrc-top {
    gap: 8px;
  }

  .rrc-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .rrc-icon-wrap svg {
    width: 17px;
    height: 17px;
  }

  .reports-report-card strong {
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .reports-report-card p {
    font-size: 0.71rem;
    line-height: 1.4;
  }
}

.reports-report-card {
  flex-shrink: 0;
  contain: layout paint;
}

body.auth-only .content-view {
  display: none !important;
}

/* ── Sombra interna decorativa nos cards ─────────────────────────────────── */
.content-card,
.dash-card,
.kpi-card,
.actuals-detail-card,
.actuals-log-card,
.dre-panel,
.tree-panel,
.editor-panel {
  box-shadow: var(--shadow), inset 0 -1px 0 rgba(255, 255, 255, 0.035);
}

.dre-workspace,
.actuals-layout {
  padding-bottom: 18px;
}


/* === DASHBOARD SPACING REDISTRIBUTION === */
.dashboard-grid,
.kpi-grid,
.dashboard-kpi-grid,
.dashboard-content-grid,
.dashboard-row,
.dashboard-main-grid {
  gap: var(--dashboard-card-gap, 20px) !important;
}

.content-card,
.kpi-card,
.dashboard-panel,
.chart-card,
.table-card,
.profile-card,
.placeholder-card,
.tree-panel,
.editor-panel,
.dash-opex-unified {
  margin: 0 !important;
}

.dashboard-section,
.dashboard-wrapper,
.dashboard-content,
.dashboard-body {
  gap: var(--dashboard-card-gap, 20px) !important;
}


/* ─── Headcount Realizado (relatório) ─────────────────────────────────────── */
.reports-hc-table .hc-caret {
  display: inline-block;
  width: 14px;
  margin-right: 2px;
  color: var(--text-faint);
  font-size: 0.7rem;
}
.reports-hc-table .hc-mgmt-row { cursor: pointer; }
.reports-hc-table .hc-mgmt-row:hover td { background: rgba(79, 124, 255, 0.1); }
.reports-hc-table .hc-drillable { cursor: pointer; }
.reports-hc-table .hc-drillable:hover { background: rgba(79, 124, 255, 0.16); color: var(--blue); }
.reports-hc-table .hc-cc-row .reports-code-cell { color: var(--text-faint); font-size: 0.66rem; }

/* ── Perfis de Acesso ─────────────────────────────────────────────────────── */
.ap-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  max-width: 1100px;
}

.ap-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.ap-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.ap-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ── Gestões ──────────────────────────────────────────────────────────────── */
.mgmt-view { padding: 24px; max-width: 640px; }
.mgmt-card { padding: 0; overflow: hidden; }
.mgmt-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.mgmt-card-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }

.mgmt-list { display: flex; flex-direction: column; }
.mgmt-empty { padding: 20px; font-size: 0.8rem; color: var(--text-faint); }

.mgmt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}
.mgmt-row:last-child { border-bottom: none; }
.mgmt-row:hover { background: rgba(255,255,255,0.03); }

.mgmt-drag-handle { color: var(--text-faint); font-size: 1rem; cursor: grab; opacity: 0.4; flex-shrink: 0; }
.mgmt-name { flex: 1; font-size: 0.82rem; color: var(--text); display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* Drilldown de CCs por gestão */
.mgmt-row-wrap:last-child .mgmt-row { border-bottom: none; }
.mgmt-expand {
  background: none; border: none; cursor: pointer; padding: 2px; border-radius: 5px;
  color: var(--text-faint); display: flex; align-items: center; flex-shrink: 0;
  transition: color 0.12s;
}
.mgmt-expand:hover { color: var(--text); }
.mgmt-chevron { transition: transform 0.15s ease; }
.mgmt-expand.open .mgmt-chevron { transform: rotate(90deg); }
.mgmt-cc-count {
  font-size: 0.68rem; color: var(--text-faint); flex-shrink: 0;
  background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.mgmt-ccs {
  padding: 2px 20px 10px 46px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.015);
}
.mgmt-row-wrap:last-child .mgmt-ccs { border-bottom: none; }
.mgmt-ccs-note {
  display: flex; align-items: center; gap: 7px;
  margin: 2px 0 8px; padding: 7px 10px;
  background: rgba(79,124,255,0.08); border: 1px solid rgba(79,124,255,0.18);
  border-radius: 8px; font-size: 0.7rem; color: var(--text-soft); line-height: 1.35;
}
.mgmt-ccs-note svg { color: var(--blue); flex-shrink: 0; }
.mgmt-ccs-note strong { color: var(--text); font-weight: 600; }
.mgmt-cc-item { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 0.76rem; }
.mgmt-cc-num { font-family: monospace; color: var(--text-soft); min-width: 72px; font-variant-numeric: tabular-nums; }
.mgmt-cc-name { color: var(--text-faint); }
.mgmt-cc-empty { padding: 4px 0; font-size: 0.74rem; color: var(--text-faint); font-style: italic; }
.mgmt-edit-input {
  flex: 1; background: var(--bg-inset, #111318); border: 1px solid var(--blue);
  border-radius: 6px; color: var(--text); font-size: 0.82rem; font-family: inherit;
  padding: 4px 8px; outline: none;
}
.mgmt-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mgmt-btn {
  background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  color: var(--text-faint); transition: background 0.12s, color 0.12s; display: flex; align-items: center;
}
.mgmt-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.mgmt-btn-delete:hover { color: #f87171; background: rgba(248,113,113,0.1); }
.mgmt-btn-save:hover  { color: #4ade80; background: rgba(74,222,128,0.1); font-size: 1rem; }
.mgmt-btn-cancel:hover { color: #f87171; }

.ap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .ap-grid { grid-template-columns: repeat(2, 1fr); }
}

.ap-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}

.ap-card--superadmin { border-top: 3px solid #f59e0b; }
.ap-card--admin      { border-top: 3px solid #4f7cff; }
.ap-card--manager    { border-top: 3px solid #22c55e; }
.ap-card--analyst    { border-top: 3px solid #8b5cf6; }

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

.ap-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ap-badge--superadmin { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ap-badge--admin      { background: rgba(79,124,255,0.15); color: #4f7cff; }
.ap-badge--manager    { background: rgba(34,197,94,0.15);  color: #22c55e; }
.ap-badge--analyst    { background: rgba(139,92,246,0.15); color: #8b5cf6; }

.ap-user-count {
  font-size: 0.68rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.ap-description {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-soft);
  line-height: 1.55;
  flex-shrink: 0;
}

.ap-perms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.ap-perm {
  font-size: 0.72rem;
  padding-left: 18px;
  position: relative;
  line-height: 1.4;
}

.ap-perm::before {
  position: absolute;
  left: 0;
  font-weight: 700;
  font-size: 0.78rem;
}

.ap-perm--yes    { color: var(--text-soft); }
.ap-perm--yes::before  { content: "✓"; color: #22c55e; }
.ap-perm--partial { color: var(--text-soft); }
.ap-perm--partial::before { content: "◐"; color: #f59e0b; }
.ap-perm--no     { color: var(--text-faint); }
.ap-perm--no::before   { content: "✕"; color: #ef4444; opacity: 0.6; }

.ap-card-footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: auto;
}

.ap-users-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--text-faint);
  padding: 0;
  transition: color 0.15s;
}
.ap-users-btn:hover { color: var(--text); }

.ap-legend {
  display: flex;
  gap: 20px;
  padding-top: 4px;
}

.ap-legend-item {
  padding-left: 18px !important;
  color: var(--text-faint) !important;
  font-size: 0.7rem !important;
}

/* ── Usuários ──────────────────────────────────────────────────────────────── */
.users-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
  padding: 20px 24px;
}

.users-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.users-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.users-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.users-table-card {
  padding: 0;
  overflow: hidden;
}

.users-table {
  table-layout: auto;
}

.users-table th:last-child,
.users-table td:last-child {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.users-col-actions { width: 1%; }

.users-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(79, 124, 255, 0.18);
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.users-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.users-name-text { font-weight: 500; color: var(--text); }
.users-email-text { font-size: 0.78rem; color: var(--text-soft); }

.users-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(79, 124, 255, 0.14);
  color: var(--blue);
}

.users-status-active { color: #22c55e; font-size: 0.75rem; }
.users-status-pending { color: #f59e0b; font-size: 0.75rem; }

.users-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.users-action-btn {
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.users-action-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.users-action-btn.users-action-delete:hover { background: rgba(239,68,68,0.12); color: #ef4444; }
.users-action-btn.users-action-resend:hover { background: rgba(34,197,94,0.12); color: #22c55e; }

.users-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 32px !important;
}

/* ── Painel de edição de usuário ──────────────────────────────────────────── */
/* overlay escuro atrás do modal */
.ue-panel::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.ue-panel.open::before { opacity: 1; pointer-events: auto; }

.ue-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.ue-panel.open { opacity: 1; pointer-events: auto; }

/* caixa do modal */
.ue-panel-inner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  width: 540px;
  max-width: calc(100vw - 40px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}
.ue-panel.open .ue-panel-inner { transform: scale(1) translateY(0); }

.ue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ue-panel-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.ue-close-btn {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 1rem; padding: 4px 6px; border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.ue-close-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }

.ue-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ue-panel-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.ue-section { display: flex; flex-direction: column; gap: 6px; }
.ue-label { font-size: 0.68rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.ue-label-hint { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.68rem; color: var(--text-faint); }
.ue-input, .ue-select {
  background: var(--bg-inset, #111318);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.15s;
}
.ue-input:focus, .ue-select:focus { outline: none; border-color: var(--blue); }
.ue-divider { height: 1px; background: var(--line); margin: 4px 0; }

/* Árvores de acesso */
.ue-tree-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.ue-tree-title { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.ue-tree-hint { font-size: 0.7rem; color: var(--text-faint); }

/* Acordeão de acesso */
.ue-accordion { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }

.ue-acc-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: none; cursor: pointer; color: var(--text-soft);
  transition: background 0.15s;
}
.ue-acc-header:hover { background: rgba(255,255,255,0.06); }
.ue-acc-header.open { color: var(--text); background: rgba(255,255,255,0.05); }

.ue-acc-left { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 600; }
.ue-acc-label { }

.ue-chevron {
  flex-shrink: 0; color: var(--text-faint);
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}
.ue-acc-header.open .ue-chevron { transform: rotate(90deg); }

.ue-acc-body { padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.ue-tree-subgroup { margin-bottom: 6px; }
.ue-tree-subgroup-title {
  font-size: 0.65rem; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 0 3px;
}
.ue-tree-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.76rem; color: var(--text-soft);
  padding: 4px 6px; border-radius: 5px;
  cursor: pointer;
  transition: background 0.1s;
}
.ue-tree-item:hover { background: rgba(255,255,255,0.04); }
.ue-tree-item input[type="checkbox"] { flex-shrink: 0; accent-color: var(--blue); }
.ue-tree-item input[disabled] { opacity: 0.45; cursor: default; }
.ue-tree-label { flex: 1; }
.ue-tree-item.ue-tree-extra { color: var(--text); }

.ue-extra-tag {
  margin-left: auto;
  font-size: 0.6rem; font-weight: 700;
  background: rgba(245,158,11,0.18); color: #f59e0b;
  padding: 1px 6px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ue-tree-empty { font-size: 0.72rem; color: var(--text-faint); padding: 4px 0; }

/* ============================================================
   Refino financeiro: números tabulares, cor +/- e profundidade
   ============================================================ */

/* 1. Algarismos de largura fixa em toda célula/KPI/input numérico —
      garante alinhamento coluna a coluna nas tabelas financeiras */
table td,
table th,
.actuals-field-amount,
.actuals-col-amount,
.dash-hc-kpi-value,
.kpi-value,
.kpi-currency,
.gap-footer-val {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 2. Valores negativos no corpo dos relatórios em vermelho-suave.
      A classe .val-neg é aplicada via JS (colorizeNegativeCells). */
.reports-value-cell.val-neg { color: var(--neg); }
.reports-total-cell.val-neg { color: var(--neg); }

/* Tons mais suaves (menos "alarme") para os indicadores semânticos */
.kpi-trend.positive, .positive-text { color: var(--pos); }
.kpi-trend.negative, .negative-text { color: var(--neg); }
.gap-footer-val.gap-pos { color: var(--pos); }
.gap-footer-val.gap-neg { color: var(--neg); }

/* Skeleton loading — placeholders pulsantes enquanto os dados carregam */
.vp-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 6px;
}
.vp-skel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vp-skel-row--head { margin-bottom: 6px; }
.vp-skel-bar {
  height: 13px;
  border-radius: 6px;
  flex: 0 0 auto;
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-hover) 50%, var(--panel) 100%);
  background-size: 200% 100%;
  animation: vp-shimmer 1.4s ease-in-out infinite;
}
.vp-skel-row--head .vp-skel-bar { height: 10px; opacity: 0.65; }
.vp-skel-bar--val { flex: 1 1 0; min-width: 0; }
@keyframes vp-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vp-skel-bar { animation: none; }
}

/* 3. Realce de 1px no topo dos painéis planos — sensação de superfície "vidro/8k".
      (kpi-card/dash-card/content-card já têm sombra própria e ficam de fora.) */
.reports-table-card,
.reports-table-shell-card,
.table-card,
.users-table-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Overlay de carregamento do app (blur + spinner) — transição de login/recarga */
#app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 9, 10, 0.35);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
#app-loading-overlay.visible { display: flex; }
.app-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.app-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--blue);
  animation: app-loading-spin 0.8s linear infinite;
}
@keyframes app-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .app-loading-spinner { animation: none; } }

/* Modal de convite de usuário */
.users-invite-overlay {
  position: fixed; inset: 0; z-index: 9600;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.users-invite-modal {
  width: 440px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.users-invite-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
}
.users-invite-kicker { font-size: 0.62rem; letter-spacing: 0.14em; color: var(--text-faint); margin: 0 0 4px; }
.users-invite-title { font-size: 1rem; font-weight: 600; color: var(--text); margin: 0; }
.users-invite-close { background: none; border: none; color: var(--text-faint); font-size: 1rem; cursor: pointer; line-height: 1; }
.users-invite-close:hover { color: var(--text); }
.users-invite-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.ui-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.74rem; color: var(--text-soft); }
.ui-field input, .ui-field select {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 0.82rem; font-family: inherit; padding: 8px 10px; outline: none;
}
.ui-field input:focus, .ui-field select:focus { border-color: var(--blue); }
.ui-hint { color: var(--text-faint); font-size: 0.66rem; }
.users-invite-note { font-size: 0.7rem; color: var(--text-faint); margin: 2px 0 0; line-height: 1.4; }
.users-invite-feedback { min-height: 16px; font-size: 0.72rem; margin: 0; }
.users-invite-feedback.is-error { color: var(--red); }
.users-invite-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
