/* RDP Pro — Estilos do App do Paciente */
/* ============================================
   UI/UX Expert — Entrega final
   Contexto: saúde mental / TCC / exercício cognitivo
   ============================================ */

/*
  DECISÕES DE DESIGN PARA CONTEXTO CLÍNICO
  ─────────────────────────────────────────
  Verde oliva (#6b7c4a): âncora identitária — preservada
  Fundo bege (#f5f5ee): quente, não-cansa, não-clínico-frio
  Tipografia Lora + DM Sans: acolhimento nos títulos e clareza no corpo
  Dark mode: tons musgo suaves — não sombrio, não "terminal"
  Placeholders: sem itálico — tom neutro, não-julgador
  Textarea: line-height 1.75 — espaço para pensar
  Fase reflexiva: fundo levemente diferente → transição cognitiva
*/

:root {
  --bg:          #f5f5ee;
  --surface:     #ffffff;
  --surface2:    #ecebe3;
  --surface-warm:#f0ede5;

  --accent:      #6b7c4a;
  --accent2:     #8a9e60;
  --accent-light:#e8edd8;

  --text:        #252520;
  --text-muted:  #6b7060;
  --text-subtle: #64675e;
  --placeholder: #686a61;

  --border:      #d4d0c4;
  --border-soft: #e4e1d8;

  --success:     #6b7c4a;
  --danger:      #b03a2e;
  --warning-bg:  #fdf6e3;
  --warning-border: #dfc06a;

  --focus-ring:  rgba(107, 124, 74, 0.22);
  --shadow-sm:   0 1px 3px rgba(60,58,50,0.07), 0 1px 2px rgba(60,58,50,0.04);
  --shadow-md:   0 4px 16px rgba(60,58,50,0.09), 0 2px 4px rgba(60,58,50,0.05);

  --radius:      14px;
  --radius-sm:   10px;
  --font-app:    'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display:'Lora', Georgia, serif;
  --icon:        #171914;
  --icon-on-dark:#11140f;
  --header-button-bg: rgba(255,255,255,0.9);
  --header-button-bg-hover: #ffffff;
  --header-button-text: #151711;
  --header-button-border: rgba(255,255,255,0.84);
}

/* [clínico] Dark mode musgo — reconfortante, não sombrio */
[data-theme="dark"] {
  --bg:          #1c1f18;
  --surface:     #242720;
  --surface2:    #2c302a;
  --surface-warm:#2a2d24;

  --accent:      #93a868;
  --accent2:     #7a9055;
  --accent-light:#2e3828;

  --text:        #e8e6de;
  --text-muted:  #9a9e90;
  --text-subtle: #a2a697;
  --placeholder: #9ea294;

  --border:      #363930;
  --border-soft: #2e3128;

  --focus-ring:  rgba(147, 168, 104, 0.28);
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.28);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.38);
  --warning-bg:     #2a2510;
  --warning-border: #6b5a20;
  --icon:        #f3f5ee;
  --icon-on-dark:#11140f;
  --header-button-bg: rgba(245,247,239,0.92);
  --header-button-bg-hover: #ffffff;
  --header-button-text: #11140f;
  --header-button-border: rgba(255,255,255,0.7);
}

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

body {
  font-family: var(--font-app);
  font-size: 17px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  transition: background 0.35s, color 0.35s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* [UI] Navegação por teclado: aparece apenas ao receber foco. */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 500;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: translateY(0); }

/* [UI] Superfícies nativas alinhadas à identidade do produto. */
::selection { background: var(--accent-light); color: var(--text); }
* { scrollbar-color: var(--accent2) var(--surface2); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--surface2); }
*::-webkit-scrollbar-thumb { background: var(--accent2); border: 2px solid var(--surface2); border-radius: 10px; }

.ui-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.14em;
  color: currentColor;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.logo-icon {
  width: 44px;
  height: 44px;
  color: var(--icon);
  margin: 0 auto 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: translateY(-50%) rotate(360deg); }
}
@keyframes savePop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.055); }
  65%  { transform: scale(0.975); }
  100% { transform: scale(1); }
}

