/* ==========================================================================
   EVONERA Design System 1.1 — Folha de Estilos Canônica
   Zero-Build / Pure Vanilla CSS com Custom Properties Semânticas
   ========================================================================== */


/* --------------------------------------------------------------------------
   Reset Global e Tipografia Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background-color: var(--ev-bg);
  color: var(--ev-text);
  font-family: var(--ev-font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--ev-duration-fast) var(--ev-ease),
              color var(--ev-duration-fast) var(--ev-ease);
}

/* Tipografia Tabular e Técnica */
.num, .mono, td.num, .ev-num, .rail-val {
  font-family: var(--ev-font-mono);
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ev-link);
  text-decoration: none;
  transition: color var(--ev-duration-fast) var(--ev-ease);
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--ev-text);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Remover marcador decorativo legado */
.tick {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Acessibilidade & Foco
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--ev-focus);
  outline-offset: 2px;
}

.ev-sr-only, .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Marca & Logotipo EVONERA (Alternância Clara / Escura)
   -------------------------------------------------------------------------- */
.ev-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
}

.ev-brand img {
  display: block;
  height: auto;
  max-width: 100%;
}

.ev-brand-horizontal {
  width: 180px;
}

.ev-brand-stacked {
  width: 190px;
}

.ev-brand-symbol {
  width: 32px;
  height: 32px;
}

/* Comportamento Light / Dark da Logo */
.ev-brand .logo-dark {
  display: none;
}
.ev-brand .logo-light {
  display: block;
}

html[data-theme="dark"] .ev-brand .logo-dark {
  display: block;
}
html[data-theme="dark"] .ev-brand .logo-light {
  display: none;
}

/* --------------------------------------------------------------------------
   Shell da Aplicação (Layout de 2 Colunas com Sidebar e Cabeçalho)
   -------------------------------------------------------------------------- */
.ev-shell {
  display: grid;
  grid-template-columns: var(--ev-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* Backdrop do Drawer Mobile (invisível em desktop, ativado em mobile) */
.ev-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 32, 0.6);
  z-index: var(--ev-z-overlay, 60);
  display: none;
}

/* Sidebar Fixa */
.ev-sidebar {
  background: var(--ev-surface);
  border-right: 1px solid var(--ev-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 20px 16px;
  z-index: var(--ev-z-dropdown);
  width: var(--ev-sidebar-width);
  box-sizing: border-box;
}

.ev-sidebar-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ev-border);
  margin-bottom: 16px;
}

/* Seletor / Indicador de Organização Ativa */
.ev-org-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--ev-surface-subtle);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-control);
  font-size: 12px;
  color: var(--ev-text-secondary);
}

.ev-org-badge .org-name {
  font-weight: 600;
  color: var(--ev-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Menu de Navegação na Sidebar */
.ev-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.ev-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--ev-radius-control);
  color: var(--ev-text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  text-decoration: none !important;
  transition: all var(--ev-duration-fast) var(--ev-ease);
}

.ev-nav-link:hover {
  background: var(--ev-surface-hover);
  color: var(--ev-text);
}

.ev-nav-link.active, .ev-nav-link[aria-current="page"] {
  background: var(--ev-selected);
  color: var(--ev-on-selected);
  font-weight: 600;
}

.ev-nav-link .nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Rodapé da Sidebar */
.ev-sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--ev-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ev-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ev-text-muted);
}

.ev-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Área Principal */
.ev-main-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Cabeçalho de Contexto Superior */
.ev-header {
  min-height: 64px;
  background: var(--ev-surface);
  border-bottom: 1px solid var(--ev-border);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: var(--ev-z-sticky);
}

.ev-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ev-text-muted);
}

.ev-breadcrumb a {
  color: var(--ev-text-secondary);
}
.ev-breadcrumb a:hover {
  color: var(--ev-text);
}

.ev-breadcrumb .sep {
  color: var(--ev-text-muted);
}

.ev-header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ev-text);
  margin: 0;
}

