/* ═══ Экран «Календарь» (задача 4) ═══════════════════════════════
   Обычная месячная сетка в стиле макетов: карточка #161618 с радиусом 24, дни недели
   моно капителью, точки по сферам. Выбранный день белым кругом, как активный чип
   на «Клиентах», сегодня коралловым. Список дня ниже сетки карточками с полоской сферы.
   От 900 в клетках названия событий, от 1180 список дня справа от сетки. */
.calendar, .cal-wrap, .cal-main, .cal-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cal-back {
  position: relative; flex: none; height: 40px; padding: 0 16px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .12); background: var(--surface); color: var(--ink); font-size: 14px;
  transition: background-color .15s;
}
.cal-back::after { content: ''; position: absolute; inset: -2px 0; }

/* ── сетка ────────────────────────────────────────────────────── */
.cal-card { display: flex; flex-direction: column; padding: 10px 8px 12px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.cal-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-left: 10px; }
.cal-month { font-family: var(--disp); font-size: 17px; font-weight: 600; }
.cal-month span { color: var(--ink-3); font-weight: 400; }
.cal-nav { display: flex; }
.cal-arrow {
  width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--ink-2);
  transition: color .15s, background-color .15s;
}
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 6px 0 4px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-align: center; color: var(--ink-3); }
.cal-wd span:nth-child(n+6) { color: #6F6B65; }
.cal-grid { row-gap: 2px; touch-action: pan-y; }
.cal-day {
  position: relative; min-width: 0; min-height: 50px; padding: 4px 0 5px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink);
  transition: background-color .15s;
}
.cal-num {
  width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center;
  font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s;
}
.cal-day.is-we .cal-num { color: var(--ink-2); }
.cal-day.is-out .cal-num { color: #57534E; }
.cal-day.is-today .cal-num { color: var(--coral); font-weight: 700; box-shadow: inset 0 0 0 1.5px rgba(234, 131, 105, .5); }
.cal-day.is-sel .cal-num { background: #F4F1EC; color: #111; font-weight: 600; box-shadow: none; }
.cal-day.is-today.is-sel .cal-num { background: var(--coral); color: var(--coral-ink); }
.cal-dots { display: flex; gap: 3px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.cal-day.is-out .cal-dots i { opacity: .4; }
.cal-titles { display: none; }
.cal-grid.slide-next { animation: cal-next .3s var(--ease); }
.cal-grid.slide-prev { animation: cal-prev .3s var(--ease); }
@keyframes cal-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes cal-prev { from { opacity: 0; transform: translateX(-28px); } }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 10px 2px; margin-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

/* ── список дня ───────────────────────────────────────────────── */
.cal-panel { display: flex; flex-direction: column; gap: 12px; }
.cal-ph { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cal-ph-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-rel { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.cal-rel.now { color: var(--coral); }
.cal-add {
  flex: none; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center;
  border: 1px solid var(--line-3); background: var(--surface); color: var(--ink); transition: background-color .15s, border-color .15s;
}
.cal-evs { display: flex; flex-direction: column; gap: 8px; }
.cal-ev {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; width: 100%;
  padding: 14px 16px 14px 20px; border-radius: 20px; text-align: left; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); transition: background-color .15s;
}
.cal-ev::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 3px 3px 0; background: var(--c); }
.cal-ev-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.cal-ev-meta { font-family: var(--mono); font-size: 11px; color: var(--c); }
.cal-ev-detail { font-size: 13px; line-height: 1.4; color: var(--ink-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.cal-next { min-height: 44px; margin: -6px 0 -10px; font-size: 14px; color: var(--coral); text-align: left; }
.cal-soon { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.cal-soon-list { display: flex; flex-direction: column; padding: 4px 6px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.cal-soon-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 14px;
  text-align: left; color: var(--ink); transition: background-color .15s;
}
.cal-soon-row { position: relative; }
.cal-soon-row + .cal-soon-row::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line); }
.cal-soon-d { flex: none; width: 76px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-transform: uppercase; }
.cal-soon-d.now { color: var(--coral); }
.cal-soon-t { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.cal-soon-t i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cal-soon-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-sub {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; border-radius: 20px;
  text-align: left; color: var(--ink); border: 1px dashed rgba(255, 255, 255, .12); transition: background-color .15s;
}
.cal-sub svg { flex: none; color: var(--coral); }
.cal-sub-txt { display: flex; flex-direction: column; gap: 3px; font-size: 15px; font-weight: 500; }
.cal-sub-txt small { font-size: 13px; font-weight: 400; color: var(--ink-3); }

/* ── шторка события ───────────────────────────────────────────── */
.evd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 14px; font-size: 14px; color: var(--ink-2); }
.evd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.evd-when { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.evd-when::before { content: '·'; margin-right: 8px; color: var(--ink-3); }
.evd-detail { font-size: 15px; line-height: 1.5; color: var(--ink-2); margin-bottom: 18px; white-space: pre-line; }
.evd-move { padding-top: 16px; border-top: 1px solid var(--line); }
.evd-move .field-row { align-items: end; }
.evd-move .btn-ghost { min-height: 48px; }
.evd-del { width: 100%; margin-top: 18px; color: #EE7A8A; border-color: rgba(238, 122, 138, .3); }

.sk-cal { height: 420px; border-radius: 24px; }

/* наведение только там, где есть мышь: на телефоне :hover залипает после тапа */
@media (hover: hover) {
  .cal-back:hover { background: var(--surface-2); }
  .cal-arrow:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
  .cal-day:hover { background: rgba(255, 255, 255, .035); }
  .cal-add:hover { background: var(--surface-2); border-color: rgba(234, 131, 105, .5); }
  .cal-ev:hover { background: var(--surface-hover); }
  .cal-next:hover { color: var(--coral-hi); }
  .cal-soon-row:hover { background: rgba(255, 255, 255, .04); }
  .cal-sub:hover { background: rgba(255, 255, 255, .03); }
  .evd-del:hover { color: #F59AA6; background: rgba(238, 122, 138, .08); }
}

/* ── компьютер: названия в клетках, список дня справа ─────────── */
@media (min-width: 900px) {
  .calendar { max-width: 640px; }
  .cal-card { padding: 14px 14px 14px; }
  .cal-grid { gap: 4px; }
  .cal-day { align-items: stretch; min-height: 92px; padding: 6px; border-radius: 14px; gap: 4px; background: rgba(255, 255, 255, .02); }
  .cal-day:hover { background: rgba(255, 255, 255, .05); }
  .cal-day.is-sel { background: rgba(244, 241, 236, .06); box-shadow: inset 0 0 0 1px rgba(244, 241, 236, .18); }
  .cal-day.is-out { background: none; }
  .cal-num { align-self: flex-start; width: 28px; height: 28px; border-radius: 14px; font-size: 13px; }
  .cal-dots { display: none; }
  .cal-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .cal-t {
    position: relative; display: block; overflow: hidden; padding: 2px 6px; border-radius: 6px;
    font-size: 11px; line-height: 1.35; color: var(--c); text-align: left; white-space: nowrap; text-overflow: ellipsis;
  }
  .cal-t::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--c); opacity: .14; }
  .cal-day.is-out .cal-t { opacity: .45; }
  .cal-more { padding-left: 6px; font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: left; }
}
@media (min-width: 1180px) {
  .calendar { max-width: 1120px; }
  .cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
  .cal-side { position: sticky; top: 36px; }
}
