/* «Доступность»: недельная сетка эксперта (frontend/js/availability-grid.js).
   Вид — как неделя в Google Календаре: белая сетка, серым — вне расписания,
   события — сплошные цветные плашки. Цвета — палитра Google:
   встреча — «павлин», общая встреча — «виноград», закрыто / занято — «графит»,
   открыто — «шалфей». */
.avail-page {
  position: relative;
  --gc-line: #dadce0;
  --gc-faint: #eef0f2;
  --gc-text: #3c4043;
  --gc-muted: #70757a;
  --gc-blue: #1a73e8;
  --gc-off: #f1f3f4;
  --gc-booking: #039be5;
  --gc-meeting: #8e24aa;
  --gc-closed: #e1e3e6;
  --gc-closed-ink: #3c4043;
  --gc-open: #33b679;
  --gc-now: #ea4335;
}

/* --- верхняя панель -------------------------------------------------------- */
.avail-page .avail-create {
  min-height: 48px;
  padding: 0 22px 0 14px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--gc-text);
  font-weight: 600;
  box-shadow:
    0 1px 2px 0 rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
  transition: box-shadow 0.15s;
}
.avail-page .avail-create:hover {
  background: #f8fafe;
  box-shadow:
    0 1px 3px 0 rgba(60, 64, 67, 0.3),
    0 4px 8px 3px rgba(60, 64, 67, 0.15);
}
.avail-create-plus {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--gc-blue);
}
.avail-create-plus svg {
  width: 26px;
  stroke-width: 2.2;
}
.avail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}
.avail-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 40px;
}
.avail-nav .today-return {
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--gc-line);
  border-radius: 18px;
  background: #fff;
  color: var(--gc-text);
  font-size: 14px;
  font-weight: 600;
}
.avail-nav .today-return:hover {
  background: #f6f8fc;
}
.avail-arrows {
  display: inline-flex;
  gap: 2px;
}
.avail-arrows .icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
}
.avail-arrows .icon-button:hover {
  background: var(--gc-off);
}
.avail-week-title {
  margin-left: 6px;
  color: var(--gc-text);
  font-size: 21px;
  font-weight: 450;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.avail-range {
  margin-left: auto;
  padding: 0;
  gap: 0;
  border: 1px solid var(--gc-line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}
.avail-range button {
  min-height: 34px;
  padding: 4px 16px;
  border-radius: 0;
  color: var(--gc-text);
  font-size: 14px;
  font-weight: 550;
}
.avail-range button + button {
  border-left: 1px solid var(--gc-line);
}
.avail-range button[aria-pressed="true"] {
  background: #e8f0fe;
  color: #1967d2;
  box-shadow: none;
}
.avail-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--yellow);
  font-size: 14px;
}

