:root {
  /* Paleta clara, estilo iOS (systemGroupedBackground / systemBlue / etc.) */
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-elevated-solid: #ffffff;
  --bg-input: #ecebf1;
  --border: rgba(60, 60, 67, 0.14);
  --border-strong: rgba(60, 60, 67, 0.26);
  --text: #1c1c1e;
  --text-dim: #6e6e73;
  --text-faint: #aeaeb2;

  --violet: #5856d6;
  --violet-2: #7d7aff;
  --cyan: #32ade6;

  --accent: #007aff;
  --accent-hover: #0066d6;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --gradient: var(--accent);
  --gradient-text: var(--accent);

  --azul: #0a84ff;
  --azul-soft: rgba(10, 132, 255, 0.12);

  --success: #34c759;
  --success-soft: rgba(52, 199, 89, 0.14);
  --warning: #ff9500;
  --warning-soft: rgba(255, 149, 0, 0.14);
  --error: #ff3b30;
  --error-soft: rgba(255, 59, 48, 0.12);

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);

  --dock-width: 260px;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px -8px rgba(0, 0, 0, 0.1);
  --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.18);

  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Paleta escura, estilo iOS Dark Mode */
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-elevated-solid: #1c1c1e;
  --bg-input: #2c2c2e;
  --border: rgba(84, 84, 88, 0.55);
  --border-strong: rgba(84, 84, 88, 0.75);
  --text: #f5f5f7;
  --text-dim: #98989f;
  --text-faint: #636366;

  --violet: #7d7aff;
  --violet-2: #9f9dff;
  --cyan: #64d2ff;

  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.22);
  --gradient: var(--accent);
  --gradient-text: var(--accent);

  --azul: #0a84ff;
  --azul-soft: rgba(10, 132, 255, 0.2);

  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.18);
  --warning: #ff9f0a;
  --warning-soft: rgba(255, 159, 10, 0.18);
  --error: #ff453a;
  --error-soft: rgba(255, 69, 58, 0.18);

  --glass-bg: rgba(40, 40, 43, 0.6);
  --glass-border: rgba(255, 255, 255, 0.12);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px -8px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 12px 40px -8px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

:root[data-theme="dark"] .logo-selo img {
  filter: brightness(0) invert(1) opacity(0.92);
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(60, 60, 67, 0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 60, 67, 0.36);
  background-clip: content-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.app-shell {
  display: block;
  min-height: 100vh;
  padding: 18px;
}

/* ---------------------------------------------------------------------- */
/* Main area                                                                */
/* ---------------------------------------------------------------------- */

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 18px;
}

header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  padding: 4px 2px;
  justify-self: start;
}

.logo-selo {
  display: inline-flex;
  align-items: center;
}

.logo-selo img {
  display: block;
  height: 30px;
  width: auto;
}

/* ---------------------------------------------------------------------- */
/* Mac Dock — barra de ícones flutuante, canto superior esquerdo            */
/* ---------------------------------------------------------------------- */

.mac-dock {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(1.9);
  -webkit-backdrop-filter: blur(30px) saturate(1.9);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.6) inset,
    0 24px 48px -16px rgba(0, 0, 0, 0.3),
    0 4px 12px -4px rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  width: auto;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn:hover {
  transform: translateY(-6px) scale(1.12);
}

.nav-btn .nav-label {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28, 28, 30, 0.9);
  color: white;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 5;
}

.nav-btn:hover .nav-label {
  opacity: 1;
}

.nav-btn::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0;
}

.nav-btn.active::after {
  opacity: 1;
  background: var(--accent);
}

.nav-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 2px 5px -1px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(255, 255, 255, 0.4) inset;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
}

