/* Экран персонала «BAG ОПТИКА · Лиды». Визуальный эталон — прототип-вариант-б.html */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #eef1f4; color: #1c2733; font-size: 15px;
  padding: 18px 14px 46px;
}

.app {
  max-width: 1100px; margin: 0 auto;
  background: #f7f9fb; border: 1px solid #c9d4de; border-radius: 14px;
  overflow: hidden; box-shadow: 0 8px 28px rgba(20,40,60,.10);
}
.app-top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #1f6f43; color: #fff; padding: 12px 18px;
}
.app-top .logo { font-weight: 700; font-size: 16px; }
.app-top .day { opacity: .85; font-size: 14px; }
.app-top .spacer { flex: 1; }
.offline {
  font-size: 12.5px; font-weight: 700; background: #b3261e; color: #fff;
  border-radius: 20px; padding: 4px 12px;
}
.shift { font-size: 13px; background: rgba(255,255,255,.15); border-radius: 20px; padding: 5px 14px; }
.shift a { color: #cfe8d8; }
.app-top .gear {
  color: #cfe8d8; text-decoration: none; font-size: 17px; opacity: .8; line-height: 1;
}
.app-top .gear:hover { opacity: 1; }
.app-body { padding: 18px; min-height: 560px; }

/* Чипы статусов */
.chip {
  display: inline-block; font-size: 12.5px; font-weight: 600;
  border-radius: 6px; padding: 3px 9px; white-space: nowrap;
}
.st-new      { background: #dce9f7; color: #1b5ea6; }
.st-nedozvon { background: #fbd9d3; color: #b3261e; }
.st-zapisan  { background: #fbe7a2; color: #7a5b00; }
.st-prishel  { background: #cfe2f3; color: #1b5ea6; }
.st-kupil    { background: #1a7f37; color: #fff; }
.st-perezvon { background: #fde3c0; color: #965c00; }
.st-dumaet   { background: #e4defc; color: #5b45b0; }
.st-arch     { background: #e2e8ee; color: #4a5a6a; }
.st-repeat   { background: #d9f2e2; color: #14683c; border: 1px dashed #7cc59a; }

/* Вкладки */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #d6dee6; }
.tabs button {
  font-family: inherit; font-size: 15px; font-weight: 600; color: #5b6b7c;
  background: none; border: none; padding: 10px 18px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button.on { color: #1f6f43; border-bottom-color: #1f6f43; }
.tabs .badge {
  background: #b3261e; color: #fff; font-size: 11.5px; border-radius: 10px;
  padding: 1px 7px; margin-left: 6px; vertical-align: 2px;
}

/* Баннер новой заявки */
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(179,38,30,.35); } 50% { box-shadow: 0 0 0 8px rgba(179,38,30,0); } }
.new-lead {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 2px solid #d24d3e; border-radius: 12px;
  padding: 13px 16px; margin-bottom: 18px; animation: pulse 1.6s infinite;
}
.new-lead .bell { font-size: 22px; }
.new-lead .t { flex: 1; min-width: 220px; }
.new-lead .t b { font-size: 15.5px; }
.new-lead .t small { display: block; color: #b3261e; font-weight: 600; margin-top: 2px; }

/* Группы задач */
.grp { margin-bottom: 20px; }
.grp-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.grp-red .grp-title { color: #b3261e; }
.grp-yellow .grp-title { color: #8a6d00; }
.grp-blue .grp-title { color: #1b5ea6; }
.grp-grey .grp-title { color: #5b6b7c; }
.task {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid #d6dee6; border-left-width: 5px; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 8px;
}
.grp-red .task { border-left-color: #d24d3e; }
.grp-yellow .task { border-left-color: #e2b93b; }
.grp-blue .task { border-left-color: #5b95c9; }
.grp-grey .task { border-left-color: #b8c4cf; opacity: .85; }
.t-when { min-width: 74px; font-weight: 700; font-size: 15px; }
.grp-red .t-when { color: #b3261e; }
.t-what { flex: 1; min-width: 200px; }
.t-action { font-weight: 700; margin-bottom: 2px; }
.t-who { color: #37485a; }
.t-who .phone { color: #5b6b7c; margin-left: 8px; white-space: nowrap; }
.t-note { font-size: 13px; color: #5b6b7c; margin-top: 2px; }
.btn {
  font-family: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  border-radius: 9px; border: none; padding: 10px 20px;
}
.btn-go { background: #1f6f43; color: #fff; }
.btn-go:hover { background: #185c37; }
.btn-lite { background: #eef3f7; color: #37485a; border: 1px solid #c9d4de; }
.collapsed-note { font-size: 13.5px; color: #5b6b7c; padding: 4px 2px; line-height: 1.5; }
.collapsed-note u { cursor: pointer; }
.all-done {
  text-align: center; color: #1a7f37; background: #e8f5ec; border: 1px dashed #9fd4ae;
  border-radius: 10px; padding: 14px; font-weight: 600; margin: 4px 0 18px;
}

/* Вечерний блок «Перед уходом» */
.predep {
  background: #fff; border: 2px solid #e2b93b; border-radius: 12px;
  padding: 14px 18px; margin-bottom: 18px;
}
.predep h3 { font-size: 15px; margin-bottom: 8px; }
.cd-item { display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; flex-wrap: wrap; }
.cd-ok { color: #1a7f37; }
.cd-bad { color: #b3261e; font-weight: 600; }
.cd-btn { margin-left: auto; }
.predep small { display: block; color: #5b6b7c; margin-top: 8px; line-height: 1.4; }

/* Утренний баннер незакрытого дня */
.morning {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: #fdeeec; border: 2px solid #b3261e; border-radius: 12px;
  padding: 13px 16px; margin-bottom: 18px;
}
.morning .t { flex: 1; min-width: 220px; }
.morning .t b { font-size: 15.5px; }
.morning .t small { display: block; color: #8a3a34; margin-top: 3px; line-height: 1.4; }

/* Источник лида */
.src {
  display: inline-block; font-size: 12px; font-weight: 600; color: #4a5a6a;
  background: #eef1f4; border: 1px solid #d6dee6; border-radius: 6px;
  padding: 2px 8px; white-space: nowrap;
}

/* Поля форм */
.fld { margin-bottom: 12px; }
.fld label {
  display: block; font-size: 12.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #5b6b7c; margin-bottom: 6px;
}
.fld input, .fld select, .fld textarea {
  width: 100%; font-family: inherit; font-size: 15px; padding: 10px 12px;
  border: 1.5px solid #c9d4de; border-radius: 9px; outline: none; background: #fff; color: inherit;
}
.fld input:focus, .fld textarea:focus { border-color: #1f6f43; }

/* Все лиды */
.search-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 260px; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid #c9d4de; border-radius: 10px; padding: 11px 14px;
}
.search input { border: none; outline: none; font-size: 16px; flex: 1; font-family: inherit; background: none; color: inherit; }
.search .ico { font-size: 17px; opacity: .55; }
.search-hint { font-size: 12.5px; color: #5b6b7c; margin: -6px 0 12px 2px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .f {
  font-size: 13.5px; font-weight: 600; border-radius: 20px; padding: 7px 15px;
  background: #fff; border: 1px solid #c9d4de; color: #37485a; cursor: pointer; font-family: inherit;
}
.filters .f.on { background: #1f6f43; border-color: #1f6f43; color: #fff; }
.filters .f .n { opacity: .75; font-weight: 500; }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid #d6dee6; border-radius: 10px; }
table.leads { border-collapse: collapse; width: 100%; min-width: 980px; }
table.leads th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: #5b6b7c; padding: 10px 12px; border-bottom: 2px solid #d6dee6; background: #f2f5f8; white-space: nowrap;
}
table.leads td { padding: 10px 12px; border-bottom: 1px solid #e7edf2; vertical-align: middle; }
table.leads tr:last-child td { border-bottom: none; }
table.leads tr.lead-row { cursor: pointer; }
table.leads tr.lead-row:hover td { background: #f0f6fb; }
tr.overdue td { background: #fdeeec; }
tr.today-row td { background: #fffbe9; }
tr.done-row td { color: #8795a5; background: #fafbfc; }
.next-step { font-weight: 700; white-space: nowrap; }
.next-step small { display: block; font-weight: 500; color: #5b6b7c; }
.overdue .next-step { color: #b3261e; }
.phone { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.cmt { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #5b6b7c; }

/* Пустые состояния и ошибки загрузки */
.tbl-empty {
  background: #fff; border: 1px dashed #c9d4de; border-radius: 10px;
  padding: 22px; text-align: center; color: #5b6b7c; margin-top: 10px; line-height: 1.55;
}
.muted { color: #8795a5; font-size: 13.5px; }

/* Календарь */
.cal-note { font-size: 13.5px; color: #5b6b7c; margin-bottom: 12px; line-height: 1.45; }
.cal-nav { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.cal-nav .btn { padding: 8px 14px; }
.cal { display: flex; gap: 12px; overflow-x: auto; }
.cal-day { flex: 1; min-width: 210px; }
.cal-day h4 { font-size: 14px; text-align: center; margin-bottom: 8px; }
.cal-day h4 small { display: block; font-weight: 500; color: #5b6b7c; }
.slot {
  display: flex; gap: 8px; align-items: center;
  border-radius: 7px; padding: 6px 10px; margin-bottom: 4px; font-size: 13px;
  border: 1px solid #dbe3ea; background: #fff;
}
.slot .tm { font-weight: 700; min-width: 42px; font-variant-numeric: tabular-nums; }
.slot.free .lbl { color: #9aa8b5; }
.slot.past { background: #f1f3f5; color: #9aa8b5; border-color: #e7ebef; }
.slot.busy { background: #e3f2e8; border-color: #8fcea5; cursor: pointer; }
.slot.busy .lbl { font-weight: 700; color: #14683c; }
.slot.pre { background: #fdf6dd; border: 1.5px dashed #d8b83a; cursor: pointer; }
.slot.pre .lbl { font-weight: 700; color: #7a5b00; }
.slot.pre .lbl small, .slot.busy .lbl small { display: block; font-weight: 500; font-size: 11.5px; }
.slot.pre .lbl small { color: #8a6d00; }
.slot.busy .lbl small { color: #4a7a5c; }
.legend { margin-top: 14px; font-size: 13px; color: #5b6b7c; display: flex; gap: 18px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* Модалки (карточка лида, добавление, смена) */
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,25,35,.45);
  z-index: 50; align-items: flex-start; justify-content: center; padding: 34px 16px; overflow-y: auto;
}
.overlay.open { display: flex; }
.lead-card {
  background: #fff; border-radius: 16px; max-width: 600px; width: 100%;
  box-shadow: 0 18px 50px rgba(10,25,40,.35); overflow: hidden;
}
.lc-head { background: #1f6f43; color: #fff; padding: 15px 22px; display: flex; align-items: center; gap: 12px; }
.lc-head .nm { font-size: 19px; font-weight: 700; }
.lc-head .ph { opacity: .9; }
.lc-head .x { margin-left: auto; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }
.lc-body { padding: 16px 22px 22px; }
.lc-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 13.5px; color: #5b6b7c; margin-bottom: 4px; align-items: center; }
.lc-meta b { color: #1c2733; }
.lc-task {
  font-size: 13.5px; color: #37485a; margin-top: 8px;
  background: #f4f8fb; border: 1px solid #d6dee6; border-radius: 8px; padding: 8px 12px;
}
.lc-note { font-size: 13px; color: #5b6b7c; margin-top: 8px; line-height: 1.4; }
.lc-sec { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #5b6b7c; margin: 16px 0 8px; }
.who-row { display: flex; gap: 8px; flex-wrap: wrap; }
.who-chip, .pick {
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 2px solid #c9d4de; background: #fff; border-radius: 20px; padding: 7px 16px; color: inherit;
}
.who-chip.sel, .pick.sel { border-color: #1f6f43; background: #e8f5ec; color: #1a7f37; }
.out-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.out {
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 2px solid #c9d4de; background: #f7f9fb; border-radius: 9px; padding: 11px 8px; color: inherit;
}
.out:hover { border-color: #1f6f43; background: #e8f5ec; }
.out.sel { border-color: #1f6f43; background: #e8f5ec; color: #14683c; }
.subform {
  background: #f4f8fb; border: 1px solid #d6dee6; border-radius: 10px;
  padding: 14px; margin-top: 12px;
}
.subform h5 { font-size: 13.5px; margin-bottom: 10px; color: #37485a; }
.pick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { border-radius: 9px; }
.date-row .pick { padding: 7px 12px; font-size: 13px; }
.auto-note {
  background: #fff8e1; border: 1px solid #f0dfa0; border-radius: 8px;
  font-size: 13px; color: #6b5900; padding: 9px 12px; margin-top: 12px; line-height: 1.45;
}
.mini-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.mini-slots .ms {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
  border: 1.5px solid #c9d4de; background: #fff; border-radius: 7px; padding: 8px 4px; color: inherit;
}
.mini-slots .ms.sel { border-color: #1f6f43; background: #e8f5ec; color: #14683c; }
.save-row { display: flex; gap: 12px; align-items: center; margin-top: 18px; }
.btn-save { background: #1f6f43; color: #fff; padding: 12px 26px; font-size: 15px; }
.btn-save:disabled { background: #b8c8bf; cursor: not-allowed; }
.save-hint { font-size: 12.5px; color: #8795a5; flex: 1; line-height: 1.35; }
.save-hint a { color: #1f6f43; }
.next-plate {
  background: #e8f5ec; border: 1.5px solid #7cc59a; color: #14683c;
  border-radius: 10px; padding: 12px 16px; font-weight: 600; margin-top: 16px; line-height: 1.4;
}
.hist { list-style: none; }
.hist li { font-size: 13px; color: #5b6b7c; padding: 5px 0; border-bottom: 1px dashed #e7edf2; line-height: 1.4; }
.hist li:last-child { border-bottom: none; }
.hist li b { color: #37485a; }
.hist li i { color: #8795a5; font-style: normal; }

/* Плашка ошибки/сообщения */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: #b3261e; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  z-index: 99; max-width: min(560px, 92vw); text-align: center; line-height: 1.4;
}
.toast.shown { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #1a7f37; }

@media (max-width: 640px) {
  .app-body { padding: 12px; }
  .out-grid { grid-template-columns: 1fr; }
  .mini-slots { grid-template-columns: repeat(3, 1fr); }
  .t-when { min-width: 100%; }
}

/* ---------- Экран входа (пароль салона) ----------
   Спрашивается один раз на компьютер: дальше работает долгая cookie. */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: #eef1f4;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-card {
  background: #fff; border: 1px solid #d6dee6; border-radius: 16px;
  box-shadow: 0 10px 40px rgba(20, 40, 60, .12);
  padding: 28px 30px; width: 100%; max-width: 420px; text-align: center;
}
.gate-card h2 { font-size: 20px; margin-bottom: 10px; }
.gate-hint { color: #5b6b7c; font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.gate-card input[type="password"] {
  width: 100%; font-family: inherit; font-size: 18px; text-align: center;
  padding: 12px 14px; border: 2px solid #c9d4de; border-radius: 10px; outline: none;
}
.gate-card input[type="password"]:focus { border-color: #1f6f43; }
.gate-check {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: #37485a; margin: 14px 0 16px; cursor: pointer;
}
.gate-card .btn { width: 100%; padding: 13px; font-size: 16px; }
.gate-msg { margin-top: 12px; font-size: 14px; min-height: 20px; color: #5b6b7c; }
.gate-msg.err { color: #b3261e; font-weight: 600; }
