/* ==========================================================================
   Wingene Vida PWA - Estilos e Design System Moderno
   ========================================================================== */

:root {
  /* Paleta Base / Tema Escuro Premium */
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-surface-hover: #26354a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Pilares do Método VIDA */
  --pilar-v: #10b981; /* Valores - Esmeralda */
  --pilar-v-bg: rgba(16, 185, 129, 0.12);
  --pilar-i: #f43f5e; /* Imperfeições - Rubi */
  --pilar-i-bg: rgba(244, 63, 94, 0.12);
  --pilar-d: #6366f1; /* Decisões - Índigo */
  --pilar-d-bg: rgba(99, 102, 241, 0.12);
  --pilar-a: #f59e0b; /* Atenção - Dourado */
  --pilar-a-bg: rgba(245, 158, 11, 0.12);

  /* Destaque de IA / Tutor da Vida */
  --ai-accent: #a855f7;
  --ai-glow: rgba(168, 85, 247, 0.18);
  --ai-gradient: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(59, 130, 246, 0.15));

  /* Dimensões & Sombras */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
}

/* ─── Telas Principais (Lock Screen vs App Principal) ────────────────────────── */

.hidden {
  display: none !important;
}

.screen {
  opacity: 1;
  transition: opacity var(--transition-smooth);
}

.screen.hidden {
  display: none !important;
}

/* ─── Tela de Bloqueio / Autenticação ────────────────────────────────────────── */

.lock-screen-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at top center, #1e293b 0%, #0b0f19 75%);
}

.lock-card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  text-align: center;
  animation: slideUpFade 0.4s ease-out;
}

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

.app-brand {
  margin-bottom: 1.5rem;
}

.app-brand img.app-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.app-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
  margin-top: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
  font-family: inherit;
}

textarea {
  width: 100%;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 1rem 1.15rem;
  font-size: 0.98rem;
  line-height: 1.6;
  box-sizing: border-box;
  resize: vertical;
  transition: all var(--transition-fast);
  outline: none;
  font-family: inherit;
}

#entryConteudo {
  min-height: 180px;
  padding: 1.15rem 1.25rem;
  font-size: 1.02rem;
  line-height: 1.65;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  resize: vertical;
}

.form-row-2col {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

@media (min-width: 641px) {
  .form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.15rem;
    align-items: flex-start;
  }
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #38bdf8;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
}

.btn-danger {
  background: #e11d48;
  color: #fff;
}

.btn-danger:hover {
  background: #be123c;
}