.nav-icon-blue { background: linear-gradient(160deg, #3aa2ff, #007aff); }
.nav-icon-graphite { background: linear-gradient(160deg, #7d7d82, #636366); }
.nav-icon-purple { background: linear-gradient(160deg, #c777ea, #af52de); }
.nav-icon-red { background: linear-gradient(160deg, #ff6a60, #ff3b30); }
.nav-icon-orange { background: linear-gradient(160deg, #ffab40, #ff9500); }
.nav-icon-yellow { background: linear-gradient(160deg, #ffd93d, #ffcc00); }
.nav-icon-teal { background: linear-gradient(160deg, #5cc3f2, #32ade6); }
.nav-icon-indigo { background: linear-gradient(160deg, #7a78e8, #5856d6); }
.nav-icon-brown { background: linear-gradient(160deg, #b89773, #a2845e); }
.nav-icon-pink { background: linear-gradient(160deg, #ff6482, #ff2d55); }
.nav-icon-gray { background: linear-gradient(160deg, #a5a5aa, #8e8e93); }
.nav-icon-green { background: linear-gradient(160deg, #5cd97e, #34c759); }

.nav-divider {
  width: 1px;
  height: 34px;
  background: rgba(60, 60, 67, 0.22);
  margin: 0 2px;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
  flex-wrap: wrap;
}

.dock-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(1.9);
  -webkit-backdrop-filter: blur(30px) saturate(1.9);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-nome {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.user-sub {
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

header .status {
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 9px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(1.9);
  -webkit-backdrop-filter: blur(30px) saturate(1.9);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.bell {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--glass-bg);
  backdrop-filter: blur(30px) saturate(1.9);
  -webkit-backdrop-filter: blur(30px) saturate(1.9);
  border: 1px solid var(--glass-border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease;
  box-shadow: var(--shadow-card);
}

.bell:hover {
  background: rgba(255, 255, 255, 0.8);
}

.bell svg {
  width: 17px;
  height: 17px;
}

main {
  padding: 0 2px 4px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.app-footer {
  padding: 14px 22px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---------------------------------------------------------------------- */
/* Dashboard — cards claros, sombra suave                                   */
/* ---------------------------------------------------------------------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.laranja {
  background: #ff9500;
  color: white;
}

.stat-icon.azul {
  background: #007aff;
  color: white;
}

.stat-icon.claro {
  background: #34c759;
  color: white;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0 0 4px 0;
  font-size: 17px;
}

.link-ver-todos {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}

.link-ver-todos:hover {
  text-decoration: underline;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-icon svg {
  width: 15px;
  height: 15px;
}

.timeline-texto {
  flex: 1;
  min-width: 0;
}

.timeline-titulo {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.timeline-data {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.sugestao-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.sugestao-item:last-child {
  border-bottom: none;
}

.sugestao-texto {
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.sugestao-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sugestao-tag {
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- */
/* Formulários / cards genéricos (Chat, Pesquisa, Segundo Cérebro etc.)     */
/* ---------------------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  background: var(--bg-elevated);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

button {
  font-family: inherit;
}

button.primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: filter 0.12s ease, transform 0.08s ease;
}

button.primary:hover {
  filter: brightness(1.08);
}

button.primary:active {
  transform: scale(0.98);
}

button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: rgba(120, 120, 128, 0.12);
  color: var(--accent);
  border: none;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
}

button.secondary:hover {
  background: rgba(120, 120, 128, 0.2);
}

button.perigo {
  background: transparent;
  color: var(--error);
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

button.perigo:hover {
  background: var(--error-soft);
}

button.perigo:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card {
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 6px;
}

.tag.gatilho {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag.estrutura {
  background: var(--success-soft);
  color: #248a3d;
}

.tag.status-aprovado {
  background: var(--success-soft);
  color: #248a3d;
}

.tag.status-pendente {
  background: var(--warning-soft);
  color: #c76f00;
}

.bloco {
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--bg-input);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.bloco .nome {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 4px;
}

.bloco .texto {
  font-size: 14px;
  line-height: 1.5;
}

.analise {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--accent-soft);
}

.analise-titulo {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.contador {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-input);
}

.contador.ok {
  color: #248a3d;
  background: var(--success-soft);
}

.contador.aviso {
  color: #c76f00;
  background: var(--warning-soft);
}

.loading {
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px 0;
}

.erro {
  color: var(--error);
  font-size: 13px;
  padding: 10px 14px;
  background: var(--error-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin: 10px 0;
}

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.form-row input {
  flex: 1;
}

label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 5px;
  font-weight: 500;
}

.field {
  margin-bottom: 14px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.subsecao {
  margin-bottom: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
}

.acoes-roteiro {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.revisao-roteiro {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  background: var(--bg-input);
}

.revisao-roteiro .acoes-revisao {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.subsecao h2 {
  font-size: 17px;
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.pequeno {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------------- */
/* Switch estilo iOS (usado em Configurações → Aparência)                  */
/* ---------------------------------------------------------------------- */

.linha-opcao {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
}

.linha-opcao label {
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
  font-weight: 500;
}

.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

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

.ios-switch-track {
  position: absolute;
  inset: 0;
  background: rgba(120, 120, 128, 0.32);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ios-switch-track::before {
  content: "";
  position: absolute;
  height: 27px;
  width: 27px;
  left: 2px;
  top: 2px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.ios-switch input:checked + .ios-switch-track {
  background: var(--success);
}

.ios-switch input:checked + .ios-switch-track::before {
  transform: translateX(20px);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }
  .main-area {
    gap: 12px;
  }
  header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .logo {
    justify-self: auto;
  }
  .mac-dock {
    justify-self: auto;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .topbar-right {
    justify-self: auto;
    justify-content: space-between;
  }
  .nav-icon {
    width: 38px;
    height: 38px;
  }
  .nav-btn .nav-label {
    display: none;
  }
  .stats-row,
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------- */
/* Autenticação (login, cadastro, onboarding) — páginas fora da SPA         */
/* ---------------------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px;
  box-shadow: var(--shadow-pop);
}

.auth-card.largo {
  max-width: 560px;
}

.auth-logo {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.logo-selo.grande img {
  height: 42px;
}

.auth-card h1 {
  font-size: 26px;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.auth-card .subtitulo {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 26px;
  line-height: 1.5;
}

.auth-rodape {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.auth-rodape a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-rodape a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------- */
/* Bibliotecas Virais — grid de cards + modal de detalhe                   */
/* ---------------------------------------------------------------------- */

.grid-virais {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.viral-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease;
}

.viral-card:hover {
  transform: translateY(-3px);
}

.viral-card-capa {
  position: relative;
  aspect-ratio: 9 / 14;
  background: var(--bg-input);
}

.viral-card-capa img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.viral-card-autor {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.viral-card-titulo {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 7px;
  border-radius: 8px;
  line-height: 1.3;
  max-height: 3.9em;
  overflow: hidden;
}

.viral-card-metricas {
  display: flex;
  justify-content: space-between;
  padding: 9px 10px 0 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.viral-card-rodape {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
}

.viral-card-origem {
  padding: 0 10px 10px 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-caixa {
  background: var(--bg-elevated-solid);
  border: 1px solid var(--border);
  border-radius: 22px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 26px;
  box-shadow: var(--shadow-pop);
}

.modal-fechar {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(120, 120, 128, 0.12);
  border: none;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 11px;
}

.modal-fechar:hover {
  background: rgba(120, 120, 128, 0.2);
  color: var(--text);
}

.modal-corpo {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}

.modal-coluna-video img {
  width: 100%;
  border-radius: var(--radius);
  background: var(--bg-input);
  aspect-ratio: 9 / 14;
  object-fit: cover;
  margin-bottom: 10px;
}

.modal-coluna-info h3 {
  margin: 18px 0 8px 0;
  font-size: 12.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-coluna-info h3:first-of-type {
  margin-top: 0;
}

.modal-metricas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 14px;
}

@media (max-width: 640px) {
  .modal-corpo {
    grid-template-columns: 1fr;
  }
  .modal-metricas {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------------------------------------------------------------------- */
/* Roteiros colapsáveis (aba Histórico) — "Saiba mais"                     */
/* ---------------------------------------------------------------------- */

.oculto {
  display: none;
}

.roteiro-colapsavel {
  background: var(--bg-input);
  margin-bottom: 10px;
}

.roteiro-resumo h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
}

.roteiro-resumo p {
  margin: 6px 0 10px 0;
}

.roteiro-detalhe {
  margin-top: 12px;
}

.roteiro-detalhe .card {
  background: var(--bg-elevated-solid);
  border: 1px solid var(--border);
}

/* ---------------------------------------------------------------------- */
/* Estúdio (chat citando perfil/post de referência) — bolhas estilo iMessage */
/* ---------------------------------------------------------------------- */

.chat-mensagens {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.msg-usuario {
  align-self: flex-end;
  max-width: 80%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
}

.msg-usuario * {
  color: white;
}

.msg-assistente {
  align-self: flex-start;
  max-width: 92%;
  background: var(--bg-input);
  border: none;
  border-radius: 18px 18px 18px 4px;
  padding: 16px;
}

.citacao-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: none;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.citacao-chip button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

.campo-linha {
  display: flex;
  gap: 12px;
}

.estagio-titulo {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 0 8px 0;
}

.estagio-titulo:first-child {
  margin-top: 0;
}

.tabela-estagio {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 6px;
}

.tabela-estagio th,
.tabela-estagio td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
}

.tabela-estagio th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
}

.citar-resultado-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}

.citar-resultado-item:hover {
  background: var(--bg-input);
}

#modal-citar-referencia .modal-caixa {
  max-width: 520px;
}

.modal-corpo-coluna {
  display: flex;
  flex-direction: column;
}
