/* ==========================================================================
   PROGRAMA 5S - SISTEMA DE AUDITORIA E GESTÃO OPERACIONAL
   Identidade Visual Técnica Corporativa (Padrão Fiscais de Performance STC / EDP)
   Alto Contraste | Corporativo Técnico Sóbrio | Tipografia Inter + JetBrains Mono
   ========================================================================== */

:root {
  /* Paleta Corporativa Oficial STC / EDP */
  --primary: #0E294B;          /* Azul corporativo escuro / Marinho STC */
  --primary-dark: #07172C;
  --primary-light: #F0F4F8;
  --accent: #E65100;           /* Laranja técnico de destaque */
  --success: #0E6251;          /* Verde técnico sóbrio (Conforme / SIM) */
  --danger: #922B21;           /* Vermelho técnico sóbrio (Falha / NÃO) */
  --warning: #B7950B;          /* Amarelo / Dourado técnico */

  --bg-app: #EAEDF1;           /* Fundo neutro corporativo */
  --surface: #FFFFFF;          /* Painéis e cards operacionais */
  --surface-elevated: #F8FAFC;
  --border: #CBD5E1;           /* Divisórias e contornos sóbrios */
  --border-dark: #94A3B8;

  --text-main: #1E293B;        /* Slate escuro de alto contraste */
  --text-secondary: #475569;
  --text-muted: #64748B;

  --radius: 4px;               /* Cantos sóbrios e técnicos */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 4px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --transition: all 0.15s ease-in-out;

  /* Aliases para retrocompatibilidade do código JS */
  --brand: var(--primary);
  --brand-light: var(--primary-light);
  --bg-primary: var(--bg-app);
  --bg-surface: var(--surface);
  --bg-elevated: #F1F5F9;
  --bg-hover: #E2E8F0;
  --border-subtle: var(--border);
  --border-focus: var(--primary);
  --sim-color: var(--success);
  --sim-bg: #E6F4EA;
  --sim-border: #A7F3D0;
  --nao-color: var(--danger);
  --nao-bg: #FDF2F2;
  --nao-border: #F5C6CB;
  --warning-color: var(--warning);
  --warning-bg: #FEF9C3;
}

