/* Garantias — tema Atlas CRM (modo embed ?embed=1) */

html.atlas-embed-root,
body.atlas-embed {
  --bg-primary: #0D1117;
  --bg-secondary: #161B22;
  --bg-card: #161B22;
  --border-color: #30363d;
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --brand-blue: #14B8A6;
  --brand-yellow: #C084FC;
  --brand-blue-hover: #0D9488;
  --brand-yellow-hover: #A855F7;
  --grad: linear-gradient(135deg, #14B8A6 0%, #7C3AED 100%);
  --shadow-premium: 0 4px 16px rgba(0, 0, 0, 0.35);
}

body.atlas-embed {
  background: var(--bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
}

body.atlas-embed .bg-overlay {
  display: none;
}

/* Layout embed — sidebar horizontal, fluxo normal (sem position:fixed) */
body.atlas-embed .dashboard-wrapper,
body.atlas-embed #dashboardSection {
  display: flex !important;
  flex-direction: column !important;
  min-height: auto !important;
}

body.atlas-embed .sidebar {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  flex-shrink: 0;
  z-index: 10;
  padding: 8px 16px;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-right: none;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  backdrop-filter: none;
}

body.atlas-embed .main-content {
  margin-left: 0 !important;
  padding: 16px 18px 32px;
  min-height: auto !important;
  width: 100% !important;
  flex: 1 1 auto;
  overflow: visible !important;
}

body.atlas-embed .sidebar > div:first-child {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 8px;
}

body.atlas-embed .sidebar-brand {
  display: none !important;
}

body.atlas-embed .sidebar-menu {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
  flex-grow: 0;
}

body.atlas-embed .sidebar-menu li {
  list-style: none;
}

body.atlas-embed .menu-item {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 6px;
  border-left: none !important;
  white-space: nowrap;
}

body.atlas-embed .menu-item i {
  width: 14px;
  height: 14px;
}

body.atlas-embed .menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

body.atlas-embed .menu-item.active {
  background: rgba(20, 184, 166, 0.12);
  color: #14B8A6;
  border-left: none;
  box-shadow: inset 0 -2px 0 #14B8A6;
}

body.atlas-embed .sidebar-footer {
  border-top: none;
  padding-top: 0;
  flex-shrink: 0;
}

body.atlas-embed #loginTriggerBlock {
  display: none !important;
}

body.atlas-embed #adminProfileBlock {
  display: none !important;
}

body.atlas-embed #loginTriggerBlock .btn-primary,
body.atlas-embed #adminProfileBlock .btn-logout {
  width: auto !important;
  font-size: 0.72rem !important;
  padding: 6px 10px !important;
  background: transparent !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  transform: none !important;
  color: var(--text-secondary) !important;
}

body.atlas-embed #loginTriggerBlock .btn-primary:hover,
body.atlas-embed #adminProfileBlock .btn-logout:hover {
  border-color: #14B8A6 !important;
  color: #14B8A6 !important;
}

body.atlas-embed .top-bar {
  margin-bottom: 14px;
  gap: 12px;
}

body.atlas-embed .page-title h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

body.atlas-embed .page-title p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

body.atlas-embed #garantiasHeroBanner {
  display: none !important;
}

body.atlas-embed .table-controls {
  align-items: flex-start;
}

body.atlas-embed #btnNovaSolicitacao {
  flex-shrink: 0;
  white-space: nowrap;
}

body.atlas-embed .metrics-grid {
  gap: 12px;
}

body.atlas-embed .metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: none;
}