/* ─── SCREENS ────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease-out; }

.screen-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
}

.screen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 26px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-md);
}

.screen-card .logo { font-size: 2.6rem; margin-bottom: 14px; display: block; }

.screen-card h2 {
  font-family: var(--font-display);
  font-size: 1.42rem;
  color: var(--accent);
  margin-bottom: 10px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.screen-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}

.screen-card .therapist-badge {
  background: var(--accent-light);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 22px;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.screen-card .therapist-badge strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 2px;
  font-weight: 600;
}

.ob-input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
  font-family: var(--font-app);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ob-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.ob-input::placeholder { color: var(--placeholder); }

.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.ob-step:last-of-type { border-bottom: none; }
.ob-step-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.ob-step-text { font-size: 0.92rem; color: var(--text-muted); line-height: 1.55; }
.ob-step-text strong { color: var(--text); font-weight: 500; }

.patient-auth-grid {
  display: grid;
  gap: 16px;
  text-align: left;
}

.patient-auth-block {
  border-top: 1px solid var(--border-soft);
  padding-top: 16px;
}

.patient-auth-block h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.auth-field-label {
  display: block;
  text-align: left;
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.onboarding-steps { text-align: left; margin-bottom: 20px; }
.recovery-note { margin-top: 12px; font-size: 0.9rem; color: var(--text-muted); }

.patient-auth-message {
  display: none;
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: left;
}

.patient-auth-message.error {
  background: #fdecea;
  border: 1px solid #f5c4c4;
  color: #b03030;
}

.patient-auth-message.success {
  background: var(--accent-light);
  border: 1px solid var(--border-soft);
  color: var(--accent);
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
/* [clínico] Gradiente sutil — entrada menos abrupta que flat color */
header {
  background: linear-gradient(180deg, #4e5c38 0%, #3e4829 100%);
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(30,35,20,0.22);
}
.header-title { text-align: center; flex: 1; min-width: 0; padding: 0 12px; }
.header-title h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #e8edda;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-left { display: flex; align-items: center; width: 44px; }

.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #e8edda;
  transition: background 0.2s;
  flex-shrink: 0;
}
.theme-btn:active { background: rgba(255,255,255,0.12); }

.header-right {
  display: flex;
  align-items: center;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--header-button-border);
  background: var(--header-button-bg);
  color: var(--header-button-text);
  font-family: var(--font-app);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0 15px;
  min-height: 38px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16,18,12,0.14);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.logout-btn:hover {
  background: var(--header-button-bg-hover);
  color: var(--header-button-text);
}

.logout-btn:active {
  transform: translateY(1px);
}

[data-theme="dark"] .logout-btn {
  background: var(--header-button-bg);
  border-color: var(--header-button-border);
  color: var(--header-button-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.34);
}

[data-theme="dark"] .logout-btn:hover {
  background: var(--header-button-bg-hover);
  color: var(--header-button-text);
}

/* ─── TABS ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.tab {
  flex: 1;
  min-height: 46px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.81rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.22s, border-color 0.22s, background 0.22s;
  line-height: 1.3;
  font-family: var(--font-app);
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-left: 0;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--surface); }
.tab:not(.active):hover { color: var(--accent2); background: rgba(107, 124, 74, 0.05); }

/* ─── PAGES ──────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.22s ease-out; }

/* ─── FORMULÁRIO ─────────────────────────────────────────────────────────── */
.form-area { padding: 20px; display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }

/* [clínico] Separador de fase TCC — divide "O que aconteceu" de "A reflexão" */
.form-phase-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 2px;
  color: var(--text-subtle);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.form-phase-label::before,
.form-phase-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.form-phase-label span { white-space: nowrap; padding: 0 4px; }

.field-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s, border-color 0.25s;
}

/* [clínico] Fase de reflexão: fundo ligeiramente diferente → transição cognitiva */
.field-card.field-card--reflection {
  background: var(--surface-warm);
  border-color: var(--border-soft);
}

.field-card label,
.field-card legend {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}
.char-count {
  font-size: 0.74rem;
  color: var(--text-subtle);
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* [clínico] line-height 1.75 — ritmo de diário, espaço para pensar
   sem itálico no placeholder — tom neutro, não-julgador */
.field-card textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-app);
  font-size: 1rem;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.75;
  min-height: 66px;
  overflow: hidden;
}
.field-card textarea::placeholder {
  color: var(--placeholder);
  font-style: normal;
  opacity: 1;
}

.datetime-row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }

.datetime-row input[type="date"],
.datetime-row input[type="time"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  font-family: var(--font-app);
  font-size: 1rem;
  color: var(--text);
  padding: 10px 8px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
}
.datetime-row input[type="date"] { flex: 3; }
.datetime-row input[type="time"] { flex: 2; min-width: 86px; }
.datetime-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

.btn-now {
  flex-shrink: 0;
  padding: 0 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  font-family: var(--font-app);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-now:hover  { background: var(--border); }
.btn-now:active { background: var(--accent); color: white; border-color: var(--accent); }

.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); height: 6px; cursor: pointer; }
.slider-val {
  font-family: var(--font-app);
  font-size: 1.5rem;
  color: var(--accent);
  min-width: 34px;
  text-align: right;
  font-weight: 600;
  line-height: 1;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.71rem;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
  padding: 0 2px;
}