.btn-sm {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.error-banner {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ─── App Header ─────────────────────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.25rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.header-brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

.header-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-title-group span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Layout do Conteúdo Principal ───────────────────────────────────────────── */

.main-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 5rem 1.25rem;
}

/* ─── Toolbar / Filtros & Busca ──────────────────────────────────────────────── */

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-bar-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar-wrap input {
  padding-left: 2.75rem;
  border-radius: 9999px;
  background-color: var(--bg-surface);
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.pilar-filter-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
}

.pilar-filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.filter-chip.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.filter-chip.chip-v.active {
  background: var(--pilar-v);
  color: #022c22;
  border-color: var(--pilar-v);
}

.filter-chip.chip-i.active {
  background: var(--pilar-i);
  color: #4c0519;
  border-color: var(--pilar-i);
}

.filter-chip.chip-d.active {
  background: var(--pilar-d);
  color: #1e1b4b;
  border-color: var(--pilar-d);
}

.filter-chip.chip-a.active {
  background: var(--pilar-a);
  color: #451a03;
  border-color: var(--pilar-a);
}

.summary-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

/* ─── Lista de Entradas ──────────────────────────────────────────────────────── */

.entries-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.entry-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.entry-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.entry-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.entry-card.pilar-v::before { background-color: var(--pilar-v); }
.entry-card.pilar-i::before { background-color: var(--pilar-i); }
.entry-card.pilar-d::before { background-color: var(--pilar-d); }
.entry-card.pilar-a::before { background-color: var(--pilar-a); }

.entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entry-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pilar-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pilar-badge.pilar-v { background: var(--pilar-v-bg); color: var(--pilar-v); }
.pilar-badge.pilar-i { background: var(--pilar-i-bg); color: var(--pilar-i); }
.pilar-badge.pilar-d { background: var(--pilar-d-bg); color: var(--pilar-d); }
.pilar-badge.pilar-a { background: var(--pilar-a-bg); color: var(--pilar-a); }

.impacto-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.impacto-badge.positivo {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.impacto-badge.negativo {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.impacto-badge.neutro {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.entry-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.entry-content {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 0.85rem;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.tag-chip {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ─── Card Destaque de IA (Somente Leitura) ─────────────────────────────────── */

.ai-insight-box {
  background: var(--ai-gradient);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-top: 0.85rem;
  position: relative;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #c084fc;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ai-badge-readonly {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.ai-comment {
  font-size: 0.92rem;
  color: #e2e8f0;
  font-style: italic;
  line-height: 1.6;
}

.ai-keyword-tag {
  display: inline-block;
  margin-top: 0.5rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
}

.ai-observation {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-left: 2px solid #a855f7;
  padding-left: 0.6rem;
}

.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

/* ─── Estado Vazio ───────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0.75rem 0 0.5rem 0;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 380px;
  margin: 0 auto 1.5rem auto;
}

/* ─── Botão Flutuante de Nova Entrada ────────────────────────────────────────── */

.fab-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border: none;
  border-radius: 9999px;
  padding: 0.85rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 40;
}

.fab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.5);
}

/* ─── Modais ─────────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 100;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

#drivePasswordModal {
  z-index: 1200 !important;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: slideUpFade 0.25s ease-out;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ─── Seletor Visual de Pilares ──────────────────────────────────────────────── */

.pilar-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.pilar-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0.25rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.pilar-option span.letter {
  font-size: 1.2rem;
  font-weight: 800;
}

.pilar-option span.name {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pilar-option.opt-v { color: var(--pilar-v); }
.pilar-option.opt-i { color: var(--pilar-i); }
.pilar-option.opt-d { color: var(--pilar-d); }
.pilar-option.opt-a { color: var(--pilar-a); }

.pilar-option.selected {
  background: rgba(255, 255, 255, 0.08);
}

.pilar-option.opt-v.selected { border-color: var(--pilar-v); }
.pilar-option.opt-i.selected { border-color: var(--pilar-i); }
.pilar-option.opt-d.selected { border-color: var(--pilar-d); }
.pilar-option.opt-a.selected { border-color: var(--pilar-a); }

/* ─── Seletor de Impacto (-5 a +5) ───────────────────────────────────────────── */

.impacto-range-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 44px;
}

.impacto-range-wrap input[type="range"] {
  flex: 1;
  accent-color: #38bdf8;
}

.impacto-val-display {
  min-width: 44px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

/* ─── Responsividade ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .header-actions .btn-text {
    display: none;
  }

  .pilar-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  .fab-btn span.fab-text {
    display: none;
  }

  .fab-btn {
    padding: 1rem;
    border-radius: 50%;
  }
}

/* ─── Editor de Tela Cheia (Fullscreen Editor) ───────────────────────────────── */

.fullscreen-editor-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-main);
  z-index: 120;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.fullscreen-editor-screen.hidden {
  display: none !important;
}

/* Header do Editor */
.editor-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  gap: 1rem;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.editor-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-title-wrap h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-title-wrap .editor-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.editor-header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn-extra-options {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.extra-options-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}

.extra-options-badge.hidden {
  display: none !important;
}

.btn-save-entry {
  padding: 0.45rem 1.15rem;
  font-weight: 600;
}

/* Barra de Contexto Imediata (Pilar VIDA, Data/Hora e Propósito) */
.editor-context-bar {
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
  flex-shrink: 0;
}

.editor-context-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.editor-context-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.context-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.editor-context-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

/* Seletor Compacto de Pilares */
.pilar-selector-compact {
  display: flex;
  gap: 0.35rem;
}

.pilar-selector-compact .pilar-option {
  padding: 0.35rem 0.75rem;
  flex-direction: row;
  gap: 0.4rem;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1.5px solid transparent;
}

.pilar-selector-compact .pilar-option span.letter {
  font-size: 0.95rem;
  font-weight: 800;
}

.pilar-selector-compact .pilar-option span.name {
  font-size: 0.8rem;
  font-weight: 600;
}

/* Inputs da Barra de Contexto */
.editor-input-wrapper {
  display: flex;
  align-items: center;
}

.editor-inline-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.editor-inline-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.editor-proposito-group {
  flex: 1;
  min-width: 200px;
  max-width: 440px;
}

.editor-proposito-group .label-with-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.editor-proposito-group select {
  width: 100%;
}

/* Workspace de Escrita (Aproveitamento Máximo) */
.editor-workspace {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
  background: var(--bg-main);
  min-height: 0;
}

.editor-main-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-height: 0;
}

.editor-textarea-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0.75rem;
  height: 100%;
  min-height: 0;
}

/* Caixa de Escrita Imersiva */
#entryConteudo {
  width: 100%;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 1.5rem 1.75rem;
  font-size: 1.12rem;
  line-height: 1.75;
  box-sizing: border-box;
  resize: none;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
}