/* --- сетка ----------------------------------------------------------------- */
.avail-grid {
  border: 1px solid var(--gc-line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.avail-head,
.avail-allday,
.avail-body {
  display: grid;
  grid-template-columns: 56px repeat(var(--avail-days), minmax(0, 1fr));
}
.avail-head {
  border-bottom: 1px solid var(--gc-line);
}
.avail-corner {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 8px 6px 0;
}
.avail-corner span {
  color: var(--gc-muted);
  font-size: 10px;
  letter-spacing: 0.2px;
}
/* Шапка дня: «ПН» маленькими буквами, под ним крупное число; сегодня — синий круг. */
.avail-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 6px;
  min-width: 0;
}
.avail-day-head small {
  color: var(--gc-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.avail-day-num {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gc-text);
  font: inherit;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.avail-day-num:hover {
  background: var(--gc-off);
}
.avail-day-head.past .avail-day-num {
  color: var(--gc-muted);
}
.avail-day-head.today small {
  color: var(--gc-blue);
}
.avail-day-head.today .avail-day-num {
  background: var(--gc-blue);
  color: #fff;
}
.avail-day-head.today .avail-day-num:hover {
  background: #1765cc;
}
.avail-day-head em {
  max-width: 100%;
  color: var(--gc-muted);
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Строка «на весь день»: выходной и блоки на весь день. */
.avail-allday {
  border-bottom: 1px solid var(--gc-line);
}
.avail-allday-cell {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 2px 8px 3px 1px;
  border-left: 1px solid var(--gc-line);
}
.avail-allday-chip {
  display: block;
  min-width: 0;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: var(--gc-closed);
  color: var(--gc-closed-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.avail-allday-chip.off {
  cursor: default;
}
.avail-allday-chip.open {
  background: var(--gc-open);
  color: #fff;
}
.avail-allday-chip.past {
  opacity: 0.6;
}
.avail-allday-chip:not(.off):hover {
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
}
.avail-scroll {
  max-height: calc(100vh - 290px);
  min-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.avail-gutter {
  position: relative;
}
.avail-hour {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
}
.avail-hour span {
  position: absolute;
  top: -7px;
  right: 8px;
  color: var(--gc-muted);
  font-size: 10.5px;
  line-height: 14px;
  font-variant-numeric: tabular-nums;
}
/* Верхнюю подпись, как в Google, не показываем: её бы обрезало. */
.avail-hour:first-child span {
  display: none;
}
/* Вне расписания — светло-серым, часы приёма — белым (как рабочие часы в Google). */
.avail-col {
  position: relative;
  border-left: 1px solid var(--gc-line);
  cursor: default;
  touch-action: pan-y;
  background: var(--gc-off);
}
.avail-col.day-off {
  background: #eceef0;
}
.avail-work {
  position: absolute;
  left: 0;
  right: 0;
  background: #fff;
}
/* Час — светло-серая линия, получас — едва заметная. */
.avail-lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 29px,
    var(--gc-faint) 29px 30px,
    transparent 30px 59px,
    var(--gc-line) 59px 60px
  );
  pointer-events: none;
}

/* --- события: сплошные плашки ---------------------------------------------- */
.avail-chip,
.avail-ghost {
  position: absolute;
  overflow: hidden;
  border-radius: 5px;
  padding: 2px 6px 2px 7px;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
}
.avail-chip {
  z-index: 2;
  border: 0;
  text-align: left;
  font-family: inherit;
  box-shadow: 0 0 0 1px #fff;
  transition:
    box-shadow 0.12s,
    opacity 0.12s;
}
.avail-chip > span,
.avail-block-label {
  display: block;
  max-width: 100%;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avail-chip small {
  display: block;
  max-width: 100%;
  color: inherit;
  font-size: 12px;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Короткое событие — одной строкой: «Закрыто, 10:00–10:30». */
.avail-chip.short {
  display: block;
  padding-top: 0;
  padding-bottom: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.avail-chip.short > span,
.avail-chip.short .avail-block-label,
.avail-chip.short small {
  display: inline;
}
.avail-chip.short small::before {
  content: ", ";
}
.avail-chip.short .avail-gcal,
.avail-chip.short .avail-join {
  display: none;
}
.avail-chip.tiny {
  font-size: 11px;
  line-height: 15px;
}
.avail-chip.tiny small {
  font-size: 11px;
}
.avail-chip:hover {
  z-index: 4;
  box-shadow:
    0 0 0 1px #fff,
    0 2px 4px rgba(60, 64, 67, 0.3),
    0 2px 8px 2px rgba(60, 64, 67, 0.15);
}
/* Прошедшее — бледнее, как в Google. */
.avail-chip.past,
.avail-booking.done {
  opacity: 0.55;
}
.avail-chip.past:hover {
  opacity: 0.8;
}
.avail-booking {
  background: var(--gc-booking);
  cursor: pointer;
}
.avail-meeting {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: var(--gc-meeting);
  cursor: pointer;
}
.avail-meeting.short {
  display: block;
}
.avail-busy {
  background: var(--gc-closed);
  color: var(--gc-closed-ink);
}
.avail-block {
  cursor: pointer;
}
.avail-block.editable {
  cursor: grab;
}
.avail-block.closed {
  background: var(--gc-closed);
  color: var(--gc-closed-ink);
}
.avail-block.open {
  background: var(--gc-open);
}
.avail-block.dragging {
  opacity: 0.3;
}
/* Отметка «в Google ✓» — мелкой третьей строкой в плашке, в поповере — значком. */
.avail-gcal {
  display: block;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}
.avail-pop-gcal .avail-gcal {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--gc-off);
  color: #5f6368;
  font-size: 12px;
  opacity: 1;
}
.avail-pop-gcal .avail-gcal.ok {
  background: #e6f4ea;
  color: #137333;
}
.avail-pop-gcal .avail-gcal.warn {
  background: #fce8e6;
  color: #c5221f;
}
.avail-resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  cursor: ns-resize;
}
.avail-resize::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 16px;
  height: 3px;
  margin-left: -8px;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: 0;
  transition: opacity 0.12s;
}
.avail-block:hover .avail-resize::after {
  opacity: 0.8;
}
.avail-join {
  margin-top: 2px;
  padding: 1px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--gc-meeting);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.avail-join:hover {
  background: #f3e5f5;
}
/* Черновик выделения — как новое событие в Google: плашка с тенью. */
.avail-ghost {
  left: 1px;
  right: 10px;
  z-index: 5;
  background: var(--gc-booking);
  font-weight: 500;
  pointer-events: none;
  box-shadow:
    0 6px 10px 0 rgba(60, 64, 67, 0.2),
    0 1px 18px 0 rgba(60, 64, 67, 0.12);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.avail-ghost b {
  font-weight: 600;
}
.avail-ghost.closed {
  background: #9aa0a6;
}
.avail-ghost.open {
  background: var(--gc-open);
}
/* Сейчас — красная линия с точкой. */
.avail-now {
  position: absolute;
  left: -1px;
  right: 0;
  z-index: 6;
  height: 2px;
  margin-top: -1px;
  background: var(--gc-now);
  pointer-events: none;
}
.avail-now::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gc-now);
}

/* --- легенда и подсказка --------------------------------------------------- */
.avail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 10px 2px 0;
}
.avail-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--gc-muted);
  font-size: 12.5px;
}
.avail-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.avail-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.lg-booking {
  background: var(--gc-booking);
}
.lg-meeting {
  background: var(--gc-meeting);
}
.lg-closed {
  background: #c4c7cc;
}
.lg-open {
  background: var(--gc-open);
}
.lg-off {
  background: #e3e5e8;
  border-radius: 2px !important;
}
.avail-access {
  color: var(--gc-muted);
  font-size: 12.5px;
}
.avail-access.ok::before {
  content: "✓ ";
  color: #188038;
  font-weight: 600;
}
.avail-hint {
  margin: 8px 2px 0;
  color: var(--gc-muted);
  font-size: 13px;
  line-height: 1.45;
}
.avail-hint .text-link,
.avail-settings-link .text-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gc-blue);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.avail-settings-link {
  margin: 0;
  font-size: 14px;
}

