/* ═══════════════════════════════════════════════════════════════════════════
   THERMOLAB – ESTILOS COMPLETOS
   Arvexa Technologies · UFAL
   Suporte a: Chart.js, Plotly 3D, canvas 2D, exportação, sidebar glass
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────── 1. VARIÁVEIS DE TEMA (CLARO) ─────────────── */
:root {
  --color-primary: #1e3a5f;
  --color-primary-dark: #0f2440;
  --color-primary-light: #2b5f9e;
  --color-secondary: #0f766e;
  --color-secondary-light: #14b8a6;

  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;

  --success: #0d9488;
  --success-bg: #f0fdfa;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;

  --sidebar-bg: rgba(15, 23, 42, 0.9);
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: var(--color-primary);

  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Libre Baskerville', 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --transition-fast: 150ms ease;
  --sidebar-width: 260px;
}





/* ─────────────── MODAL DE BOAS-VINDAS ─────────────── */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
}

.welcome-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.welcome-modal-container {
  position: relative;
  background: var(--bg-surface);
  color: var(--text-primary);
  width: min(90%, 550px);
  max-height: 85vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 10001;
  animation: slideUpModal 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  border: 1px solid var(--border-light);
}

@keyframes slideUpModal {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.welcome-modal-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.3px;
}

.welcome-modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  transition: color 0.2s;
  padding: 0;
  margin: 0;
}

.welcome-modal-close:hover {
  color: #fff;
}

.welcome-modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.welcome-changelog h3,
.welcome-guidelines h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
  letter-spacing: 0.3px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.welcome-changelog ul,
.welcome-guidelines ul {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.welcome-changelog li,
.welcome-guidelines li {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.welcome-modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.welcome-agree-btn {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.welcome-agree-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(0.98);
}

/* Responsivo */
@media (max-width: 550px) {
  .welcome-modal-container {
    width: 95%;
  }
  .welcome-modal-header h2 {
    font-size: 1.1rem;
  }
  .welcome-modal-body {
    padding: 1rem;
  }
}







/* ─────────────── 2. MODO ESCURO (PALETA COMPLETAMENTE AJUSTADA) ─────────────── */
body.dark {
  --bg-page: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #1e293b;
  --bg-hover: #334155;

  --border-light: #334155;
  --border-medium: #475569;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* Cores primárias agora em tons claros para contraste no fundo escuro */
  --color-primary: #60a5fa;
  --color-primary-dark: #3b82f6;
  --color-primary-light: #93c5fd;
  --color-secondary: #14b8a6;
  --color-secondary-light: #5eead4;

  --success-bg: rgba(13, 148, 136, 0.15);
  --danger-bg: rgba(220, 38, 38, 0.15);
  --info-bg: rgba(37, 99, 235, 0.15);

  --sidebar-bg: rgba(15, 23, 42, 0.95);
}

/* ─────────────── 3. RESET & BASE ─────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
}
body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

/* ─────────────── 4. LAYOUT PRINCIPAL ─────────────── */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ─────────────── 5. SIDEBAR ─────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(226, 232, 240, 0.1);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.1);
  margin-bottom: 20px;
}
.sidebar-logo .logo-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}
.sidebar-logo .logo-text span {
  color: var(--color-secondary-light);
}
.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
}
.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(226, 232, 240, 0.08);
  margin-top: auto;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-footer a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}
.sidebar-footer a:hover {
  color: #fff;
}

/* ─────────────── 6. CONTEÚDO PRINCIPAL ─────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 20px 48px;
  transition: margin-left 0.3s ease;
  width: calc(100% - var(--sidebar-width));
}
.content-section {
  display: none;
}
.content-section.active {
  display: block;
}

/* ─────────────── 7. CORREÇÃO: REMOVER AZUL DOS MINI CABEÇALHOS NO MODO ESCURO ─────────────── */
body.dark h3,
body.dark h4,
body.dark h5,
body.dark h6,
body.dark .card-title,
body.dark .section-title,
body.dark .widget-title,
body.dark .panel-title,
body.dark .state-name {
  color: var(--text-primary) !important;
}

/* ─────────────── 8. TOGGLE MOBILE ─────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .sidebar-toggle {
    display: block;
  }
}

/* ─────────────── 9. WRAPPER & HEADER ─────────────── */
.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
  flex-wrap: wrap;
  gap: 16px;
}
.logo-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logo {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.logo span {
  color: var(--color-secondary);
}
.logo-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.3px;
  font-weight: 400;
}

/* Header direito: agora com flex row e alinhamento melhor */
.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.header-right > * {
  white-space: nowrap;
}
#clock {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-right: auto; /* empurra os itens seguintes para a direita em telas maiores */
}
.state-counter {
  font-size: 0.75rem;
  color: var(--color-secondary-light);
  font-weight: 600;
  background: var(--success-bg);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

/* ─────────────── 10. TABS ─────────────── */
/* ═══════════════════════════════════════════════════════════════
   PAINÉIS DE CONTEÚDO DAS ABAS (tab-panel)
   ═══════════════════════════════════════════════════════════════ */
.tab-panel {
  display: none;
  animation: fadeSlideOut 0.2s ease forwards;
}

.tab-panel.active {
  display: block;
  animation: fadeSlideIn 0.25s ease forwards;
}

/* Animações usadas pelas abas */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn:not(.active):hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ─────────────── 11. GRID & PAINÉIS ─────────────── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr; }
}
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-fast), background-color 0.3s;
}
.panel:hover {
  box-shadow: var(--shadow-lg);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 20px;
  text-transform: uppercase;
  color: var(--color-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

/* Indicadores coloridos */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot-blue {
  background: var(--info);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.dot-green {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
}
.dot-cyan {
  background: var(--color-secondary-light);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25);
}

/* ─────────────── 12. FORMULÁRIOS ─────────────── */
.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.field-group.full {
  grid-template-columns: 1fr;
}
.field-group.triple {
  grid-template-columns: 1fr 1fr 1fr;
}
label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
}
label.highlight {
  color: var(--info);
  font-weight: 700;
}
label.cyan {
  color: var(--color-secondary);
  font-weight: 600;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color 0.3s;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
input.target {
  border-color: var(--info);
  background: var(--info-bg);
}
input.target:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  appearance: none;
  -webkit-appearance: none;
}

.divider-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
  margin: 16px 0 12px;
  font-weight: 600;
}

