:root {
  color-scheme: dark;
  --ai-bg: #343541;
  --ai-sidebar: #202123;
  --ai-surface: #444654;
  --ai-text: #ececf1;
  --ai-text-muted: #c5c5d2;
  --ai-accent: #10a37f;
  --ai-border: rgba(255, 255, 255, 0.08);
  --ai-sidebar-width: 260px;
}

body.ai-body {
  background-color: var(--ai-bg);
  color: var(--ai-text);
  font-family: "Söhne", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
}

body.modo-claro {
  --ai-bg: #f5f6fa;
  --ai-sidebar: #ffffff;
  --ai-surface: #ffffff;
  --ai-text: #1f2937;
  --ai-text-muted: #6b7280;
  --ai-border: rgba(31, 41, 55, 0.1);
}

a {
  color: var(--ai-text);
  text-decoration: none;
}

.ai-layout {
  display: flex;
  min-height: 100vh;
}

.ai-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--ai-sidebar-width);
  background: var(--ai-sidebar);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--ai-border);
}

.ai-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--ai-border);
  color: var(--ai-text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.ai-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ai-logo {
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-logo-container {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ai-logo-imagem {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(75, 85, 99, 0.9);
  background: #1c1d23;
  padding: 0;
}

.ai-logo-home {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 24px;
  margin-left: auto;
  margin-right: auto;
  display: block;
  box-shadow: 0 18px 36px rgba(16, 255, 156, 0.5);
}

body.modo-claro .ai-logo-home {
  background: #ffffff;
}

body.modo-claro .ai-logo-imagem {
  border-color: rgba(31, 41, 55, 0.2);
  background: #ffffff;
}

.ai-btn-primary {
  background: var(--ai-accent);
  border: none;
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-btn-primary:hover {
  background: #0c8c6c;
  color: #ffffff;
}

.ai-sidebar-section {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ai-text-muted);
}

.ai-history {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-history li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ai-text-muted);
  font-size: 0.85rem;
}

.ai-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-history-link {
  color: var(--ai-text);
  flex: 1;
}

.ai-history-link:hover {
  color: var(--ai-text);
}

.ai-history-delete {
  background: transparent;
  border: 1px solid var(--ai-border);
  color: var(--ai-text-muted);
  border-radius: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-history-delete:hover {
  color: #ff9b9b;
  border-color: rgba(255, 155, 155, 0.5);
}

.ai-sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--ai-border);
}

.ai-perfil-dropup {
  position: relative;
}

.ai-perfil-botao {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ai-text);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.ai-perfil-botao:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ai-border);
}

.ai-perfil-seta {
  margin-left: auto;
  color: var(--ai-text-muted);
  font-size: 0.85rem;
}

.ai-perfil-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 100%;
  background: #2a2b32;
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 10;
}

.ai-perfil-menu.ativo {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-perfil-status {
  display: flex;
  justify-content: center;
}

.ai-selo-pro {
  background: rgba(16, 163, 127, 0.2);
  color: #8ef3d3;
  border: 1px solid rgba(16, 163, 127, 0.45);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.ai-btn-upgrade {
  background: rgba(192, 132, 252, 0.18);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.45);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  width: 100%;
  text-align: center;
}

.ai-btn-upgrade:hover {
  color: #ffffff;
  background: rgba(192, 132, 252, 0.35);
}

.ai-perfil-divisor {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.ai-perfil-link {
  color: var(--ai-text);
  padding: 8px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-perfil-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ai-text);
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2a2b32;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--ai-text);
}

body.modo-claro .ai-avatar {
  background: #e5e7eb;
  color: #111827;
}

.ai-user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.ai-user-plan {
  font-size: 0.75rem;
  color: var(--ai-text-muted);
}

.ai-main {
  margin-left: var(--ai-sidebar-width);
  flex: 1;
  padding: 32px 24px 48px;
}

.ai-main-inner {
  max-width: 980px;
  margin: 0 auto;
}

.ai-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 16px;
}

.ai-layout.sidebar-fechada .ai-topbar {
  justify-content: flex-start;
}

.ai-layout.sidebar-fechada .ai-sidebar-toggle {
  display: inline-flex;
}

.ai-layout:not(.sidebar-fechada) .ai-topbar .ai-sidebar-toggle {
  display: none;
}

.ai-hamburguer {
  display: none;
  background: transparent;
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 8px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ai-hamburguer span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ai-text);
  border-radius: 999px;
}

.codigo-borrado {
  position: relative;
  filter: blur(6px);
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.sobreposicao-borrado {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  border-radius: 0.5rem;
}

.ai-hero {
  text-align: center;
  padding: 80px 12px 40px;
}

.ai-hero h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.ai-hero p {
  color: var(--ai-text-muted);
  margin-bottom: 32px;
}

.ai-cta-central {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
}

.ai-cta-icone {
  color: #00ff9c;
  background: rgba(0, 255, 156, 0.08);
  border: 1px solid rgba(0, 255, 156, 0.25);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0, 255, 156, 0.2);
}

