/* /funcionalidades/calendario-reservas-y-videollamadas/ — the month with the
   meeting panel. Five scenes (pantallas-escenas.js): 0 a task's date dragged
   from Tuesday to Friday, 1 a booking landing on Wednesday, 2 the booking
   open and waiting for a decision, 3 confirmed, 4 the month with both done —
   the resting state, and the markup's first paint.

   The accent is the product's default (globals.css --accent, a muted sage):
   today, the Month tab and the calendar's own meetings wear it. The dates
   from other modules wear their source's tone (page.tsx TONE_CLASS). */

.pn-frame[data-screen="calendar"] {
  --cl-accent: #467557;
  --cl-accent-10: rgb(70 117 87 / 0.1);
  --cl-accent-40: rgb(70 117 87 / 0.4);
  --cl-success: #187c49;
  --cl-success-soft: #e6f6eb;
  --cl-warning: #9a692a;
  --cl-warning-soft: #fdf0d8;
}

/* ---------- the header ---------- */

.pn-frame[data-screen="calendar"] .cl-head-acts { gap: 7px; }

.pn-frame[data-screen="calendar"] .md-btn.is-danger {
  border-color: var(--ac-bad);
  background: var(--ac-bad);
  color: #fff;
}

/* ---------- the month card ---------- */

.pn-frame[data-screen="calendar"] .cl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ac-line);
}

.pn-frame[data-screen="calendar"] .cl-month {
  font-size: 13px;
  font-weight: 650;
}

/* The product writes these with Tailwind's `capitalize`, which also turns
   "de" into "De"; only the first letter is raised here. */
.pn-frame[data-screen="calendar"] .cl-month::first-letter { text-transform: uppercase; }

.pn-frame[data-screen="calendar"] .cl-bar-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pn-frame[data-screen="calendar"] .cl-bar-side em { color: var(--ac-mut); font-size: 9.5px; }

.pn-frame[data-screen="calendar"] .cl-views {
  display: flex;
  padding: 2px;
  border: 1px solid var(--ac-line);
  border-radius: 7px;
}

.pn-frame[data-screen="calendar"] .cl-views i {
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--ac-mut);
  font-size: 9.5px;
  font-weight: 500;
}

.pn-frame[data-screen="calendar"] .cl-views i.is-on { background: var(--cl-accent); color: #fff; }

.pn-frame[data-screen="calendar"] .cl-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--ac-line);
  background: #f8f8f9;
}

.pn-frame[data-screen="calendar"] .cl-weekdays > span {
  padding: 6px 4px;
  color: var(--ac-mut);
  font-size: 9.5px;
  font-weight: 500;
  text-align: center;
}

.pn-frame[data-screen="calendar"] .cl-weekdays > span::first-letter { text-transform: uppercase; }

/* Rows are fixed, so a chip moving along one stays on its line. */
.pn-frame[data-screen="calendar"] .cl-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(5, 104px);
}

.pn-frame[data-screen="calendar"] .cl-day {
  box-sizing: border-box;
  padding: 5px;
  border-right: 1px solid var(--ac-line);
  border-bottom: 1px solid var(--ac-line);
  background: #fff;
  transition: box-shadow 0.18s ease;
}

.pn-frame[data-screen="calendar"] .cl-day:nth-child(7n) { border-right: 0; }
.pn-frame[data-screen="calendar"] .cl-day:nth-last-child(-n + 7) { border-bottom: 0; }
.pn-frame[data-screen="calendar"] .cl-day.is-out { background: #fafafb; }

.pn-frame[data-screen="calendar"] .cl-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.pn-frame[data-screen="calendar"] .cl-day-head b {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  place-items: center;
  border-radius: 99px;
  box-sizing: border-box;
  font-size: 9.5px;
  font-weight: 400;
}

.pn-frame[data-screen="calendar"] .cl-day.is-out .cl-day-head b { color: #b4b8c0; }

.pn-frame[data-screen="calendar"] .cl-day.is-today .cl-day-head b {
  background: var(--cl-accent);
  color: #fff;
  font-weight: 600;
}

.pn-frame[data-screen="calendar"] .cl-add {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--ac-line);
  border-radius: 7px;
  background: #fff;
  color: var(--ac-mut);
}

.pn-frame[data-screen="calendar"] .cl-i { width: 10px; height: 10px; flex-shrink: 0; }
.pn-frame[data-screen="calendar"] .cl-add .cl-i { width: 12px; height: 12px; }

.pn-frame[data-screen="calendar"] .cl-items { display: flex; flex-direction: column; }
.pn-frame[data-screen="calendar"] .cl-items > * + * { margin-top: 3px; }

.pn-frame[data-screen="calendar"] :is(.cl-ev, .cl-chip) {
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  width: 100%;
  height: 19px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--cl-accent-10);
  color: var(--cl-accent);
  font-size: 9.5px;
}