[data-theme="dark"] {
  --primary: #38BDF8;
  --primary-dark: #0284C7;
  --primary-light: #16243B;
  --accent: #FB923C;
  --success: #34D399;
  --danger: #F87171;
  --warning: #FBBF24;

  --bg-app: #0B1320;
  --surface: #111C2E;
  --surface-elevated: #16243B;
  --border: #233550;
  --border-dark: #374D6F;

  --text-main: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  --bg-primary: var(--bg-app);
  --bg-surface: var(--surface);
  --bg-elevated: #16243B;
  --bg-hover: #1E314F;
  --border-subtle: var(--border);
  --border-focus: #38BDF8;

  --sim-color: #34D399;
  --sim-bg: rgba(52, 211, 153, 0.12);
  --sim-border: rgba(52, 211, 153, 0.3);

  --nao-color: #F87171;
  --nao-bg: rgba(248, 113, 113, 0.12);
  --nao-border: rgba(248, 113, 113, 0.3);

  --warning-color: #FBBF24;
  --warning-bg: rgba(251, 191, 36, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* Reset Técnico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container Responsivo de Formulário Técnico */
.app-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  position: relative;
}

@media (min-width: 640px) {
  .app-container {
    max-width: 860px;
    margin: 1rem auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }
}

/* ==========================================================================
   HEADER CORPORATIVO OFICIAL STC / EDP
   ========================================================================== */
.app-header {
  background: #0E294B;
  color: #FFFFFF;
  border-bottom: 2px solid var(--accent);
  padding: 0.55rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.brand-group, .brand-badge {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-logo-card {
  background: #FFFFFF;
  padding: 2px 8px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brand-logo-img, .brand-icon {
  height: 36px;
  width: auto;
  max-width: 90px;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.2;
  color: #FFFFFF;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: #CBD5E1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.status-pill {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
}

.status-pill.online {
  background: #064E3B;
  color: #6EE7B7;
  border: 1px solid #059669;
}

.status-pill.offline {
  background: #7F1D1D;
  color: #FCA5A5;
  border: 1px solid #DC2626;
}

.btn-header-tool, .btn-icon {
  background: #1E293B;
  border: 1px solid #334155;
  color: #E2E8F0;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-header-tool:hover, .btn-icon:hover {
  background: #334155;
  color: #FFFFFF;
}

/* ==========================================================================
   VIEWS E LAYOUT DE CONTEÚDO
   ========================================================================== */
.view {
  flex: 1;
  padding: 0.85rem 1rem 5.5rem;
  display: none;
  animation: fadeIn 0.15s ease-out;
}

.view.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 2px;
}

.view-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ==========================================================================
   PAINÉIS E CARDS OPERACIONAIS
   ========================================================================== */
.card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.card-elevated {
  background: var(--surface-elevated);
}

.panel-header {
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0.85rem;
  margin: -14px -14px 12px -14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0E294B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .panel-title {
  color: var(--primary);
}

/* ==========================================================================
   FORMULÁRIOS, LABELS E INPUTS TÉCNICOS
   ========================================================================== */
.form-group {
  margin-bottom: 12px;
}

.form-label, .field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-select, .form-input, .form-textarea, .field-input, .field-select {
  width: 100%;
  height: 38px;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-textarea {
  height: auto;
  min-height: 55px;
  padding: 0.5rem 0.65rem;
  resize: vertical;
}

.form-select:focus, .form-input:focus, .form-textarea:focus,
.field-input:focus, .field-select:focus {
  outline: none;
  border-color: #0E294B;
  box-shadow: 0 0 0 2px rgba(14, 41, 75, 0.12);
}

[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-textarea:focus {
  border-color: #38BDF8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.form-select:disabled, .form-input:disabled {
  background-color: var(--surface-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.8;
}

/* ==========================================================================
   PÍLULAS, BADGES E CHIPS TÉCNICOS
   ========================================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chip-brand {
  background: #F0F4F8;
  color: #0E294B;
  border: 1px solid #CBD5E1;
}

[data-theme="dark"] .chip-brand {
  background: rgba(56, 189, 248, 0.12);
  color: #38BDF8;
  border-color: rgba(56, 189, 248, 0.25);
}

.chip-success {
  background: #E6F4EA;
  color: #0E6251;
  border: 1px solid #A7F3D0;
}

[data-theme="dark"] .chip-success {
  background: rgba(52, 211, 153, 0.12);
  color: #34D399;
  border-color: rgba(52, 211, 153, 0.3);
}

.chip-warning {
  background: #FEF9C3;
  color: #854D0E;
  border: 1px solid #FDE047;
}

[data-theme="dark"] .chip-warning {
  background: rgba(251, 191, 36, 0.12);
  color: #FBBF24;
  border-color: rgba(251, 191, 36, 0.25);
}

.chip-neutral {
  background: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ==========================================================================
   BOTÕES CORPORATIVOS E AÇÕES
   ========================================================================== */
.btn-primary {
  width: 100%;
  height: 44px;
  background: #0E294B;
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: #07172C;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  width: 100%;
  height: 40px;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-elevated);
  border-color: var(--border-dark);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Botão final de gravação no estilo Transmissão STC */
#btn-submit-final {
  background: #0E6251;
  color: #FFFFFF;
}

#btn-submit-final:hover:not(:disabled) {
  background: #09473A;
}

/* ==========================================================================
   TELA DE AUDITORIA DE CAMPO
   ========================================================================== */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.25s ease-out;
}

.audit-senso-context {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.senso-logo {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: var(--radius);
}

.senso-logo-audit {
  width: 38px;
  height: 38px;
}

#audit-counter {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius);
}

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.senso-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

#audit-codigo-pergunta {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #0E294B;
  background: #F1F5F9;
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius);
}

[data-theme="dark"] #audit-codigo-pergunta {
  color: var(--primary);
  background: rgba(56, 189, 248, 0.12);
}

.question-text {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
  margin-bottom: 12px;
}

.evidence-box {
  background: var(--surface-elevated);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  margin-bottom: 16px;
}

/* Grade de Botões de Decisão SIM / NÃO / N/A */
.decision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.9fr;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-decision {
  height: 44px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: var(--transition);
}

.btn-decision:hover {
  background: var(--bg-hover);
}

/* Estado selecionado - SIM (Conforme Técnico) */
.btn-sim.selected, .btn-sim.active {
  background: #0E6251 !important;
  color: #FFFFFF !important;
  border-color: #084034 !important;
  box-shadow: 0 2px 4px rgba(14, 98, 81, 0.25);
}

/* Estado selecionado - NÃO (Falha Técnica) */
.btn-nao.selected, .btn-nao.active {
  background: #922B21 !important;
  color: #FFFFFF !important;
  border-color: #6D2018 !important;
  box-shadow: 0 2px 4px rgba(146, 43, 33, 0.25);
}

/* Estado selecionado - N/A (Neutro) */
.btn-na.selected, .btn-na.active {
  background: #475569 !important;
  color: #FFFFFF !important;
  border-color: #334155 !important;
}

/* ==========================================================================
   ÁREA DE NÃO CONFORMIDADE (SMART ACTION BOX)
   ========================================================================== */
.smart-action-card {
  display: none;
  background: #FDF7F7;
  border: 1px solid #F5C6CB;
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
  animation: slideDown 0.15s ease-out;
}

[data-theme="dark"] .smart-action-card {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
}

.smart-action-card.open {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.action-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

/* Botão de Câmera Técnico */
#btn-trigger-camera, .btn-file-trigger {
  width: 100%;
  height: 40px;
  background: #FFFFFF;
  border: 1px solid var(--border-dark);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

[data-theme="dark"] #btn-trigger-camera, [data-theme="dark"] .btn-file-trigger {
  background: var(--surface);
  border-color: var(--border);
}

#btn-trigger-camera:hover, .btn-file-trigger:hover {
  background: var(--surface-elevated);
}