.ai-cta-botao {
  background: var(--ai-accent);
  color: #ffffff;
  padding: 14px 28px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 12px 28px rgba(16, 163, 127, 0.35);
}

.ai-cta-botao:hover {
  background: #0c8c6c;
  color: #ffffff;
  transform: translateY(-1px);
}

body.modo-claro .ai-cta-icone {
  background: rgba(16, 163, 127, 0.12);
  border-color: rgba(16, 163, 127, 0.3);
}

.ai-input-card {
  position: relative;
  background: var(--ai-surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.ai-input-card textarea {
  background: transparent;
  border: none;
  color: var(--ai-text);
  width: 100%;
  min-height: 220px;
  resize: vertical;
  outline: none;
  font-size: 0.95rem;
}

.ai-input-card .form-control {
  background: transparent;
  border: none;
  color: var(--ai-text);
  box-shadow: none;
  padding: 0;
}

.ai-input-card textarea::placeholder {
  color: var(--ai-text-muted);
}

.ai-input-zip {
  display: none;
}

.ai-dropzone {
  background: #1e1f26;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.ai-dropzone:hover,
.ai-dropzone.ativo {
  border-color: #00ff9c;
  background: rgba(0, 255, 156, 0.06);
  box-shadow: 0 0 22px rgba(0, 255, 156, 0.18);
}

.ai-dropzone-icone {
  color: #00ff9c;
}

.ai-dropzone-titulo {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ai-text);
}

.ai-dropzone-subtitulo {
  font-size: 0.85rem;
  color: var(--ai-text-muted);
}

.ai-dropzone-selecionado {
  display: none;
  align-items: center;
  gap: 12px;
  color: var(--ai-text);
}

.ai-dropzone.selecionado .ai-dropzone-conteudo {
  display: none;
}

.ai-dropzone.selecionado .ai-dropzone-selecionado {
  display: flex;
}

.ai-dropzone-arquivo {
  font-weight: 600;
  color: var(--ai-text);
}

.ai-dropzone-remover {
  border: 1px solid var(--ai-border);
  background: transparent;
  color: var(--ai-text-muted);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-dropzone-remover:hover {
  border-color: rgba(248, 113, 113, 0.6);
  color: #fca5a5;
}

body.modo-claro .ai-dropzone {
  background: #f3f4f6;
  border-color: rgba(31, 41, 55, 0.2);
}

body.modo-claro .ai-dropzone:hover,
body.modo-claro .ai-dropzone.ativo {
  border-color: #10a37f;
  background: rgba(16, 163, 127, 0.08);
}

.ai-send-button {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ai-accent);
  border: none;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(16, 163, 127, 0.4);
}

.ai-send-button:hover {
  background: #0c8c6c;
}

.ai-card {
  background: var(--ai-surface);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--ai-border);
}

.ai-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 16, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.ai-modal-overlay.ativo {
  display: flex;
}

.ai-modal {
  width: min(680px, 100%);
  background: #2a2b32;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

button,
.btn,
input,
select,
textarea {
  min-height: 44px;
}

body.modo-claro .ai-modal {
  background: #ffffff;
  border-color: rgba(31, 41, 55, 0.1);
}

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

.ai-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.ai-modal-fechar {
  border: none;
  background: transparent;
  color: var(--ai-text);
  font-size: 1.1rem;
}

.ai-modal-tabs {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 6px;
}

.ai-modal-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ai-text-muted);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.ai-modal-tab.ativo {
  background: rgba(16, 163, 127, 0.2);
  color: var(--ai-text);
}

.ai-modal-conteudo {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-modal-painel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.ai-modal-painel.ativo {
  display: flex;
}

.ai-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-form-grupo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-form-grupo label {
  font-size: 0.85rem;
  color: var(--ai-text-muted);
}

.ai-form-grupo input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ai-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--ai-text);
}

body.modo-claro .ai-form-grupo input {
  background: #f9fafb;
}

.ai-plano-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-card-titulo {
  font-size: 0.85rem;
  color: var(--ai-text-muted);
}

.ai-card-subtitulo {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ai-text);
}

.ai-expiracao {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(16, 163, 127, 0.12);
  border: 1px solid rgba(16, 163, 127, 0.35);
  color: #c7f9e9;
}

.ai-aparencia-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.ai-toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.ai-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ai-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: 0.2s;
}

.ai-toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: 0.2s;
}

.ai-toggle-switch input:checked + .ai-toggle-slider {
  background: rgba(16, 163, 127, 0.6);
}

