*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #232735;
  --border: #2e3345;
  --text: #e8eaef;
  --text-muted: #9aa3b8;
  --accent: #3b9eff;
  --accent-hover: #5aafff;
  --success: #34d399;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --sidebar-width: 240px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.view {
  display: none;
  min-height: 100vh;
}

.view--active {
  display: flex;
}

#login-view {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 158, 255, 0.15), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card__brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-card__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  color: var(--accent);
  background: rgba(59, 158, 255, 0.12);
  border-radius: 10px;
}

.login-card__brand h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.login-card__brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-form__error {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--danger);
}

.login-form__error[hidden] {
  display: none;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.sidebar__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--accent);
}

.sidebar__title {
  display: block;
  font-size: 0.95rem;
}

.sidebar__subtitle {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar__close {
  display: none;
  margin-left: auto;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar__nav-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.85rem;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar__nav-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar__nav-btn--active {
  background: rgba(59, 158, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.sidebar__settings {
  flex-shrink: 0;
  padding: 0 0.75rem 0.75rem;
}

.sidebar__settings .sidebar__nav-btn {
  width: 100%;
}

.sidebar__footer {
  flex-shrink: 0;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.5);
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.app-header__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.tool-panel {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.tool-panel:has(.custos3d) {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-form {
  max-width: 720px;
}

.tool-form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field__label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field__label--required::after {
  content: ' *';
  color: var(--accent);
}

.field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.2);
}

.field input.field--invalid {
  border-color: var(--danger);
}

.field__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn--primary {
  color: #fff;
  background: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  color: var(--text-muted);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn--block {
  width: 100%;
}

.btn--icon {
  padding: 0.5rem;
  min-width: 2.25rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 720px;
  margin-top: 1.5rem;
}

.results[hidden] {
  display: none;
}

.result-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row--total {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.result-row--profit {
  color: var(--success);
  font-weight: 700;
}

.result-row--negative {
  color: var(--danger);
}

.result-row__label {
  color: var(--text-muted);
}

.result-row__value {
  font-variant-numeric: tabular-nums;
}

/* —— Custos 3D (layout calculadora) —— */
.custos3d {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.custos3d__lead {
  margin: 0;
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.custos3d__layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr);
  flex: 1;
  min-height: 0;
  gap: 0;
}

.custos3d__inputs {
  padding: 1.5rem;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field--stacked {
  gap: 0.5rem;
}

.info-callout {
  margin: -0.25rem 0 0.25rem;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #93c5fd;
  background: rgba(59, 158, 255, 0.08);
  border: 1px solid rgba(59, 158, 255, 0.35);
  border-radius: 8px;
}

.custos3d__results {
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-card {
  padding: 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.result-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-card--empty .result-card__empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tier-callout {
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
}

.tier-callout strong {
  font-weight: 600;
}

.result-hero {
  padding: 1.75rem 1.5rem;
  text-align: center;
  background: linear-gradient(145deg, rgba(59, 158, 255, 0.12) 0%, var(--surface-2) 55%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.result-hero--profit .result-hero__value {
  color: var(--success);
}

.result-hero--loss .result-hero__value {
  color: var(--danger);
}

.result-hero--empty .result-hero__value {
  color: var(--text-muted);
}

.result-hero__value {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.result-hero__margin {
  font-size: 0.45em;
  font-weight: 600;
  opacity: 0.9;
}

.result-hero__label {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.result-hero__caption {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.cost-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border);
}

.cost-bar--empty {
  min-height: 12px;
}

.cost-bar__segment {
  min-width: 2px;
  transition: width 0.25s ease;
}

.breakdown-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.breakdown-legend__item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
}

.breakdown-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.breakdown-legend__label {
  color: var(--text-muted);
}

.breakdown-legend__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* —— Gerador de Anúncios —— */
.gerador-anuncios {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.gerador-anuncios__tabbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.ga-tablist {
  display: flex;
  gap: 0;
  margin-bottom: -1px;
}

.ga-tab {
  position: relative;
  margin: 0;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.ga-tab:hover:not(.ga-tab--active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.ga-tab--active {
  color: var(--text);
  font-weight: 600;
  background: var(--bg);
  border-color: var(--border);
  border-bottom-color: var(--bg);
}

.ga-tab--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.ga-gerar--loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8.5rem;
}

.ga-gerar__spinner {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ga-spin 0.8s linear infinite;
}

.ga-action-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.ga-action-row .ga-model-inline,
.ga-action-row .btn--primary {
  flex: 0 0 calc(50% - 0.25rem);
  max-width: calc(50% - 0.25rem);
  min-width: 0;
}

.ga-action-row .ga-model-inline {
  margin: 0;
}

.ga-action-row .btn--primary {
  width: 100%;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.ga-model-block {
  max-width: 520px;
  margin-bottom: 1rem;
}

.ga-model-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
}

.ga-model-block__head .ga-model-inline--imagens {
  flex: 1 1 280px;
  max-width: none;
  margin-bottom: 0;
}

.ga-model-refresh {
  flex: 0 0 auto;
  align-self: flex-end;
  margin-bottom: 0.15rem;
}

.ga-model-refresh__icon {
  display: block;
}

.ga-model-refresh:disabled .ga-model-refresh__icon {
  opacity: 0.45;
  animation: ga-spin 0.9s linear infinite;
}

@keyframes ga-spin {
  to {
    transform: rotate(360deg);
  }
}

.ga-model-source {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.ga-model-source--catalog {
  color: #9ec8f0;
  background: rgba(59, 158, 255, 0.1);
  border-color: rgba(59, 158, 255, 0.22);
}

.ga-model-source--error {
  color: #f0a0a0;
  background: rgba(220, 80, 80, 0.1);
  border-color: rgba(220, 80, 80, 0.28);
}

.ga-model-source--loading {
  color: var(--text-muted, #9aa3b2);
  background: var(--surface-2);
  border-color: var(--border);
}

.ga-model-source__detail {
  text-decoration: underline;
  cursor: help;
  opacity: 0.85;
}

.ga-model-inline--imagens {
  max-width: 420px;
  margin-bottom: 1rem;
}

.ga-model-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

.ga-model-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.2);
}

.gerador-anuncios__panel {
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--bg);
}

.ga-image-upload {
  margin-bottom: 0.25rem;
}

.ga-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.ga-image-grid--empty {
  grid-template-columns: 1fr;
}

.ga-image-grid--empty .ga-image-slot--empty {
  aspect-ratio: 1;
  max-width: 280px;
  min-height: 280px;
}

.ga-image-slot {
  position: relative;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
}

.ga-image-slot--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.ga-image-slot--empty:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--accent);
}

.ga-image-slot__icon {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
}

.ga-image-slot__hint {
  font-size: 0.8rem;
}

.ga-image-slot--filled img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ga-image-slot__remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.ga-image-slot--filled:hover .ga-image-slot__remove {
  opacity: 1;
}

.ga-image-slot__remove:hover {
  background: rgba(220, 38, 38, 0.9);
}

.settings-page {
  max-width: 560px;
}

.settings-page__lead {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.settings-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.settings-card__text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.settings-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-status {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.settings-status--ok {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.settings-status--empty {
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.settings-form__error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.settings-form__error[hidden] {
  display: none;
}

.gerador-anuncios__layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.gerador-anuncios__inputs,
.gerador-anuncios__results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gerador-anuncios__results[hidden] {
  display: none !important;
}

.gerador-anuncios__results {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

#ga-market-tabs[hidden],
.ga-tabs--market:not(.ga-market-tabs--visible) {
  display: none !important;
}

.ga-tabs--market.ga-market-tabs--visible {
  display: flex !important;
}

.tool-panel:has(.gerador-anuncios) {
  padding: 0;
  overflow-y: auto;
}

.ga-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  resize: vertical;
  min-height: 4rem;
}

.ga-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 158, 255, 0.2);
}

.ga-textarea--output {
  background: var(--bg);
}

.ga-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ga-status--error {
  color: var(--danger);
}

.ga-ai-log {
  margin: 0 0 1rem;
}

.ga-ai-log__details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.ga-ai-log--success .ga-ai-log__details {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
}

.ga-ai-log--error .ga-ai-log__details {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.08);
}

.ga-ai-log__summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.ga-ai-log__summary::-webkit-details-marker {
  display: none;
}

.ga-ai-log__summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.15s;
}

.ga-ai-log__details[open] .ga-ai-log__summary::after {
  transform: rotate(180deg);
}

.ga-ai-log__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ga-ai-log__icon--success {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.2);
}

.ga-ai-log__icon--error {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.2);
}

.ga-ai-log__title {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.ga-ai-log__raw {
  margin: 0;
  padding: 0.85rem 1rem;
  max-height: 320px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--bg);
  border-top: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
}

.ga-image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ga-thumb {
  margin: 0;
  width: 72px;
}

.ga-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ga-thumb figcaption {
  font-size: 0.65rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ga-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.ga-tabs__btn {
  margin: 0 0 -1px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.ga-tabs__btn:hover:not(.ga-tabs__btn--active) {
  color: var(--text);
}

.ga-tabs__btn--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.ga-panel__hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ga-status--global {
  margin: 0;
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.ga-status--global:not([hidden]) {
  display: block;
}

.ga-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ga-section > .field__label {
  margin: 0;
}

.ga-section--generated {
  gap: 1rem;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
}

.ga-section--generated > .field__label {
  margin-bottom: 0.25rem;
}

.ga-suggestion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ga-suggestion__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.ga-suggestion__head h3 {
  margin: 0;
  font-size: 0.9rem;
}

.ga-suggestion__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ga-category {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
}

.ga-generated-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.ga-gen-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ga-gen-slot-wrap {
  position: relative;
}

.ga-gen-slot-wrap .ga-gen-slot {
  width: 100%;
}

.ga-gen-slot {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  overflow: hidden;
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.ga-gen-slot:hover {
  border-color: var(--accent);
}

.ga-gen-slot--loading {
  cursor: wait;
  pointer-events: none;
  border-style: solid;
}

.ga-gen-slot--ready {
  border: 1px solid var(--border);
  border-style: solid;
}

.ga-gen-slot__info {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  opacity: 0.9;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.ga-gen-slot__info:hover,
.ga-gen-slot__info:focus-visible {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.ga-gen-slot__info-icon {
  display: block;
}

.ga-gen-slot__tooltip {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 10;
  min-width: 11rem;
  max-width: min(20rem, 92vw);
  padding: 0.5rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  text-align: left;
  white-space: normal;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
}

.ga-gen-slot__info:hover .ga-gen-slot__tooltip,
.ga-gen-slot__info:focus-visible .ga-gen-slot__tooltip {
  opacity: 1;
  visibility: visible;
}

.ga-gen-slot--loading .ga-gen-slot__info {
  pointer-events: auto;
}

.ga-gen-slot__media {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  height: 100%;
  padding: 0.75rem;
  text-align: center;
  box-sizing: border-box;
}

.ga-gen-slot__preview {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
}

.ga-gen-slot__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ga-gen-slot__remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.ga-gen-slot--ready:hover .ga-gen-slot__remove,
.ga-gen-slot--ready:focus-within .ga-gen-slot__remove {
  opacity: 1;
}

.ga-gen-slot__remove:hover {
  background: rgba(220, 38, 38, 0.9);
}

.ga-gen-slot .ga-gen-slot__overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.ga-gen-slot:not(.ga-gen-slot--ready):hover .ga-gen-slot__overlay,
.ga-gen-slot:not(.ga-gen-slot--ready):focus-visible .ga-gen-slot__overlay {
  opacity: 1;
}

.ga-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.ga-lightbox[hidden] {
  display: none;
}

.ga-lightbox__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.ga-lightbox__panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 900px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ga-lightbox__img {
  max-width: 100%;
  max-height: calc(92vh - 3rem);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.ga-lightbox__close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
}

.ga-lightbox__close:hover {
  background: rgba(0, 0, 0, 0.75);
}

body.ga-lightbox-open {
  overflow: hidden;
}

.ga-gen-slot--loading .ga-gen-slot__media {
  color: var(--text-muted);
}

.ga-gen-card--loading .ga-gen-slot {
  border-color: rgba(59, 158, 255, 0.35);
}

.ga-gen-placeholder__icon {
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.45;
}

.ga-gen-placeholder__label {
  font-size: 0.75rem;
  line-height: 1.3;
}

.ga-gen-placeholder__spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ga-spin 0.8s linear infinite;
}

@keyframes ga-spin {
  to {
    transform: rotate(360deg);
  }
}

.ga-gen-card figcaption {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.ga-gen-card--ready figcaption {
  font-weight: 600;
  color: var(--text);
}

.ga-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ga-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  max-width: 440px;
  width: calc(100% - 2rem);
}

.ga-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.ga-dialog__form {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ga-dialog__form h3 {
  margin: 0;
}

.ga-dialog__text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.ga-api-status {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #93c5fd;
  background: rgba(59, 158, 255, 0.08);
  border: 1px solid rgba(59, 158, 255, 0.35);
  border-radius: 8px;
}

.ga-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.field--inline input {
  width: auto;
}

.btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .custos3d__layout {
    grid-template-columns: 1fr;
  }

  .custos3d__inputs {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: none;
    transform: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
  }

  .sidebar__close {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .app-main {
    margin-left: 0;
  }

  .tool-panel {
    padding: 1rem;
  }
}
