:root {
  /* Фирменный акцент SipUni — поменяйте здесь, чтобы перекрасить весь интерфейс */
  --brand: #846DF2;
  --brand-dark: #6a51e0;
  --brand-soft: #eeeafd;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #243140;
  --muted: #8a97a6;
  --border: #e6eaee;
  --radius: 30px;
  --shadow: 0 1px 3px rgba(20, 40, 60, .08), 0 1px 2px rgba(20, 40, 60, .04);
  --input-bg: #fff;
  --ghost-bg: #eef1f4;
  --ghost-bg-hover: #e3e8ec;
  --toolbar-bg: #fafbfc;
  --on-pastel: #243140;   /* текст на пастельных блоках встреч/аватарках — всегда тёмный */
  --cal-dim: rgba(255, 255, 255, .55);   /* вуаль поверх календаря при загрузке событий */
  /* отпуска — «человека нет»: янтарный, чтобы не спорить с фиолетовыми встречами */
  --vac-bg: #fdf1d8;
  --vac-fg: #8a5a08;
  --vac-line: #f0d9a3;
  --vac-col: rgba(233, 179, 74, .13);    /* заливка столбца дня, в котором есть отпуск */
  /* «сегодня» больше не заливаем: дефолт FullCalendar тут жёлтый и спорил бы с отпуском,
     вместо заливки — красный кружок на числе в шапке дня (как в мини-календаре) */
  --fc-today-bg-color: transparent;
}

/* тёмная тема — переопределяем переменные (включая FullCalendar --fc-*) */
html[data-theme="dark"] {
  --brand-soft: rgba(132, 109, 242, .22);
  --bg: #14181d;
  --card: #1b2129;
  --text: #e6eaee;
  --muted: #8a97a6;
  --border: #2b333d;
  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
  --input-bg: #232a33;
  --ghost-bg: #2a323c;
  --ghost-bg-hover: #333c47;
  --toolbar-bg: #232a33;
  --fc-page-bg-color: var(--card);
  --fc-border-color: var(--border);
  --fc-neutral-bg-color: #232a33;
  --fc-today-bg-color: transparent;
  --cal-dim: rgba(20, 24, 29, .55);
  /* Тон сдвинут от жёлтого к оранжевому: жёлтый поверх тёмно-синего фона даёт оливковую грязь
     (rgba(233,179,74,.10) над #1b2129 = #302f2c), а с перевесом красного канала выходит тёплый песок. */
  --vac-bg: rgba(255, 150, 50, .22);
  --vac-fg: #f0a862;
  --vac-line: rgba(255, 150, 50, .40);
  --vac-col: rgba(255, 150, 50, .13);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { margin: 0; height: 100%; color: var(--text); background: var(--bg);
  font-family: "Open Sans", -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

/* height:100% (от html/body) надёжнее 100vh во вложенном iframe — берёт высоту фрейма. */
#app { display: flex; height: 100%; min-height: 100%; }

#sidebar { width: 312px; flex-shrink: 0; padding: 16px; overflow-y: auto;
  display: flex; flex-direction: column; }
/* блок авторизации прижат к нижнему краю колонки */
#sidebar #userbar { margin-top: auto; margin-bottom: 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; }
.block { margin-bottom: 16px; }
.block label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.block-title { font-size: 13px; color: var(--text); margin-bottom: 10px; font-weight: 600;
  font-family: Montserrat, sans-serif; }
.muted { color: var(--muted); font-size: 12px; margin-top: 6px; }
.error { color: #d6336c; font-size: 13px; margin-top: 10px; min-height: 16px; }

input, textarea, button { font-size: 14px; font-family: inherit; }
input[type=text], input[type=email], input[type=password], input#search,
textarea, input[type=datetime-local] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--input-bg); color: var(--text); outline: none; transition: border-color .15s; }
input:focus, textarea:focus { border-color: var(--brand); }
.row2 { display: flex; gap: 10px; }
.row2 label { flex: 1; }

