@import url('tokens.css');

/**
 * ==============================================================================
 * PHM TECH — PHM DBSTUDIO (CSS DEDICADO & DESIGN SYSTEM DE ENGENHARIA DE DADOS)
 * Arquitetura Isolada: Consome tokens.css
 * Prof. Paulo Henrique Maciel · PHM Tech
 * ==============================================================================
 */

/* ==========================================================================
   1. SEÇÕES E ALTERNÂNCIA DE SUPERFÍCIES DO DBSTUDIO
   ========================================================================== */

/* Seção 1: Hero & Toolbar de Modelagem DER */
.dbs-section-hero {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 2.75rem 0 2rem 0;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Seção 2: Prancheta DER Interativa & Painel DBA */
.dbs-section-canvas {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  padding: 2rem 0 3rem 0;
  position: relative;
  min-height: 650px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* Seção 3: Guia Didático de Engenharia de Dados & DER */
.dbs-section-guide {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 3.5rem 0;
  position: relative;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

/* ==========================================================================
   2. HERO PRINCIPAL & BANNER
   ========================================================================== */

.dbs-master-hero {
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
}

.dbs-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm, 4px);
  background: rgba(13, 148, 136, 0.08);
  border: 1px solid rgba(13, 148, 136, 0.22);
  color: var(--teal);
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .dbs-hero-badge {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(45, 212, 191, 0.3);
  color: var(--teal-light);
}

.dbs-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 900;
  line-height: 1.18;
  color: var(--navy);
  margin: 0 auto 1.15rem auto;
  letter-spacing: -0.02em;
}

.dbs-hero-highlight {
  color: var(--teal);
  display: inline-block;
}

[data-theme="dark"] .dbs-hero-highlight {
  color: var(--teal-light);
}

.dbs-hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 780px;
  margin: 0 auto 1.5rem auto;
}

/* ==========================================================================
   3. SEÇÃO DIDÁTICA: GUIA DE ENGENHARIA DE DADOS
   ========================================================================== */

.dbs-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
}

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

@media (max-width: 600px) {
  .dbs-guide-grid {
    grid-template-columns: 1fr;
  }
}

.dbs-guide-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.dbs-guide-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: var(--shadow-md);
}

.dbs-guide-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dbs-guide-card h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.dbs-guide-card p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}



/**
 * PHM DBStudio — Estilos & Design Tokens (Modelador DER & SQL v2.0)
 * Suporte completo aos 3 Temas: Escuro, Sépia e Claro (100% SVG Nativo)
 * Prof. Paulo Henrique Maciel · PHM Tech
 */

:root {
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --cyan: #38bdf8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #ef4444;
  --blue: #2563eb;
  
  --bg-app: #080a14;
  --bg-header: rgba(13, 16, 32, 0.88);
  --bg-surface: #0f1426;
  --bg-card: #151b33;
  --bg-card-hover: #1b2342;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --line-color: rgba(255, 255, 255, 0.1);
  --line-light: rgba(255, 255, 255, 0.06);
  
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 4px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="sepia"] {
  --bg-app: #f4ede2;
  --bg-header: rgba(239, 230, 216, 0.92);
  --bg-surface: #ffffff;
  --bg-card: #ede3d2;
  --bg-card-hover: #e5d8c3;
  --text-main: #332619;
  --text-muted: #6e5842;
  --text-subtle: #8a735c;
  --line-color: #d8c7b0;
  --line-light: #e4d8c7;
  --shadow-sm: 0 2px 6px rgba(90, 60, 30, 0.08);
  --shadow-md: 0 8px 20px rgba(90, 60, 30, 0.12);
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --line-color: #cbd5e1;
  --line-light: #e2e8f0;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* CABEÇALHO OFICIAL PHM APP */
.app-header {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--line-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.header-top-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease;
  flex-shrink: 0;
}

.logo-area:hover .logo-icon {
  transform: rotate(-10deg) scale(1.08);
}

.logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  gap: 1px;
}

.logo-text h1 {
  font-size: 1.05rem !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em !important;
  color: var(--text-main) !important;
  line-height: 1.15 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.logo-text p {
  font-size: 0.68rem !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
}

/* SELETOR DE TEMAS */
.theme-switcher-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm, 4px);
  padding: 2px 4px;
  flex-shrink: 0;
}

.theme-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.theme-pill-btn:hover {
  color: var(--text-main);
}