.photo-preview-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.photo-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  display: none;
}

.photo-preview.visible {
  display: block;
}

/* ==========================================================================
   COCKPIT E RADIAL SCORE GAUGE
   ========================================================================== */
.score-cockpit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 14px;
}

.gauge-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(#0E6251 calc(var(--score-deg, 0) * 1deg), var(--border) 0deg);
  margin-bottom: 10px;
}

.gauge-inner {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-number {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-main);
}

.gauge-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sensos-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.senso-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.senso-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.senso-item-header span:last-child {
  font-family: var(--mono);
  font-weight: 700;
}

.senso-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.senso-bar {
  width: 100%;
  height: 5px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.senso-bar-fill {
  height: 100%;
  background: #0E294B;
  transition: width 0.3s ease-out;
}

[data-theme="dark"] .senso-bar-fill {
  background: var(--primary);
}

/* ==========================================================================
   PAINÉIS DE DESTAQUE OPERACIONAL (SETUP, AÇÕES, VISÃO BASE, PAINEL)
   Padrão Corporativo: Cartão operacional técnico sobre fundo neutro (sem duplicação de header)
   ========================================================================== */
.screen-hero, .global-dash-hero, .base-score-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.global-dash-hero {
  border-left: 4px solid var(--accent);
}

.base-score-hero {
  border-left: 4px solid #0E294B;
  position: relative;
  padding-bottom: 30px;
}

.screen-hero--actions {
  border-left: 4px solid #0E294B;
}

.screen-hero--audit {
  border-left: 4px solid #0E294B;
}

.screen-hero h1, .global-dash-hero h2, .base-score-copy h2 {
  margin: 0 0 2px;
  color: #0E294B;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

[data-theme="dark"] .screen-hero h1,
[data-theme="dark"] .global-dash-hero h2,
[data-theme="dark"] .base-score-copy h2 {
  color: var(--primary);
}

.screen-hero p:last-child, .global-dash-hero p:last-child, .base-score-copy p:last-child {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.screen-hero-kicker, .base-score-kicker {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.screen-hero--audit img {
  display: none; /* Evita duplicar a logo do 5S já exibida no cabeçalho */
}

.screen-hero-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #0E294B;
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--surface-elevated);
}

[data-theme="dark"] .screen-hero-symbol {
  color: var(--primary);
}

.global-dash-ring, .base-score-ring {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border: 3px solid var(--border);
  border-right-color: var(--accent);
  border-radius: 50%;
  font-family: var(--mono);
  background: var(--surface-elevated);
}

.global-dash-ring strong, .base-score-ring strong {
  font-size: 0.88rem;
  color: #0E294B;
}

[data-theme="dark"] .global-dash-ring strong,
[data-theme="dark"] .base-score-ring strong {
  color: var(--primary);
}

.base-score-status {
  position: absolute;
  bottom: 8px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.global-kpi-row, .base-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.base-kpi-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.base-kpi {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.base-kpi small {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.base-kpi strong {
  color: var(--text-main);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.2;
}

/* ==========================================================================
   PLANO DE AÇÃO: LISTA OPERACIONAL
   ========================================================================== */
.acoes-toolbar {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.acoes-clean-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.acao-item {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s ease;
}

.acao-item:last-child {
  border-bottom: none;
}

.acao-item:hover {
  background: var(--surface-elevated);
}

.acao-item.vencido {
  border-left: 3px solid var(--danger);
}

.acao-item.em-dia {
  border-left: 3px solid #0E294B;
}

.acao-item.concluido {
  border-left: 3px solid var(--success);
  opacity: 0.9;
}

.acao-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  font-size: 0.74rem;
}

.acao-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.acao-badge.vencido {
  background: #FEE2E2;
  color: #922B21;
}

.acao-badge.em-dia {
  background: #E6F0F8;
  color: #0E294B;
}

.acao-badge.concluido {
  background: #E6F4EA;
  color: #0E6251;
}

.acao-codigo-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--text-main);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius);
}

.acao-texto-acao {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 4px;
}

.acao-texto-desvio {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-bottom: 6px;
}

.desvio-tag {
  color: var(--danger);
  font-weight: 700;
}

.acao-meta-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.btn-acao-concluir {
  padding: 3px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #0E6251;
  background: #E6F4EA;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  transition: var(--transition);
}

.btn-acao-concluir:hover {
  background: #0E6251;
  color: #FFFFFF;
}

/* ==========================================================================
   VISÃO BASE: HISTÓRICO E SENSO TRACKS
   ========================================================================= */
.base-score-card {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.base-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.base-section-heading h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.base-section-heading span {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.base-senso-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.base-senso-row + .base-senso-row {
  border-top: 1px solid var(--border);
}

.base-senso-row img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.base-senso-row > div strong {
  font-size: 0.75rem;
  color: var(--text-main);
  display: block;
}

.base-senso-row > div small {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
}

.base-senso-row > b {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-main);
}

.base-senso-track {
  height: 4px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.base-senso-track i {
  display: block;
  height: 100%;
  background: #0E294B;
  transition: width 0.2s ease;
}

[data-theme="dark"] .base-senso-track i {
  background: var(--primary);
}

.base-owner-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.base-owner-line span {
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.68rem;
}

.base-owner-line strong {
  color: var(--text-main);
}

/* Histórico de Sensos */
.history-senso-breakdown {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 6px 0;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
}

.history-senso-score {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
}

.history-senso-score .senso-logo {
  width: 28px;
  height: 28px;
}

/* Rótulo em fonte sem serifa e maior: na mono pequena o "S" se confundia com "5" */
.history-senso-score > span {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   BARRA FIXA INFERIOR DE NAVEGAÇÃO (BOTTOM NAV)
   ========================================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.45rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  z-index: 90;
}

[data-theme="dark"] .bottom-nav {
  background: #111C2E;
  border-top-color: #233550;
}

.nav-item {
  flex: 1;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item.active {
  color: #0E294B;
  font-weight: 800;
}

[data-theme="dark"] .nav-item.active {
  color: #38BDF8;
}

/* ==========================================================================
   MODAIS TÉCNICOS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-backdrop .card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

.selo-badge {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  background: color-mix(in srgb, var(--sim-color) 15%, transparent);
  color: var(--sim-color);
  border: 1px solid var(--sim-color);
}
.selo-badge[hidden] { display: none; }

/* Filtros do Plano de Ação: texto e contador na mesma linha (no celular quebravam em pedaços) */
.btn-filter-acao {
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: center;
}

.acoes-filtros-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.acoes-filtros-extra .form-select {
  height: 34px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.acao-reincidencia-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 0.68rem;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
}

.acao-escalonada-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 0.68rem;
  font-weight: 700;
  background: #FEE2E2;
  color: #991B1B;
}

.nc-reincidencia-banner {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #F59E0B;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  margin-bottom: 10px;
}

.pendencias-audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pendencia-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #0E294B;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.pendencia-card.vencida {
  border-left-color: var(--danger);
}

.pendencia-card.concluir {
  border-left-color: var(--success);
}

.pendencia-decisao {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.btn-pendencia-decisao {
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-pendencia-decisao.ativo-manter {
  background: #E6F0F8;
  border-color: #0E294B;
  color: #0E294B;
}

.btn-pendencia-decisao.ativo-concluir {
  background: #E6F4EA;
  border-color: #0E6251;
  color: #0E6251;
}

.pendencia-tratativa-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.pendencia-assinatura-previa {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.pendencias-msg-erro {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #EF4444;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.8rem;
  margin-top: 10px;
}

[data-theme="dark"] .nc-reincidencia-banner,
[data-theme="dark"] .acao-reincidencia-tag {
  background: rgba(245, 158, 11, 0.16);
  color: #FCD34D;
}

[data-theme="dark"] .btn-pendencia-decisao.ativo-manter {
  background: rgba(56, 189, 248, 0.16);
  border-color: #38BDF8;
  color: #BAE6FD;
}

[data-theme="dark"] .btn-pendencia-decisao.ativo-concluir {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10B981;
  color: #A7F3D0;
}

/* ==========================================================================
   NAVEGAÇÃO SUPERIOR (DESKTOP) + VISÃO DO LOCAL + PLANO DE AÇÃO TABULAR
   ========================================================================== */
.top-nav {
  display: none;
}

.visao-local-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.visao-local-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.visao-local-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.cert-access-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.base-history-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 12px 0 8px;
}

.acoes-toolbar-search {
  position: relative;
  margin-bottom: 10px;
}

.acoes-toolbar-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.acoes-todo-header {
  display: none;
}

.acao-col-data,
.acao-col-inspetor,
.acao-col-base,
.acao-col-local-nome,
.acao-col-item,
.acao-col-desvio-desk,
.acao-col-resp,
.acao-badge-desk {
  display: none;
}

.acao-prazo-data {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.acao-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.acao-tratativa-concluida {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.acao-foto-col {
  margin-top: 6px;
}

.acao-foto-thumb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.acao-foto-thumb-btn:hover {
  transform: scale(1.03);
  border-color: var(--primary);
}

.acao-foto-thumb {
  width: 56px;
  height: 44px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  display: block;
  background: var(--surface-elevated);
}

.acao-foto-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 44px;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--surface-elevated);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.acao-sem-foto {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-backdrop .modal-foto-card {
  max-width: 780px;
  width: 100%;
  padding: 14px;
}

.modal-foto-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.modal-foto-img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #0f172a;
}

/* ==========================================================================
   ADAPTAÇÃO COMPLETA PARA DESKTOP / NOTEBOOK (>= 960px)
   Mantém 100% do layout mobile intacto abaixo de 960px
   ========================================================================== */
@media (min-width: 960px) {
  .app-container {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .app-header {
    padding: 0.55rem 1.5rem;
  }

  .header-content {
    max-width: min(94vw, 1440px);
    gap: 1.5rem;
  }

  .app-container.app-wide .header-content {
    max-width: min(97vw, 1820px);
  }

  .top-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 12px;
  }

  .top-nav .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 7px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #CBD5E1;
    border-radius: var(--radius);
    border-bottom: 2px solid transparent;
  }

  .top-nav .nav-item svg {
    width: 17px;
    height: 17px;
  }

  .top-nav .nav-item:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
  }

  .top-nav .nav-item.active {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.14);
    border-bottom-color: var(--accent);
    font-weight: 700;
  }

  .bottom-nav {
    display: none;
  }

  .view {
    width: 100%;
    max-width: min(94vw, 1440px);
    margin: 0 auto;
    padding: 1.25rem 1.5rem 2.5rem;
  }

  #view-acoes,
  #view-historico {
    max-width: min(97vw, 1820px);
  }

  #view-audit,
  #view-pendencias,
  #view-cockpit {
    max-width: 1060px;
  }

  /* ---- AUDITORIA + VISÃO DO LOCAL EM 2 COLUNAS ---- */
  #view-setup.active {
    display: grid;
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 14px 24px;
    align-items: start;
  }

  #view-setup > #campo-envios {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }

  #view-setup > .setup-left-col {
    grid-column: 1;
    grid-row: 2;
  }

  #view-setup > .setup-right-col {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .visao-local-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
  }

  .base-kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  /* ---- EXECUÇÃO DE AUDITORIA E COCKPIT ---- */
  .smart-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  .cockpit-top-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
  }

  .cockpit-top-grid .score-cockpit {
    justify-content: center;
  }

  /* ---- PAINEL GERENCIAL EM GRADE ---- */
  .dashboard-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
  }

  .dashboard-top-grid .global-dash-hero,
  .dashboard-top-grid .global-kpi-row {
    margin-bottom: 0;
  }

  .dashboard-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 16px;
    align-items: start;
  }

  /* ---- PLANO DE AÇÃO: BARRA COMPACTA + TABELA LARGA ---- */
  #view-acoes .screen-hero--actions {
    padding: 10px 16px;
    margin-bottom: 10px;
  }

  .acoes-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .acoes-toolbar-search {
    flex: 1 1 260px;
    margin-bottom: 0;
  }

  .acoes-toolbar-pills {
    flex: 0 1 auto;
    padding-bottom: 0;
    overflow: visible;
  }

  .acoes-filtros-extra {
    display: flex;
    gap: 8px;
    margin-top: 0;
    flex: 0 1 auto;
  }

  .acoes-filtros-extra .form-select {
    height: 38px;
    min-width: 165px;
    font-size: 0.8rem;
  }

  .acoes-clean-list {
    overflow: auto;
    max-height: calc(100vh - 235px);
  }

  .acoes-todo-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 76px 108px 90px 120px 114px minmax(140px, 1fr) minmax(170px, 1.3fr) 110px 92px 54px 96px;
    min-width: 1180px;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  }

  .acoes-todo-header > span:nth-child(10),
  .acoes-todo-header > span:nth-child(11) {
    text-align: center;
  }

  .acao-item {
    display: grid;
    grid-template-columns: 76px 108px 90px 120px 114px minmax(140px, 1fr) minmax(170px, 1.3fr) 110px 92px 54px 96px;
    grid-template-areas: "data inspetor base local item desvio acao_corr resp prazo foto acao_btn";
    min-width: 1180px;
    gap: 8px;
    align-items: start;
    padding: 10px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .acao-col-data {
    display: block;
    grid-area: data;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .acao-col-inspetor {
    display: block;
    grid-area: inspetor;
    font-size: 0.78rem;
    color: var(--text-main);
    overflow-wrap: break-word;
  }

  .acao-col-base {
    display: block;
    grid-area: base;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
  }

  .acao-col-local-nome {
    display: block;
    grid-area: local;
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow-wrap: break-word;
  }

  .acao-col-item {
    display: block;
    grid-area: item;
  }

  .acao-col-item .acao-codigo-tag {
    display: inline-block;
    white-space: nowrap;
    font-size: 0.7rem;
  }

  .acao-col-desvio-desk {
    display: block;
    grid-area: desvio;
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow-wrap: break-word;
  }

  .acao-meta-top {
    display: contents;
  }

  .acao-col-local {
    display: none;
  }

  .acao-col-prazo {
    grid-area: prazo;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .acao-badge-mobile {
    display: none;
  }

  .acao-badge-desk {
    display: inline-flex;
    white-space: nowrap;
    font-size: 0.68rem;
  }

  .acao-col-desc {
    grid-area: acao_corr;
    min-width: 0;
  }

  .acao-col-desc .acao-texto-acao {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
  }

  .acao-col-desc .acao-texto-desvio {
    display: none;
  }

  .acao-col-resp {
    display: block;
    grid-area: resp;
    font-size: 0.78rem;
    color: var(--text-main);
    overflow-wrap: break-word;
  }

  .acao-meta-bottom {
    grid-area: acao_btn;
    border-top: none;
    padding-top: 0;
    justify-content: center;
    text-align: center;
    font-size: 0.72rem;
  }

  .acao-meta-bottom .btn-acao-concluir {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .acao-resp-prazo {
    display: none;
  }

  .acao-foto-col {
    grid-area: foto;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 1500px) {
  .acoes-todo-header,
  .acao-item {
    grid-template-columns: 84px 132px 106px 148px 118px minmax(180px, 1fr) minmax(210px, 1.35fr) 136px 102px 56px 108px;
    min-width: 0;
    gap: 10px;
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ==========================================================================
   PAINEL: QUADRO RESUMO DE AÇÕES
   ========================================================================== */
.dash-resumo { margin-bottom: 16px; }
.dash-resumo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dash-resumo-head h2 { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin: 0; }
.dash-resumo-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.dash-tab { padding: 6px 12px; font-size: 0.78rem; font-weight: 600; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-elevated); color: var(--text-secondary); cursor: pointer; }
.dash-tab:hover { background: var(--bg-hover); }
.dash-tab.active { background: #0E294B; color: #fff; border-color: #0E294B; }
[data-theme="dark"] .dash-tab.active { background: var(--primary); color: #0B1320; border-color: var(--primary); }
.dash-resumo-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.dash-kpi { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-elevated); }
.dash-kpi small { display: block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.dash-kpi strong { font-family: var(--mono); font-size: 1.15rem; color: var(--text-main); }
.dash-kpi-alerta strong { color: var(--nao-color); }
.dash-kpi-ok strong { color: var(--sim-color); }
.dash-resumo-tabela { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.dash-tabela { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.dash-tabela th { position: sticky; top: 0; background: var(--surface-elevated); text-align: left; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dash-tabela td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.dash-tabela tr:last-child td { border-bottom: none; }
.dash-tabela .num { text-align: right; font-family: var(--mono); }
.dash-col-nome { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text-main); }
.dash-num-alerta { color: var(--nao-color); font-weight: 800; }
.dash-col-pct { min-width: 120px; }
.dash-pct-bar { display: inline-block; width: 70px; height: 6px; margin-right: 6px; vertical-align: middle; background: var(--border); border-radius: 3px; overflow: hidden; }
.dash-pct-bar i { display: block; height: 100%; background: var(--sim-color); }
.dash-col-pct span { font-family: var(--mono); font-size: 0.74rem; }
@media (min-width: 960px) {
  .dash-resumo-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .dash-resumo-tabela { max-height: 360px; }
  .dash-col-nome { max-width: 420px; }
  .dash-pct-bar { width: 140px; }
}

/* Botões secundários das ações e tabela da aba Histórico */
.btn-acao-secundario {
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-acao-secundario:hover {
  background: var(--border);
}

.btn-acao-assumir {
  color: #1D4ED8;
  background: #EFF6FF;
  border-color: #BFDBFE;
}

.btn-acao-assumir:hover {
  background: #1D4ED8;
  color: #FFFFFF;
  border-color: #1D4ED8;
}

.historico-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.historico-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 820px;
}

.historico-table thead th {
  text-align: left;
  padding: 10px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-body, rgba(0, 0, 0, 0.03));
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.historico-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.historico-table tbody tr:last-child td {
  border-bottom: none;
}

.historico-table tbody tr:hover {
  background: rgba(14, 98, 81, 0.04);
}

.historico-table .num {
  text-align: center;
  white-space: nowrap;
}

.historico-table .obs-cell {
  min-width: 220px;
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  color: var(--text-muted);
}

#view-historico .card {
  max-width: 100%;
}

/* ==========================================================================
   OTIMIZAÇÃO DE TELA (NOTEBOOK/DESKTOP): AUDITORIA E PAINEL SIMÉTRICOS
   ========================================================================== */
@media (min-width: 960px) {
  .view {
    padding: 0.9rem 1.5rem 1.5rem;
  }

  #view-setup,
  #view-dashboard,
  #view-acoes,
  #view-historico {
    max-width: min(97vw, 1820px);
  }

  /* Auditoria: formulário compacto à esquerda + visão do local em grade simétrica à direita */
  #view-setup.active {
    grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
    gap: 12px 18px;
  }

  #view-setup .screen-hero--audit {
    padding: 12px 16px;
    margin-bottom: 10px;
  }

  #view-setup .setup-left-col .card {
    padding: 14px 16px;
    margin-bottom: 10px;
  }

  #view-setup .setup-left-col .form-group {
    margin-bottom: 10px;
  }

  #view-setup .visao-local-header {
    margin-bottom: 10px;
  }

  #view-setup #cert-result-container {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: stretch;
  }

  #view-setup #cert-status-card {
    grid-column: 1;
    grid-row: 1 / span 2;
    margin-bottom: 0;
    padding: 10px 14px;
  }

  #view-setup #cert-status-card .base-score-status {
    position: static;
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  #view-setup .base-kpi-row {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
    gap: 8px;
  }

  #view-setup .base-kpi {
    padding: 8px 10px;
  }

  #view-setup .base-owner-line {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    padding: 6px 12px;
    align-self: end;
  }

  #view-setup .base-score-card {
    grid-column: 1 / -1;
    grid-row: 3;
    margin-bottom: 0;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  #view-setup .base-score-card .base-section-heading {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  #view-setup .base-senso-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-body, rgba(0, 0, 0, 0.02));
  }

  #view-setup .base-senso-row > img {
    width: 22px;
    height: 22px;
    grid-column: 1;
    grid-row: 1;
  }

  #view-setup .base-senso-row > div {
    grid-column: 2 / span 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  #view-setup .base-senso-row > div strong {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #view-setup .base-senso-row > div small {
    display: none;
  }

  #view-setup .base-senso-row > b {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.78rem;
    text-align: center;
  }

  #view-setup .base-senso-row > .selo-badge {
    grid-column: 1 / -1;
    justify-self: end;
    font-size: 0.68rem;
    padding: 1px 6px;
  }

  #view-setup .base-history-title {
    grid-column: 1 / -1;
    grid-row: 4;
    margin: 2px 0 0;
  }

  #view-setup #cert-ultimas-list {
    grid-column: 1 / -1;
    grid-row: 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  #view-setup #cert-ultimas-list > .card {
    margin: 0 !important;
    padding: 10px 12px !important;
    font-size: 0.78rem;
  }

  #view-setup #cert-ultimas-list > .card:last-child:nth-child(4),
  #view-setup #cert-ultimas-list > .card:last-child:nth-child(2),
  #view-setup #cert-ultimas-list > .card:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }

  #view-setup #cert-ultimas-list img {
    width: 18px !important;
    height: 18px !important;
  }

  /* Painel: grade 50/50 simétrica e alturas controladas para reduzir rolagem */
  #view-dashboard .view-title {
    margin-bottom: 2px;
  }

  #view-dashboard .view-subtitle {
    margin-bottom: 10px;
  }

  #view-dashboard .dashboard-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 12px;
  }

  #view-dashboard .global-dash-hero {
    padding: 14px 18px;
  }

  #view-dashboard .dash-resumo {
    margin-bottom: 12px;
    padding: 14px 16px;
  }

  #view-dashboard .dash-resumo-tabela {
    max-height: 300px;
    overflow-y: auto;
  }

  #view-dashboard .dashboard-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }

  #view-dashboard .dashboard-main-grid > .card {
    margin-bottom: 0;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
  }

  #dashboard-regionais-list,
  #dashboard-bases-list {
    max-height: calc(100vh - 460px);
    min-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
  }
}
