#journalView .d4-photo-button { color:#3478ac !important; background:transparent !important; border:0 !important; box-shadow:none !important; display:inline-flex; align-items:center; gap:5px; padding:8px; min-height:44px; cursor:pointer; flex-shrink:0; }
#journalView .d4-general { color:#3478ac !important; background:transparent !important; border:0 !important; box-shadow:none !important; display:inline-flex; align-items:center; gap:8px; padding:8px 0; margin:0 0 12px; cursor:pointer; font:inherit; }
.d4-dialog { box-sizing:border-box; width:min(860px,calc(100% - 24px)); max-height:90dvh; overflow:auto; border:1px solid #ded7cc; border-radius:14px; padding:22px; background:#fffefd; color:#423c35; }
.d4-dialog::backdrop { background:rgba(30,29,27,.65); }
.d4-dialog button { cursor:pointer; font:inherit; min-height:44px; margin:4px; border:1px solid #d8d1c7; border-radius:6px; background:#faf7f2; color:#3478ac; padding:8px 12px; }
.d4-heading { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.d4-heading h2 { font-size:1.2rem; margin:0; }
.d4-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:14px; margin-top:18px; }
.d4-grid figure { margin:0; min-width:0; }
.d4-grid .d4-thumb { padding:0; width:100%; margin:0; overflow:hidden; aspect-ratio:4/3; }
.d4-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.d4-grid figcaption { font-size:.8rem; margin-top:5px; }
.d4-full { display:block; width:100%; max-height:60dvh; object-fit:contain; margin:16px 0; }
.d4-dialog label { display:block; margin:12px 0; }
.d4-dialog input { display:block; max-width:100%; margin-top:8px; }
.d4-dialog textarea { display:block; box-sizing:border-box; width:100%; min-height:70px; margin:8px 0; font:inherit; }
.d4-dialog :focus-visible,.d4-photo-button:focus-visible,.d4-general:focus-visible { outline:2px solid #3478ac; outline-offset:3px; }
@media(max-width:480px) { .d4-dialog { padding:14px; } .d4-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; } .d4-photo-button { padding:5px; } }

/* One diary-only palette, including controls created after editing or navigation.
   Do not target the global daisy or change buttons in any other module. */
#journalView button,
.d4-dialog button {
  background:#faf8f5 !important;
  background-image:none !important;
  color:#394b55 !important;
  border:1px solid #ddd6cb !important;
  border-radius:8px;
  box-shadow:0 1px 3px rgb(48 42 34 / 4%) !important;
  font-weight:500;
}
#journalView button:hover:not(:disabled),
.d4-dialog button:hover:not(:disabled) {
  background:#f0ece5 !important;
  border-color:#bcb3a6 !important;
}
#journalView button:active:not(:disabled),
.d4-dialog button:active:not(:disabled) {
  background:#e7e1d7 !important;
  color:#273e56 !important;
}
#journalView button:focus-visible,
.d4-dialog button:focus-visible {
  outline:2px solid #3478ac;
  outline-offset:3px;
}
#journalView button:disabled,
.d4-dialog button:disabled {
  background:#f3f0eb !important;
  color:#746e65 !important;
  opacity:.65;
  cursor:default;
}
#journalView .journal-calendar-days,
#journalView .journal-calendar-weekdays { grid-template-columns:repeat(7,minmax(0,1fr)); }
#journalView .journal-day-cell {
  background:#fffefd !important;
  box-sizing:border-box;
  min-width:0;
  padding:6px 2px;
  border-style:solid !important;
}
#journalView .journal-day-cell.is-selected {
  background:#eee8de !important;
  border:2px solid #8d8274 !important;
}
#journalView .journal-day-cell.is-today { border-color:#8d8274 !important; }
#journalView .journal-day-cell.is-other-month:not(.is-selected) {
  background:transparent !important;
  border-color:transparent !important;
}
#journalView :is(.d4-photo-button,.d4-general) {
  color:#3478ac !important;
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
#journalView :is(.d4-photo-button,.d4-general) span { color:#2b658f; }
#journalView :is(.d4-photo-button,.d4-general) svg { color:#3478ac; flex-shrink:0; }
#journalView :is(.back-button,.btn-journal-edit,.journal-entry-collapse-btn) {
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
}
#journalView .journal-entry-header { flex-wrap:wrap; }
#journalView .journal-entry-header-left { flex-basis:120px; }
#journalView .journal-actions-row { flex-wrap:wrap; }