.theme-pill-btn.active {
  background: #0f766e;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* BOTÕES DE AÇÃO DO CABEÇALHO */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  vertical-align: middle;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--line-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn-header-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--purple);
  transform: translateY(-1px);
}

.btn-header-action svg {
  color: var(--purple);
  flex-shrink: 0;
}

/* CONTAINER PRINCIPAL DO DBSTUDIO */
.dbstudio-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* TOOLBAR SUPERIOR ORGANIZADA */
.dbstudio-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.toolbar-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.toolbar-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-top: 0.45rem;
  border-top: 1px dashed var(--line-light);
}

.tools-group, .simulation-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.btn-tool-action {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--text-main);
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-tool-action:hover {
  border-color: var(--teal);
  color: var(--teal);
  transform: translateY(-1px);
}

.btn-tool-action.primary {
  background: var(--teal);
  color: #ffffff;
  border: 1px solid var(--teal);
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.2);
}

.btn-tool-action.primary:hover {
  background: #0f766e;
  border-color: #0f766e;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}

.btn-tool-link {
  background: var(--bg-card);
  border: 1.5px solid var(--line-color);
  color: var(--text-main);
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool-link:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-tool-link.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* BOTÕES DE AÇÃO SQL (CARREGAR .SQL, BAIXAR .SQL) */
.btn-sql-action {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--cyan);
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sql-action:hover {
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  transform: translateY(-1px);
}

.btn-sql-action svg {
  color: var(--cyan);
}

/* ZOOM & HISTÓRICO PILLS */
.zoom-controls-pill, .history-controls-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-zoom {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-zoom:hover:not(:disabled) {
  background: var(--bg-surface);
  color: var(--text-main);
}

.btn-zoom:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.zoom-value {
  font-family: 'Fira Code', monospace;
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 0 0.35rem;
  cursor: pointer;
}

/* BOTÃO GUIA "COMO USAR" */
.btn-toolbar-guide {
  background: rgba(139, 92, 246, 0.12);
  border: 1.5px solid rgba(139, 92, 246, 0.45);
  color: var(--purple);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-toolbar-guide:hover {
  background: var(--purple);
  color: #ffffff;
  border-color: var(--purple);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.select-dbstudio {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--text-main);
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
}

.btn-copy-sql {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--purple);
  padding: 0.32rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-sql:hover {
  background: var(--purple);
  color: #ffffff;
  border-color: var(--purple);
  transform: translateY(-1px);
}

.btn-clear-canvas {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--rose);
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-canvas:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--rose);
}

.btn-clear-canvas svg {
  color: var(--rose);
}

/* LAYOUT PRINCIPAL (PRANCHETA + SIDEBAR) */
.dbstudio-main-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1rem;
  flex: 1;
  min-height: 600px;
  min-width: 0;
}

.der-canvas-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.der-canvas-wrapper.rel-mode-active {
  cursor: crosshair !important;
}

/* CABEÇALHO DO QUADRO DER (ESTILO HEADER QUADRO AO LADO) */
.der-canvas-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line-color);
  z-index: 10;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.canvas-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.80rem;
  font-weight: 800;
  color: var(--teal);
}

.canvas-hud-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.hud-badge {
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.3);
  color: var(--teal);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm, 4px);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.68rem;
  white-space: nowrap;
}

.hud-badge.rel-active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--amber);
  color: var(--amber);
}

/* CONTAINER DE ZOOM TRANSFORM */
.der-zoom-container {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transition: transform 0.15s ease-out;
  background-image: radial-gradient(var(--line-color) 1px, transparent 1px);
  background-size: 24px 24px;
}

.der-links-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 3000px;
  height: 3000px;
  pointer-events: none;
  z-index: 1;
}

.der-tables-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 3000px;
  height: 3000px;
  z-index: 2;
}

/* CARDS DE TABELAS DO DER */
.der-table-card {
  position: absolute;
  min-width: 230px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1.5px solid var(--line-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: move;
  user-select: none;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  z-index: 5;
}

.der-table-card:hover {
  border-color: var(--purple);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}

.der-table-card.active {
  border-color: var(--purple);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.45);
}

.der-table-card.rel-origin-selected {
  border-color: var(--amber) !important;
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.65) !important;
  animation: bounceRel 0.6s infinite alternate;
}