.pn-frame[data-screen="calendar"] :is(.cl-ev, .cl-chip) > i {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pn-frame[data-screen="calendar"] .cl-ev.is-busy { background: rgb(17 19 24 / 0.06); color: var(--ac-mut); }
.pn-frame[data-screen="calendar"] .cl-chip.is-support { background: rgb(245 158 11 / 0.1); color: #b45309; }
.pn-frame[data-screen="calendar"] .cl-chip.is-delivery { background: rgb(139 92 246 / 0.1); color: #6d28d9; }
.pn-frame[data-screen="calendar"] .cl-chip.is-sales { background: rgb(16 185 129 / 0.1); color: #047857; }
.pn-frame[data-screen="calendar"] .cl-chip.is-money { background: rgb(14 165 233 / 0.1); color: #0369a1; }
.pn-frame[data-screen="calendar"] .cl-chip.is-reminder { background: rgb(244 63 94 / 0.1); color: #be123c; }

/* The three slots that open and close: the dragged chip's old place, its
   new one, and the booking's. Each is one chip tall when open. */
.pn-frame[data-screen="calendar"] .cl-slot {
  position: relative;
  display: block;
  max-height: 19px;
  transition: max-height 0.26s ease, margin-top 0.26s ease, opacity 0.2s ease;
}

.pn-frame[data-screen="calendar"] .cl-slot.is-from { z-index: 4; }

/* The image the browser drags: a lifted copy riding over the week. */
.pn-frame[data-screen="calendar"] .cl-ghost {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  box-shadow: 0 6px 16px rgb(17 19 24 / 0.16);
  background: #edf2ee;
}

/* Scene 0: the chip is still on Tuesday and Friday has no room for it yet. */
.pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-slot.is-to,
.pn-frame[data-screen="calendar"]:is([data-mk-scene="0"], [data-mk-scene="1"]) .cl-slot.is-booking {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-ghost { display: flex; opacity: 0; }

/* Scenes 1 to 4: the date moved, so Tuesday no longer holds it. */
.pn-frame[data-screen="calendar"]:not([data-mk-scene="0"]) .cl-slot.is-from {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

/* ---------- the meeting panel ---------- */

.pn-frame[data-screen="calendar"] .cl-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: none;
  place-items: center;
  background: rgb(17 19 24 / 0.25);
}

.pn-frame[data-screen="calendar"]:is([data-mk-scene="2"], [data-mk-scene="3"]) .cl-overlay { display: grid; }

.pn-frame[data-screen="calendar"] .cl-modal {
  width: 424px;
  border: 1px solid var(--ac-line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(17 19 24 / 0.18), 0 2px 8px rgb(17 19 24 / 0.08);
}

.pn-frame[data-screen="calendar"] .cl-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 19px 13px;
  border-bottom: 1px solid var(--ac-line);
}

.pn-frame[data-screen="calendar"] .cl-modal-head p { font-size: 14px; font-weight: 650; }
.pn-frame[data-screen="calendar"] .cl-close { width: 14px; height: 14px; flex-shrink: 0; color: var(--ac-dim); }

.pn-frame[data-screen="calendar"] .cl-modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 16px 19px 18px;
  font-size: 11px;
}

.pn-frame[data-screen="calendar"] :is(.cl-when, .cl-where) {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.pn-frame[data-screen="calendar"] .cl-when-i { width: 13px; height: 13px; margin-top: 1px; flex-shrink: 0; color: var(--ac-mut); }
.pn-frame[data-screen="calendar"] .cl-when b { font-weight: 500; }
.pn-frame[data-screen="calendar"] .cl-when p { color: var(--ac-mut); }
.pn-frame[data-screen="calendar"] .cl-where p { overflow-wrap: anywhere; }

.pn-frame[data-screen="calendar"] :is(.cl-call, .cl-pending-acts, .cl-foot-acts) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.pn-frame[data-screen="calendar"] .cl-call .md-ibtn { width: 29px; height: 29px; }

.pn-frame[data-screen="calendar"] .cl-pending {
  padding: 10px;
  border: 1px solid rgb(154 105 42 / 0.3);
  border-radius: 8px;
  background: var(--cl-warning-soft);
}

.pn-frame[data-screen="calendar"] .cl-pending b { font-weight: 600; }
.pn-frame[data-screen="calendar"] .cl-pending p { margin-top: 3px; color: var(--ac-mut); }
.pn-frame[data-screen="calendar"] .cl-pending-acts { margin-top: 10px; }

.pn-frame[data-screen="calendar"] .cl-people-title {
  margin-bottom: 6px;
  color: var(--ac-dim);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pn-frame[data-screen="calendar"] .cl-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pn-frame[data-screen="calendar"] .cl-person em { color: var(--cl-success); font-size: 9.5px; }

.pn-frame[data-screen="calendar"] .cl-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 13px;
  border-top: 1px solid var(--ac-line);
}

.pn-frame[data-screen="calendar"] .cl-foot u {
  color: var(--cl-accent);
  font-weight: 600;
  text-decoration: underline;
}

/* Confirmed: the request is decided, so its box goes. */
.pn-frame[data-screen="calendar"][data-mk-scene="3"] .cl-pending { display: none; }

/* ---------- the toasts ---------- */

.pn-frame[data-screen="calendar"] .cl-toast {
  position: absolute;
  z-index: 6;
  right: 77px;
  bottom: 19px;
  display: none;
  align-items: center;
  gap: 10px;
  width: 272px;
  box-sizing: border-box;
  padding: 8px 8px 8px 10px;
  border: 1px solid rgb(24 124 73 / 0.35);
  border-radius: 10px;
  background: var(--cl-success-soft);
  box-shadow: 0 10px 24px rgb(17 19 24 / 0.12);
  color: var(--cl-success);
}

.pn-frame[data-screen="calendar"] .cl-toast p {
  flex: 1;
  color: var(--ac-ink);
  font-size: 11px;
  font-weight: 500;
}

.pn-frame[data-screen="calendar"] .cl-toast-i { width: 13px; height: 13px; flex-shrink: 0; }

.pn-frame[data-screen="calendar"] .cl-toast-x {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1.5px solid rgb(24 124 73 / 0.45);
  border-radius: 99px;
}

.pn-frame[data-screen="calendar"]:is([data-mk-scene="0"], [data-mk-scene="1"]) .cl-toast.is-moved,
.pn-frame[data-screen="calendar"][data-mk-scene="3"] .cl-toast.is-confirmed { display: flex; }

/* ---------- the motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* 0 — lift at 0.5 s, ride three columns, drop at 2.25 s. The column is a
     fifth of nothing: three cells are three times the chip plus each cell's
     padding (2 × 5 px) and its right border. */
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-ghost { animation: cl-drag 2.25s cubic-bezier(0.45, 0, 0.3, 1) both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-slot.is-from > .cl-chip:first-child { animation: cl-held 2.25s step-end both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-day.is-drop { animation: cl-over 2.3s step-end both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-slot.is-from { animation: cl-close 0.26s ease 2.25s both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-slot.is-to { animation: cl-open 0.26s ease 2.25s both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="0"] .cl-toast.is-moved { animation: cl-toast-in 0.3s ease-out 2.4s both; }

  /* 1 — the toast runs out; the booking lands and is opened. */
  .pn-frame[data-screen="calendar"][data-mk-scene="1"] .cl-toast.is-moved { animation: cl-toast-out 0.25s ease-in 1.4s both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="1"] .cl-slot.is-booking { animation: cl-open 0.3s ease 0.5s both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="1"] .cl-ev.is-new { animation: cl-arrive 1.5s ease 0.5s both, cl-press 0.34s ease 2.25s; }

  /* 2 — the panel opens; Confirm is pressed. */
  .pn-frame[data-screen="calendar"][data-mk-scene="2"] .cl-overlay { animation: cl-fade 0.2s ease-out both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="2"] .cl-modal { animation: cl-land 0.28s ease-out both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="2"] .cl-confirm { animation: cl-press 0.36s ease 2.6s both; }

  /* 3 — confirmed. */
  .pn-frame[data-screen="calendar"][data-mk-scene="3"] .cl-toast.is-confirmed { animation: cl-toast-in 0.3s ease-out 0.15s both; }
  .pn-frame[data-screen="calendar"][data-mk-scene="3"] .cl-people { animation: cl-settle 0.3s ease-out both; }
}

@keyframes cl-drag {
  0%, 22% { opacity: 0; transform: none; }
  24% { opacity: 0.92; transform: translateY(-2px) rotate(-1.5deg); }
  88% { opacity: 0.92; transform: translate(calc(300% + 33px), -2px) rotate(-1.5deg); }
  99.9% { opacity: 0.92; transform: translate(calc(300% + 33px), 0); }
  100% { opacity: 0; transform: translate(calc(300% + 33px), 0); }
}

@keyframes cl-held {
  0%, 22% { opacity: 1; }
  23%, 100% { opacity: 0.4; }
}

@keyframes cl-over {
  0%, 73% { box-shadow: none; }
  74%, 99% { box-shadow: inset 0 0 0 2px var(--cl-accent-40); }
  100% { box-shadow: none; }
}

@keyframes cl-close {
  from { max-height: 19px; margin-top: 3px; opacity: 1; }
  to { max-height: 0; margin-top: 0; opacity: 0; }
}

@keyframes cl-open {
  from { max-height: 0; margin-top: 0; opacity: 0; }
  to { max-height: 19px; margin-top: 3px; opacity: 1; }
}

@keyframes cl-arrive {
  0% { box-shadow: 0 0 0 0 rgb(70 117 87 / 0.5); }
  40% { box-shadow: 0 0 0 3px rgb(70 117 87 / 0.25); }
  100% { box-shadow: 0 0 0 0 rgb(70 117 87 / 0); }
}

@keyframes cl-press {
  0%, 100% { transform: none; }
  45% { transform: scale(0.95); filter: brightness(0.92); }
}

@keyframes cl-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cl-land {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes cl-settle {
  from { transform: translateY(6px); }
  to { transform: none; }
}

@keyframes cl-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes cl-toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