.ev-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Botão Alternador de Tema */
.ev-theme-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: var(--ev-radius-control);
  border: 1px solid var(--ev-border);
  background: var(--ev-surface);
  color: var(--ev-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-sizing: border-box;
  position: relative;
  transition: background var(--ev-duration-fast) var(--ev-ease),
              border-color var(--ev-duration-fast) var(--ev-ease),
              color var(--ev-duration-fast) var(--ev-ease);
}
.ev-theme-btn:hover {
  background: var(--ev-surface-hover);
  color: var(--ev-text);
  border-color: var(--ev-border-control);
}
.ev-theme-btn:focus-visible {
  outline: 2px solid var(--ev-focus);
  outline-offset: 2px;
}

/* Exibição condicional de ícone: único por tema com micro-animação */
.ev-theme-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform var(--ev-duration-fast) var(--ev-ease);
}
.ev-theme-btn:hover svg {
  transform: scale(1.12);
}

/* Modo Claro: exibe a Lua (convite para escuro), esconde o Sol */
html[data-theme="light"] .ev-theme-btn .theme-icon-sun,
html:not([data-theme="dark"]) .ev-theme-btn .theme-icon-sun,
html[data-theme="light"] .ev-theme-btn .logo-dark,
html:not([data-theme="dark"]) .ev-theme-btn .logo-dark {
  display: none !important;
}
html[data-theme="light"] .ev-theme-btn .theme-icon-moon,
html:not([data-theme="dark"]) .ev-theme-btn .theme-icon-moon,
html[data-theme="light"] .ev-theme-btn .logo-light,
html:not([data-theme="dark"]) .ev-theme-btn .logo-light {
  display: block !important;
}

/* Modo Escuro: exibe o Sol (convite para claro), esconde a Lua */
html[data-theme="dark"] .ev-theme-btn .theme-icon-moon,
html[data-theme="dark"] .ev-theme-btn .logo-light {
  display: none !important;
}
html[data-theme="dark"] .ev-theme-btn .theme-icon-sun,
html[data-theme="dark"] .ev-theme-btn .logo-dark {
  display: block !important;
  color: var(--ev-action);
}

/* Conteúdo da Página */
.ev-main {
  width: 100%;
  max-width: var(--ev-content-max);
  margin-inline: auto;
  padding: 32px;
  min-width: 0;
  flex: 1;
}

/* Barra de Contexto (Rail e Abas) alinhada rigorosamente à grade de conteúdo */
.ev-context-bar {
  width: 100%;
  max-width: var(--ev-content-max);
  margin-inline: auto;
  padding: 24px 32px 0 32px;
  min-width: 0;
}

/* Botão Hambúrguer Mobile */
.ev-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-control);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ev-text);
}

/* --------------------------------------------------------------------------
   Resumo de Telemetria / Barra de Métricas (#rail-metrics)
   Substituição da régua industrial escura por um card executivo EVONERA
   -------------------------------------------------------------------------- */
#rail-container, .rail {
  margin-bottom: 24px;
}

#rail-metrics, .rail-in {
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  padding: 18px 24px;
  box-shadow: var(--ev-shadow);
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  gap: 20px;
  align-items: center;
}

.rail-main {
  padding-right: 20px;
  border-right: 1px solid var(--ev-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-main .big {
  font-size: 26px;
  font-weight: 700;
  color: var(--ev-text);
  font-family: var(--ev-font-mono);
  line-height: 1.1;
}

.rail-main .tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ev-text-secondary);
}

.rail-sep {
  display: none;
}

.rail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-lbl {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ev-text-secondary);
  text-transform: none;
}

.rail-val {
  font-size: 16px;
  font-weight: 600;
  color: var(--ev-text);
  font-family: var(--ev-font-mono);
}

.rail-val.b { color: var(--ev-info); }
.rail-val.o { color: var(--ev-warning); }
.rail-val.g { color: var(--ev-success); }

