/* ============================================================
   calendar.css — Agenda (calendário mensal) · tema claro minimal
   ============================================================ */

.cal-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}

/* ─── Card principal ───────────────────────────────────────── */
.cal-main {
  background: #fff;
  border: 1px solid var(--border-card, #E4E7EC);
  border-radius: 18px;
  padding: 18px;
}
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.cal-nav { display: inline-flex; align-items: center; gap: 8px; }
.cal-nav strong {
  font-size: 16px; font-weight: 800; color: var(--text-primary, #0B1220);
  min-width: 148px; text-align: center; text-transform: capitalize;
}
.cal-nav-btn {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary, #475467);
  border: 1px solid var(--border-card, #E4E7EC); background: #fff;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.cal-nav-btn:hover { background: var(--bg-elevated, #F2F4F7); color: var(--text-primary, #0B1220); }

.cal-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.cal-lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted, #667085); }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; }

/* Cores dos tipos de evento */
.ev-paid     { background: #10B981; }
.ev-pending  { background: #F59E0B; }
.ev-overdue  { background: #EF4444; }
.ev-reminder { background: #7C3AED; }
.ev-sub      { background: #0EA5E9; }

/* ─── Cabeçalho de dias da semana ──────────────────────────── */
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #667085);
  padding: 4px 0;
}

/* ─── Grade do mês ─────────────────────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 96px; padding: 8px; text-align: left;
  background: #fff; border: 1px solid var(--border-subtle, #F0F2F5);
  border-radius: 12px; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; font-family: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
  animation: calCellIn .32s ease both;
}
@keyframes calCellIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cal-cell:hover { border-color: var(--border-card, #E4E7EC); box-shadow: 0 6px 18px rgba(15,23,42,.06); }
.cal-out { background: #FAFBFC; }
.cal-out .cal-daynum { color: #C0C7D1; }
.cal-daynum { font-size: 13px; font-weight: 700; color: var(--text-secondary, #475467); }
.cal-today .cal-daynum {
  background: var(--brand-ink, #0F172A); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-selected { border-color: var(--brand-ink, #0F172A); box-shadow: 0 0 0 1px var(--brand-ink, #0F172A); }

.cal-pills { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-pill {
  font-size: 10.5px; font-weight: 700; color: #fff;
  padding: 2px 6px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: 10px; font-weight: 700; color: var(--text-muted, #667085); padding-left: 2px; }

/* ─── Painel lateral do dia ────────────────────────────────── */
.cal-side {
  background: #fff;
  border: 1px solid var(--border-card, #E4E7EC);
  border-radius: 18px; padding: 16px;
  position: sticky; top: 16px;
}
.cal-side-head { margin-bottom: 12px; }
.cal-side-head strong {
  display: block; font-size: 14px; font-weight: 800;
  color: var(--text-primary, #0B1220); text-transform: capitalize;
}
.cal-side-count { font-size: 12px; color: var(--text-muted, #667085); }
.cal-side-body { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }

.cal-item {
  display: flex; gap: 10px; padding: 10px;
  border: 1px solid var(--border-subtle, #F0F2F5); border-radius: 12px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
  animation: calCellIn .28s ease both;
}
.cal-item:hover { border-color: var(--border-card, #E4E7EC); box-shadow: 0 4px 14px rgba(15,23,42,.05); }
.cal-item-bar { width: 4px; border-radius: 4px; flex-shrink: 0; }
.cal-item-main { flex: 1; min-width: 0; }
.cal-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-item-top strong { font-size: 13px; color: var(--text-primary, #0B1220); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item-val { font-size: 13px; font-weight: 800; color: var(--text-primary, #0B1220); white-space: nowrap; }
.cal-item-time { font-size: 12px; font-weight: 700; color: var(--text-muted, #667085); }
.cal-item-sub { display: block; font-size: 12px; color: var(--text-muted, #667085); margin-top: 2px; }
.cal-item-action {
  margin-top: 8px; font-size: 12px; font-weight: 700;
  color: #059669; background: rgba(16,185,129,.10);
  border: 1px solid rgba(16,185,129,.22); border-radius: 8px;
  padding: 5px 10px; cursor: pointer; transition: background .15s;
}
.cal-item-action:hover { background: rgba(16,185,129,.18); }
.cal-item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cal-item-actions .cal-item-action { margin-top: 0; }
.cal-item-action.wa   { color: #128C7E; background: rgba(37,211,102,.12); border-color: rgba(37,211,102,.28); }
.cal-item-action.wa:hover { background: rgba(37,211,102,.2); }
.cal-item-action.mail { color: #0284C7; background: rgba(2,132,199,.10); border-color: rgba(2,132,199,.24); }
.cal-item-action.mail:hover { background: rgba(2,132,199,.18); }

/* Botão 'Nova cobrança neste dia' no topo do painel */
.cal-add-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 12px; margin-bottom: 10px;
  border-radius: 10px; font-size: 13px; font-weight: 700; font-family: inherit;
  color: #fff; background: var(--brand-ink, #0F172A);
  border: none; cursor: pointer; transition: background .15s, transform .15s;
}
.cal-add-btn:hover { background: #1E293B; transform: translateY(-1px); }

/* ─── Anotação do dia (textarea no painel lateral) ─────────── */
.cal-day-note {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; margin-bottom: 8px;
  background: var(--bg-elevated, #F2F4F7);
  border: 1px solid var(--border-subtle, #F0F2F5);
  border-radius: 12px;
}
.cal-day-note .form-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #667085); margin: 0; }
.cal-day-note textarea {
  resize: vertical; min-height: 40px; padding: 6px 8px;
  border: 1px solid transparent; background: #fff;
  font-size: 13px; line-height: 1.4;
  border-radius: 8px;
}
.cal-day-note textarea:focus { border-color: var(--brand-ink, #0F172A); outline: none; }
.cal-note-status { font-size: 11px; color: var(--text-muted, #667085); min-height: 14px; }

/* Item clicável (indica que abre detalhes) */
.cal-item-clickable { cursor: pointer; }
.cal-item-clickable:hover .cal-item-top strong { text-decoration: underline; text-decoration-color: rgba(15,23,42,.15); text-underline-offset: 3px; }

/* ─── Modal de detalhes do evento ──────────────────────────── */
.evd-body { display: flex; flex-direction: column; gap: 14px; }
.evd-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated, #F2F4F7);
  border: 1px solid var(--border-subtle, #F0F2F5);
  border-radius: 12px;
}
.evd-type {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 999px;
  background: #fff; color: var(--text-primary, #0B1220);
  border: 1px solid var(--border-card, #E4E7EC);
}
.evd-type.ev-paid    { color: #059669; border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.08); }
.evd-type.ev-pending { color: #B45309; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.08); }
.evd-type.ev-overdue { color: #DC2626; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }
.evd-value { font-size: 22px; font-weight: 800; color: var(--text-primary, #0B1220); }

.evd-grid { display: grid; gap: 8px; }
.evd-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border-subtle, #F0F2F5);
}
.evd-row span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #667085); }
.evd-row strong { font-size: 13px; color: var(--text-primary, #0B1220); text-align: right; word-break: break-word; }

.evd-note-wrap { display: flex; flex-direction: column; gap: 6px; }
.evd-note-wrap textarea { resize: vertical; min-height: 60px; }
.evd-note-status { font-size: 11px; color: var(--text-muted, #667085); min-height: 14px; }

.evd-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 4px;
}
.evd-actions .btn { flex: 1; min-width: 140px; }

/* ─── Responsivo ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .cal-wrap { grid-template-columns: 1fr; }
  .cal-side { position: static; }
  .cal-cell { min-height: 76px; }
}
@media (max-width: 560px) {
  .cal-main { padding: 12px; }
  .cal-cell { min-height: 62px; padding: 5px; border-radius: 9px; }
  .cal-pill { font-size: 0; padding: 0; height: 6px; width: 100%; border-radius: 3px; }  /* vira barrinha */
  .cal-legend { display: none; }
  .cal-grid, .cal-weekdays { gap: 4px; }
}