#entryConteudo:focus {
  border-color: var(--border-focus);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(56, 189, 248, 0.15);
}

#entryConteudo::placeholder {
  color: #475569;
  font-style: italic;
}

/* Barra de Contagem de Palavras / Status */
.editor-wordcount-bar {
  padding: 0.4rem 1.5rem 0.65rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Drawer de Outras Opções */
.editor-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.22s ease-out;
}

.editor-drawer.hidden {
  display: none !important;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.editor-drawer-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-drawer-header h4 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.editor-drawer-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.editor-drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}

.drawer-backdrop.hidden {
  display: none !important;
}

/* Responsividade do Editor */
@media (max-width: 768px) {
  .editor-header {
    padding: 0 0.85rem;
    height: 56px;
  }

  .editor-header-left {
    gap: 0.5rem;
  }

  .editor-title-wrap h2 {
    font-size: 1.05rem;
  }

  .editor-title-wrap .editor-subtitle {
    display: none;
  }

  .editor-context-bar {
    padding: 0.6rem 0.85rem;
  }

  .editor-context-inner {
    gap: 0.65rem;
  }

  .editor-context-divider {
    display: none;
  }

  .pilar-selector-compact {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .pilar-selector-compact .pilar-option {
    padding: 0.35rem 0.2rem;
    justify-content: center;
  }

  .pilar-selector-compact .pilar-option span.name {
    display: none;
  }

  .editor-date-group,
  .editor-proposito-group {
    width: 100%;
    max-width: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }

  .editor-date-group .editor-input-wrapper,
  .editor-proposito-group .editor-input-wrapper {
    width: 100%;
  }

  .editor-date-group input,
  .editor-proposito-group select {
    width: 100%;
  }

  .editor-textarea-container {
    padding: 0.75rem 0.85rem 0.5rem;
  }

  #entryConteudo {
    padding: 1.15rem 1rem;
    font-size: 1.02rem;
  }

  .editor-wordcount-bar {
    padding: 0.35rem 0.85rem 0.5rem;
  }

  .editor-drawer {
    width: 100%;
    max-width: 100vw;
  }
}

/* ─── Estilos do Google Drive & Toast ────────────────────────────────────────── */

#btnDriveSync.connected {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}

#btnDriveSync.connected:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

#btnDriveSync.connected:active {
  transform: scale(0.97);
}

#btnDriveSync.syncing {
  pointer-events: none;
  opacity: 0.85;
}

.spin-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #f8fafc;
  padding: 0.75rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notice.toast-hiding {
  opacity: 0;
  transform: translate(-50%, 15px);
}

.toast-notice.hidden {
  display: none !important;
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 15px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ─── Propósitos no PWA (Seletor & Badges) ────────────────────────────────── */

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.btn-text-action {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color var(--transition-fast);
}

.btn-text-action:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.proposito-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proposito-badge svg {
  flex-shrink: 0;
}

.proposito-badge.pilar-v {
  background: var(--pilar-v-bg);
  color: var(--pilar-v);
  border-color: rgba(16, 185, 129, 0.3);
}

.proposito-badge.pilar-i {
  background: var(--pilar-i-bg);
  color: var(--pilar-i);
  border-color: rgba(244, 63, 94, 0.3);
}

.proposito-badge.pilar-d {
  background: var(--pilar-d-bg);
  color: var(--pilar-d);
  border-color: rgba(99, 102, 241, 0.3);
}

.proposito-badge.pilar-a {
  background: var(--pilar-a-bg);
  color: var(--pilar-a);
  border-color: rgba(245, 158, 11, 0.3);
}