.rail-empty {
  grid-column: 1 / -1;
  padding: 8px;
  color: var(--ev-text-muted);
  font-size: 13px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Abas de Navegação (.ev-tabs / .tabbar)
   -------------------------------------------------------------------------- */
.tabbar {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--ev-border);
}

.tabs, .ev-tabs {
  display: flex;
  gap: 28px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab, .ev-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 4px;
  border-bottom: 3px solid transparent;
  color: var(--ev-text-secondary);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: all var(--ev-duration-fast) var(--ev-ease);
}

.tab:hover, .ev-tabs a:hover {
  color: var(--ev-text);
}

.tab.on, .tab[aria-current="page"], .ev-tabs a[aria-current="page"] {
  border-bottom-color: var(--ev-action);
  color: var(--ev-text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Botões (EVONERA Buttons + Compatibilidade .btn)
   -------------------------------------------------------------------------- */
.ev-btn, .btn {
  min-height: var(--ev-control-height);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--ev-border-control);
  border-radius: var(--ev-radius-control);
  background: var(--ev-surface);
  color: var(--ev-text);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none !important;
  transition: all var(--ev-duration-fast) var(--ev-ease);
  line-height: 1;
}

.ev-btn:hover, .btn:hover {
  background: var(--ev-surface-hover);
  border-color: var(--ev-text-secondary);
}

.ev-btn--primary, .btn-primary {
  background: var(--ev-action) !important;
  color: var(--ev-on-action) !important;
  border-color: transparent !important;
}

.ev-btn--primary:hover, .btn-primary:hover {
  background: var(--ev-action-hover) !important;
}

.ev-btn--primary:active, .btn-primary:active {
  background: var(--ev-action-active) !important;
}

.ev-btn--ghost, .btn-ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--ev-text-secondary);
}
.ev-btn--ghost:hover, .btn-ghost:hover {
  background: var(--ev-surface-hover) !important;
  color: var(--ev-text);
}

.ev-btn--danger, .btn-danger {
  color: var(--ev-danger) !important;
  border-color: var(--ev-danger) !important;
  background: transparent;
}
.ev-btn--danger:hover, .btn-danger:hover {
  background: var(--ev-danger-bg) !important;
}

.btn-sm, .ev-btn--sm {
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
  box-sizing: border-box;
}

.btn-icon, .ev-btn--icon {
  width: var(--ev-control-height);
  height: var(--ev-control-height);
  padding: 0;
  box-sizing: border-box;
}