@keyframes bounceRel {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.der-table-header {
  background: rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid var(--line-color);
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.der-table-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.der-table-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-tbl-action {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-tbl-action:hover {
  color: var(--purple);
  background: var(--bg-surface);
}

.btn-tbl-action.delete:hover {
  color: var(--rose);
}

.der-table-columns {
  display: flex;
  flex-direction: column;
}

.der-col-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--line-light);
  font-size: 0.74rem;
}

.der-col-row:last-child {
  border-bottom: none;
}

.der-col-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-main);
  font-weight: 600;
}

.flag-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 0.08rem 0.3rem;
  border-radius: 3px;
  line-height: 1;
}

.flag-pk { background: rgba(245, 158, 11, 0.2); color: var(--amber); }
.flag-fk { background: rgba(56, 189, 248, 0.2); color: var(--cyan); }
.flag-nn { background: rgba(239, 68, 68, 0.2); color: var(--rose); }
.flag-uq { background: rgba(16, 185, 129, 0.2); color: var(--emerald); }
.flag-ai { background: rgba(139, 92, 246, 0.2); color: var(--purple); }

.der-col-type {
  font-family: 'Fira Code', monospace;
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* MODOS DE VISÃO: LÓGICO E CONCEITUAL */
.view-logical .der-col-type { display: none; }
.view-logical .flag-badge:not(.flag-pk):not(.flag-fk) { display: none; }

.view-conceptual .der-table-columns { display: none; }
.view-conceptual .der-table-card { min-width: 160px; max-width: 200px; text-align: center; }

/* RELACIONAMENTOS SVG */
.der-rel-line {
  stroke: var(--purple);
  stroke-width: 2;
  transition: stroke 0.2s ease, stroke-width 0.2s ease;
}

.der-rel-line:hover {
  stroke: var(--cyan);
  stroke-width: 3.5;
}

/* PAINEL LATERAL DE ENGENHARIA DBA */
.dbstudio-inspector-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--line-color);
  background: var(--bg-card);
}

.inspector-tab {
  flex: 1;
  padding: 0.65rem 0.4rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.inspector-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
  background: var(--bg-surface);
}

.tab-audit-count {
  background: var(--rose);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-xs, 2px);
}

