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

html, body {
  height: 100%;
}

:root {
  --bg: radial-gradient(circle at top left, #022b1d 0, #02060a 50%, #020308 100%);
  --bg-light: radial-gradient(circle at top left, #e3f9f3 0, #f3f4f6 50%, #ffffff 100%);
  --panel-bg: rgba(9, 19, 23, 0.92);
  --panel-bg-light: #ffffff;
  --border-soft: rgba(0, 255, 194, 0.16);
  --border-soft-light: rgba(15, 118, 110, 0.22);
  --text-main: #ecf7f3;
  --text-main-light: #0b1720;
  --text-muted: #a8c7bd;
  --text-muted-light: #4b5563;
  --accent1: #00d187;
  --accent2: #00ffc2;
  --chip-bg: rgba(0, 0, 0, 0.4);
  --chip-bg-light: #e5f6f3;
}

body {
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

body.light-theme {
  background: var(--bg-light);
  color: var(--text-main-light);
}

.app {
  max-width: 1120px;
  margin: 24px auto;
  padding: 16px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.header-left {
  flex: 1;
}

.logo-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 0;
  border: none;
  background: transparent;
}

.logo-inline-text h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-inline-text p {
  margin-top: 4px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.header-tag span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 194, 0.35);
  background: var(--chip-bg);
  color: #8fffe0;
}

body.light-theme .header-tag span {
  border-color: rgba(16, 185, 129, 0.45);
  background: var(--chip-bg-light);
  color: #047857;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 194, 0.4);
  background: rgba(2, 10, 12, 0.9);
  color: #c7fdf0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.btn-chip:hover {
  background: rgba(0, 255, 194, 0.12);
}

body.light-theme .btn-chip {
  border-color: rgba(5, 150, 105, 0.5);
  background: #ffffff;
  color: #064e3b;
}

body.light-theme .btn-chip:hover {
  background: #ecfdf5;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px;
}

/* página interna: uma coluna só */
.main-grid.main-single {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  background: var(--panel-bg);
  border-radius: 16px;
  padding: 18px 18px 20px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

body.light-theme .panel {
  background: var(--panel-bg-light);
  border-color: var(--border-soft-light);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.panel h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

body.light-theme .section-subtitle {
  color: var(--text-muted-light);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

body.light-theme .field-group label {
  color: var(--text-muted-light);
}

.field-group select,
.field-group input {
  background: rgba(5, 12, 16, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 194, 0.25);
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
}

body.light-theme .field-group select,
body.light-theme .field-group input {
  background: #f9fafb;
  border-color: rgba(15, 118, 110, 0.32);
  color: var(--text-main-light);
}

.field-group select:focus,
.field-group input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(0, 255, 194, 0.22);
}

.btn-primary {
  width: 100%;
  margin: 4px 0 12px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(120deg, var(--accent1), var(--accent2));
  color: #02110a;
  box-shadow: 0 12px 28px rgba(0, 200, 140, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(0, 220, 150, 0.6);
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(0, 180, 120, 0.5);
}

.btn-secondary {
  margin-top: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 194, 0.4);
  background: transparent;
  color: #c7fdf0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-secondary:hover {
  background: rgba(0, 255, 194, 0.08);
}

body.light-theme .btn-secondary {
  border-color: rgba(5, 150, 105, 0.6);
  color: #065f46;
}

body.light-theme .btn-secondary:hover {
  background: #ecfdf5;
}

.output-block {
  margin-top: 10px;
}

.output-block h3 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: #d8f9f0;
}

body.light-theme .output-block h3 {
  color: #0f172a;
}

.output-text {
  font-size: 0.85rem;
  color: #d0e8e1;
  line-height: 1.5;
}

body.light-theme .output-text {
  color: #111827;
}

.output-list {
  list-style: disc;
  padding-left: 16px;
  font-size: 0.85rem;
  color: #d0e8e1;
}

body.light-theme .output-list {
  color: #111827;
}

.output-list li {
  margin-bottom: 4px;
}

.roi-output {
  margin-top: 10px;
}

.roi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 8px;
}

.roi-card {
  background: radial-gradient(circle at top, rgba(0, 255, 194, 0.18), rgba(3, 18, 20, 0.95));
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(0, 255, 194, 0.28);
}

body.light-theme .roi-card {
  background: #ecfdf5;
  border-color: rgba(16, 185, 129, 0.5);
}

.roi-label {
  display: block;
  font-size: 0.75rem;
  color: #a8d2c4;
  margin-bottom: 4px;
}

body.light-theme .roi-label {
  color: #047857;
}

.roi-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.roi-value.destaque {
  font-size: 1.05rem;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 255, 194, 0.12), rgba(0, 0, 0, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.login-card {
  width: 320px;
  max-width: 90%;
  background: rgba(3, 10, 12, 0.96);
  border-radius: 18px;
  padding: 20px 18px 18px;
  border: 1px solid rgba(0, 255, 194, 0.34);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.8);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #020617;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.login-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.login-btn {
  margin-top: 6px;
}

.login-error {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #f97373;
  min-height: 16px;
}

body.light-theme .login-card {
  background: #ffffff;
  border-color: rgba(16, 185, 129, 0.5);
}

/* breakpoint médio: tablet */
@media (max-width: 880px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .app {
    margin: 12px auto 18px;
    padding: 10px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    align-items: flex-start;
  }

  .header-logo {
    width: 80px;
    height: 80px;
  }

  .logo-inline-text h1 {
    font-size: 1.4rem;
  }
}

/* breakpoint pequeno: celular */
@media (max-width: 600px) {
  .app {
    padding: 8px;
  }

  .header-logo {
    width: 64px;
    height: 64px;
  }

  .logo-inline-text h1 {
    font-size: 1.2rem;
  }

  .logo-inline-text p {
    font-size: 0.8rem;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .btn-chip {
    font-size: 0.7rem;
    padding: 5px 8px;
  }

  .panel {
    padding: 14px 12px 16px;
  }

  .roi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media print {
  body {
    background: #ffffff;
  }
  .login-overlay {
    display: none !important;
  }
  .header-actions,
  .btn-primary,
  .btn-secondary {
    display: none !important;
  }
  .app {
    max-width: 100%;
    margin: 0;
    padding: 0 12mm;
  }
}

/* restos do modo apresentação (se ainda usar em alguma tela) */
body.presentation-mode .main-grid {
  grid-template-columns: minmax(0, 1fr);
}

body.presentation-mode #panelDiscurso {
  display: none;
}

body.presentation-mode #btnExportDiscursoPdf,
body.presentation-mode #btnExportRoiPdf,
body.presentation-mode #btnCopiarDiscurso,
body.presentation-mode #btnCopiarRoi,
body.presentation-mode .header-tag {
  display: none;
}

body.presentation-mode .logo-inline-text p {
  display: none;
}