/* кастомный выпадающий список поиска */
.suggest-wrap { position: relative; }
.suggest { list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; left: 0; right: 0; z-index: 30;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto; scrollbar-gutter: stable; }
/* тонкий аккуратный скроллбар, чтобы не налезал на скруглённый угол/текст */
.suggest { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.suggest::-webkit-scrollbar { width: 8px; }
.suggest::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.suggest::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.suggest-item { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-item:hover { background: var(--brand-soft); }
.suggest-item.active { background: var(--brand); color: #fff; }

button { padding: 9px 14px; border: none; border-radius: 8px; background: var(--brand); color: #fff;
  cursor: pointer; font-weight: 600; transition: background .15s; }
button:hover { background: var(--brand-dark); }
button.wide { width: 100%; margin-top: 10px; }
button.ghost { background: var(--ghost-bg); color: var(--text); }
button.ghost:hover { background: var(--ghost-bg-hover); }
button:disabled { opacity: .6; cursor: default; }

/* строка пользователя / вход */
.user-row { display: flex; align-items: center; gap: 8px; font-size: 14px; position: relative; }
.me-name { flex: 1; font-weight: 600; text-align: left; background: transparent; color: var(--text);
  padding: 2px 4px; border-radius: 8px; cursor: pointer; font-family: inherit; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }
.me-name:hover { background: transparent; color: var(--brand); }
/* всплывающее меню пользователя — раскрывается ВВЕРХ (блок прижат к низу) */
.dropdown.user-menu { top: auto; bottom: 100%; margin: 0 0 6px; min-width: 150px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent;
  color: var(--text); padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.menu-item:hover { background: var(--brand-soft); color: var(--brand); }
.icon-btn { background: transparent; color: var(--muted); padding: 2px 8px; font-size: 16px; }
.icon-btn:hover { background: transparent; color: var(--brand); }

/* единая форма входа — крупные скруглённые поля */
#auth.overlay { background: rgba(20, 40, 60, .3); }   /* фон-календарь должен читаться */
.auth-card { width: 400px; }
.auth-title { text-align: center; margin: 0 0 4px; }
.auth-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.auth-notfound { color: #F58231; text-align: center; font-size: 14px; margin-bottom: 10px; }
.auth-card input { width: 100%; padding: 13px 18px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--input-bg); color: var(--text); font-size: 15px;
  outline: none; transition: border-color .15s, box-shadow .15s; }
.auth-card input::placeholder { color: var(--muted); }
.auth-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
#auth-pass-row { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.auth-actions { display: flex; gap: 10px; }
.auth-actions button { flex: 1; border-radius: 999px; padding: 13px; font-size: 15px; }
#auth-msg { text-align: center; margin-top: 12px; }
#auth-msg a { color: var(--brand); font-weight: 600; }

/* мини-календарь: своя сетка отдельных кружков (как в Google) */
#mini { font-size: 12px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mini-title { font-size: 13px; font-weight: 600; font-family: Montserrat, sans-serif; color: var(--text); }
.mini-nav { background: transparent; color: var(--muted); padding: 2px 8px; font-size: 16px; line-height: 1;
  border-radius: 8px; }
.mini-nav:hover { background: var(--brand-soft); color: var(--brand); }
.mini-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.mini-wd span { text-align: center; color: var(--muted); font-weight: 600; font-size: 11px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; user-select: none; }
.mini-day { aspect-ratio: 1; padding: 0; border: none; background: transparent; color: var(--text);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 12px; }
.mini-day:hover { background: var(--brand-soft); }
.mini-day.other { color: #c7cdd4; }
.mini-day.selected { background: var(--brand); color: #fff; }
.mini-day.today { box-shadow: inset 0 0 0 2px #e6194b; }

/* заголовок списка с кнопкой обновления */
.block-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-title-row .block-title { margin-bottom: 0; }

/* чипы выбранных календарей */
#chips { list-style: none; padding: 0; margin: 0; }
.chip { display: flex; align-items: center; gap: 6px; padding: 5px 2px; font-size: 14px; border-radius: 8px; }
.chip.is-hidden { opacity: .45; }
.chip.dragging { opacity: .4; background: var(--brand-soft); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.chip-drag { cursor: grab; color: var(--muted); font-size: 12px; user-select: none;
  width: 16px; text-align: center; flex-shrink: 0; }
.chip-drag.pinned { cursor: default; filter: grayscale(1); opacity: .55; }
.chip.drop-before { box-shadow: inset 0 2px 0 0 var(--brand); }
.chip.drop-after { box-shadow: inset 0 -2px 0 0 var(--brand); }
.chip-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* аватарка сотрудника в чипе */
.chip-ava { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.chip-ava.ava-initials { display: flex; align-items: center; justify-content: center;
  color: var(--on-pastel); font-size: 9px; font-weight: 600; font-family: Montserrat, sans-serif; }
.dot-btn { width: 16px; height: 16px; padding: 0; border: 1px solid rgba(0,0,0,.12);
  border-radius: 50%; cursor: pointer; flex-shrink: 0; }

/* поповер-палитра из 30 цветов */
.palette { position: fixed; z-index: 100; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(20,40,60,.22); padding: 8px;
  display: grid; grid-template-columns: repeat(6, 24px); gap: 6px; }
.palette .sw { width: 24px; height: 24px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; }
.palette .sw.active { border-color: var(--text); }

/* заголовок-кнопка «Показаны на календаре» + выпадающее меню наборов */
.as-link { background: transparent; color: var(--text); padding: 0; font-weight: 600;
  font-family: Montserrat, sans-serif; font-size: 13px; cursor: pointer; }
.as-link:hover { background: transparent; color: var(--brand); }
.as-link .caret { color: var(--muted); font-size: 11px; }
.presets-anchor { position: relative; }
.dropdown { position: absolute; top: 100%; left: 0; z-index: 60; margin-top: 6px; min-width: 230px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(20,40,60,.22); padding: 8px; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text); padding: 2px 4px 8px;
  font-family: Montserrat, sans-serif; }
#presets { list-style: none; margin: 0; padding: 0; }

/* пресеты наборов */
.preset { display: flex; align-items: center; gap: 6px; padding: 5px 2px; font-size: 14px; }
.preset-name { flex: 1; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-name:hover { color: var(--brand); }
.chip-eye { background: transparent; color: var(--muted); padding: 2px 4px; font-size: 13px; }
.chip-eye:hover { background: transparent; color: var(--brand); }
.chip-x { background: transparent; color: var(--muted); padding: 2px 4px; }
.chip-x:hover { background: transparent; color: #d6336c; }
/* SVG-иконки: центрируем и наследуем цвет */
.icon-btn, .chip-eye, .chip-x, .chip-drag.pinned { display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg, .chip-eye svg, .chip-x svg, .chip-drag.pinned svg { display: block; }

/* свёрнутая левая панель — только на десктопе: в мобильном она превращается в меню */
#app:not(.mobile).sidebar-collapsed #sidebar { display: none; }
/* узлы мобильного режима — на десктопе их нет */
.drawer-close, .drawer-backdrop, .fab { display: none; }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
#main { flex: 1; padding: 16px; min-width: 0; position: relative; display: flex; flex-direction: column; }
.cal-views { flex: 1; min-height: 0; position: relative; }
#calendar, .cal-timeline { position: absolute; inset: 0; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.cal-timeline { overflow: hidden; padding: 8px 12px 12px; display: flex; flex-direction: column; }
.cal-timeline.hidden, #calendar.hidden { display: none; }
/* затенение + спиннер поверх области календаря во время догрузки встреч (тулбар/сайдбар не трогаем) */
.cal-loading { position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: var(--cal-dim); backdrop-filter: blur(1px); border-radius: var(--radius); }
/* верхний горизонтальный скроллбар (виден сверху) + прокручиваемая область с полотном */
.tl-topscroll { flex: 0 0 auto; overflow-x: auto; overflow-y: hidden; }
.tl-topscroll-spacer { height: 1px; }
.tl-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; }
.tl-topscroll::-webkit-scrollbar { height: 12px; }
.tl-topscroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.tl-topscroll::-webkit-scrollbar-track { background: transparent; }

/* верхняя панель календаря (единая для всех видов) */
.cal-toolbar { display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cal-navbtn { font-size: 20px; line-height: 1; }
.cal-today { padding: 7px 14px; }
.cal-title-wrap { margin-left: 8px; min-width: 0; }
.cal-title { font-family: Montserrat, sans-serif; font-size: 18px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-title-note { font-size: 11px; color: var(--muted); }
.cal-right { display: flex; align-items: center; gap: 10px; margin-left: 100px; }   /* блок контролов — за датой, отступ ~100px */
/* каждая тематическая группа — единый переключатель-«пилюля» */
.cal-toolbar .cal-seg { display: inline-flex; align-items: center; gap: 0; margin-bottom: 0;
  background: var(--ghost-bg); border-radius: 999px; padding: 3px; }
.cal-toolbar .cal-seg .seg { flex: 0 0 auto; background: transparent; color: var(--muted);
  font-weight: 600; border-radius: 999px; padding: 5px 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
.cal-toolbar .cal-seg .seg svg { display: block; }
/* скрытая группа сохраняет своё место (позиции блоков фиксированы) */
.cal-toolbar .cal-seg.ctl-off { visibility: hidden; pointer-events: none; }
.cal-toolbar .cal-seg .seg:hover { background: transparent; color: var(--brand); }
.cal-toolbar .cal-seg .seg.active { background: var(--brand); color: #fff; }
.cal-toolbar .cal-seg .seg.active:hover { background: var(--brand-dark); color: #fff; }
.cal-toolbar .cal-seg .seg[disabled] { opacity: .4; cursor: default; }
.cal-toolbar .cal-seg .seg[data-view] { font-size: 15px; padding: 5px 11px; }

/* «Лента» (Вид2/Вид3): свой горизонтальный тайм-грид */
.tl { display: flex; flex-direction: column; }
.tl-head { display: flex; align-items: flex-end; position: sticky; top: 0; z-index: 3;
  background: var(--card); padding-bottom: 4px; }
.tl-label-col { flex: 0 0 var(--tl-label-w, 150px); position: sticky; left: 0; z-index: 5;
  background: var(--card); }
.tl-track-head { position: relative; flex: 1; height: 16px; }
.tl-hour { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted);
  white-space: nowrap; }
.tl-row { display: flex; align-items: stretch; border-top: 1px solid var(--border); }
.tl-label { flex: 0 0 var(--tl-label-w, 150px); display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 2px; font-size: 13px; color: var(--text); min-width: 0;
  position: sticky; left: 0; z-index: 2; background: var(--card); }
.tl-label .tl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label .avatar, .tl-label .ava-initials { width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 50%; object-fit: cover; font-size: 10px; }
.tl-label.is-today .tl-name { color: #e6194b; font-weight: 600; }
.tl-track { position: relative; flex: 1; min-height: 34px;
  background-image: repeating-linear-gradient(90deg, var(--border) 0 1px,
    transparent 1px calc(100% / var(--tl-hours, 14))); }
.tl-ev { position: absolute; height: 40px; border-radius: 6px; padding: 3px 6px; font-size: 11px;
  line-height: 1.2; color: var(--on-pastel); overflow: hidden; cursor: default; box-sizing: border-box;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tl-zoom .seg { font-size: 17px; font-weight: 700; padding: 5px 12px; flex: 0 0 auto; line-height: 1; }
.tl-zoom-val { display: flex; align-items: center; justify-content: center; min-width: 34px;
  font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums;
  font-family: Montserrat, sans-serif; user-select: none; }
.tl-ev-time { font-weight: 700; margin-right: 4px; }
.tl-ev.has-access { cursor: pointer; }
.tl-ev.locked { background-image: repeating-linear-gradient(45deg,
    rgba(0,0,0,.14) 0 6px, transparent 6px 12px); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: #e6194b; z-index: 1; pointer-events: none; }
/* полоска выделения времени при протягивании ЛКМ */
.tl-select { position: absolute; top: 2px; bottom: 2px; z-index: 1; pointer-events: none;
  background: rgba(132, 109, 242, .22); border: 1px solid var(--brand); border-radius: 6px; }
.tl-empty { color: var(--muted); font-size: 13px; padding: 14px 4px; }

/* отпуска: полоса «весь день» под шапкой дней (Вид 1 — родной all-day FullCalendar) */
.fc .fc-timegrid-axis-frame { justify-content: flex-start; padding-left: 4px; }
.fc .fc-timegrid-axis-cushion { font-size: 11px; color: var(--muted); font-weight: 600;
  max-width: none; text-transform: none; }
.fc .fc-daygrid-body .fc-daygrid-day-frame { min-height: 0; }
.fc .fc-event.ev-vac { background: var(--vac-bg); border-color: var(--vac-line); border-radius: 999px;
  padding: 0 4px; }
.fc .fc-event.ev-vac .fc-event-title { color: var(--vac-fg); font-weight: 600; font-size: 11px; }
.fc .fc-event.ev-vac.fc-event-past { opacity: 1; }   /* «человека нет» — не выцветает как прошедшая встреча */
.fc .fc-daygrid-more-link { font-size: 11px; color: var(--muted); font-weight: 600; }

/* отпуска в «ленте» (Вид 2/3): такая же полоса «весь день» поверх дорожки */
.tl-allday { position: absolute; left: 2px; right: 2px; top: 2px; height: 20px; z-index: 2;
  display: flex; align-items: center; padding: 0 10px; border-radius: 999px;
  background: var(--vac-bg); color: var(--vac-fg); font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Вид 3: человека нет весь день — штрихуем всю дорожку */
.tl-track.has-vac { background-image: repeating-linear-gradient(45deg,
    var(--vac-bg) 0 8px, transparent 8px 16px); }

/* поп-ап «+ ещё N» из полосы отпусков — под карточки проекта */
.fc .fc-popover { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden; }
.fc .fc-popover-header { background: var(--toolbar-bg); color: var(--text); padding: 7px 10px;
  font-family: Montserrat, sans-serif; font-size: 12px; font-weight: 600; }
.fc .fc-popover-body { padding: 8px 10px 10px; }

/* день, в котором кто-то в отпуске, — жёлтый столбец на всю высоту сетки времени.
   Селектор специфичнее дефолтного .fc-day-today, так что «сегодня + отпуск» отработает сам */
.fc .fc-timegrid-col.vac-day { background-color: var(--vac-col); }

/* шапка дня: день недели + число; сегодняшнее число — в красном кружке, как в мини-календаре */
.fc-dayhead { display: inline-flex; align-items: center; gap: 6px; }
.fc-dayhead-wd { color: var(--muted); font-size: 12px; font-weight: 600; }
.fc-dayhead-num { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 600; }
.fc-dayhead-num.is-today { box-shadow: inset 0 0 0 2px #e6194b; color: #e6194b; }

/* тематизация FullCalendar под бренд */
.fc .fc-button-primary { background: var(--brand); border-color: var(--brand); font-weight: 600; }
.fc .fc-button-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active { background: var(--brand-dark); border-color: var(--brand-dark); }
.fc .fc-toolbar-title { font-family: Montserrat, sans-serif; font-size: 18px; text-align: center; }
/* приписка под заголовком: всё время — по Москве */
.fc .fc-toolbar-title::after { content: "Все даты и время отображаются по Москве";
  display: block; font-family: "Open Sans", sans-serif; font-size: 11px; font-weight: 400;
  color: var(--muted); margin-top: 2px; }
/* округлые кнопки навигации — тот же радиус, что у блоков */
.fc .fc-button { border-radius: var(--radius); }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child {
  border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.fc .fc-button-group > .fc-button:last-child {
  border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.fc .fc-timegrid-now-indicator-line { border-color: #e6194b; border-width: 3px; }
.fc .fc-timegrid-now-indicator-arrow { border-color: #e6194b; }
/* пастельные блоки светлые при любой теме — текст всегда тёмный для читаемости */
.fc .fc-event-title, .fc .fc-event-time, .fc-event .fc-event-main { color: var(--on-pastel); }
/* прошедшие встречи — блёклые */
.fc-event-past { opacity: .45; }

/* встречи без доступа: тот же цвет + полупрозрачная тёмная штриховка, без текста */
.fc-event.ev-locked { cursor: default; overflow: hidden; }
.fc-event.ev-locked::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(45deg, transparent 0, transparent 5px,
    rgba(0, 0, 0, .14) 5px, rgba(0, 0, 0, .14) 10px); }
/* встречи с доступом — кликабельны */
.fc-event[href] { cursor: pointer; }

/* оверлеи (модалка и загрузка) */
.overlay { position: fixed; inset: 0; background: rgba(20, 40, 60, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50; }
.overlay.hidden { display: none; }
.modal-card { background: var(--card); border-radius: var(--radius); padding: 22px; width: 440px;
  max-width: 92vw; box-shadow: 0 10px 40px rgba(20,40,60,.25); }
/* окно создания встречи — шире на 50% */
#modal .modal-card { width: 660px; position: relative; }
.modal-card h2 { margin: 0 0 16px; font-size: 19px; font-family: Montserrat, sans-serif; padding-right: 28px; }
.modal-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.modal-card label input, .modal-card label textarea { margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* участники создаваемой встречи — редактируемые чипы */
.mp-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 13px;
  border-radius: 999px; background: var(--brand-soft); color: var(--text); }
.mp-chip.mp-fixed { background: var(--brand); color: #fff; }
.mp-x { background: transparent; color: inherit; padding: 0 2px; font-size: 12px; opacity: .7; }
.mp-x:hover { background: transparent; opacity: 1; color: #d6336c; }

/* крутящаяся иконка обновления при фоновой загрузке событий */
.icon-btn.spinning { animation: spin 1s linear infinite; }

/* простой WYSIWYG-редактор описания */
.rte { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 12px;
  background: var(--input-bg); transition: border-color .15s; }
.rte:focus-within { border-color: var(--brand); }
.rte-toolbar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border);
  background: var(--toolbar-bg); }
.rte-btn { background: transparent; color: var(--text); padding: 4px 9px; border-radius: 7px;
  font-size: 14px; line-height: 1; min-width: 30px; }
.rte-btn:hover { background: var(--brand-soft); color: var(--brand); }
.rte-area { min-height: 92px; max-height: 240px; overflow-y: auto; padding: 10px 12px;
  outline: none; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.rte-area:empty:before { content: attr(data-placeholder); color: var(--muted); }
.rte-area p { margin: 0 0 8px; }
.rte-area ul, .rte-area ol { margin: 0 0 8px; padding-left: 22px; }
.rte-area a { color: var(--brand); }

/* переключатель «Ссылка на созвон» */
.segmented { display: flex; gap: 6px; margin-bottom: 12px; }
.segmented .seg { flex: 1; background: var(--ghost-bg); color: var(--text); font-weight: 600;
  border-radius: 999px; padding: 8px 6px; font-size: 13px; }
.segmented .seg:hover { background: var(--ghost-bg-hover); }
.segmented .seg.active { background: var(--brand); color: #fff; }
.link-row { display: block; }
.link-row input { margin-top: 4px; }

/* поп-ап деталей встречи */
.mtg-card { position: relative; width: 780px; }
.mtg-x { position: absolute; top: 14px; right: 14px; background: transparent; color: var(--muted);
  padding: 2px 8px; font-size: 16px; }
.mtg-x:hover { background: transparent; color: var(--brand); }
.mtg-card h2 { padding-right: 28px; }
.mtg-time { color: var(--brand); font-weight: 600; font-family: Montserrat, sans-serif; margin: -8px 0 14px; }
.mtg-link { font-size: 14px; margin: -6px 0 14px; color: var(--text); overflow-wrap: anywhere; }
.mtg-link a { color: var(--brand); font-weight: 600; }
#mtg-link-val { color: var(--muted); }
.mtg-desc { font-size: 14px; line-height: 1.5; margin-bottom: 16px; max-height: 600px; overflow-y: auto;
  overflow-wrap: anywhere; }
.mtg-desc p { margin: 0 0 8px; }
.mtg-desc ul, .mtg-desc ol { margin: 0 0 8px; padding-left: 22px; }
.mtg-desc a { color: var(--brand); }
.mtg-people { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: var(--on-pastel); font-weight: 600; font-size: 13px;
  font-family: Montserrat, sans-serif; cursor: default; box-shadow: var(--shadow); }
img.avatar { object-fit: cover; }
.mtg-open { display: inline-block; background: var(--brand); color: #fff; text-decoration: none;
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.mtg-open:hover { background: var(--brand-dark); }

/* поп-ап загрузки */
.loader-card { background: var(--card); border-radius: var(--radius); padding: 26px 34px;
  box-shadow: 0 10px 40px rgba(20,40,60,.25); display: flex; flex-direction: column;
  align-items: center; gap: 14px; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--brand-soft);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
#loading-text { color: var(--text); font-weight: 600; font-family: Montserrat, sans-serif; }
@keyframes spin { to { transform: rotate(360deg); } }

/* раздел статистики */
.stats-card { position: relative; width: 96vw; max-width: 96vw; height: 94vh; max-height: 94vh; overflow-y: auto; }
.stats-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.stats-tab { background: var(--ghost-bg); color: var(--text); border-radius: 999px; padding: 7px 16px; }
.stats-tab:hover { background: var(--brand-soft); color: var(--brand); }
.stats-tab.active { background: var(--brand); color: #fff; }
.stats-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stats-chart { border: 1px solid var(--border); border-radius: 14px; padding: 12px 12px 8px; }
.stats-chart-title { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px;
  font-family: Montserrat, sans-serif; }
.stats-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.stats-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; min-width: 0; }
.stats-bar-val { font-size: 10px; color: var(--muted); line-height: 1; margin-bottom: 2px; }
.stats-bar { width: 100%; max-width: 26px; min-height: 2px; background: var(--brand);
  border-radius: 4px 4px 0 0; }
.stats-bar-label { font-size: 9px; color: var(--muted); margin-top: 4px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stats-totals { font-size: 13px; color: var(--text); margin-bottom: 16px; line-height: 1.5; }
.stats-table { display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px 16px; }
.stats-row { display: contents; }
.stats-row > div { padding: 7px 0; border-bottom: 1px solid var(--border); }
.stats-row > div.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-row-head > div { font-size: 12px; color: var(--muted); font-weight: 600; }
/* кликабельные заголовки-сортировка */
.stats-th { background: transparent; color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 7px 0; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  cursor: pointer; text-align: left; font-family: inherit; white-space: nowrap; }
.stats-th.num { text-align: right; }
.stats-th:hover { background: transparent; color: var(--brand); }
.stats-th.active { color: var(--text); }

/* --- плашка «встреча создастся подзадачей задачи» (deep-link ?parent=) --- */
.parent-banner { flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  margin: 0 0 10px; padding: 11px 18px; border-radius: 16px;
  background: var(--brand-soft); border: 1px solid transparent; }
.parent-banner.done { background: var(--ghost-bg); border-color: var(--border); }
.pb-tag { flex: 0 0 auto; font-family: Montserrat, sans-serif; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--brand);
  border-radius: 999px; padding: 4px 12px; }
.parent-banner.done .pb-tag { background: #2f9e44; }
.pb-txt { flex: 1 1 auto; min-width: 0; }
.pb-title { font-family: Montserrat, sans-serif; font-weight: 600; font-size: 14px;
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-title a { color: var(--brand); text-decoration: none; }
.pb-title a:hover { text-decoration: underline; }
.pb-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
/* крестик на плашке «из задачи» — отказ от привязки к надзадаче */
.pb-close { flex: 0 0 auto; background: transparent; color: var(--muted); padding: 4px 6px;
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.pb-close:hover { background: transparent; color: #d6336c; }
.pb-close svg { display: block; }


/* ======================= мобильный режим (телефоны и узкие окна) =======================
   Доступен только Вид 1 на один день; левая панель уезжает в выдвижное меню. */
@media (max-width: 780px) {
  #main { padding: 10px; }
  #calendar, .cal-timeline { padding: 6px; border-radius: 16px; }

  /* левая панель → выезжающее меню поверх календаря */
  #app.mobile #sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 86vw; max-width: 340px;
    z-index: 60; background: var(--bg); box-shadow: 4px 0 24px rgba(20, 40, 60, .3);
    transform: translateX(-100%); transition: transform .22s ease; }
  #app.mobile.drawer-open #sidebar { transform: none; }
  #app.mobile .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(20, 40, 60, .45); }
  #app.mobile .drawer-close { display: inline-flex; align-items: center; justify-content: center;
    align-self: flex-end; background: transparent; color: var(--muted); font-size: 18px;
    padding: 2px 6px; margin: -4px -4px 4px 0; }

  /* тулбар: гамбургер + «‹ Сегодня ›» + дата, переключатели видов не нужны */
  .cal-toolbar { gap: 8px; margin-bottom: 8px; flex-wrap: nowrap; }
  #app.mobile .cal-right { display: none; }
  .cal-nav { gap: 4px; }
  .cal-title-wrap { margin-left: 4px; }
  .cal-title { font-size: 15px; }
  .cal-title-note { font-size: 10px; }
  .cal-today { padding: 6px 10px; font-size: 13px; }

  /* сетка крупнее (слот 30 мин = 24px → час ≈ 48px) и прокручивается по вертикали */
  .fc .fc-timegrid-slot { height: 24px; }
  .fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { font-size: 10px; padding: 0 3px; }
  .fc .fc-event-title, .fc .fc-event-time { font-size: 11px; }
  .fc-dayhead-wd { font-size: 11px; }
  .fc-dayhead-num { width: 22px; height: 22px; font-size: 12px; }

  /* круглая кнопка создания встречи */
  #app.mobile .fab { display: flex; align-items: center; justify-content: center;
    position: absolute; right: 16px; bottom: 16px; z-index: 40; padding: 0;
    width: 56px; height: 56px; border-radius: 50%; font-size: 26px; line-height: 1;
    box-shadow: 0 6px 18px rgba(20, 40, 60, .32); }

  /* модалки и карточки — на весь экран */
  .modal-card, #modal .modal-card, .mtg-card, .auth-card, .stats-card {
    width: 100%; max-width: 100%; height: 100%; max-height: 100%;
    border-radius: 0; padding: 16px; overflow-y: auto; }
  .row2 { flex-direction: column; gap: 0; }
  .modal-actions button { flex: 1; padding: 12px; }
  .auth-actions { flex-direction: column; }
  .parent-banner { flex-wrap: wrap; }
}