.inspector-content {
  padding: 0.85rem;
  flex: 1;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.inspector-content.active {
  display: flex;
}

/* VISUALIZADOR DE CÓDIGO SQL */
.sql-code-viewer {
  background: #030712;
  border: 1px solid #1f2937;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  font-family: 'Fira Code', monospace;
  overflow: hidden;
  flex: 1;
}

.code-viewer-header {
  background: #111827;
  padding: 0.45rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1f2937;
}

.term-dots {
  display: flex;
  gap: 0.3rem;
}

.term-dots .dot { width: 7px; height: 7px; border-radius: 50%; }
.term-dots .dot.red { background: #ef4444; }
.term-dots .dot.yellow { background: #f59e0b; }
.term-dots .dot.green { background: #10b981; }

.code-viewer-dialect {
  font-size: 0.68rem;
  color: #9ca3af;
  font-weight: 700;
}

.sql-code-viewer pre {
  padding: 0.85rem;
  font-size: 0.75rem;
  color: #c084fc;
  line-height: 1.5;
  overflow: auto;
  flex: 1;
  margin: 0;
}

/* DICIONÁRIO DE DADOS (CARDS RESUMIDOS & BONITOS) */
.dictionary-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dictionary-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-light);
}

.btn-copy-markdown {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  color: var(--purple);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-markdown:hover {
  background: var(--purple);
  color: #ffffff;
}

.dict-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  transition: all 0.2s ease;
}

.dict-summary-card:hover {
  border-color: var(--purple);
  transform: translateY(-1px);
}

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

.dict-table-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-open-dict-modal {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--purple);
  color: var(--purple);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-open-dict-modal:hover {
  background: var(--purple);
  color: #ffffff;
}

/* TABELA DENTRO DO MODAL DE DICIONÁRIO */
.dict-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

.dict-modal-table th, .dict-modal-table td {
  border: 1px solid var(--line-light);
  padding: 0.45rem 0.65rem;
  text-align: left;
}

.dict-modal-table th {
  background: var(--bg-surface);
  color: var(--purple);
  font-weight: 800;
}

/* AUDITORIA DBA / LINTER */
.audit-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.audit-summary-box {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.audit-status-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
}

.audit-issue-card {
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.74rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.audit-issue-card.error {
  background: rgba(239, 68, 68, 0.15);
  border-left: 3px solid var(--rose);
  color: var(--text-main);
}

.audit-issue-card.warning {
  background: rgba(245, 158, 11, 0.15);
  border-left: 3px solid var(--amber);
  color: var(--text-main);
}

.audit-issue-card.success {
  background: rgba(16, 185, 129, 0.15);
  border-left: 3px solid var(--emerald);
  color: var(--emerald);
}

.audit-issue-card strong {
  font-size: 0.76rem;
}

/* PLAYGROUND SQL */
.playground-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.playground-editor textarea {
  width: 100%;
  background: #030712;
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  color: #38bdf8;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  outline: none;
  resize: vertical;
  margin-top: 0.35rem;
}

.btn-run-query {
  background: var(--purple);
  color: #ffffff;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-run-query:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

.query-samples-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  flex-wrap: wrap;
}

.query-samples-pill a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.query-samples-pill a:hover {
  text-decoration: underline;
}

.playground-results-box {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  flex: 1;
  overflow: auto;
  min-height: 180px;
}

.sql-table-result {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.sql-table-result th, .sql-table-result td {
  border: 1px solid var(--line-light);
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.sql-table-result th {
  background: rgba(139, 92, 246, 0.2);
  color: var(--purple);
}

/* =========================================================================
   MODAIS (EDITOR DE TABELA, RELACIONAMENTO, IMPORTAÇÃO SQL & GUIA DIDÁTICO)
   ========================================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

.modal-dialog.modal-lg {
  max-width: 860px;
}

.modal-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-surface);
}

.modal-header-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  color: var(--text-main);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.80rem;
  outline: none;
}

/* IMPORT SQL MODAL ACTIONS */
.import-sql-actions-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.btn-select-file {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-select-file:hover {
  background: var(--cyan);
  color: #080a14;
}

/* CONSTRUTOR DE COLUNAS */
.columns-builder-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

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

.btn-add-col-mini {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--purple);
  color: var(--purple);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.col-builder-legend {
  display: grid;
  grid-template-columns: 140px 130px 30px 30px 30px 30px 30px 100px 30px;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
  background: var(--bg-surface);
  border-radius: 4px;
  text-align: center;
}

.col-builder-legend span:first-child, .col-builder-legend span:nth-child(2), .col-builder-legend span:nth-child(8) {
  text-align: left;
}

.col-builder-row {
  display: grid;
  grid-template-columns: 140px 130px 30px 30px 30px 30px 30px 100px 30px;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.col-builder-row input, .col-builder-row select {
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  color: var(--text-main);
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  font-size: 0.74rem;
  font-family: 'Fira Code', monospace;
}

.col-builder-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  cursor: pointer;
}

.btn-del-col {
  background: transparent;
  border: none;
  color: var(--rose);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: var(--bg-surface);
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--line-color);
  color: var(--text-muted);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-save-primary {
  background: var(--purple);
  color: #ffffff;
  border: none;
  padding: 0.45rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.rel-connection-preview {
  background: var(--bg-surface);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}

/* =========================================================================
   ESTILOS DO MODAL DIDÁTICO: COMO USAR O PHM DBSTUDIO
   ========================================================================= */
.guide-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.guide-modal-overlay.open {
  display: flex;
  animation: fadeInModal 0.25s ease-out;
}

.guide-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  border-radius: var(--radius-md, 6px);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.guide-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line-color);
  background: var(--bg-card);
}

.guide-title-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guide-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
}

.guide-title-box h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  line-height: 1.2;
}

.guide-title-box p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}

.btn-close-guide {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  line-height: 1;
}

.btn-close-guide:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--rose);
}

/* TABS DO GUIA */
.guide-nav-tabs {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line-color);
  overflow-x: auto;
}