/* ─────────────── 13. BOTÕES ─────────────── */
.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
}
.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}
.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.75rem;
  padding: 8px 12px;
  margin-top: 10px;
}
.btn-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: #b91c1c;
}
.btn-sm {
  display: inline-flex;
  width: auto;
  margin-top: 0;
  font-size: 0.6875rem;
  padding: 6px 12px;
  letter-spacing: 0.5px;
}

/* ─────────────── 14. RESULTADO ─────────────── */
.result-box {
  display: none;
  margin-top: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px;
}
.result-box.visible {
  display: block;
  animation: fadeSlideIn 0.25s ease;
}
.result-box.error {
  border-left: 4px solid var(--danger);
  background: var(--danger-bg);
}
.result-box.success {
  border-left: 4px solid var(--info);
  background: var(--info-bg);
}
.result-label {
  font-size: 0.65rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-secondary);
  font-family: var(--font-mono);
  letter-spacing: -1px;
  margin-bottom: 4px;
  line-height: 1.2;
}
.result-value.error {
  color: var(--danger);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
}
.result-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.result-formula {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1.6;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 8px;
  word-break: break-word;
  white-space: pre-wrap;
}
.save-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.save-name-input {
  flex: 1;
  min-width: 140px;
  margin-top: 0;
  font-size: 0.8125rem;
  padding: 8px 10px;
}

/* ─────────────── 15. LISTA DE ESTADOS ─────────────── */
.state-scroll {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}
.state-scroll::-webkit-scrollbar {
  width: 5px;
}
.state-scroll::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 10px;
}
.state-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.state-empty {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 28px 0;
  opacity: 0.8;
}
.state-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  animation: fadeIn 0.2s ease;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}
.state-card:hover {
  box-shadow: var(--shadow-md);
}
.state-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.state-name {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 0.2px;
}
.state-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: 4px;
}
.state-values {
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin-top: 6px;
  line-height: 1.5;
}
.state-values b {
  color: var(--success);
  font-weight: 700;
}
.state-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.state-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  line-height: 1;
  transition: color var(--transition-fast);
  border-radius: 4px;
}
.delete-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ─────────────── 16. EXPORTAÇÃO ─────────────── */
.export-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 10px;
  align-items: center;
}
.export-row select {
  margin-top: 0;
  height: 100%;
}

/* ─────────────── 17. CORNER GRID (BILINEAR) ─────────────── */
.corner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0;
  background: var(--bg-surface);
}
.corner-label {
  font-size: 0.7rem;
  color: var(--color-secondary);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 14px;
  grid-column: 1 / -1;
  font-weight: 700;
}

/* ─────────────── 18. TOAST ─────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 12px 24px;
  border-radius: 30px;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  background: var(--danger);
}

/* ─────────────── 19. CONTROLES (IDIOMA / TEMA) ─────────────── */
.language-select {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 6px 10px;
  cursor: pointer;
}
.dark-mode-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}
.dark-mode-toggle:hover {
  color: var(--text-primary);
}

/* ─────────────── 20. MODAL DE GRÁFICO ─────────────── */
.graph-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.graph-modal.open {
  display: flex;
}

.graph-modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(90vw, 1000px);
  height: min(85vh, 700px);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.graph-modal-content h3 {
  margin-bottom: 16px;
  font-family: var(--font-heading);
  color: var(--color-primary);
  flex-shrink: 0;
}

.close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 10;
  background: var(--bg-surface);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  color: var(--danger);
}

#graph-canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: calc(100% - 40px);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
}

.js-plotly-plot,
.plotly-container {
  width: 100% !important;
  height: 100% !important;
  max-height: 100%;
  overflow: hidden !important;
}

#graph-canvas,
#plotly-container {
  width: 100% !important;
  height: 100% !important;
  max-height: calc(100% - 40px);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

#plotly-container {
  overflow: hidden;
}

/* ─────────────── 21. SEÇÕES ESPECIAIS (DOCS, TEAM, DONATE) ─────────────── */
.docs-content {
  max-width: 800px;
}
.docs-content h3 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  margin-top: 1.5em;
}
.docs-content pre {
  background: var(--bg-hover);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  overflow-x: auto;
  font-family: var(--font-mono);
}
.team-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.team-card i {
  font-size: 2rem;
  color: var(--color-primary);
}
.donate-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.donate-card {
  flex: 1;
  min-width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.donate-card i {
  font-size: 2rem;
  color: var(--color-secondary);
  margin-bottom: 10px;
}

/* ─────────────── 22. ANIMAÇÕES ─────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─────────────── 23. RESPONSIVO ─────────────── */
@media (max-width: 600px) {
  .field-group,
  .field-group.triple {
    grid-template-columns: 1fr;
  }
  .export-row {
    grid-template-columns: 1fr;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .tab-btn {
    font-size: 0.7rem;
    padding: 8px 6px;
  }
  header {
    flex-direction: column;
  }
  .header-right {
    width: 100%;
    justify-content: flex-start;
  }
  .graph-modal-content {
    width: 95vw;
    padding: 16px;
  }
}