body.atlas-embed .metric-title {
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.atlas-embed .metric-value {
  color: var(--text-primary);
}

body.atlas-embed .form-control,
body.atlas-embed select.form-control,
body.atlas-embed input.form-control {
  background: #0D1117;
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.atlas-embed .tab-content .metric-card,
body.atlas-embed .table-container,
body.atlas-embed .modal-card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

body.atlas-embed table th {
  background: #0D1117;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

body.atlas-embed table td {
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.atlas-embed .btn-primary {
  background: linear-gradient(135deg, #14B8A6, #0D9488);
  border: none;
}

body.atlas-embed .btn-primary:hover {
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.25);
}

body.atlas-embed #loginSection.modal-overlay {
  background: rgba(13, 17, 23, 0.92);
}

body.atlas-embed #loginSection .modal-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

@media (max-width: 900px) {
  body.atlas-embed .sidebar {
    flex-wrap: wrap;
    padding: 8px 10px;
  }

  body.atlas-embed .sidebar-menu {
    order: 3;
    width: 100%;
  }

  body.atlas-embed .main-content {
    padding: 12px 10px 20px;
  }
}

/* Tema claro — sincronizado com Atlas CRM (postMessage atlas-theme) */
body.atlas-embed.atlas-theme-light {
  --bg-primary: #EFF6FF;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --text-primary: #0A2540;
  --text-secondary: #475569;
  --border-color: rgba(10, 37, 64, 0.12);
  background: #EFF6FF;
  color: #0A2540;
}

body.atlas-embed.atlas-theme-light .sidebar {
  background: #FFFFFF;
  border-color: rgba(10, 37, 64, 0.1);
}

body.atlas-embed.atlas-theme-light .menu-item {
  color: #475569;
}

body.atlas-embed.atlas-theme-light .menu-item.active {
  background: rgba(30, 64, 175, 0.08);
  color: #1E40AF;
  border-color: rgba(30, 64, 175, 0.2);
}

body.atlas-embed.atlas-theme-light .metric-card,
body.atlas-embed.atlas-theme-light .table-container,
body.atlas-embed.atlas-theme-light .modal-card {
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.1) !important;
  box-shadow: 0 1px 3px rgba(10, 37, 64, 0.06);
}

body.atlas-embed.atlas-theme-light .metric-title {
  color: #64748B !important;
}

body.atlas-embed.atlas-theme-light .metric-value {
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .page-title h2 {
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .page-title p {
  color: #64748B !important;
}

body.atlas-embed.atlas-theme-light table th {
  background: #DBEAFE !important;
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light table td {
  color: #0A2540 !important;
  border-color: rgba(10, 37, 64, 0.06) !important;
}

/* ── Formulários, busca e filtros (Sincronização + abas operacionais) ── */
body.atlas-embed.atlas-theme-light .form-control,
body.atlas-embed.atlas-theme-light select.form-control,
body.atlas-embed.atlas-theme-light input.form-control,
body.atlas-embed.atlas-theme-light textarea.form-control,
body.atlas-embed.atlas-theme-light #globalStoreFilter {
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.18) !important;
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .form-control:focus {
  background: #FFFFFF !important;
  border-color: #1E40AF !important;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12) !important;
}

body.atlas-embed.atlas-theme-light .form-group label,
body.atlas-embed.atlas-theme-light h3,
body.atlas-embed.atlas-theme-light h4 {
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .search-box .search-icon {
  color: #64748B !important;
}

body.atlas-embed.atlas-theme-light .filter-pill {
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.14) !important;
  color: #475569 !important;
}

body.atlas-embed.atlas-theme-light .filter-pill:hover {
  background: #F0F9FF !important;
  color: #0A2540 !important;
  border-color: rgba(30, 64, 175, 0.25) !important;
}

body.atlas-embed.atlas-theme-light .filter-pill.active {
  background: #1E40AF !important;
  border-color: #1E40AF !important;
  color: #FFFFFF !important;
}

body.atlas-embed.atlas-theme-light .btn-secondary {
  background: #F8FAFC !important;
  border-color: rgba(10, 37, 64, 0.14) !important;
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .btn-secondary:hover {
  background: #EFF6FF !important;
  border-color: rgba(30, 64, 175, 0.25) !important;
}

body.atlas-embed.atlas-theme-light .cfg-store-row,
body.atlas-embed.atlas-theme-light .cfg-channel-row {
  background: #F8FAFC !important;
  border-color: rgba(10, 37, 64, 0.1) !important;
}

body.atlas-embed.atlas-theme-light code,
body.atlas-embed.atlas-theme-light pre {
  background: #F1F5F9 !important;
  color: #0A2540 !important;
  border-color: rgba(10, 37, 64, 0.1) !important;
}

/* ── Guia do Processo — cards legíveis no claro ── */
body.atlas-embed.atlas-theme-light .process-step-card {
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.12) !important;
  box-shadow: 0 1px 4px rgba(10, 37, 64, 0.06);
}

body.atlas-embed.atlas-theme-light .process-step-card:hover {
  background: #F8FAFC !important;
  border-color: rgba(30, 64, 175, 0.2) !important;
}

body.atlas-embed.atlas-theme-light .process-step-title,
body.atlas-embed.atlas-theme-light .process-step-body,
body.atlas-embed.atlas-theme-light .process-step-body p,
body.atlas-embed.atlas-theme-light .process-step-body li {
  color: #0A2540 !important;
}

body.atlas-embed.atlas-theme-light .process-link {
  color: #1D4ED8 !important;
}

body.atlas-embed.atlas-theme-light .process-link:hover {
  color: #1E40AF !important;
  text-shadow: none !important;
}

body.atlas-embed.atlas-theme-light .process-alert {
  background: #FFFBEB !important;
  border-left-color: #F59E0B !important;
  color: #78350F !important;
}

body.atlas-embed.atlas-theme-light .process-image-container {
  border-color: rgba(10, 37, 64, 0.12) !important;
  background: #FFFFFF !important;
}

body.atlas-embed.atlas-theme-light .process-image-container > div:first-child {
  background: #F1F5F9 !important;
  color: #475569 !important;
  border-bottom-color: rgba(10, 37, 64, 0.08) !important;
}

body.atlas-embed.atlas-theme-light .process-image {
  background: #F8FAFC !important;
}

body.atlas-embed.atlas-theme-light .menu-item.active {
  box-shadow: inset 0 -2px 0 #1E40AF;
}

body.atlas-embed.atlas-theme-light .request-card,
body.atlas-embed.atlas-theme-light .warranty-card {
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.1) !important;
}

body.atlas-embed.atlas-theme-light .empty-state,
body.atlas-embed.atlas-theme-light .table-empty {
  color: #64748B !important;
  background: #FFFFFF !important;
  border-color: rgba(10, 37, 64, 0.1) !important;
}
