/* Делай Кассу — оформление. Один файл, без сборки. */

/* --- Шрифты: локальные Unbounded (заголовки) и Onest (текст) --- */

@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('../fonts/unbounded-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Unbounded';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('../fonts/unbounded-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg-deep:    #04191F;   /* низ экрана */
  --bg-top:     #08303C;   /* верх экрана */
  --surface:    rgba(8, 44, 55, 0.72);   /* карточки, поля */
  --surface-2:  rgba(13, 58, 70, 0.90);  /* строки в шторке */
  --line:       rgba(120, 214, 224, 0.16);
  --line-soft:  rgba(150, 240, 245, 0.12);
  --text:       #EAF9FA;
  --muted:      #8FB6BD;
  --muted-2:    #6F979E;   /* подписи дней, мелкие пояснения */
  --accent:     #24E0CE;
  --accent-a:   #2AE7D3;   /* начало градиента кнопки */
  --accent-b:   #0FB3A9;   /* конец градиента кнопки */
  --accent-ink: #03252A;   /* текст на кнопке */
  --danger:     #FF5A5A;
  --tap: 72px;
  --pad: 16px;
}

* { box-sizing: border-box; }

/* Классы с display перебивали скрытие атрибутом hidden — возвращаем приоритет. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 900px at 100% 0%,  rgba(36, 224, 206, 0.26), transparent 58%),
    radial-gradient(760px 560px at 8% 6%,     rgba(130, 255, 240, 0.10), transparent 60%),
    radial-gradient(900px 700px at 0% 42%,    rgba(26, 150, 196, 0.20), transparent 60%),
    radial-gradient(1000px 800px at 52% 118%, rgba(61, 220, 151, 0.15), transparent 62%),
    linear-gradient(160deg, #0A3A47 0%, #082F3B 34%, #062733 62%, #04191F 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: Onest, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* Цифры одинаковой ширины — суммы не дёргаются при смене значения */
.day__value, .shift__total, .input, .week__labels { font-variant-numeric: tabular-nums; }

/* --- Фоновый слой: пятна, геометрия, штриховка, знаки --- */

.bg {
  /* display нужен явно: в запасных стилях слой отключён, иначе без внешнего
     файла его знаки текут как обычный текст и выталкивают приложение вниз. */
  display: block;
  position: fixed;
  /* Длинная запись рядом с inset: он появился только в 2020-м. */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  /* Знаки расставляет скрипт — до его первого прохода слой не показываем,
     иначе при открытии видно, как они переезжают. */
  visibility: hidden;
}

.bg.is-ready { visibility: visible; }

.bg > span { position: absolute; }

/* Слой 2 — размытые пятна */
.bg-blob { border-radius: 50%; }

/* Слой 3 — геометрия */
.bg-sq {
  border-radius: 22%;
  border: 1px solid rgba(150, 240, 245, 0.08);
}

.bg-sq--fill { background: rgba(36, 224, 206, 0.04); }

.bg-circle {
  border-radius: 50%;
  border: 1px solid rgba(150, 240, 245, 0.08);
}

.bg-tri {
  background: rgba(150, 240, 245, 0.03);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.bg-hex {
  background: rgba(150, 240, 245, 0.028);
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.bg-lines {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  background-image: repeating-linear-gradient(122deg,
    rgba(150, 240, 245, 0.018) 0 1px, transparent 1px 34px);
}

/* Слой 4 — тематические знаки: текстура, а не рисунок */
.bg-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #9BF0EE;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bg-mark--ruble {
  font-weight: 800;
  line-height: 1;
  color: #9BF0EE;
}

/* --- Каркас экрана --- */

.screen {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  /* Сначала vh, следом dvh: на телефоне 100vh не учитывает нижнюю панель
     браузера, и содержимое считается влезающим, хотя выходит за экран.
     Старый движок не поймёт вторую строку и возьмёт первую. */
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
}

.screen[hidden] { display: none; }

.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
}

/* Подложка под шапкой: гасит фон под названием, край растворяется. */
.top-scrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 110px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 25, 31, 0.72), rgba(4, 25, 31, 0));
}