.btn-icon.btn-sm,
.ev-btn--icon.ev-btn--sm,
.ev-btn--sm.ev-btn--icon {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.ev-btn:disabled, .btn:disabled, .ev-btn[disabled], .btn[disabled] {
  background: var(--ev-surface-subtle) !important;
  color: var(--ev-text-muted) !important;
  border-color: var(--ev-border) !important;
  cursor: not-allowed !important;
  opacity: 0.65;
}

/* --------------------------------------------------------------------------
   Cards, Painéis & Grids
   -------------------------------------------------------------------------- */
.ev-card, .card, .proj {
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  padding: 24px;
  box-shadow: var(--ev-shadow);
  transition: box-shadow var(--ev-duration-fast) var(--ev-ease),
              border-color var(--ev-duration-fast) var(--ev-ease);
}

.card-title, .ev-card h2, .ev-card h3 {
  font-size: 18px;
  line-height: 24px;
  margin: 0 0 16px;
  font-weight: 600;
  color: var(--ev-text);
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.metric {
  background: var(--ev-surface-subtle);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-control);
  padding: 12px 14px;
}

.metric .lbl {
  font-size: 11.5px;
  color: var(--ev-text-secondary);
  margin-bottom: 4px;
}

.metric .val {
  font-size: 19px;
  font-weight: 600;
  color: var(--ev-text);
  font-family: var(--ev-font-mono);
}

.metric .sub {
  font-size: 11px;
  color: var(--ev-text-secondary);
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Formulários & Entradas (Regra do Alto Contraste & 44px)
   -------------------------------------------------------------------------- */
.ev-field, .field, .qf {
  display: grid;
  gap: 6px;
}

.ev-field label, .field label, .qf label {
  font-weight: 500;
  font-size: 13px;
  color: var(--ev-text);
}

.ev-input, .field-input, input[type="text"], input[type="email"],
input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  min-height: var(--ev-control-height);
  border: 1px solid var(--ev-border-control);
  border-radius: var(--ev-radius-control);
  padding: 10px 14px;
  background: var(--ev-surface);
  color: var(--ev-text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color var(--ev-duration-fast) var(--ev-ease),
              box-shadow var(--ev-duration-fast) var(--ev-ease);
}

.ev-input:hover, .field-input:hover, select:hover, textarea:hover {
  border-color: var(--ev-text-secondary);
}

.ev-input:focus, .field-input:focus, select:focus, textarea:focus {
  border-color: var(--ev-focus);
  outline: 3px solid var(--ev-focus);
  outline-offset: 1px;
}

.ev-input::placeholder, .field-input::placeholder, textarea::placeholder {
  color: var(--ev-text-muted);
}

/* Regra Estrita de Alto Contraste em Dropdowns */
select, select option {
  background-color: #FFFFFF !important;
  color: #1E2A38 !important;
}

html[data-theme="dark"] select, html[data-theme="dark"] select option {
  background-color: #1B2531 !important;
  color: #F2F5F8 !important;
}

/* Validação de Formulários */
.has-error .ev-input, .has-error .field-input, [aria-invalid="true"] {
  border-color: var(--ev-danger) !important;
  outline-color: var(--ev-danger) !important;
}

.ev-help, .hint, .faint {
  font-size: 12px;
  color: var(--ev-text-secondary);
}

.ev-error, .field-error-msg {
  font-size: 12px;
  color: var(--ev-danger);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Formulário de Cadastro Rápido (Quick Add) */
.quick {
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  padding: 16px 20px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.qf.grow {
  flex: 1;
  min-width: 200px;
}

/* Checkbox & Switch */
.ev-check {
  accent-color: var(--ev-action);
  width: 18px;
  height: 18px;
}

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

.switch-input {
  accent-color: var(--ev-action);
  width: 20px;
  height: 20px;
}

/* --------------------------------------------------------------------------
   Tabelas de Dados (.ev-table / .tbl-wrap)
   -------------------------------------------------------------------------- */
.ev-table-wrap, .tbl-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  background: var(--ev-surface);
}

.ev-table, table {
  width: 100%;
  border-collapse: collapse;
  background: var(--ev-surface);
  font-size: 13.5px;
}

.ev-table caption, table caption {
  text-align: left;
  padding: 16px;
  font-weight: 600;
}

.ev-table th, table th {
  text-align: left;
  font-weight: 500;
  color: var(--ev-text-secondary);
  background: var(--ev-surface-subtle);
  padding: 12px 16px;
  border-bottom: 1px solid var(--ev-border);
  white-space: nowrap;
}

.ev-table td, table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ev-border);
  color: var(--ev-text);
}

.ev-table tbody tr:hover, table tbody tr:hover {
  background: var(--ev-surface-hover);
}

.ev-table tr[aria-selected="true"], table tr.hit, table tr[aria-selected="true"] {
  background: var(--ev-selected) !important;
}

.total-row {
  font-weight: 600;
  background: var(--ev-surface-subtle);
}

/* --------------------------------------------------------------------------
   Badges, Chips & Alertas
   -------------------------------------------------------------------------- */
.ev-badge, .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--ev-radius-pill);
  padding: 3px 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--ev-text-secondary);
  background: var(--ev-surface-subtle);
}

.ev-badge--success, .chip.green {
  color: var(--ev-success);
  background: var(--ev-success-bg);
}

.ev-badge--warning, .chip.orange {
  color: var(--ev-warning);
  background: var(--ev-warning-bg);
}

