/* Палитра студии: маджента #f0188c как акцент, к ней фиолетовый.
   Фон одноцветный — так список задач читается спокойнее.
   Заголовки — широкий гротеск Archivo, текст — Montserrat. */

:root {
  --ink: #14101a;
  --surface: #1d1726;
  --surface-2: #251d30;
  --line: #322740;

  --text: #f6f3f8;
  --muted: #9d94a8;

  --pink: #f0188c;
  --pink-soft: #ff52ae;
  --violet: #8b2fd6;

  --ok: #38d39f;
  --warn: #ffb020;
  --bad: #ff4d6d;

  --radius: 12px;

  /* Высота шапки: на неё опирается отступ содержимого */
  --topbar: 56px;
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

/* ---------- Вход ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

.login__card {
  width: min(400px, 100%);
  padding: 36px 26px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.login__logo, .topbar__logo {
  font-family: 'Archivo', Arial, sans-serif;
  font-variation-settings: 'wdth' 125, 'wght' 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.login__logo { font-size: 26px; }

.login__logo span, .topbar__logo span { color: var(--pink); }

.login__title {
  margin: 18px 0 6px;
  font-family: 'Archivo', Arial, sans-serif;
  font-variation-settings: 'wdth' 110, 'wght' 700;
  font-size: 20px;
  text-transform: uppercase;
}

.login__hint { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login__status { margin: 16px 0 0; min-height: 20px; color: var(--muted); font-size: 13px; }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
}

.btn--primary { color: #fff; background: var(--pink); }
.btn--primary:active { background: #d4157c; }

.btn--ghost { color: var(--text); background: transparent; border: 1px solid var(--line); }
.btn--danger { color: #fff; background: var(--bad); }
.btn--small { padding: 9px 16px; font-size: 13px; }

/* ---------- Шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar);
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__logo { font-size: 17px; flex: 0 0 auto; }

.topbar__spacer { flex: 1; }

.user { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user__name { font-weight: 600; font-size: 13px; }
.user__role { color: var(--muted); font-size: 11px; }

.icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
}

.icon-btn:active { background: var(--surface-2); }

/* ---------- Вкладки ---------- */

.tabs {
  position: sticky;
  top: var(--topbar);
  z-index: 19;
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tab {
  flex: 1;
  padding: 13px 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab--active { color: var(--text); border-bottom-color: var(--pink); }

/* ---------- Панель фильтров ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

/* Сворачиваются только на узких экранах: там шапка съедала полэкрана.
   На широком месте хватает, и прятать фильтры незачем. */
.filters--collapsed { display: none; }

.date-group { display: flex; gap: 6px; align-items: center; flex: 1 1 auto; }
.date-group .field { flex: 1; min-width: 0; }

/* ---------- Поля ---------- */

.field {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.field:focus { border-color: var(--pink); }
.field option { background: var(--surface-2); color: var(--text); }

.field--select { flex: 1 1 140px; min-width: 0; }

input[type="date"], input[type="time"] { min-height: 40px; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }

.label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.label .field { color: var(--text); font-weight: 400; text-transform: none; letter-spacing: normal; }

.hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Дни недели ---------- */

.weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.weekday { cursor: pointer; }
.weekday input { position: absolute; opacity: 0; pointer-events: none; }

.weekday span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
}

.weekday input:checked + span { color: #fff; background: var(--pink); border-color: var(--pink); }

/* ---------- Содержимое ---------- */

.content { max-width: 900px; margin: 0 auto; padding: 16px 14px 90px; }

.content__head { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }

.page-title {
  margin: 0;
  font-family: 'Archivo', Arial, sans-serif;
  font-variation-settings: 'wdth' 112, 'wght' 700;
  font-size: 19px;
  text-transform: uppercase;
}

.page-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.note {
  margin-bottom: 14px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface);
  border-left: 2px solid var(--violet);
  border-radius: 8px;
  font-size: 12px;
}

.empty { margin-top: 36px; color: var(--muted); text-align: center; }

/* ---------- Список задач ---------- */

.schedule { display: flex; flex-direction: column; gap: 18px; }

.hour__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--pink);
  font-family: 'Archivo', Arial, sans-serif;
  font-variation-settings: 'wdth' 105, 'wght' 700;
  font-size: 15px;
}

.hour__count {
  padding: 1px 7px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-variation-settings: normal;
  font-size: 11px;
  font-weight: 600;
}

.hour__items { display: flex; flex-direction: column; gap: 8px; }

.task {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
}

.task--editable { cursor: pointer; }
.task--editable:active { background: var(--surface-2); }

.task--done { border-left-color: var(--ok); }
.task--failed { border-left-color: var(--bad); }
.task--progress { border-left-color: var(--warn); }

.task__title { font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }

.task__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.chip {
  padding: 3px 9px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.chip--role { color: #fff; background: var(--pink); }
.chip--deadline { color: var(--pink-soft); }
.chip--done { color: var(--ok); }
.chip--failed { color: var(--bad); }
.chip--schedule { color: #fff; background: var(--violet); }

/* ---------- Кнопка добавления ---------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: var(--pink);
  border: 0;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(240, 24, 140, .4);
}

/* ---------- Окно правки ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, .6);
}

.modal__card {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal__title {
  margin: 0;
  font-family: 'Archivo', Arial, sans-serif;
  font-variation-settings: 'wdth' 110, 'wght' 700;
  font-size: 17px;
  text-transform: uppercase;
}

.modal__error { margin: 0; color: var(--bad); font-size: 13px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

/* ---------- Переключатель ---------- */

.switch {
  display: flex;
  width: 100%;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.switch__btn {
  flex: 1;
  padding: 9px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.switch__btn--active { color: #fff; background: var(--pink); }

/* ---------- Сводка расписания шаблона ---------- */

.schedule-badge {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
}

.schedule-badge__title { font-size: 13px; font-weight: 600; }

.schedule-badge__days { display: flex; flex-wrap: wrap; gap: 5px; }

/* Кружки дней: активные залиты акцентом, остальные приглушены,
   чтобы расписание читалось одним взглядом. */
.day-dot {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.day-dot--on { color: #fff; background: var(--pink); border-color: var(--pink); }

/* ---------- Выбор области правки ---------- */

.scope-ask { display: flex; flex-direction: column; gap: 10px; }

.scope-ask__text { margin: 0; color: var(--muted); font-size: 13px; }

.scope-btn {
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.scope-btn:active { border-color: var(--pink); }
.scope-btn b { display: block; margin-bottom: 3px; font-size: 14px; }
.scope-btn span { color: var(--muted); font-size: 12px; }

/* ---------- Широкие экраны ---------- */

@media (min-width: 760px) {
  .topbar { padding: 0 22px; }
  .content { padding: 22px 22px 90px; }
  .page-title { font-size: 24px; }
  .tabs { justify-content: flex-start; }
  .tab { flex: 0 0 auto; padding: 13px 26px; }
  .filters { padding: 12px 22px; }
  .modal { align-items: center; }
  .modal__card { border-radius: 16px; padding: 26px; }

  /* На широком экране фильтры показываем всегда, кнопка не нужна */
  .filters--collapsed { display: flex; }
  #toggle-filters { display: none; }
}

/* ---------- График работы ---------- */

.month-label {
  flex: 1;
  text-align: center;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
}

.calendar__head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.calendar__weekend { color: var(--pink-soft); }

.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar__cell {
  min-height: 74px;
  padding: 5px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
}

.calendar__cell:active { border-color: var(--pink); }
.calendar__cell--empty { background: transparent; border-color: transparent; cursor: default; }
.calendar__cell--weekend { background: var(--surface-2); }
.calendar__cell--today { border-color: var(--pink); }

.calendar__day {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.calendar__cell--today .calendar__day { color: var(--pink-soft); }

/* Смена в клетке: имя сверху, время под ним — так помещается
   на узком экране, где колонка шириной с палец. */
.shift-chip {
  margin-bottom: 3px;
  padding: 3px 5px;
  background: var(--violet);
  border-radius: 5px;
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
}

.shift-chip__name { display: block; font-weight: 600; }
.shift-chip__time { display: block; opacity: .8; }

/* ---------- Смены выбранного дня ---------- */

.shift-day__branch {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.shift-list { display: flex; flex-direction: column; gap: 12px; }

.shift-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.shift-row__times { display: flex; gap: 8px; align-items: center; }
.shift-row__times .field { flex: 1; min-width: 0; }
.shift-row__dash { color: var(--muted); }

.shift-row__actions { display: flex; gap: 8px; }
.shift-row__actions .btn { flex: 1; }

@media (min-width: 760px) {
  .calendar__cell { min-height: 108px; padding: 7px 6px; }
  .shift-chip { font-size: 11px; }

  /* На широком экране строка смены выстраивается в один ряд:
     сотрудник, время, филиал, кнопки. */
  .shift-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .shift-row__who { flex: 1 1 200px; }
  .shift-row__branch { flex: 0 1 160px; }
  .shift-row__times { flex: 0 0 auto; }
  .shift-row__times .field { flex: 0 0 auto; width: auto; }

  .shift-row__actions .btn { flex: 0 0 auto; }
}

/* ---------- Поле с поиском ---------- */

.picker { position: relative; }
.picker__input { width: 100%; }

.picker__menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 210px;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
}

.picker__item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.picker__item:hover { background: var(--surface-2); }
.picker__item--chosen { background: var(--violet); }

.picker__name { display: block; font-weight: 600; }
.picker__meta { display: block; color: var(--muted); font-size: 12px; }
.picker__item--chosen .picker__meta { color: rgba(255, 255, 255, .75); }

.picker__empty { padding: 8px 10px; color: var(--muted); font-size: 12px; }
/* Ссылка на инструкции выглядит так же, как вкладки расписания. */
.tab[href] { text-decoration: none; display: flex; align-items: center; }