/* --- поповер: белая карточка с тенью, как быстрое создание в Google -------- */
.avail-popover {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: 400px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  border-radius: 8px;
  background: #fff;
  color: var(--gc-text);
  box-shadow:
    0 24px 38px 3px rgba(0, 0, 0, 0.14),
    0 9px 46px 8px rgba(0, 0, 0, 0.12),
    0 11px 15px -7px rgba(0, 0, 0, 0.2);
  animation: avail-pop 0.14s ease-out;
}
.avail-pop-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 4px 20px;
}
.avail-pop-head strong {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}
.avail-pop-head.bar {
  justify-content: flex-end;
  min-height: 40px;
  padding: 4px 6px;
  background: var(--gc-off);
}
.avail-pop-head .icon-button {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
}
.avail-pop-head .icon-button:hover {
  background: rgba(60, 64, 67, 0.08);
}
.avail-pop-head .icon-button svg {
  width: 18px;
}
.avail-pop-swatch {
  flex: none;
  width: 14px !important;
  height: 14px;
  padding: 0 !important;
  border-radius: 4px;
  background: #9aa0a6;
}
.avail-pop-swatch.open {
  background: var(--gc-open);
}
.avail-pop-swatch.meeting {
  background: var(--gc-meeting);
}
.avail-pop-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 12px 20px 6px;
}
/* Название — крупно, с подчёркиванием, как «Добавьте название» в Google. */
.avail-pop-title {
  display: block;
  padding-left: 36px;
}
.avail-pop-title input {
  width: 100%;
  padding: 6px 0 5px;
  border: 0;
  border-bottom: 1px solid var(--gc-line);
  border-radius: 0;
  background: transparent;
  color: var(--gc-text);
  font: inherit;
  font-size: 21px;
  font-weight: 400;
  outline: none;
}
.avail-pop-title input:focus {
  padding-bottom: 4px;
  border-bottom: 2px solid var(--gc-blue);
}
.avail-pop-title input::placeholder {
  color: #80868b;
}
/* «Закрыть время / Открыть для записи» — как переключатель типа события в Google. */
.avail-popover .avail-kind {
  display: flex;
  gap: 6px;
  margin-left: 36px;
  padding: 0;
  border: 0;
  background: none;
}
.avail-popover .avail-kind button {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 6px;
  color: var(--gc-text);
  font-size: 14px;
  font-weight: 550;
}
.avail-popover .avail-kind button:hover {
  background: var(--gc-off);
}
.avail-popover .avail-kind button[aria-pressed="true"] {
  background: #e8f0fe;
  color: #1967d2;
  box-shadow: none;
}
.avail-pop-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.avail-pop-icon {
  display: grid;
  place-items: center;
  height: 34px;
  color: #5f6368;
}
.avail-pop-icon svg {
  width: 20px;
}
.avail-pop-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-height: 34px;
}
.avail-pop-date {
  font-size: 14px;
  font-weight: 500;
}
.avail-pop-times {
  display: flex;
  align-items: center;
  gap: 4px;
}
.avail-pop-dash {
  color: var(--gc-muted);
}
.avail-popover .field {
  margin: 0;
  gap: 0;
}
/* Время, дата, формат — компактные серые поля, как в Google. */
.avail-popover .field select,
.avail-popover .field input {
  min-height: 34px;
  width: auto;
  padding: 5px 30px 5px 10px;
  border: 0;
  border-radius: 4px;
  background-color: var(--gc-off);
  background-position: right 9px center;
  background-size: 14px;
  color: var(--gc-text);
  font-size: 14px;
  font-weight: 500;
}
.avail-popover .field input {
  padding-right: 10px;
}
.avail-popover .field select:hover,
.avail-popover .field input:hover {
  background-color: #e8eaed;
}
.avail-popover .field select:focus-visible,
.avail-popover .field input:focus-visible {
  outline: 2px solid var(--gc-blue);
  outline-offset: 0;
}
.avail-pop-format select {
  max-width: 100%;
}
.avail-warning {
  margin: 0 0 0 36px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fef7e0;
  color: #594300;
  font-size: 13px;
}
.avail-pop-gcal {
  margin: 0 0 0 36px;
}
.avail-popover .form-error {
  margin: 0 0 0 36px;
}
.avail-pop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
}
.avail-pop-actions span {
  flex: 1;
}
.avail-popover .avail-pop-actions .button {
  min-height: 36px;
  padding: 0 20px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
}
.avail-popover .avail-pop-actions .button.quiet {
  color: var(--gc-blue);
}
.avail-popover .avail-pop-actions .button.quiet:hover {
  background: #f6f9fe;
}
.avail-popover .avail-pop-actions .button.primary {
  background: var(--gc-blue);
  border-color: var(--gc-blue);
}
.avail-popover .avail-pop-actions .button.primary:hover {
  background: #1765cc;
  box-shadow:
    0 1px 2px 0 rgba(60, 64, 67, 0.3),
    0 1px 3px 1px rgba(60, 64, 67, 0.15);
}
.avail-popover .button.avail-delete {
  border-color: transparent;
  background: transparent;
  color: #d93025;
}
.avail-popover .button.avail-delete:hover {
  background: #fce8e6;
}
.avail-sheet-when {
  margin: 0;
  padding: 0 20px 0 46px;
  font-size: 14px;
  font-weight: 500;
}
.avail-sheet-note {
  margin: 8px 0 0;
  padding: 0 20px 0 46px;
  font-size: 13.5px;
}
.avail-picker {
  position: relative;
}
@keyframes avail-pop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