.ai-toggle-switch input:checked + .ai-toggle-slider::before {
  transform: translateX(22px);
}

.ai-toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 11000;
}

.ai-toast {
  background: #2a2b32;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--ai-text);
  opacity: 0;
  transform: translateY(6px);
  transition: 0.2s ease;
}

.ai-toast.ativo {
  opacity: 1;
  transform: translateY(0);
}

.ai-toast.sucesso {
  border-color: rgba(16, 163, 127, 0.5);
}

.ai-toast.erro {
  border-color: rgba(248, 113, 113, 0.6);
}

.card {
  background: var(--ai-surface);
  border: 1px solid var(--ai-border);
  color: var(--ai-text);
}

.alert {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--ai-border);
  color: var(--ai-text);
}

.bg-light,
.bg-white {
  background-color: #2a2b32 !important;
  border: 1px solid var(--ai-border) !important;
  color: var(--ai-text) !important;
}

pre,
code {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  background-color: #1e1e1e !important;
  color: #00ff9c !important;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #444;
}

table {
  width: 100%;
  display: block;
  overflow-x: auto;
}

pre {
  margin: 0;
  line-height: 1.5;
  font-size: 0.9rem;
  overflow-x: auto;
}

code {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.codigo-refatorado {
  background-color: #1e1e1e !important;
  color: #00ff9c !important;
  max-height: 60vh;
  overflow: auto;
}

.nav-tabs {
  border-bottom: 1px solid var(--ai-border);
}

.nav-tabs .nav-link {
  color: var(--ai-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link.active {
  color: var(--ai-text);
  background: transparent;
  border-bottom: 2px solid var(--ai-accent);
}

.tab-content {
  background: var(--ai-surface);
}

.btn-outline-light {
  border-color: var(--ai-border);
  color: var(--ai-text);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ai-text);
}

.conteudo-markdown pre {
  background-color: #0f111a;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}

.conteudo-markdown code {
  white-space: pre;
}

.btn,
.btn:focus,
.btn:active {
  border-radius: 10px;
}

.text-muted {
  color: var(--ai-text-muted) !important;
}

@media (max-width: 768px) {
  .ai-sidebar {
    position: fixed;
    width: var(--ai-sidebar-width);
    height: 100vh;
    transform: translateX(-100%);
    z-index: 5;
  }

  .ai-layout.sidebar-aberta .ai-sidebar {
    transform: translateX(0);
  }

  .ai-main {
    margin-left: 0;
    padding: 16px;
  }

  .ai-topbar {
    justify-content: space-between;
  }

  .ai-hamburguer {
    display: inline-flex;
  }

  .ai-topbar .ai-sidebar-toggle {
    display: none;
  }

  .ai-hero h1 {
    font-size: 1.6rem;
  }

  .ai-modal {
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
  }
}

.ai-layout.sidebar-fechada .ai-sidebar {
  transform: translateX(calc(-1 * var(--ai-sidebar-width)));
}

.ai-layout.sidebar-fechada .ai-main {
  margin-left: 0;
}

.ai-sidebar {
  transition: transform 0.2s ease-in-out;
}

.ai-main {
  transition: margin-left 0.2s ease-in-out;
}

.ai-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 16, 22, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
  z-index: 4;
}

.ai-layout.sidebar-aberta .ai-sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.ai-overlay-carregamento {
  position: fixed;
  inset: 0;
  background: rgba(18, 19, 24, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ai-overlay-carregamento.ativo {
  display: flex;
}

.ai-loader-conteudo {
  text-align: center;
  padding: 32px;
  border-radius: 16px;
  background: rgba(32, 33, 35, 0.65);
  border: 1px solid rgba(16, 163, 127, 0.4);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ai-loader-radar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(192, 132, 252, 0.6);
  position: relative;
  box-shadow: 0 0 25px rgba(192, 132, 252, 0.35);
  overflow: hidden;
}

.ai-loader-radar::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px dashed rgba(16, 163, 127, 0.6);
}

.ai-loader-radar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(
    rgba(16, 163, 127, 0.5),
    rgba(16, 163, 127, 0.0) 60%
  );
  animation: giro-radar 2.4s linear infinite;
  transform-origin: center;
}

.ai-loader-radar span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(16, 163, 127, 0.3);
  animation: pulso-radar 2.4s ease-in-out infinite;
}

.ai-loader-radar span:nth-child(2) {
  animation-delay: 1.2s;
}

.ai-loader-texto {
  font-size: 1rem;
  color: var(--ai-text);
  font-weight: 500;
  min-height: 24px;
}

@keyframes giro-radar {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulso-radar {
  0% {
    transform: scale(0.75);
    opacity: 0.0;
  }
  40% {
    opacity: 0.6;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

