:root {
  --bg-main: #060b0d;
  --bg-card: #0c1518;
  --bg-input: #121e23;
  --line: #1c323a;
  --txt-main: #e6f1f4;
  --txt-muted: #79929c;
  --accent: #0a7e8c;
  --accent-glow: rgba(10, 126, 140, 0.45);
  --accent-hover: #1094a4;
  --accent-2: #34d399; /* Green/Emerald accent */
  --error: #f43f5e;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-main);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

body {
  background: var(--bg-main);
  color: var(--txt-main);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.5;
}

/* ==========================================================================
   TELA DE LOGIN
   ========================================================================== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #05161c 0%, #060b0d 50%, #0c2027 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: -1;
}

/* Animação suave de fundo para dar sensação de viagem e dinamismo */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Adiciona formas geométricas desfocadas no fundo para o visual premium */
.login-background::before,
.login-background::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
}
.login-background::before {
  width: 300px;
  height: 300px;
  background: var(--accent);
  top: 20%;
  left: 15%;
}
.login-background::after {
  width: 350px;
  height: 350px;
  background: var(--accent-2);
  bottom: 25%;
  right: 15%;
}

.login-card {
  background: rgba(12, 21, 24, 0.75);
  border: 1px solid rgba(28, 50, 58, 0.65);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: loginAppear 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.logo-fallback {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  color: #fff;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
  background: linear-gradient(to right, #fff, var(--accent-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--txt-muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.76rem;
  color: var(--txt-muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 45px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--txt-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  outline: none;
  transition: color var(--transition);
}

.toggle-password:hover {
  color: var(--txt-main);
}

.login-btn {
  margin-top: 10px;
  width: 100%;
}

.login-error {
  margin-top: 20px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #ffa5b5;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==========================================================================
   PAINEL PRINCIPAL (DASHBOARD)
   ========================================================================== */
.app-dashboard {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 28px;
  gap: 20px;
}

.header-brand {
  display: flex;
  align-items: center;
}

.header-logo {
  max-height: 48px;
  width: auto;
}

.header-logo-fallback {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: #fff;
  letter-spacing: -0.03em;
}

.header-divider {
  width: 1px;
  height: 36px;
  background: var(--line);
  margin: 0 20px;
}

.header-title-wrapper h1 {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: #fff;
}

.header-subtitle {
  color: var(--txt-muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-mode-toggle {
  min-width: 320px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--txt-muted);
  border-radius: var(--radius-md);
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.4);
  color: #ffa5b5;
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 28px;
  align-items: start;
}

/* Estilo do Card Geral */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.sticky-card {
  position: sticky;
  top: 24px;
}

.section-title {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  margin-bottom: 18px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.section-title.text-center {
  border-left: none;
  padding-left: 0;
  text-align: center;
}

/* Linhas e Inputs */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.row.one {
  grid-template-columns: 1fr;
}

.row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.row:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.72rem;
  color: var(--txt-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--txt-main);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

/* Customizações de inputs especiais */
input[type=file] {
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--txt-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

input[type=file]::-webkit-file-upload-button {
  background: var(--line);
  border: none;
  color: var(--txt-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-right: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

input[type=file]::-webkit-file-upload-button:hover {
  background: var(--accent);
}

input[type=range] {
  padding: 0;
  border: none;
  background: transparent;
  height: 32px;
  accent-color: var(--accent);
  cursor: pointer;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

/* Seletor de cores (Swatches) */
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.swatch:hover {
  transform: scale(1.15);
}

.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}

/* Botões do Toggle Group */
.toggle-group {
  display: flex;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: var(--radius-md);
}

.toggle-group button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--txt-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition);
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.toggle-group button:hover {
  color: var(--txt-main);
  background: rgba(255, 255, 255, 0.03);
}

.toggle-group button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 126, 140, 0.4);
}

/* Coluna de Visualização (Preview Stage) */
.stage {
  background: repeating-conic-gradient(#080f12 0% 25%, #0d161a 0% 50%) 50%/24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
  margin-bottom: 20px;
  overflow: hidden;
}

canvas {
  max-width: 100%;
  max-height: 62vh;
  height: auto;
  width: auto;
  border-radius: 8px;
  display: block;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  touch-action: none;
  background: #000;
}

/* Ações */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 126, 140, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 18px rgba(10, 126, 140, 0.45);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--txt-main);
}

.btn-ghost:hover {
  background: var(--bg-input);
  border-color: var(--accent);
}

.hint {
  font-size: 0.72rem;
  color: var(--txt-muted);
  line-height: 1.5;
}

.text-center {
  text-align: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   RESPONSIVIDADE E DISPOSITIVOS MÓVEIS
   ========================================================================== */
@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .preview-col {
    grid-row: 1; /* Move o Preview para o topo no celular */
  }
  
  .sticky-card {
    position: static;
  }
  
  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }
  
  .header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  
  .header-mode-toggle {
    width: 100%;
  }
  
  .header-brand {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .app-dashboard {
    padding: 16px 12px 40px;
  }
  
  .card {
    padding: 16px;
  }
  
  .row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .row.three {
    grid-template-columns: 1fr;
  }
  
  .toggle-group {
    flex-wrap: wrap;
  }
  
  .login-card {
    padding: 24px 20px;
  }
}


