/* Content calendar (calendar.js). App tokens only; platform colours are local. */
.cal { --cal-yt: #f2665a; --cal-tt: #58d1c9; --cal-ig: #d874b8; display: grid; gap: 14px; }
.cal .p-youtube { --pc: var(--cal-yt); }
.cal .p-tiktok { --pc: var(--cal-tt); }
.cal .p-instagram { --pc: var(--cal-ig); }

.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.cal-nav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-nav h2 { margin: 0 8px; font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: -.03em; white-space: nowrap; }
.cal-arrow { width: 34px; padding: 0; font-size: 20px; line-height: 1; }
.cal-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cal-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-fchip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13px; }
.cal-fchip:hover { border-color: var(--line-3); }
.cal-fchip.on { background: var(--surface-3); color: var(--text); border-color: var(--pc); }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--muted)); display: inline-block; flex: none; }
.cal-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.cal-seg button { height: 28px; padding: 0 14px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.cal-seg button.on { background: var(--surface-3); color: var(--text); }

/* events */
.cal-ev { --pc: var(--cal-yt); position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 6px 4px 8px; border-radius: 7px; background: var(--surface-2);
  border: 1px solid var(--line); border-left: 3px solid var(--pc); color: var(--text); font-size: 12px; line-height: 1.25; cursor: pointer; text-align: left; }
.cal-ev:hover { background: var(--surface-3); border-color: var(--line-3); border-left-color: var(--pc); }
.cal-ev:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.cal-ev time { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
.cal-ev .cal-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dots { display: inline-flex; gap: 3px; flex: none; }
.cal-ev.can-move { cursor: grab; }
.cal-ev.drag { opacity: .45; }
.cal-ev.st-posted { background: transparent; border-color: var(--line); }
.cal-ev.st-posted .cal-t { color: var(--text-2); }
.cal-daylist .cal-ev.st-posted time::after, .cal-aday .cal-ev.st-posted time::after { content: " live"; color: var(--success); }
.cal-ev.st-failed { border-color: var(--danger); border-left-color: var(--pc); background: var(--danger-soft); }
.cal-daylist .cal-ev.st-failed time::after, .cal-aday .cal-ev.st-failed time::after { content: " failed"; color: var(--danger); }
.cal-ev.st-posting { animation: cal-pulse 1.6s ease-in-out infinite; }
@keyframes cal-pulse { 50% { border-color: var(--accent-line); } }
.cal-mv { flex: none; width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; }
.cal-mv svg { width: 14px; height: 14px; }
.cal-mv:hover { background: var(--hover); color: var(--text); }
.cal-mv.txt { width: auto; padding: 0 8px; height: 24px; font-size: 12px; font-weight: 600; color: var(--text-2); border: 1px solid var(--line-2); }

/* month */
.cal-month { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.cal-dow, .cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-dow span { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-cell { min-height: 118px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr; gap: 5px; align-content: start; min-width: 0; }
.cal-row > .cal-cell:last-child { border-right: 0; }
.cal-row:last-child > .cal-cell { border-bottom: 0; }
.cal-cell.out { background: var(--bg-2); }
.cal-cell.out .cal-num { color: var(--faint); }
.cal-cell.drop, .cal-col.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-line); }
.cal-num { justify-self: start; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; border: 0; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.cal-num:hover { background: var(--hover); }
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-evs { display: grid; gap: 3px; align-content: start; min-width: 0; }
.cal-more { justify-self: start; border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 2px 4px; }
.cal-more:hover { color: var(--text); }
.cal-mini, .cal-daylist { display: none; }

/* week */
.cal-week { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.cal-whead { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-wh { padding: 8px 10px; display: flex; align-items: baseline; gap: 6px; border-left: 1px solid var(--line); }
.cal-wh span { font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-wh b { font-family: var(--display); font-size: 17px; }
.cal-wh.today b { color: var(--accent-text); }
.cal-scroll { max-height: 640px; overflow: auto; }
.cal-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.cal-gutter { display: grid; }
.cal-gutter span { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); text-align: right; padding: 2px 8px 0 0; box-sizing: border-box; }
.cal-col { border-left: 1px solid var(--line); min-width: 0; }
.cal-colbody { position: relative; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 45px, var(--line) 45px, var(--line) 46px); }
.cal-col.today .cal-colbody { background-color: rgba(206, 240, 71, 0.025); }
.cal-colbody .cal-ev { position: absolute; height: 38px; align-items: flex-start; flex-wrap: wrap; row-gap: 0; padding: 3px 5px 3px 7px; overflow: hidden; }
.cal-colbody .cal-ev time { flex: none; }
.cal-colbody .cal-ev .cal-t { flex: 1 1 60px; }
.cal-colbody .cal-ev .cal-dots, .cal-colbody .cal-ev .cal-mv { display: none; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* tray */
.cal-tray { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 8px; }
.cal-tray h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cal-tray .hint { margin: 0; }
.cal-tray-list { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-tray-list .cal-ev { max-width: 320px; }

.cal-legend { margin: 0; }
.cal-empty { margin-top: 4px; }
.cal-lib-link { margin-bottom: 12px; display: none; }

/* dialog */
.cal-modal { align-items: center; }
.cal-sheet { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; padding: 24px; display: grid; gap: 14px; position: relative; box-shadow: var(--shadow-float); animation: sheet-in .3s var(--ease-out); }
.cal-sheet h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.03em; padding-right: 40px; }
.cal-dlg-title { margin: 0; color: var(--text-2); font-size: 14px; }
.cal-dlg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal-sheet .hint { margin: 0; }

/* phone: the month is a compact grid of dots, the selected day and the week are lists */
@media (max-width: 700px) {
  .cal-nav h2 { font-size: 18px; margin: 0 4px; }
  .cal-tools { width: 100%; justify-content: space-between; }
  .cal-lib-link { display: inline-flex; }
  .cal-dow span { padding: 6px 2px; text-align: center; font-size: 11px; }
  .cal-cell { min-height: 54px; padding: 4px 2px; gap: 2px; justify-items: center; }
  .cal-cell .cal-evs { display: none; }
  .cal-cell .cal-num { justify-self: center; }
  .cal-cell.sel:not(.today) .cal-num { background: var(--surface-3); color: var(--text); }
  .cal-mini { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
  .cal-mini .cal-dot { width: 6px; height: 6px; }
  .cal-mini .cal-dot.st-posted { opacity: .45; }
  .cal-daylist { display: grid; gap: 6px; }
  .cal-daylist h3, .cal-aday h3 { margin: 0 0 2px; font-size: 14px; }
  .cal-daylist .cal-ev, .cal-aday .cal-ev { padding: 8px 8px 8px 10px; font-size: 13px; }
  .cal-agenda { display: grid; gap: 14px; }
  .cal-aday { display: grid; gap: 6px; }
  .cal-aday.today h3 { color: var(--accent-text); }
  .cal-aday p { margin: 0; font-size: 13px; }
  .cal-cell.drop { background: none; box-shadow: none; }
  .cal-modal { place-items: end stretch; padding: 0; }
  .cal-sheet { border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-width: none; }
  .cal-tray-list .cal-ev { max-width: none; width: 100%; }
}

/* the Move button appears on hover / focus in the grids (always in the phone lists) */
.cal-cell .cal-mv:not(.txt), .cal-colbody .cal-mv { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); opacity: 0; background: var(--surface-3); }
.cal-cell .cal-ev:hover .cal-mv, .cal-cell .cal-ev:focus-within .cal-mv { opacity: 1; }