/* --- телефон: строки-получасы, подсказка выделения и шторка снизу ---------- */
.avail-strip {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.avail-strip .date-tab {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 56px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gc-text);
}
.avail-strip .date-tab small {
  color: var(--gc-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.avail-strip .date-tab b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 500;
}
.avail-strip .date-tab.today b,
.avail-strip .date-tab.today small {
  color: var(--gc-blue);
}
.avail-strip .date-tab.active {
  background: transparent;
  color: var(--gc-text);
}
.avail-strip .date-tab.active b {
  background: var(--gc-blue);
  color: #fff;
}
.avail-row {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--gc-faint);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(26, 115, 232, 0.12);
}
.avail-row.hour {
  border-bottom-color: var(--gc-line);
}
.avail-row.past {
  cursor: default;
}
.avail-pickbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--gc-muted);
  font-size: 13px;
  line-height: 1.35;
}
.avail-pickbar.active {
  background: #e8f0fe;
  color: #1967d2;
  font-size: 14px;
}
.avail-pickbar.active span {
  flex: 1;
}
.avail-pickbar .button {
  min-height: 36px;
  padding-inline: 12px;
  border-radius: 18px;
}
.avail-pickbar .icon-button {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
.avail-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(32, 33, 36, 0.4);
  animation: avail-fade 0.18s ease-out;
}
.avail-sheet-grip {
  align-self: center;
  width: 32px;
  height: 4px;
  margin: 8px 0 2px;
  border-radius: 2px;
  background: #dadce0;
}
@keyframes avail-fade {
  from {
    opacity: 0;
  }
}
@keyframes avail-rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
@media (max-width: 768px) {
  .avail-nav {
    gap: 4px;
  }
  .avail-nav .today-return {
    padding: 0 14px;
    width: auto;
  }
  .avail-week-title {
    margin-left: 2px;
    font-size: 16px;
  }
  .avail-page.mobile .avail-head,
  .avail-page.mobile .avail-allday,
  .avail-page.mobile .avail-body {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  /* День уже назван в заголовке и в полоске дней — шапка колонки не нужна. */
  .avail-page.mobile .avail-head {
    display: none;
  }
  .avail-page.mobile .avail-allday-chip {
    height: 28px;
    line-height: 28px;
    font-size: 13px;
  }
  .avail-page.mobile .avail-scroll {
    max-height: calc(100dvh - 290px);
    min-height: 320px;
  }
  .avail-page.mobile .avail-lines {
    display: none;
  }
  .avail-page.mobile .avail-col {
    cursor: pointer;
  }
  .avail-page.mobile .avail-hour span {
    font-size: 11px;
  }
  .avail-page.mobile .avail-chip {
    padding: 4px 10px;
    font-size: 14px;
    border-radius: 6px;
  }
  .avail-page.mobile .avail-chip.short {
    padding-top: 2px;
    padding-bottom: 0;
  }
  .avail-page.mobile .avail-chip small {
    font-size: 12.5px;
  }
  .avail-page.mobile .avail-meeting:not(.short) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
  }
  .avail-page.mobile .avail-join {
    padding: 4px 14px;
    font-size: 13px;
  }
  .avail-page.mobile .avail-ghost {
    right: 4px;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 6px;
  }
  .avail-foot {
    flex-direction: column;
    align-items: flex-start;
  }
  .avail-popover.avail-sheet {
    position: fixed;
    left: 0 !important;
    right: 0;
    top: auto !important;
    bottom: 0;
    width: auto;
    max-height: 85dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 16px 16px 0 0;
    animation: avail-rise 0.2s ease-out;
  }
  .avail-sheet .avail-pop-head.bar {
    min-height: 0;
    padding: 0 8px;
    background: transparent;
  }
  .avail-sheet .avail-pop-head strong {
    font-size: 18px;
  }
  .avail-sheet .avail-pop-body {
    padding: 4px 16px 6px;
  }
  .avail-sheet .avail-pop-title,
  .avail-sheet .avail-kind,
  .avail-sheet .avail-warning,
  .avail-sheet .avail-pop-gcal,
  .avail-sheet .form-error {
    margin-left: 0;
    padding-left: 0;
  }
  .avail-sheet .avail-kind button {
    flex: 1;
    min-height: 44px;
  }
  .avail-sheet .field select,
  .avail-sheet .field input {
    min-height: 44px;
    font-size: 16px;
  }
  .avail-sheet .avail-pop-title input {
    font-size: 20px;
  }
  .avail-sheet-when,
  .avail-sheet-note {
    padding: 0 16px 0 42px;
  }
  .avail-sheet .avail-pop-actions {
    padding: 10px 16px 16px;
  }
  .avail-sheet .avail-pop-actions .button {
    min-height: 46px;
    flex: 1 1 auto;
  }
  .avail-sheet .avail-pop-actions span {
    display: none;
  }
}
@media (max-width: 700px) {
  .avail-page .head-actions .avail-create {
    min-height: 44px;
    padding: 0 16px 0 10px;
    font-size: 14px;
    white-space: nowrap;
  }
  /* С «Доступностью» у руководителя 8 пунктов нижнего меню — подписи мельче. */
  .bottom-nav[style*="--nav-count:8"] .nav-item {
    font-size: 8.5px;
    letter-spacing: -0.1px;
  }
  .avail-scroll {
    max-height: calc(100vh - 330px);
  }
  .avail-head,
  .avail-allday,
  .avail-body {
    grid-template-columns: 46px minmax(0, 1fr);
  }
  .avail-col {
    cursor: pointer;
  }
  .avail-popover {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 75vh;
  }
}
/* Закрытое — спокойная светло-серая плашка с графитовой кромкой: синие встречи заметнее. */
.avail-block.closed,
.avail-busy {
  box-shadow:
    inset 3px 0 0 #80868b,
    0 0 0 1px #fff;
}
.avail-block.closed:hover,
.avail-busy:hover {
  box-shadow:
    inset 3px 0 0 #80868b,
    0 0 0 1px #fff,
    0 2px 4px rgba(60, 64, 67, 0.3);
}
