/* EstouFeliz v5.0.1 — revisão geral de temas + relatório no padrão do app */

/* 1) Fundos passam a acompanhar as variáveis do tema. Isso evita o caso
   "paleta escura + fundo claro" quando o sistema operacional está em dark. */
html,body{background:var(--fog);color:var(--ink)}
body,.main,.rail,.panel,.btn,.field input,.field select,.field textarea{transition:background-color .18s,border-color .18s,color .18s}
.rail{background:color-mix(in srgb,var(--fog) 96%,var(--paper) 4%)}
.railfoot{background:transparent!important}
.mobilebar{color:var(--ink)}

.quick-body,
.diary-body,
.report-v34-body{
  background:linear-gradient(155deg,
    color-mix(in srgb,var(--fog) 96%,var(--paper) 4%) 0%,
    var(--fog) 48%,
    color-mix(in srgb,var(--fog) 92%,var(--focus) 8%) 100%)!important;
  color:var(--ink)!important;
}

/* 2) Diário: contraste consistente em claro, escuro e modo automático. */
.diary-v34{
  --v34-card:color-mix(in srgb,var(--paper) 78%,var(--sunk) 22%);
  --v34-card-strong:color-mix(in srgb,var(--paper) 58%,var(--sunk) 42%);
  --v34-blue2:color-mix(in srgb,var(--paper) 86%,#438ddd 14%);
}
.diary-v34-titlebar h1,.diary-period-nav h2,.diary-list-head h2,.diary-metric strong{color:var(--ink)!important}
.diary-v34-titlebar p,.month-weekdays span,.week-day small,.week-day em,.timeline-copy small,.diary-metric small{color:var(--muted)!important}
.diary-view-tabs{background:var(--v34-card-strong)!important;border:1px solid var(--line)}
.diary-view-tabs button{color:var(--ink2)!important}
.diary-view-tabs button.on{color:#fff!important}
.diary-dashboard-card,.diary-list-wrap,.diary-metric,.timeline-card{background:var(--v34-card)!important;border-color:var(--line)!important;color:var(--ink)!important}
.month-cell,.week-day,.timeline-more{color:var(--ink)!important}
.month-cell:hover,.week-day:hover,.timeline-card:hover{background:var(--paper)!important;border-color:var(--line2)!important}
.diary-insights{background:color-mix(in srgb,var(--paper) 78%,#438ddd 22%)!important;color:color-mix(in srgb,var(--ink) 72%,#1262b7 28%)!important;border:1px solid color-mix(in srgb,var(--line) 62%,#438ddd 38%)}
.diary-report-link{background:var(--paper)!important;border-color:var(--line2)!important;color:var(--ink)!important}
.text-link{color:color-mix(in srgb,var(--focus) 76%,#2670bc 24%)!important}

/* 3) Registro rápido: não deixa texto/bordas lavarem em nenhum tema. */
.quick-question h1,.last-mood-summary strong,.quick-mood,.quick-detail-open{color:var(--ink)!important}
.quick-kicker{filter:saturate(.92)}
.quick-moods,.last-mood-card,.quick-detail-open{border-color:var(--line)!important}
.quick-moods{background:color-mix(in srgb,var(--paper) 80%,transparent)!important}
.quick-mood{background:color-mix(in srgb,var(--paper) 82%,transparent)!important;border-color:var(--line)!important}
.quick-mood:hover,.quick-mood:focus-visible,.quick-mood.saved{background:var(--paper)!important}
.last-mood-card,.quick-detail-open{background:color-mix(in srgb,var(--paper) 90%,transparent)!important}
.last-mood-summary small,.last-mood-summary span,.quick-detail-open small{color:var(--muted)!important}
.relative-btn{color:var(--ink)!important;border-color:var(--line2)!important}

/* 4) Componentes gerais do app. */
.panel,.v3-form-card,.ef50-central .panel{color:var(--ink)}
.alert.warn{color:var(--ink2)}
.seg button,.seg a{color:var(--ink2)}
.seg button[aria-pressed="true"],.seg a[aria-current]{color:var(--ink);background:var(--paper)}
.tabbar{border:1px solid var(--line)}
.tabbar a.on{color:var(--ink)!important;background:var(--sunk)!important}

/* 5) Construtor de relatório agora vive dentro do shell padrão. */
.report-v34-body .report-app-shell{min-height:100vh;background:var(--fog)}
.report-main{max-width:1260px!important}
.report-main .report-builder{width:min(1040px,100%)!important;margin:0!important;padding:0 0 64px!important}
.report-main .report-builder-head{margin-bottom:22px;align-items:flex-end}
.report-main .report-builder-head h1{font-size:clamp(32px,4vw,48px)!important;color:var(--ink)!important}
.report-main .report-builder-head p{color:var(--muted)!important}
.report-main .report-head-actions{margin-left:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.report-main .report-card,.report-main .preview-summary{background:var(--paper)!important;border-color:var(--line)!important;color:var(--ink)!important;box-shadow:var(--lift)!important}
.report-main .report-card h2,.report-main .report-card b,.report-main .report-field b,.report-main .annex-row b{color:var(--ink)!important}
.report-main .report-sub{color:var(--muted)!important}
.report-main .report-field,.report-main .annex-row,.report-main .preset-btn,.report-main .period-quick button,.report-main .chart-pick,.report-main .adv-chart,.report-main .compare-card{background:color-mix(in srgb,var(--paper) 94%,var(--sunk) 6%)!important;color:var(--ink)!important;border-color:var(--line)!important}
.report-main .preset-btn.on,.report-main .chart-filter button.on{background:linear-gradient(135deg,#438ddd,#3676ca)!important;color:#fff!important;border-color:transparent!important}
.report-main .report-tip{background:color-mix(in srgb,var(--paper) 82%,#4b9bea 18%)!important;border-color:color-mix(in srgb,var(--line) 55%,#438ddd 45%)!important;color:var(--ink)!important}
.report-main .report-tip small{color:var(--ink2)!important}
.report-main .report-card-title span{background:var(--sunk)!important;color:var(--ink2)!important}
.report-main .report-generate{box-shadow:0 12px 30px -20px rgba(36,92,160,.55)}

/* 6) Tema escuro: reforço de contraste nos pontos que tinham texto apagado. */
:root[data-theme="dark"] .diary-insights{background:#20344c!important;color:#dbeaff!important;border-color:#35526f!important}
:root[data-theme="dark"] .week-day.selected{background:#263b57!important;border-color:#4c6b91!important;color:#f4f7fb!important}
:root[data-theme="dark"] .report-main .report-tip{background:#203247!important;border-color:#365773!important;color:#eef4fb!important}
:root[data-theme="dark"] .report-main .report-tip small{color:#bdccdd!important}
:root[data-theme="dark"] .report-main .tag-high{background:#21452c!important;color:#b6f4c3!important}
:root[data-theme="dark"] .report-main .tag-mid{background:#4a3b14!important;color:#ffe5a3!important}
:root[data-theme="dark"] .report-main .tag-opt{background:#203b59!important;color:#c0e0ff!important}
:root[data-theme="dark"] .report-main .tag-private{background:#4a2437!important;color:#ffc0dc!important}

/* O mesmo reforço para quem segue automaticamente o tema escuro do sistema. */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .diary-insights{background:#20344c!important;color:#dbeaff!important;border-color:#35526f!important}
  :root:not([data-theme="light"]) .week-day.selected{background:#263b57!important;border-color:#4c6b91!important;color:#f4f7fb!important}
  :root:not([data-theme="light"]) .report-main .report-tip{background:#203247!important;border-color:#365773!important;color:#eef4fb!important}
  :root:not([data-theme="light"]) .report-main .report-tip small{color:#bdccdd!important}
}

/* 7) Tema claro explícito: elimina restos de regras escuras após alternância. */
:root[data-theme="light"] .diary-v34-titlebar h1,
:root[data-theme="light"] .diary-period-nav h2,
:root[data-theme="light"] .diary-list-head h2{color:#2f3947!important}
:root[data-theme="light"] .diary-v34-titlebar p{color:#677287!important}
:root[data-theme="light"] .month-weekdays span{color:#778299!important}
:root[data-theme="light"] .diary-dashboard-card,
:root[data-theme="light"] .diary-list-wrap{border-color:#dbe2ec!important}

/* 8) Impressão continua limpa, sem sidebar ou navegação. */
@media print{
  .report-app-shell>.rail,.report-app-shell>.tabbar,.report-main>.mobilebar{display:none!important}
  .report-app-shell{display:block!important;background:#fff!important}
  .report-main{padding:0!important;max-width:none!important}
}

@media(max-width:860px){
  .report-main .report-builder{width:100%!important}
  .report-main .report-builder-head{align-items:flex-start;flex-direction:column}
  .report-main .report-head-actions{margin-left:0;width:100%}
  .report-main .report-head-actions .btn{flex:1 1 auto}
}
.report-preview-shell .report-main .report-preview{width:min(980px,100%)!important;margin:0!important;padding:0 0 64px!important}
.report-preview-shell .preview-top{margin-top:0}
@media print{
  .report-preview-shell>.rail,.report-preview-shell>.tabbar,.report-preview-shell .mobilebar,.report-preview-shell .preview-top,.report-preview-shell .preview-summary,.report-preview-shell .preview-actions{display:none!important}
  .report-preview-shell .report-main,.report-preview-shell .report-preview{padding:0!important;margin:0!important;width:100%!important;max-width:none!important}
}
