/* ==========================================================================
   MIA - ASSISTENTE DE MEMÓRIA
   NOVO DESIGN SYSTEM PREMIUM, PROFISSIONAL E ACESSÍVEL
   ========================================================================== */

/* 1. VARIÁVEIS DE DESIGN & TOKENS DE ESTILO */
:root {
  color-scheme: light;
  
  /* Paleta de Cores Harmônica e Contraste Acessível (WCAG AA/AAA) */
  --bg: #F9F8F5;
  --bg-gradient: radial-gradient(circle at 80% 10%, #FDFDFB 0%, #F2EFF7 100%);
  --surface: #FFFFFF;
  --surface-strong: #FCFAF7;
  --surface-glass: rgba(255, 255, 255, 0.75);
  
  --ink: #192623;
  --muted: #536360;
  --line: #E2ECE8;
  --line-focus: #147B78;
  
  /* Cores de Ação (Teal / Coral / Ouro) */
  --teal-light: #1C8C88;
  --teal: #0F5B58;
  --teal-dark: #073B39;
  --teal-gradient: linear-gradient(135deg, #1C8C88 0%, #0F5B58 100%);
  
  --coral: #D36D53;
  --coral-light: #FDF1EE;
  --coral-dark: #8C3E2D;
  
  --sage: #E3ECE1;
  --sage-dark: #2A4742;
  --sage-gradient: linear-gradient(135deg, #E3ECE1 0%, #D4E0D1 100%);
  
  --gold: #F5CE7A;
  --gold-light: #FEF8EC;
  --gold-dark: #785A1D;
  
  --danger: #C5443B;
  --danger-light: #FDF3F2;
  
  /* Efeitos e Sombras Premium */
  --shadow-sm: 0 2px 8px rgba(25, 38, 35, 0.04);
  --shadow-md: 0 10px 30px -5px rgba(25, 38, 35, 0.05), 0 4px 12px -2px rgba(25, 38, 35, 0.02);
  --shadow-lg: 0 20px 40px -10px rgba(25, 38, 35, 0.08), 0 8px 20px -6px rgba(25, 38, 35, 0.04);
  --shadow-glow: 0 0 0 3px rgba(15, 91, 88, 0.15);
  
  /* Border Radius Refinados */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Fontes Modernas */
  --font-headings: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* 2. CONFIGURAÇÕES GLOBAIS E RESET */
* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  font-size: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headings);
  font-weight: 700;
  margin-top: 0;
  color: var(--ink);
}

h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Ocultação Padrão */
.hidden {
  display: none !important;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

/* Transições Globais Refinadas */
.nav-tab,
.primary-button,
.soft-button,
.danger-button,
.small-button,
.memory-card,
input,
textarea,
select {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 3. BOTÕES E CAMPOS DE ENTRADA (FORMULÁRIOS) */
input,
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  font-family: var(--font-body);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--line-focus);
  box-shadow: var(--shadow-glow);
  background: #FFFFFF;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-headings);
  font-size: 0.95rem;
}

button {
  cursor: pointer;
  border: none;
  font-family: var(--font-headings);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Estilos de Botões */
.primary-button,
.soft-button,
.danger-button,
.provider-button,
.quick-prompts button {
  min-height: 48px;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.primary-button {
  background: var(--teal-gradient);
  color: #FFFFFF;
  border: 1px solid rgba(15, 91, 88, 0.1);
}

.primary-button:hover:not(:disabled) {
  background: var(--teal-dark);
  box-shadow: 0 4px 12px rgba(15, 91, 88, 0.25);
  transform: translateY(-1px);
}

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

.soft-button,
.quick-prompts button {
  background: var(--sage);
  color: var(--teal-dark);
  border: 1px solid #CBD8C4;
}

.soft-button:hover:not(:disabled),
.quick-prompts button:hover:not(:disabled) {
  background: #D4E0D1;
  color: var(--teal-dark);
  transform: translateY(-1px);
}

.soft-button:active:not(:disabled),
.quick-prompts button:active:not(:disabled) {
  transform: scale(0.98);
}

.danger-button {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #E4B6AD;
}

.danger-button:hover:not(:disabled) {
  background: #FFE5E2;
  color: #A02E26;
  transform: translateY(-1px);
}

.text-button {
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.text-button:hover {
  background: var(--sage);
  color: var(--teal-dark);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Botões de Autenticação */
.provider-button {
  width: 100%;
  background: #FFFFFF;
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.provider-button:hover:not(:disabled) {
  background: var(--surface-strong);
  border-color: #A0B3AE;
  transform: translateY(-1px);
}

.google-signin-slot {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Forçar o iframe do SDK do Google a ocupar 100% da largura do slot */
.google-signin-slot > div,
.google-signin-slot iframe {
  width: 100% !important;
  min-width: 0 !important;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.local-button {
  width: 100%;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-style: dashed;
}

.google-signin-slot > div {
  width: 100% !important;
}

/* Foco Visível para Teclado (Acessibilidade) */
.primary-button:focus-visible,
.soft-button:focus-visible,
.danger-button:focus-visible,
.text-button:focus-visible,
.provider-button:focus-visible,
.nav-tab:focus-visible,
.small-button:focus-visible,
.safety-button:focus-visible {
  outline: 3px solid var(--line-focus);
  outline-offset: 3px;
}

/* 4. TELAS DE ACESSO (LOGIN E DESBLOQUEIO) */
/* ── Tela de Login ─────────────────────────────── */

.signup-view {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px);
  min-height: 100vh;
}

/* Painel esquerdo — identidade da marca */
.signup-hero {
  background: linear-gradient(150deg, #0a3d3b 0%, #176b68 55%, #1e8a82 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 8vw, 80px);
  position: relative;
  overflow: hidden;
}

/* Círculos decorativos sutis */
.signup-hero::before,
.signup-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}
.signup-hero::before {
  width: 520px; height: 520px;
  top: -160px; right: -140px;
}
.signup-hero::after {
  width: 360px; height: 360px;
  bottom: -120px; left: -80px;
}

.signup-hero-content {
  position: relative;
  z-index: 1;
  max-width: 500px;
  width: 100%;
}

.signup-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 48px;
}

.signup-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  object-position: center 18%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.signup-eyebrow-label {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.signup-brand-name {
  font-family: var(--font-headings);
  font-size: 2rem;
  font-weight: 900;
  color: white;
  line-height: 1;
}

.signup-tagline {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  color: white;
  margin: 0 0 44px;
  font-family: var(--font-headings);
}

.signup-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.signup-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.45;
}

.signup-benefits li::before {
  content: "✓";
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: white;
  margin-top: 2px;
}

/* Painel direito — formulário de login */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 6vw, 64px) clamp(32px, 5vw, 56px);
  background: var(--bg);
  border-left: 1px solid var(--line);
}

.unlock-panel {
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-panel-header {
  margin-bottom: 28px;
}

.auth-panel h2 {
  font-family: var(--font-headings);
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--ink);
}

.unlock-panel h1 {
  font-family: var(--font-headings);
  font-weight: 800;
  margin-bottom: 12px;
}

.auth-status {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  max-width: 400px; /* limite máximo do SDK do Google */
}

.profile-completion {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-completion h3 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

/* Tela Desbloquear PIN */
.unlock-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.unlock-avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 3px solid var(--sage);
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}

.unlock-panel {
  width: min(100%, 460px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unlock-panel label {
  width: 100%;
  text-align: left;
  margin-bottom: 16px;
}

.unlock-panel h1 {
  font-size: 2rem;
  line-height: 1.2;
}

/* 5. ESTRUTURA DO APLICATIVO PRINCIPAL (LAYOUT) */
.main-view {
  display: flex;
  min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 290px;
  padding: 30px 24px;
  background: var(--surface-strong);
  border-right: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}

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

.brand-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--sage);
  box-shadow: var(--shadow-sm);
}

.brand h2 {
  font-size: 1.4rem;
  margin-bottom: 0;
  font-weight: 800;
}

.brand p {
  margin-bottom: 0;
}

/* Abas de Navegação */
.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: left;
}

.nav-tab:hover {
  background: var(--sage);
  color: var(--teal-dark);
}

.nav-tab.active {
  background: var(--teal-gradient);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.nav-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botões de Segurança na Sidebar */
.safety-button {
  background: #FFF9E6;
  border: 2.5px solid #F3C45E;
  color: #61460A;
  border-radius: var(--radius-md);
  font-weight: 900;
  padding: 14px 18px;
  min-height: 58px;
  width: 100%;
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}

.safety-button:hover {
  background: #FEEFB3;
  color: #4C3707;
}

.comfort-button {
  background: var(--teal);
  color: #FFFFFF;
  font-weight: 800;
  border-radius: var(--radius-md);
  min-height: 48px;
  width: 100%;
}

.comfort-button:hover {
  background: var(--teal-dark);
}

/* Caixas de Acessibilidade */
.access-box {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
}

.toggle-row input {
  width: 22px;
  height: 22px;
  margin: 0;
  cursor: pointer;
}

/* Área de Conteúdo */
.content {
  margin-left: 290px;
  flex: 1;
  padding: clamp(24px, 5vw, 48px);
  max-width: 1200px;
}

/* Barra Superior */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 20px;
  border-bottom: 1.5px solid var(--line);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-avatar {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--sage);
  box-shadow: var(--shadow-md);
}

.topbar h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  margin-bottom: 0;
  color: var(--teal-dark);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-chip {
  padding: 8px 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 6. PAINÉIS E CARDS DE CONTEÚDO */
.panel {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-md);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading h2 {
  font-size: 1.5rem;
  margin-bottom: 0;
  font-weight: 800;
}

.search-input {
  max-width: 280px;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.95rem;
}

/* Grade de Layout */
.home-layout,
.workbench,
.assistant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: start;
}

/* settingsView: Perfil tem mais campos — precisa de mais espaço que Conta */
#settingsView .workbench {
  grid-template-columns: minmax(0, 0.55fr) minmax(0, 1.45fr);
}

/* 7. PAINEL DE PRÓXIMA AÇÃO */
.next-action-card {
  background: var(--sage-gradient);
  border: 2px solid #CBD8C4;
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.next-action-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  pointer-events: none;
}

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

.next-action-card h2 {
  font-size: 1.4rem;
  color: var(--sage-dark);
  font-weight: 800;
  margin-bottom: 2px;
}

.next-action-instruction {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.4;
  color: var(--ink);
  margin-bottom: 20px;
}

.status-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--teal-dark);
  border: 1px solid #CBD8C4;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
}

/* Regra de Segurança do Próximo Passo */
.next-action-safety,
.routine-safety-summary {
  background: var(--coral-light);
  border-left: 5px solid var(--coral);
  color: var(--coral-dark);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* Controles de Rotina */
.next-action-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.next-action-controls button,
.next-action-controls .safety-button {
  flex: 1;
  min-width: 140px;
  min-height: 52px;
  font-size: 1.05rem;
}

/* 8. CARDS DE RESUMO DO TOPO */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.summary-icon {
  width: 32px;
  height: 32px;
  color: var(--teal);
  margin-bottom: 12px;
  stroke-width: 2;
}

.summary-card span {
  display: block;
  font-size: 2.2rem;
  font-family: var(--font-headings);
  font-weight: 900;
  color: var(--teal-dark);
  line-height: 1;
  margin-bottom: 6px;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.summary-card.accent {
  background: var(--gold-light);
  border-color: #ECD299;
}

.summary-card.accent .summary-icon,
.summary-card.accent span {
  color: var(--gold-dark);
}

/* 9. MEMÓRIAS DE PESSOAS E FATOS */
.item-list {
  display: grid;
  gap: 16px;
}

.memory-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 12px;
}

.memory-card:hover {
  border-color: #B5C9C3;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.person-card-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.person-photo {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.person-initials {
  display: grid;
  place-items: center;
  background: var(--sage-gradient);
  color: var(--teal-dark);
  font-family: var(--font-headings);
  font-weight: 900;
  font-size: 1.3rem;
  border: 2px solid #CBD8C4;
}

.person-card-heading h3 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.memory-card p {
  color: var(--ink);
  margin-bottom: 0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--sage);
  color: var(--teal-dark);
  border: 1px solid rgba(15, 91, 88, 0.08);
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.small-button {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
}

.small-button:hover {
  background: var(--sage);
  color: var(--teal-dark);
  border-color: #CBD8C4;
}

.small-button.danger-action {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #E4B6AD;
}

.small-button.danger-action:hover {
  background: #FFE5E2;
  color: #A02E26;
  border-color: #DDA89D;
}

/* Upload de Fotos */
.photo-field {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.photo-field:has(.photo-preview.hidden)::before {
  content: "";
  width: 90px;
  height: 90px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 2px dashed #CBD8C4;
  background: radial-gradient(circle at 50% 35%, #9AA7A3 0 13px, transparent 14px),
              radial-gradient(circle at 50% 80%, #9AA7A3 0 25px, transparent 26px),
              #FAF8F5;
}

.photo-preview {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  object-fit: cover;
  border: 2px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.photo-field-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

/* 10. INTERFACE DE CHAT (ASSISTENTE) */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 240px);
  min-height: 540px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1.5px solid var(--line);
  background: var(--surface-strong);
}

.chat-toolbar h2 {
  font-size: 1.2rem;
  margin-bottom: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #FAF8F5;
}

.message-row {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.message-row.assistant {
  align-self: flex-start;
}

.message-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--sage);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.message {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 1.05rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.message.assistant {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top-left-radius: 4px;
}

.message.user {
  background: var(--teal-gradient);
  color: #FFFFFF;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(15, 91, 88, 0.15);
}

/* Indicador Animado "Mia está digitando" */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
}

.typing-indicator span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--teal);
  opacity: 0.4;
  animation: typingPulse 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Spinner de carregamento em botões */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
}

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

/* Spinner visível mesmo em modo calmo */
body.calm-mode .btn-spinner {
  animation: spin 0.7s linear infinite !important;
}

@keyframes typingPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Prompts Rápidos e Entrada de Texto */
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  background: var(--surface-strong);
  border-top: 1.5px solid var(--line);
}

.quick-prompts button {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.9rem;
  border-radius: var(--radius-full);
}

.chat-form {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1.5px solid var(--line);
  background: var(--surface);
}

.chat-form input {
  flex: 1;
}

/* Painel Lateral do Assistente */
.memory-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.memory-side .panel {
  box-shadow: var(--shadow-sm);
}

.daily-panel h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.daily-orientation {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--teal-dark) !important;
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.daily-item {
  padding-left: 14px;
  border-left: 3px solid var(--teal);
}

.daily-item strong {
  font-family: var(--font-headings);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.daily-item p {
  margin: 2px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* 11. IMPORTAÇÃO DE HISTÓRIAS DE VIDA */
.life-import-panel {
  margin-bottom: 24px;
}

.history-import-inputs {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.history-import-inputs .field-hint {
  margin: 0;
}

.history-import-text {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.history-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.history-candidate {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.history-candidate-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.history-candidate-fields .wide-field {
  grid-column: 1 / -1;
}

.history-source {
  background: var(--surface-strong);
  border-left: 4px solid var(--coral);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

/* 12. CONFIGURAÇÕES, PIN E AUDITORIA */
.weekday-fieldset {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 0;
}

.weekday-options {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.weekday-options label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 2px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
}

.weekday-options input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.weekday-options label:has(input:checked) {
  background: var(--teal-gradient);
  border-color: var(--teal);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.routine-audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.routine-audit-item {
  padding: 10px 14px;
  border-left: 4px solid var(--line);
  background: var(--surface-strong);
  border-radius: var(--radius-sm);
}

.routine-audit-item strong {
  font-family: var(--font-headings);
  font-size: 0.95rem;
  color: var(--ink);
}

.routine-audit-item p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Espaço em Disco */
.storage-usage {
  padding: 14px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 700;
}

.storage-usage.warning {
  border-color: #F3C45E;
  background: #FFF9E6;
  color: #61460A;
}

/* Visualização de Dados */
.data-preview {
  background: #192623;
  color: #E2ECE8;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
}

/* 13. MODO DE REORIENTAÇÃO ("MIA, ESTOU CONFUSO/A") */
.orientation-mode {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  padding: clamp(16px, 4vw, 40px);
  overflow-y: auto;
}

.orientation-shell {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.orientation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 2px solid var(--line);
  background: var(--surface-strong);
}

.orientation-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.orientation-brand h1 {
  font-size: 1.8rem;
  margin-bottom: 0;
  color: var(--teal-dark);
}

.orientation-mia-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  border: 2px solid var(--sage);
}

.orientation-content {
  display: flex;
  flex-direction: column;
}

.orientation-person {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 28px;
  background: #EDF5F3;
  border-bottom: 2px solid var(--line);
}

.orientation-profile-photo {
  width: 110px;
  height: 110px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md);
}

.orientation-statements p {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--ink);
}

.orientation-statements p:last-child {
  margin-bottom: 0;
}

.orientation-statements .orientation-comfort {
  color: var(--teal);
  font-size: 1.5rem;
  font-weight: 900;
  margin-top: 14px;
  font-family: var(--font-headings);
}

.orientation-location-live {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--teal-dark) !important;
  background: rgba(23, 107, 104, 0.07);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  padding: 10px 14px !important;
  font-size: 1.2rem !important;
  font-weight: 700;
  margin-bottom: 10px !important;
  transition: background 0.3s;
}

.orientation-section {
  padding: 28px;
  border-bottom: 2px solid var(--line);
}

.orientation-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.orientation-routine {
  margin: 0;
  padding-left: 24px;
}

.orientation-routine li {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
}

.orientation-support {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px;
  background: var(--coral-light);
  gap: 20px;
}

.orientation-support h2 {
  font-size: 1.4rem;
  color: var(--coral-dark);
  font-weight: 800;
  margin-bottom: 4px;
}

.orientation-support-action {
  min-height: 60px;
  padding: 12px 28px;
  font-size: 1.1rem;
  background: var(--coral);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.orientation-support-action:hover {
  background: var(--coral-dark);
}

.orientation-support-action.is-disabled {
  background: #CBD8C4;
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* 14. COMPONENTES ADICIONAIS */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #FFFFFF;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Customização de Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #CBD8C4;
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #A0B3AE;
}

/* 15. ACESSIBILIDADE E CUSTOMIZAÇÕES GLOBAIS DE MODO */

/* Modo: Texto Maior */
body.large-text {
  font-size: 1.2rem;
}

body.large-text h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
body.large-text h2 { font-size: 1.7rem; }
body.large-text h3 { font-size: 1.4rem; }
body.large-text .next-action-instruction { font-size: 1.7rem; }
body.large-text .message { font-size: 1.15rem; }
body.large-text .orientation-statements p { font-size: 1.5rem; }

/* Modo Calmo: Sem Animações, Efeitos de Hover ou Escalas */
body.calm-mode {
  --shadow-lg: 0 4px 12px rgba(25, 38, 35, 0.06);
  --shadow-md: 0 2px 8px rgba(25, 38, 35, 0.04);
}

body.calm-mode *,
body.calm-mode *::before,
body.calm-mode *::after {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

body.calm-mode .summary-card:hover,
body.calm-mode .memory-card:hover {
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}

body.calm-mode .primary-button:hover,
body.calm-mode .soft-button:hover,
body.calm-mode .danger-button:hover {
  transform: none !important;
  box-shadow: none !important;
}

body.calm-mode .typing-indicator span {
  animation: typingOpacityPulse 1.2s infinite ease-in-out !important;
}

@keyframes typingOpacityPulse {
  0%, 80%, 100% { opacity: 0.25; }
  40%           { opacity: 1;    }
}

/* 16. RESPONSIVIDADE (MEDIA QUERIES) */
@media (max-width: 1040px) {
  .home-layout,
  .workbench,
  .assistant-layout {
    grid-template-columns: 1fr;
  }
  
  .memory-side {
    margin-top: 12px;
  }
}

@media (max-width: 980px) {
  .main-view {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1.5px solid var(--line);
    padding: 24px;
    gap: 16px;
  }

  .nav-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .nav-tab {
    width: auto;
    flex: 1;
    min-width: 120px;
    justify-content: center;
    font-size: 0.95rem;
    padding: 10px 12px;
  }

  .content {
    margin-left: 0;
    padding: 24px 16px;
  }

  .access-box {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 12px;
    padding-top: 16px;
  }
  
  .topbar-avatar {
    display: block;
  }
}

@media (max-width: 768px) {
  .signup-view {
    grid-template-columns: 1fr;
  }

  .signup-hero {
    padding: 40px 24px 36px;
    min-height: auto;
  }

  .signup-brand {
    margin-bottom: 28px;
  }

  .signup-tagline {
    font-size: 1.6rem;
    margin-bottom: 28px;
  }

  .signup-benefits {
    display: none; /* simplificar em mobile */
  }

  .auth-panel {
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 36px 24px;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, 1fr);
    display: grid;
  }

  .nav-tab {
    min-height: 56px;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    padding: 8px 6px;
    text-align: center;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .next-action-controls {
    grid-template-columns: 1fr;
    display: grid;
  }
  
  .weekday-options {
    grid-template-columns: repeat(4, 1fr);
  }

  .time-fields,
  .history-candidate-fields {
    grid-template-columns: 1fr;
  }

  .orientation-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .orientation-person {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .orientation-support {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .chat-panel {
    height: calc(100vh - 200px);
  }
}