.guide-tab-btn {
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.guide-tab-btn:hover { color: var(--text-main); }
.guide-tab-btn.active {
  color: var(--purple);
  background: var(--bg-surface);
  border-bottom-color: var(--purple);
}

.guide-modal-content {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.guide-pane {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.guide-pane.active {
  display: flex;
}

.guide-pane h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.guide-hero-box {
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-main);
}

.guide-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.guide-feature-item {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  line-height: 1.45;
}

.guide-feature-item strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.guide-feature-item p {
  color: var(--text-muted);
  margin: 0;
}

.feat-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--line-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  flex-shrink: 0;
}

.guide-device-card {
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.76rem;
  line-height: 1.5;
}

.dev-badge {
  font-weight: 800;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  width: max-content;
}

.dev-badge.pk { background: rgba(245, 158, 11, 0.2); color: var(--amber); }
.dev-badge.fk { background: rgba(56, 189, 248, 0.2); color: var(--cyan); }
.dev-badge.nn { background: rgba(239, 68, 68, 0.2); color: var(--rose); }

.proto-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-left: 3px solid var(--purple);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.76rem;
  line-height: 1.5;
}

.proto-detail-card h4 {
  font-size: 0.84rem;
  color: var(--purple);
  margin: 0;
}

.error-case-card {
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.76rem;
  line-height: 1.5;
}