.ev-badge--danger, .chip.red {
  color: var(--ev-danger);
  background: var(--ev-danger-bg);
}

.ev-badge--info, .chip.blue {
  color: var(--ev-info);
  background: var(--ev-info-bg);
}

.ev-alert, .alert {
  padding: 14px 18px;
  border-radius: var(--ev-radius-control);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid currentColor;
}

.ev-alert--info, .alert.info {
  color: var(--ev-info);
  background: var(--ev-info-bg);
}

.ev-alert--success, .alert.ok {
  color: var(--ev-success);
  background: var(--ev-success-bg);
}

.ev-alert--warning, .alert.warn {
  color: var(--ev-warning);
  background: var(--ev-warning-bg);
}

.ev-alert--danger, .alert.danger {
  color: var(--ev-danger);
  background: var(--ev-danger-bg);
}

/* --------------------------------------------------------------------------
   Diálogos, Modais & Overlays
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 32, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--ev-z-overlay);
  padding: 16px;
}

.overlay.on {
  display: flex;
}

.ev-dialog, .modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-dialog);
  padding: 24px;
  background: var(--ev-surface);
  color: var(--ev-text);
  box-shadow: var(--ev-shadow-overlay);
}

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

.modal-head h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Notificações Toast
   -------------------------------------------------------------------------- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ev-text);
  color: var(--ev-surface);
  padding: 12px 20px;
  border-radius: var(--ev-radius-control);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--ev-shadow-overlay);
  z-index: var(--ev-z-toast);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity var(--ev-duration-normal) var(--ev-ease),
              transform var(--ev-duration-normal) var(--ev-ease);
}

#toast.on {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Estado Vazio (.ev-empty / .empty)
   -------------------------------------------------------------------------- */
.ev-empty, .empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty .ico {
  font-size: 36px;
  margin-bottom: 4px;
}

.empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ev-text);
}

.empty p {
  max-width: 480px;
  color: var(--ev-text-secondary);
}

/* --------------------------------------------------------------------------
   Veredito Comercial & Curva SVG (Dimensionamento)
   -------------------------------------------------------------------------- */
.verdict {
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  padding: 24px;
  box-shadow: var(--ev-shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.verdict .kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--ev-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.verdict .big {
  font-size: 36px;
  font-weight: 700;
  color: var(--ev-text);
  font-family: var(--ev-font-mono);
  line-height: 1;
}

.verdict .note {
  font-size: 13.5px;
  color: var(--ev-text-secondary);
}

.scope {
  width: 100%;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ev-text-secondary);
}

.legend span i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: var(--ev-radius-sm);
}

/* --------------------------------------------------------------------------
   Autenticação / Login
   -------------------------------------------------------------------------- */
.auth-wrapper {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

.auth-form-card {
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-dialog);
  padding: 36px 32px;
  box-shadow: var(--ev-shadow-overlay);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--ev-text-secondary);
}

.demo-fill-btn {
  width: 100%;
  padding: 10px 14px;
  background: var(--ev-surface-subtle);
  border: 1px dashed var(--ev-border-control);
  border-radius: var(--ev-radius-control);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: var(--ev-text);
  transition: background var(--ev-duration-fast) var(--ev-ease);
}
.demo-fill-btn:hover {
  background: var(--ev-surface-hover);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 14px;
  color: var(--ev-text-muted);
  pointer-events: none;
  display: flex;
}

.input-with-icon input {
  padding-left: 42px;
}

.input-with-icon .toggle-pwd-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--ev-text-muted);
  cursor: pointer;
  padding: 4px;
}

/* --------------------------------------------------------------------------
   Folha de Relatório Técnico / Memorial (Impressão A4)
   -------------------------------------------------------------------------- */
.sheet.doc {
  background: #FFFFFF;
  color: #1E2A38;
  padding: 40px;
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-card);
  box-shadow: var(--ev-shadow);
  margin-top: 16px;
}

.sheet.doc h1 {
  font-size: 24px;
  color: #1E2A38;
  margin-bottom: 8px;
}