.form-actions { display: flex; gap: 10px; padding: 0 20px 10px; max-width: 760px; margin: 0 auto; }

.btn-save {
  flex: 1;
  padding: 0 16px;
  min-height: 50px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: white;
  font-family: var(--font-app);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
  position: relative;
  overflow: hidden;
}
.btn-save:hover:not(:disabled)  { filter: brightness(0.91); }
.btn-save:active:not(:disabled) { transform: scale(0.98); }
.btn-save:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-save:disabled { opacity: 0.52; cursor: not-allowed; }
.btn-save.saved { animation: savePop 0.45s ease; background: #4a7a3e; }

.btn-loading { pointer-events: none; opacity: 0.72; }
.btn-loading::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.32);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-clear {
  padding: 0 18px;
  min-height: 50px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-app);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-clear:hover  { background: var(--surface2); color: var(--text); }
.btn-clear:active { background: var(--border); }
.btn-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ─── LOCK ───────────────────────────────────────────────────────────────── */
.locked-banner {
  margin: 24px 20px 0;
  background: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
  animation: fadeIn 0.28s ease-out;
}
.locked-banner h3 { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent); margin-bottom: 8px; }
.locked-banner p  { font-size: 0.92rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }
.btn-go-history {
  padding: 0 24px;
  min-height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-app);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
}
.btn-go-history:hover  { filter: brightness(0.9); }
.btn-go-history:active { transform: scale(0.98); }

/* ─── HISTÓRICO ──────────────────────────────────────────────────────────── */
.history-area { padding: 20px; max-width: 760px; margin: 0 auto; }

.history-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.history-empty .icon { font-size: 3rem; margin-bottom: 18px; opacity: 0.55; display: block; }
.history-empty p { font-size: 1rem; line-height: 1.65; margin-bottom: 22px; }
.history-empty .empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font-family: var(--font-app);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: filter 0.15s, transform 0.12s;
}
.history-empty .empty-cta:hover  { filter: brightness(0.9); }
.history-empty .empty-cta:active { transform: scale(0.98); }

.days-counter {
  font-size: 0.86rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0 0 16px;
}
.days-counter span { color: var(--accent); font-weight: 700; font-size: 1rem; }

.history-item {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s;
}
.history-item:hover { box-shadow: var(--shadow-md); }

.history-summary {
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.15s;
}
.history-summary:active { background: var(--surface2); }

.history-summary-row { display: flex; justify-content: space-between; align-items: flex-start; }