/* Знак в шапке рисованный: фотографическая иконка в 40 пикселях не читалась. */
.app-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  background: rgba(36, 224, 206, 0.14);
  border: 1px solid rgba(36, 224, 206, 0.35);
  color: #24E0CE;
  margin-right: 12px;
}

/* Заголовки экранов — Unbounded, тексты — Onest */
.top-bar__title {
  margin: 0;
  font-family: Unbounded, 'Arial Black', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Название приложения чуть мельче: Unbounded широкий, иначе жмёт шестерёнку */
#screen-list .top-bar__title { font-size: 17px; }

.top-bar__back {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 17px;
  padding: 8px 8px 8px 0;
  cursor: pointer;
}

.top-bar__action {
  margin-left: auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 0 var(--pad) 130px;
}

/* Первому экрану нужно, чтобы контейнер умел растягиваться по высоте. */
#screen-list .content {
  display: flex;
  flex-direction: column;
  /* Зазор до кнопки складывается с верхним отступом её панели (12),
     в сумме — 16 от последней карточки. */
  padding-bottom: 4px;
}

/* Пока показывается первый экран, страница не растёт: блок сам прокручивается
   внутри, если содержимое не помещается. min-height: 0 обязателен — без него
   флекс-элемент не даёт себя сжать и выталкивает страницу. */
body.is-onboarding #screen-list {
  height: 100vh;
  height: 100dvh;   /* та же пара: запасной вариант остаётся рядом */
}

body.is-onboarding #screen-list .content {
  min-height: 0;
  padding-bottom: 0;
}

body.is-onboarding #screen-list .action-bar { padding-top: 0; }

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px var(--pad) calc(14px + env(safe-area-inset-bottom));
  /* Заливки нет намеренно: на бирюзовой части фона она читалась как
     грязный прямоугольник. Список держит отступ снизу у .content. */
}

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

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  font-family: inherit;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

.btn--primary { gap: 12px; }

.btn--primary {
  position: relative;
  /* Отсвет из левого верхнего угла поверх основного перехода. */
  background-image:
    radial-gradient(120% 140% at 12% 0%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 46%),
    linear-gradient(135deg, #4CF6E2 0%, #1ECFBE 42%, #0D9492 100%);
  /* Рамка тёмная, в тон тексту: даёт вырезанный силуэт на любом фоне. */
  border: 2px solid #04231F;
  color: #04231F;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 2px 6px rgba(0, 0, 0, 0.30),
    0 6px 14px rgba(16, 190, 175, 0.22),
    0 14px 30px rgba(16, 190, 175, 0.20);
  transition: transform 120ms linear, box-shadow 120ms linear;
}

/* Внутренний контур тёмный — он и даёт ощущение выточенной кнопки. */
.btn--primary::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  left: 6px;
  inset: 6px;
  border: 1px solid rgba(4, 35, 31, 0.20);
  border-radius: 12px;
  pointer-events: none;
}

/* Рифление по краям — как насечка на ребре монеты. Псевдоэлементов у кнопки
   всего два, поэтому обе полосы рисуем слоями фона одного элемента. */
.btn--primary::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 21%;
  height: 58%;
  background-image:
    repeating-linear-gradient(90deg, rgba(4, 35, 31, 0.28) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(90deg, rgba(4, 35, 31, 0.28) 0 2px, transparent 2px 5px);
  background-size: 12px 100%;
  background-position: left center, right center;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Вдавливание при нажатии; в покое ничего не движется. */
.btn--primary:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 2px 6px rgba(0, 0, 0, 0.30),
    0 3px 7px rgba(16, 190, 175, 0.22),
    0 7px 15px rgba(16, 190, 175, 0.20);
}

/* Значок сидит в кружке, а не висит в воздухе. */
.btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: rgba(4, 35, 31, 0.14);
}

.btn--ghost {
  width: auto;
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
}

.btn--wide { width: 100%; }

.btn--danger {
  min-height: 56px;
  border: 1px solid var(--danger);
  border-radius: 16px;
  background: none;
  color: var(--danger);
  font-size: 18px;
  font-weight: 600;
}

/* --- Панель дня --- */

