:root {
  /* Paleta oficial do Projeto Maya (Manual da Mamãe OFC) */
  --petroleo: #4A3B36; /* Texto (usado como cor escura de destaque/header) */
  --salvia: #A8AE9A;   /* Verde Sálvia */
  --dourado: #F1CE84;  /* Amarelo Macio (accent no lugar do dourado) */
  --marfim: #FAF7F2;   /* Off-white */
  --areia: #DDB2B5;    /* Rosa Suave */
  --grafite: #4A3B36;  /* Texto */
  --azul-nevoa: #BFCAD3; /* reserva, não usada nas regras herdadas */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--marfim);
  color: var(--grafite);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--petroleo);
  color: var(--marfim);
  padding: 16px 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  border: 1px solid var(--dourado);
  color: var(--dourado);
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif;
  font-weight: bold;
}
.brand-mark-photo {
  object-fit: cover;
  border-width: 2px;
}
.brand-name { font-family: Georgia, serif; letter-spacing: 2px; font-size: 1.1em; }
.brand-tag { font-size: 0.75em; color: var(--areia); }

.month-nav { display: flex; align-items: center; gap: 12px; font-weight: 600; }

.btn-ghost {
  background: none;
  border: 1px solid var(--dourado);
  color: var(--dourado);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1em;
}
.btn-ghost:hover { background: rgba(197,164,109,0.15); }

.btn-primary {
  background: var(--dourado);
  color: var(--petroleo);
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}
.btn-primary:hover { opacity: 0.9; }

main { display: flex; gap: 0; align-items: flex-start; }

.calendar-wrap { flex: 1; padding: 20px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75em;
  color: var(--grafite);
  margin-bottom: 10px;
  align-items: center;
}
.legend span { display: flex; align-items: center; gap: 4px; }
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--salvia);
}
.dot.status-Rascunho { background: var(--areia); }
.dot.status-Aprovado { background: var(--dourado); }
.dot.status-Publicado { background: var(--petroleo); }
.dot.obs-dot { background: #E0913A; }

.day-badge.tem-observacao {
  box-shadow: 0 0 0 2px #E0913A;
}

.weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekdays span {
  text-align: center;
  font-weight: 700;
  color: var(--petroleo);
  font-size: 0.85em;
  padding: 6px 0;
}

.day-cell {
  background: white;
  border: 1px solid var(--areia);
  border-radius: 8px;
  min-height: 90px;
  padding: 8px;
  cursor: pointer;
  position: relative;
}
.day-cell:hover { border-color: var(--dourado); }
.day-cell.empty { background: transparent; border: none; cursor: default; }
.day-number { font-weight: 700; color: var(--petroleo); }
.day-cell.today .day-number {
  background: var(--petroleo);
  color: white;
  border-radius: 50%;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
}
.day-badges { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.day-badge {
  font-size: 0.7em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--salvia);
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-badge.status-Aprovado { background: var(--dourado); color: var(--petroleo); }
.day-badge.status-Publicado { background: var(--petroleo); color: white; }
.day-badge.status-Rascunho { background: var(--areia); color: var(--grafite); }

.day-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 60, 70, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.day-panel-overlay.hidden { display: none; }
.day-panel {
  width: min(1000px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: white;
  border-radius: 12px;
  padding: 24px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.day-panel-header { display: flex; justify-content: space-between; align-items: center; }
.day-panel-header h2 { color: var(--petroleo); font-family: Georgia, serif; }

.posts-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.post-card {
  border: 1px solid var(--areia);
  border-radius: 8px;
  padding: 10px;
}
.post-card .tipo { font-weight: 700; color: var(--petroleo); font-size: 0.85em; }
.post-card .gancho { margin: 4px 0; }
.post-card img, .post-card video { max-width: 100%; border-radius: 6px; margin-top: 6px; }
.midia-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.midia-item { position: relative; }
.midia-item img, .midia-item video {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0;
  display: block;
}
.midia-item.tem-nota img { outline: 2px solid var(--dourado); }
.midia-thumb { cursor: pointer; }
.btn-nota {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 4px;
  font-size: 0.7em;
  padding: 1px 3px;
  cursor: pointer;
}
.nota-box {
  grid-column: 1 / -1;
  width: 100%;
  font-size: 0.8em;
  padding: 6px;
  border: 1px solid var(--dourado);
  border-radius: 6px;
  margin-top: 2px;
  font-family: inherit;
}
.nota-box.hidden { display: none; }
.midia-count { font-size: 0.7em; color: var(--salvia); margin-top: 2px; }
.legenda-preview {
  font-size: 0.8em;
  color: var(--grafite);
  background: var(--marfim);
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: 6px;
  white-space: pre-wrap;
}
.nota-geral-wrap { margin-top: 6px; }
.btn-nota-geral {
  font-size: 0.75em;
  border: 1px solid var(--dourado);
  background: none;
  color: var(--petroleo);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
}
.nota-geral-box {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 0.85em;
  padding: 6px;
  border: 1px solid var(--dourado);
  border-radius: 6px;
  font-family: inherit;
  min-height: 60px;
}
.nota-geral-box.hidden { display: none; }
.post-card .status-pill {
  display: inline-block;
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--areia);
  margin-top: 6px;
}
.post-card .actions { margin-top: 8px; display: flex; gap: 8px; }
.post-card .actions button {
  font-size: 0.75em;
  border: 1px solid var(--petroleo);
  background: none;
  color: var(--petroleo);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
}

.post-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.post-form.hidden { display: none; }
.post-form label { font-size: 0.8em; font-weight: 700; color: var(--petroleo); }
.post-form input, .post-form textarea, .post-form select {
  border: 1px solid var(--areia);
  border-radius: 6px;
  padding: 8px;
  font-family: inherit;
  font-size: 0.9em;
}

.tipo-tabs { display: flex; gap: 6px; }
.tipo-tab {
  flex: 1;
  border: 1px solid var(--areia);
  background: white;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  font-size: 0.8em;
}
.tipo-tab.active { background: var(--petroleo); color: white; border-color: var(--petroleo); }

.form-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-actions .btn-ghost { flex: 1; }
.form-actions .btn-primary { flex: 1; }

.midia-preview img, .midia-preview video { max-width: 100%; border-radius: 6px; }

.midia-dropzone {
  border: 2px dashed var(--areia);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.midia-dropzone.dragover {
  border-color: var(--dourado);
  background: rgba(197,164,109,0.1);
}
.midia-dropzone input[type="file"] { display: block; width: 100%; }
.midia-dropzone .dropzone-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8em;
  color: var(--grafite);
  opacity: 0.6;
}
.midia-preview-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.midia-preview-item {
  background: var(--marfim);
  border: 1px solid var(--areia);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78em;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-btn {
  position: absolute;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  border-radius: 50%;
  width: 48px;
  height: 48px;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.3); }
.lightbox-close { top: 16px; right: 16px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--dourado);
  font-size: 0.9em;
  background: rgba(0,0,0,0.5);
  padding: 4px 12px;
  border-radius: 12px;
}

@media (max-width: 800px) {
  main { flex-direction: column; }
  .day-panel { width: 100%; min-height: auto; }
}