.d4-upload { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:12px 0; }
.d4-upload-hint { font-size:.8rem; color:#6b655c; }
.d4-dialog input[hidden] { display:none; }
.d4-dialog button { font-weight:500; }
.d4-dialog .d4-heading { position:sticky; top:-1px; background:#fffefd; z-index:1; }
.d4-dialog.d4-enlarged[open] {
  display:flex;
  flex-direction:column;
  gap:10px;
  height:min(820px,calc(100dvh - 24px));
  max-height:calc(100dvh - 24px);
  overflow:hidden;
}
.d4-photo-nav,.d4-photo-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; flex-shrink:0; }
.d4-enlarged button { margin:0; padding:8px 10px; font-size:.9rem; }
.d4-photo-status { margin:0; font-size:.85rem; flex-shrink:0; }
.d4-photo-status:empty { height:0; }
.d4-photo-frame { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.d4-enlarged .d4-full { width:100%; height:100%; max-height:100%; min-height:0; margin:0; object-fit:contain; }
.d4-enlarged .d4-caption-editor { flex-shrink:0; margin:0; font-size:.85rem; }
.d4-enlarged textarea { min-height:48px; height:56px; max-height:100px; margin:6px 0 0; padding:8px; resize:vertical; border:1px solid #d8d1c7; border-radius:6px; background:#fffefd; color:#423c35; }
#journalView .journal-entry-card.d4-moment-highlight {
  animation:d4-moment-arrival 4.5s ease-out both;
}
@keyframes d4-moment-arrival {
  0%,65% { background-color:#f3eee3; box-shadow:0 0 0 2px #b8cdd9; }
  100% { background-color:transparent; box-shadow:0 0 0 2px transparent; }
}
@media(prefers-reduced-motion:reduce) {
  #journalView .journal-entry-card.d4-moment-highlight { animation:none; background-color:#f3eee3; outline:2px solid #b8cdd9; outline-offset:2px; }
}
@media(max-height:480px) {
  .d4-dialog.d4-enlarged { padding:10px; gap:6px; }
  .d4-enlarged textarea { height:40px; min-height:40px; max-height:60px; }
}

/* DA ESTA — DIARY UPGRADE VISUAL AZUL PROFUNDO & BRANCO PEROLADO */
:root[data-daesta-theme="blue"] #journalView button,
:root[data-daesta-theme="blue"] .d4-dialog button,
body:not([data-daesta-theme="white"]) #journalView button,
body:not([data-daesta-theme="white"]) .d4-dialog button {
  background: rgba(248, 235, 210, 0.06) !important;
  color: #f5efe4 !important;
  border: 1px solid rgba(255, 245, 225, 0.35) !important;
  box-shadow: none !important;
}

:root[data-daesta-theme="blue"] #journalView button:hover:not(:disabled),
:root[data-daesta-theme="blue"] .d4-dialog button:hover:not(:disabled),
body:not([data-daesta-theme="white"]) #journalView button:hover:not(:disabled),
body:not([data-daesta-theme="white"]) .d4-dialog button:hover:not(:disabled) {
  background: rgba(248, 235, 210, 0.12) !important;
  border-color: rgba(255, 245, 225, 0.60) !important;
  color: #ffffff !important;
}

:root[data-daesta-theme="blue"] .d4-dialog,
body:not([data-daesta-theme="white"]) .d4-dialog {
  background: rgba(4, 9, 20, 0.88) !important;
  border: 1px solid rgba(255, 245, 225, 0.42) !important;
  color: #f3eee5 !important;
  -webkit-backdrop-filter: blur(20px) saturate(115%) !important;
  backdrop-filter: blur(20px) saturate(115%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 253, 246, 0.15), 0 24px 60px rgba(0, 0, 0, 0.70) !important;
}

:root[data-daesta-theme="blue"] .d4-enlarged textarea,
body:not([data-daesta-theme="white"]) .d4-enlarged textarea {
  background: rgba(248, 235, 210, 0.05) !important;
  border: 1px solid rgba(179, 203, 232, 0.50) !important;
  color: #f3eee5 !important;
}