.day {
  margin: 4px 0 18px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(150, 240, 245, 0.16);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.38);
  background: linear-gradient(158deg, rgba(36, 224, 206, 0.20), rgba(8, 44, 55, 0.88) 58%);
}

.day__head {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Высота строки фиксирована: иконка глаза появляется, панель не дёргается. */
  height: 19px;
}

.day__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.day__eye-off {
  position: relative;
  display: flex;
  padding: 0;
  background: none;
  border: 0;
  color: var(--muted-2);
  cursor: pointer;
}

/* Значок 19 пикселей, палец — 44: зону растим невидимо, чтобы не поехала
   строка с датой, у которой высота зафиксирована. */
.day__eye-off::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

/* Высота одна и та же в обоих состояниях — при переключении ничего не прыгает */
.day__sum {
  display: flex;
  align-items: center;
  width: 100%;
  height: 62px;
  margin-top: 2px;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.day__value {
  font-family: Unbounded, 'Arial Black', system-ui, sans-serif;
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.day__hidden {
  display: flex;
  align-items: center;
  gap: 11px;
}

.day__hidden .dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(150, 240, 245, 0.28);
}

.day__eye { color: var(--muted); margin-left: 4px; }

.day__totals {
  margin-top: 8px;
  font-size: 17px;
  color: var(--muted);
}

.day__week {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.week {
  display: flex;
  align-items: stretch;
  /* Промежутка между колонками нет намеренно: зоны нажатия идут вплотную,
     чтобы палец не попадал в мёртвую полосу. Просвет между столбиками даёт
     внутренний отступ колонки. */
  gap: 0;
  /* 40 под столбик, 6 промежуток, остальное под подпись: иначе флекс
     поджимает самый высокий столбик и пропорция врёт. */
  height: 64px;
}

/* Нажимается вся колонка, а не закрашенный прямоугольник: иначе в день
   с маленьким заработком пришлось бы целиться в полоску в два пикселя. */
.week__col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 3.5px;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.week__bar {
  width: 100%;
  flex: none;
  border-radius: 3px;
  background: rgba(150, 240, 245, 0.20);
  transition: background-color 140ms linear;
}

/* День без денег — тонкая полоска, акцентом не заливается даже выбранный. */
.week__bar--empty { background: var(--line); }

.week__label {
  text-align: center;
  font-size: 11px;
  color: var(--muted-2);
  transition: color 140ms linear;
}

.week__col--on .week__bar:not(.week__bar--empty) { background: var(--accent); }

.week__col--on .week__label {
  font-weight: 600;
  color: #63E4D6;
}

/* Итог за неделю: всегда на месте, прячется только сумма */
.week-total {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.week-total__head { white-space: nowrap; }

.week-total__sum {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.week-total__dots {
  display: inline-flex;
  gap: 5px;
  vertical-align: middle;
}

.week-total__dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(150, 240, 245, 0.28);
}

/* Ставка за час и за заказ */
.day__rate {
  margin-top: 4px;
  font-size: 15px;
  color: var(--muted);
}

/* --- Экран первого запуска --- */

/* Свободное место распределяется, а не копится внизу: промежутки дышат по высоте окна. */
.intro {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Заголовок прижат к шапке, остаток высоты забирают карточки. */
  justify-content: flex-start;
  padding: clamp(12px, 2.4vh, 46px) 0 0;
  overflow-y: auto;
  scrollbar-width: none;
}

/* Полоса прокрутки блока только мешает: содержимое почти всегда влезает. */
.intro::-webkit-scrollbar { display: none; }

.intro__title {
  margin: 0;
  font-family: Unbounded, 'Arial Black', system-ui, sans-serif;
  font-size: clamp(15px, min(3.2vh, 5.2vw), 22px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

/* Балансировка переносов убирает одинокое слово на последней строке. */
.intro__sub {
  margin: 10px auto 0;
  max-width: 320px;
  font-size: clamp(14.5px, 2.2vh, 18px);
  font-weight: 500;
  line-height: 1.5;
  color: #A7CBD0;
  text-align: center;
  text-wrap: balance;
}

/* Карточки — плотная группа по центру свободного места. Собственного
   отступа сверху нет: иначе расстояния над группой и под ней разъедутся. */
.intro__cards {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(4px, 1.4vh, 16px) 0;
  gap: clamp(9px, 1.1vh, 30px);
}

/* На широком экране карточки короче — там и появляется место под воздух. */
@media (min-width: 700px) {
  .intro__cards { gap: clamp(9px, 3.2vh, 30px); }
}

.intro-card {
  display: flex;
  gap: clamp(9px, 1.7vh, 14px);
  align-items: flex-start;
  padding: clamp(10px, 1.4vh, 11px);
  border-radius: 16px;
  background: rgba(8, 44, 55, 0.66);
  border: 1px solid var(--line);
}

.intro-card__icon {
  flex: 0 0 clamp(32px, 4.6vh, 40px);
  width: clamp(32px, 4.6vh, 40px);
  height: clamp(32px, 4.6vh, 40px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.intro-card__title {
  display: block;
  font-size: clamp(15px, 2vh, 17px);
  font-weight: 700;
}

.intro-card__text {
  display: block;
  margin-top: 4px;
  font-size: clamp(12.5px, 1.72vh, 14.5px);
  line-height: 1.4;
  color: var(--muted);
}

/* Ниже 700 пикселей подзаголовок уступает место четырём блокам:
   он повторяет то, что и так сказано в карточках. Отступы там же ужимаются:
   без этого четыре карточки перестают влезать. */
@media (max-height: 699px) {
  /* Подзаголовок не прячется никогда: это главная фраза экрана.
     На низком экране он не исчезает, а ужимается. */
  .intro__sub {
    font-size: clamp(13px, 1.9vh, 15px);
    margin-top: 8px;
    line-height: 1.35;
  }
  .intro { padding-top: clamp(2px, 0.9vh, 10px); }
  /* Поля карточек отдают место подзаголовку; кегль текста не трогаем.
     Нижний отступ держит зазор до кнопки, иначе карточка упирается в неё. */
  .intro-card { padding: 8px 10px; }
  .intro__cards {
    padding: 0 0 8px;
    gap: 9px;
  }
}

/* Совсем низкий экран (320×568 и подобные): отдаём последние пиксели
   отступами, шрифты не трогаем. */
@media (max-height: 599px) {
  .intro-card { padding: 6px 10px; gap: 8px; }
  /* Плотнее ведём строки и отступы, кегль не трогаем. */
  .intro-card__title { line-height: 1.2; }
  .intro-card__text { line-height: 1.3; margin-top: 2px; }
  .intro__cards { padding: 0 0 8px; gap: 5px; }
  .intro { padding-top: 0; }
  body.is-onboarding #screen-list .action-bar {
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
}

/* --- Список смен --- */

.shifts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-head {
  margin: 12px 2px 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.day-head:first-child { margin-top: 0; }

/* Обводка группы выбранного дня гаснет сама: цвет уходит в прозрачный. */
.day-head, .shift {
  outline: 1px solid transparent;
  transition: outline-color 400ms linear;
}

.flash { outline-color: var(--accent); }

.shift {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.shift:active { filter: brightness(1.12); }

/* Рейка службы */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 30px;
  flex: 0 0 30px;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
}

.chip--lg {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  font-size: 18px;
}

.rail__line {
  width: 3px;
  flex: 1 1 auto;
  border-radius: 2px;
}

.shift__body {
  flex: 1 1 auto;
  min-width: 0;
}

.shift__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.shift__top--hidden { align-items: center; }

.shift__service {
  font-size: 20px;
  font-weight: 700;
}

.shift__total {
  font-size: 24px;
  font-weight: 800;
  white-space: nowrap;
}

.shift__dots {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.shift__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(150, 240, 245, 0.28);
}

.shift__meta {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  color: var(--muted);
}

.shift__rate {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.shift__rate-dots {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.shift__rate-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(150, 240, 245, 0.24);
}

.shift__note {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  color: var(--muted-2);
  overflow-wrap: anywhere;
}

/* --- Форма --- */

.field { margin-bottom: 16px; }

.field-pair {
  display: flex;
  gap: 12px;
}

.field-pair .field {
  flex: 1 1 0;
  min-width: 0;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  width: 100%;
  height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
}

.input::placeholder { color: #5F858C; }

.input:focus {
  outline: none;
  border: 2px solid var(--accent);
}

.input--sm {
  height: 56px;
  font-size: 19px;
  font-weight: 600;
}

.input--area {
  height: auto;
  min-height: 72px;
  padding: 14px 16px;
  font-size: 19px;
  font-weight: 500;
  resize: vertical;
}

.row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.row .input { flex: 1 1 auto; }

.hint {
  margin: 8px 2px 0;
  font-size: 14px;
  color: var(--muted-2);
}

/* Кнопки даты */

.date-row {
  display: flex;
  gap: 10px;
  position: relative;
}

.date-btn {
  flex: 1 1 0;
  height: 64px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 19px;
  font-weight: 500;
  cursor: pointer;
}

.date-btn--icon {
  flex: 0 0 64px;
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.date-btn--on {
  border: 0;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: var(--accent-ink);
  font-weight: 800;
}

.date-btn--on.date-btn--icon { color: var(--accent-ink); }

/* Системный выбор даты: нужен живым для showPicker, но не виден */
.date-native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: 0;
  padding: 0;
}

.date-chosen {
  margin: 8px 2px 0;
  font-size: 15px;
  color: var(--accent);
}

/* Строка службы */

.service-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: var(--tap);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.service-row__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-row__chevron { color: var(--muted); flex: 0 0 auto; }

/* Блок «Подробнее» */

.more {
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.more__summary {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0 16px;
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.more__summary::-webkit-details-marker { display: none; }

.more__summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--muted);
}

.more[open] .more__summary::after { content: "▴"; }

.more__body {
  padding: 6px 16px 16px;
  border-top: 1px solid var(--line-soft);
}

/* --- Ошибки --- */

.form-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 16px;
}

.input--invalid { border-color: var(--danger); }

/* Полоска обновления: в потоке страницы, над шапкой, не перекрывает её. */
.update-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: linear-gradient(135deg, rgba(36, 224, 206, 0.22), rgba(8, 44, 55, 0.94));
  border-bottom: 1px solid var(--line);
}

.update-bar__text {
  flex: 1 1 auto;
  font-size: 17px;
  font-weight: 600;
}

.update-bar__btn {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.update-bar__btn:disabled { opacity: 0.6; }

.db-error {
  position: relative;
  z-index: 3;
  padding: 12px var(--pad);
  background: #4a1f1f;
  color: #ffd8d8;
  font-size: 15px;
}

.delete-zone {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

/* --- Настройки --- */

.section-title {
  margin: 26px 0 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title:first-child { margin-top: 6px; }

.services {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service {
  padding: 8px 8px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.service__row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service__chip {
  padding: 0;
  border: 0;
  cursor: pointer;
}

.service__name {
  flex: 1 1 auto;
  font-size: 19px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.service__remove {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.service__remove:active { color: var(--danger); }

/* Плашки цвета: выбор в одно касание, без спектра */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 4px 4px;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatch--on { border-color: var(--text); }

.swatch--custom {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 14px;
  background: none;
  border: 1px dashed rgba(150, 240, 245, 0.3);
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
}

.swatch--custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}

.switch__text {
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 600;
}

.switch__hint {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted-2);
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  flex: 0 0 auto;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  background: rgba(150, 240, 245, 0.16);
  padding: 3px;
}

.switch__knob {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.12s linear;
}

.switch input:checked ~ .switch__track {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
}

.switch input:checked ~ .switch__track .switch__knob {
  background: var(--accent-ink);
  transform: translateX(24px);
}

/* --- Данные --- */

.data-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.data-report {
  margin: 12px 0 0;
  font-size: 16px;
  color: var(--text);
}

.data-report--error { color: var(--danger); }

/* --- Шторка выбора службы --- */

.sheet-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  background: rgba(2, 14, 18, 0.6);
}

.sheet-backdrop[hidden] { display: none; }

.sheet {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  max-height: 82vh;
  overflow-y: auto;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #0B3844, #072732);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(150, 240, 245, 0.2);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.6);
}

.sheet__handle {
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 3px;
  background: rgba(150, 240, 245, 0.3);
}

/* Шапка шторки: слева стрелка «назад» (на первом шаге её нет),
   посередине заголовок, справа крестик. Обе кнопки — 44×44. */
.sheet__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.sheet__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-family: Unbounded, 'Arial Black', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
}

.sheet__nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background-color: transparent;
  color: var(--muted);
  cursor: pointer;
}

.sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 64px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--surface-2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sheet-row__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-row--on {
  background: rgba(36, 224, 206, 0.14);
  border-color: var(--accent);
}

.sheet-row__check { color: var(--accent); flex: 0 0 auto; }

/* Развилка: значок слева, шеврон справа. */
/* Строки развилки длиннее названий служб: даём переносить, а не обрезать. */
.sheet-row__name--fork {
  font-size: 17px;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
}

.sheet-row__icon { flex: 0 0 auto; display: flex; color: var(--accent); }
.sheet-row__chevron { flex: 0 0 auto; display: flex; color: var(--muted); }

/* Своя служба: поле, плашки цветов, кнопка «Готово». */
.sheet-own {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-own .input {
  height: 56px;
  font-size: 20px;
  font-weight: 600;
}

.sheet-own .label { display: block; }

.sheet-own .form-error { margin: 0; }

.sheet-own__done:disabled {
  opacity: 0.45;
  cursor: default;
}

/* --- Строка выгрузки на главном экране --- */

.datarow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  margin: 10px 0 14px;
}

.datarow__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 6px;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.datarow__btn:active { color: var(--text); }

.datarow__dot { color: var(--muted-2); }

/* --- Напоминание о резервной копии --- */

.backup {
  margin: 10px 0 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(36, 224, 206, 0.10);
  border: 1px solid rgba(36, 224, 206, 0.28);
}

.backup__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.backup__text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--muted);
}

.backup__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Малая кнопка --- */

/* Намеренно НЕ разновидность .btn--primary: декор большой кнопки — рифление,
   внутренняя рамка, радиальный блик, дальние тени — на площади 130×44
   читается как грязь. Здесь работают только градиент и блик сверху. */
.btn--small {
  width: auto;
  min-height: 0;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid #04231F;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-ink);
  /* Без своего цвета фона браузер подставляет системный серый — он вылезает
     по скруглённым углам из-под градиента. */
  background-color: transparent;
  background-image: linear-gradient(135deg, #4CF6E2 0%, #1ECFBE 42%, #0D9492 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 1px 3px rgba(0, 0, 0, 0.28),
    0 3px 8px rgba(16, 190, 175, 0.18);
  transition: transform 120ms linear, box-shadow 120ms linear;
}

.btn--small:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 2px 4px rgba(16, 190, 175, 0.18);
}

/* Разрушающее действие не должно выглядеть так же, как безопасное. */
.btn--wipe {
  background-image: none;
  background-color: transparent;
  border: 1px solid rgba(255, 90, 90, 0.55);
  color: var(--danger);
  box-shadow: none;
}

.btn--wipe:active {
  background-color: rgba(255, 90, 90, 0.12);
  box-shadow: none;
}

.btn--plain {
  width: auto;
  min-height: 44px;
  padding: 0 8px;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

/* --- Окно выбора при загрузке файла --- */

.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 14, 18, 0.66);
}

.modal[hidden] { display: none; }

.modal__box {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #0B3844, #072732);
  border: 1px solid rgba(150, 240, 245, 0.2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.modal__title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
}

.modal__text {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--muted);
}

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

.modal__actions .btn { width: 100%; }

/* Сообщение формы теперь под кнопкой сохранения */
.action-bar .form-error {
  margin: 10px 0 0;
  text-align: center;
}

.hint--tight {
  margin: 6px 2px 4px;
  font-size: 13px;
}

/* Номер версии — самой нижней строкой в настройках */
.app-version {
  margin: 22px 2px 0;
  font-size: 13px;
  color: var(--muted-2);
}