.history-date {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.history-chevron {
  font-size: 0.9rem;
  color: var(--text-subtle);
  transition: transform 0.25s ease;
  flex-shrink: 0;
  margin-top: 1px;
}
.history-item.open .history-chevron { transform: rotate(180deg); }

.history-situation { font-size: 1.05rem; font-weight: 500; color: var(--text); line-height: 1.48; }
.history-feeling {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.feeling-icon {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
  opacity: 0.9;
}
.history-anx {
  display: inline-block;
  margin-top: 5px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.79rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  align-self: flex-start;
  border: 1px solid var(--border-soft);
}

.history-detail {
  display: none;
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border-soft);
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.2s ease-out;
}
.history-item.open .history-detail { display: flex; }

.detail-row label {
  display: block;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 3px;
  margin-top: 12px;
}
.detail-row p { font-size: 0.96rem; line-height: 1.6; color: var(--text); }

.detail-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn-edit {
  flex: 1;
  padding: 0 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-app);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-edit:hover  { background: var(--surface2); color: var(--text); }
.btn-edit:active { background: var(--border); }
.btn-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-del {
  flex: 1;
  padding: 0 12px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid #f0d0ce;
  background: #fdf0ef;
  color: #a03030;
  font-family: var(--font-app);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-del:hover  { background: #faddda; }
.btn-del:active { background: #f5cac8; }
.btn-del:focus-visible { outline: 2px solid #a03030; outline-offset: 2px; }
[data-theme="dark"] .btn-del { background: #2e1818; border-color: #4a2828; color: #d07070; }
[data-theme="dark"] .btn-del:hover { background: #3a2020; }

/* ─── CHART ──────────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.chart-title { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.chart-canvas-wrap { position: relative; width: 100%; height: 180px; }

/* ─── SEND PANEL ─────────────────────────────────────────────────────────── */
.send-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.send-panel-label { font-size: 0.88rem; color: var(--text-muted); flex: 1; min-width: 140px; }
.send-panel-label strong { display: block; color: var(--text); font-size: 0.96rem; margin-bottom: 3px; font-weight: 600; }
.send-panel-label span { font-size: 0.83rem; line-height: 1.45; }
.send-panel-btns { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

.btn-export-pdf, .btn-export-email, .btn-export-clear {
  min-height: 40px;
  min-width: 72px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font-app);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
}
.btn-export-pdf   { border: none; background: var(--accent2); color: white; }
.btn-export-pdf:hover  { filter: brightness(0.9); }
.btn-export-pdf:active { transform: scale(0.97); }

.btn-export-email {
  border: none; background: var(--accent); color: white;
  position: relative; overflow: hidden;
}
.btn-export-email:hover:not(:disabled)  { filter: brightness(0.9); }
.btn-export-email:active:not(:disabled) { transform: scale(0.97); }
.btn-export-email:disabled { opacity: 0.58; cursor: not-allowed; }

.btn-export-clear { border: 1px solid var(--border); background: transparent; color: var(--text-muted); }
.btn-export-clear:hover  { background: var(--surface2); }
.btn-export-clear:active { background: var(--border); }

/* ─── INSIGHTS ───────────────────────────────────────────────────────────── */
.insights-area { padding: 20px; max-width: 760px; margin: 0 auto; }
.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.insight-card:hover { box-shadow: var(--shadow-md); }

.insight-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; line-height: 1.4; }
.insight-val   { font-family: var(--font-app); font-size: 1.75rem; color: var(--accent); line-height: 1; }
.insight-unit  { font-size: 0.92rem; color: var(--text-muted); font-family: var(--font-app); }

.insight-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.insight-section-title {
  display: flex;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
}
.insight-section-body  { font-size: 0.93rem; color: var(--text-muted); line-height: 1.6; }

.feeling-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.feeling-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text);
  min-width: 104px;
  text-transform: capitalize;
}
.feeling-bar-wrap { flex: 1; height: 7px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.feeling-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
}
.datetime-field { min-width: 0; }
.datetime-field legend { width: 100%; padding: 0; }
.feeling-count { font-size: 0.8rem; color: var(--text-subtle); min-width: 24px; text-align: right; }

/* ─── PRIVACY ────────────────────────────────────────────────────────────── */
.privacy-area {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.privacy-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}
.privacy-info h2,
.privacy-actions h2,
.install-info h2 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.3;
  margin-bottom: 12px;
}
.privacy-info p + p { margin-top: 12px; }
.privacy-info strong { color: var(--text); font-weight: 600; }
.privacy-note {
  color: var(--accent);
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
}

.privacy-actions { padding: 22px 20px; }
.privacy-actions > p { color: var(--text-muted); line-height: 1.55; margin-bottom: 16px; }
.privacy-action-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.privacy-action-grid .btn-save,
.privacy-action-grid .btn-clear { width: 100%; }

.privacy-danger-zone {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.privacy-danger-zone div { min-width: 0; }
.privacy-danger-zone strong { display: block; color: var(--danger); margin-bottom: 3px; }
.privacy-danger-zone span { display: block; color: var(--text-muted); font-size: 0.88rem; line-height: 1.45; }

.install-info {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text-muted);
}
.install-info h2 { font-size: 1rem; margin-bottom: 8px; }
.install-info p { font-size: 0.92rem; line-height: 1.55; }
.install-info p + p { margin-top: 4px; }
.install-info strong { color: var(--text); }

.app-version { text-align: center; color: var(--text-subtle); font-size: 0.84rem; padding: 4px 0 8px; }

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  padding: 11px 22px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── FOCUS GLOBAL ───────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

@media (max-width: 560px) {
  .header-title { padding-inline: 6px; }
  .header-title h1 { font-size: 0.96rem; }
  .logout-btn { width: 44px; padding: 0; justify-content: center; font-size: 0; }
  .logout-btn .ui-icon { width: 18px; height: 18px; }
  .tab { padding-inline: 4px; font-size: 0.76rem; }
  .tab .icon-label { flex-direction: column; gap: 2px; }
  .privacy-action-grid { grid-template-columns: 1fr; }
  .privacy-danger-zone { align-items: stretch; flex-direction: column; }
  .privacy-danger-zone .btn-del { width: 100%; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  /* [UI] Estados permanecem visíveis; apenas deslocamentos e giros são removidos. */
  html { scroll-behavior: auto; }
  .screen.active,
  .page.active,
  .locked-banner,
  .history-detail,
  .btn-save.saved,
  .btn-loading::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  body,
  .skip-link,
  .toast,
  .tab,
  .field-card,
  .history-item,
  .history-summary,
  .history-chevron,
  button,
  input,
  textarea { transition-duration: 0.01ms !important; }
}