.sheet.doc .pmeta {
  font-size: 13px;
  color: var(--ev-text-secondary);
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ev-border);
  margin-bottom: 24px;
  line-height: 1.6;
}

.sheet.doc h2 {
  font-size: 17px;
  color: var(--ev-text);
  margin-top: 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ev-border);
  padding-bottom: 6px;
}

.sheet.doc p.txt {
  font-size: 13px;
  color: var(--ev-text);
  margin-bottom: 16px;
  line-height: 1.6;
}

.sheet.doc table {
  background: var(--ev-surface);
  color: var(--ev-text);
}

.sheet.doc table th {
  background: var(--ev-surface-subtle);
  color: var(--ev-text-secondary);
}

.sheet.doc table td, .sheet.doc table th {
  border-color: var(--ev-border);
}

@media print {
  body {
    background: #FFFFFF !important;
    color: #1E2A38 !important;
  }
  .ev-shell {
    display: block !important;
  }
  .ev-sidebar, .ev-header, .tabbar, #rail-container, .btn-print-hide, .ev-no-print, .ev-context-bar {
    display: none !important;
  }
  .ev-main, .ev-context-bar {
    padding: 0 !important;
    max-width: none !important;
  }
  .sheet.doc {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  @page {
    size: A4;
    margin: 15mm;
  }
  .sheet.doc h2, .sheet.doc h3 {
    break-after: avoid;
  }
  .sheet.doc tr, .sheet.doc figure {
    break-inside: avoid;
  }
  .sheet.doc thead {
    display: table-header-group;
  }
}

/* --------------------------------------------------------------------------
   Layout Responsivo (Desktop, Tablet, Mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .ev-shell {
    grid-template-columns: 208px minmax(0, 1fr);
  }
  .ev-sidebar {
    width: 208px;
  }
  .ev-main {
    padding: 24px;
  }
  .ev-context-bar {
    padding: 20px 24px 0 24px;
  }
  #rail-metrics, .rail-in {
    grid-template-columns: auto repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .ev-shell {
    display: block;
  }
  .ev-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform var(--ev-duration-normal) var(--ev-ease);
    box-shadow: var(--ev-shadow-overlay);
    z-index: 100;
  }
  .ev-sidebar.open {
    transform: translateX(0);
  }
  .ev-sidebar-backdrop.open {
    display: block;
  }
  .ev-mobile-toggle {
    display: inline-flex;
  }
  .ev-header {
    padding: 12px 16px;
    gap: 10px;
  }
  .ev-header-meta {
    display: none !important;
  }
  .ev-header-actions {
    gap: 6px;
  }
  .ev-header-actions .ev-btn span {
    display: none;
  }
  .ev-header-actions .ev-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    justify-content: center;
  }
  .ev-breadcrumb h1 {
    max-width: 140px;
    display: inline-block;
    vertical-align: bottom;
  }
  .ev-main {
    padding: 16px;
  }
  .ev-context-bar {
    padding: 16px 16px 0 16px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
  #rail-metrics, .rail-in {
    grid-template-columns: 1fr 1fr;
  }
  .rail-main {
    grid-column: 1 / -1;
    border-right: none;
    border-bottom: 1px solid var(--ev-border);
    padding-bottom: 12px;
  }
  .quick {
    flex-direction: column;
    align-items: stretch;
  }
  .quick .qf {
    width: 100% !important;
  }
}

/* --------------------------------------------------------------------------
   Barra de Progresso Discreta no Topo (Transições HTMX)
   -------------------------------------------------------------------------- */
.ev-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--ev-action);
  opacity: 0;
  pointer-events: none;
  z-index: 99999;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.htmx-request .ev-top-progress,
.ev-top-progress.htmx-request,
body.htmx-request .ev-top-progress {
  opacity: 1;
  transform: scaleX(0.75);
  transition: transform 3s cubic-bezier(0.1, 0.8, 0.2, 1), opacity 0.1s ease;
}