.error-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.err-tag {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.osi-summary-table {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.osi-row-item {
  display: grid;
  grid-template-columns: 45px 130px 1fr;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
}

.osi-cell-num {
  font-family: 'Fira Code', monospace;
  font-weight: 900;
  font-size: 0.82rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-align: center;
}

.osi-row-item.pg .osi-cell-num { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.osi-row-item.my .osi-cell-num { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.osi-row-item.ora .osi-cell-num { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.osi-row-item.sql .osi-cell-num { background: rgba(139, 92, 246, 0.2); color: #c084fc; }

.osi-cell-name { font-weight: 800; color: var(--text-main); }
.osi-cell-desc { color: var(--text-muted); }

.guide-modal-footer {
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border-top: 1px solid var(--line-color);
  display: flex;
  justify-content: flex-end;
}

.btn-guide-close-bottom {
  background: var(--purple);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.80rem;
  font-weight: 800;
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-guide-close-bottom:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

/* RESPONSIVIDADE */
@media (max-width: 1024px) {
  .dbstudio-main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
  }

  .header-top-row {
    width: 100%;
    justify-content: space-between;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
  }
}

@media (max-width: 640px) {
  .dbstudio-toolbar {
    padding-inline: 0.75rem;
  }

  .toolbar-row-bottom,
  .simulation-controls,
  .preset-box,
  .view-mode-box,
  .dialect-box {
    width: 100%;
    min-width: 0;
  }

  .preset-box,
  .view-mode-box,
  .dialect-box {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .select-dbstudio {
    width: 100%;
  }

  .header-actions {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .col-builder-legend, .col-builder-row {
    grid-template-columns: 1fr;
  }
}

/* P1-10 — contraste WCAG AA em superfícies claras — Padrão Editorial Técnico */
:root:not([data-theme="dark"]) .dbs-hero-badge,
:root:not([data-theme="dark"]) .btn-copy-sql,
:root:not([data-theme="dark"]) .btn-toolbar-guide,
:root:not([data-theme="dark"]) #hud-status-badge,
:root:not([data-theme="dark"]) .inspector-tab.active { color: #0f766e !important; }
:root:not([data-theme="dark"]) .canvas-title-text { color: #0b1e3d !important; }
:root:not([data-theme="dark"]) .btn-sql-action { color: #075985 !important; }
:root:not([data-theme="dark"]) .btn-clear-canvas { color: #b91c1c !important; }
:root:not([data-theme="dark"]) .brand-accent-gold { color: #b45309 !important; }
:root:not([data-theme="dark"]) .footer-brand-sep { color: #64748b !important; }
[data-theme="dark"] .dbs-hero-badge,
[data-theme="dark"] .btn-copy-sql,
[data-theme="dark"] .btn-toolbar-guide,
[data-theme="dark"] #hud-status-badge,
[data-theme="dark"] .inspector-tab.active { color: #2dd4bf !important; }
[data-theme="dark"] .canvas-title-text { color: #f8fafc !important; }

/* ==========================================================================
   CABEÇALHO CANÔNICO DO ECOSSISTEMA PHM TECH — BOTÕES GHOST & NAVEGAÇÃO
   ========================================================================== */
.phm-ecosystem-header .phm-ecosystem-header__inner,
.phm-ecosystem-header .nav-wrap {
  justify-content: flex-start !important;
}

.phm-ecosystem-header .phm-projects-menu > summary,
.phm-ecosystem-header .phm-hub-back {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-soft, #475569) !important;
  transition: all 0.15s ease;
}

.phm-ecosystem-header .phm-projects-menu > summary::-webkit-details-marker {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary span,
.phm-ecosystem-header .phm-projects-menu > summary svg:last-child,
.phm-ecosystem-header .phm-hub-back span {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary svg:first-child,
.phm-ecosystem-header .phm-hub-back svg {
  margin: 0 !important;
}

.phm-ecosystem-header .phm-projects-menu > summary:hover,
.phm-ecosystem-header .phm-projects-menu[open] > summary,
.phm-ecosystem-header .phm-hub-back:hover {
  border-color: var(--line, #e2e8f0) !important;
  background: var(--surface-soft, #f1f5f9) !important;
  color: var(--teal, #0d9488) !important;
}

[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="dark"] .phm-ecosystem-header .phm-hub-back {
  color: #94a3b8 !important;
}

[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="dark"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="dark"] .phm-ecosystem-header .phm-hub-back:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #2dd4bf !important;
}

[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back {
  color: #715842 !important;
}

[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back:hover {
  background: rgba(67, 52, 34, 0.08) !important;
  border-color: rgba(67, 52, 34, 0.15) !important;
  color: #78350f !important;
}

.phm-ecosystem-header .menu-toggle {
  display: none !important;
}

@media (max-width: 900px) {
  .phm-ecosystem-header .menu-toggle {
    display: inline-flex !important;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid transparent !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-soft, #475569) !important;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .phm-ecosystem-header .menu-toggle:hover {
    border-color: var(--line, #e2e8f0) !important;
    background: var(--surface-soft, #f1f5f9) !important;
    color: var(--teal, #0d9488) !important;
  }
  [data-theme="dark"] .phm-ecosystem-header .menu-toggle {
    color: #94a3b8 !important;
  }
  [data-theme="dark"] .phm-ecosystem-header .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #2dd4bf !important;
  }
  [data-theme="sepia"] .phm-ecosystem-header .menu-toggle {
    color: #715842 !important;
  }
  [data-theme="sepia"] .phm-ecosystem-header .menu-toggle:hover {
    background: rgba(67, 52, 34, 0.08) !important;
    border-color: rgba(67, 52, 34, 0.15) !important;
    color: #78350f !important;
  }
  .phm-ecosystem-header .header-editorial-nav {
    display: none !important;
  }
  .phm-ecosystem-header .header-editorial-nav.open {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface, #0b1329);
    border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.1));
    padding: 1rem 1.25rem;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 999;
  }
  [data-theme="light"] .phm-ecosystem-header .header-editorial-nav.open {
    background: #ffffff;
    border-bottom-color: var(--line, #e2e8f0);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  }
}

body.app-body {
  overflow-x: hidden;
}

.phm-ecosystem-header {
  width: 100% !important;
  max-width: 100vw !important;
  box-sizing: border-box !important;
}

@media (max-width: 640px) {
  .phm-ecosystem-header .phm-ecosystem-header__inner {
    padding-inline: 0.35rem !important;
    gap: 0.2rem !important;
  }
  .phm-ecosystem-header .nav-left-cluster {
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .phm-ecosystem-header .app-logo-wordmark {
    height: 20px !important;
    max-width: 85px !important;
    width: auto !important;
  }
  .phm-ecosystem-header .nav-cluster-divider {
    display: none !important;
  }
  .phm-ecosystem-header .phm-ecosystem-header__actions {
    gap: 0.15rem !important;
    flex-shrink: 0 !important;
  }
  .phm-ecosystem-header .nav-pref-trigger,
  .phm-ecosystem-header .phm-projects-menu > summary,
  .phm-ecosystem-header .phm-hub-back,
  .phm-ecosystem-header .menu-toggle {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    justify-content: center !important;
  }
}

/* Salvaguarda de Acessibilidade: Skip Link fora do fluxo visual quando não focado */
.phm-skip-link {
  position: absolute !important;
  top: -9999px !important;
  left: 1rem !important;
  z-index: 999999 !important;
  padding: 0.5rem 1rem !important;
  background: #0b1329 !important;
  color: #2dd4bf !important;
  border: 1px solid #2dd4bf !important;
  border-radius: 4px !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.phm-skip-link:focus,
.phm-skip-link:focus-visible {
  top: 1rem !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  outline: 2px solid #2dd4bf !important;
}

