/* ============================================================
   amoTEAM · Таблицы → НСРМ — оформление кабинета.
   Цвета и скругления те же, что в виджетах (widgets/_etalons).
   ============================================================ */

:root {
    --primary: #3949ab;
    --primary-dark: #283593;
    --title: #1a237e;
    --text: #333;
    --muted: #999;
    --bg: #f5f6fa;
    --soft: #f8f9fc;
    --line: #eee;
    --green: #2e7d32;
    --orange: #e65100;
    --red: #c62828;
    --purple: #6a1b9a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }

/* ---------- вход и регистрация ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth__box { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(26, 35, 126, .08); }
.auth__logo { font-size: 20px; font-weight: 800; color: var(--title); margin-bottom: 6px; }
.auth__sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth__switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- каркас ---------- */
.app { display: none; min-height: 100vh; }
.app.on { display: flex; }

.side {
    width: 240px; background: #1a237e; color: #fff; padding: 24px 0;
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; height: 100vh; z-index: 100;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;               /* катается вся колонка целиком, а не только список пунктов */
}
.side.collapsed { transform: translateX(-240px); }
.side__logo { padding: 0 20px 24px; font-size: 20px; font-weight: 700; letter-spacing: -.5px; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; justify-content: space-between; white-space: nowrap; }
.side__close { background: none; border: none; color: rgba(255,255,255,.5); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all .15s; line-height: 1; flex-shrink: 0; }
.side__close:hover { color: #fff; background: rgba(255,255,255,.1); }
.side__menu { padding: 16px 0; }
.side__group { padding: 0 20px; margin-bottom: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.3); font-weight: 600; white-space: nowrap; overflow: hidden; }
.side__item { display: flex; align-items: center; gap: 10px; padding: 11px 20px; font-size: 13px; color: rgba(255,255,255,.7); cursor: pointer; transition: all .15s; border-left: 3px solid transparent; white-space: nowrap; }
.side__item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side__item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #7986cb; font-weight: 600; }
.side__item .ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.side__item .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side__item .pill { margin-left: auto; background: var(--orange); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.side__bottom { padding: 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.side__item--soft { color: rgba(255,255,255,.55); text-decoration: none; padding-top: 9px; padding-bottom: 9px; }
.side__foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; color: rgba(255,255,255,.4); white-space: nowrap; overflow: hidden; }
.side__overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 99; opacity: 0; pointer-events: none; transition: opacity .3s; }
.side__overlay.show { opacity: 1; pointer-events: all; }

.main { margin-left: 240px; flex: 1; min-width: 0; transition: margin-left .3s cubic-bezier(.4, 0, .2, 1); }
.main.wide { margin-left: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; color: var(--title); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }
.badge.trial { background: linear-gradient(135deg, #e65100, #f57c00); }
.badge__sm { display: none; }                     /* короткая надпись — только на телефоне */
.badge.active { background: linear-gradient(135deg, #2e7d32, #43a047); }
.badge.stopped { background: linear-gradient(135deg, #c62828, #e53935); }
.badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.content { padding: 26px 28px 60px; max-width: 1180px; }
.view { display: none; }
.view.on { display: block; }

/* ---------- карточки и сетки ---------- */
.card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 18px; }
.card h3 { font-size: 15px; color: var(--title); margin-bottom: 14px; font-weight: 700; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head h3 { margin: 0; }

.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.stat { background: #fff; border-radius: 14px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat .n { font-size: 27px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--muted); margin-top: 5px; }
.c-blue { color: var(--primary); } .c-green { color: var(--green); }
.c-orange { color: var(--orange); } .c-purple { color: var(--purple); } .c-red { color: var(--red); }

/* ---------- кнопки ---------- */
.btn { background: var(--primary); color: #fff; border: none; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #f0f1f8; color: var(--primary); }
.btn.ghost:hover { background: #e8eaf6; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: #ffebee; color: var(--red); }
.btn.danger:hover { background: #ffcdd2; }
.btn.wide { width: 100%; }

/* ---------- поля ---------- */
label { font-size: 13px; color: #555; display: block; margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
    padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
    background: var(--soft); color: var(--text); width: 100%; font-family: inherit;
}
select {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 28px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='none' stroke='%233949ab' stroke-width='1.6' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(57,73,171,.08); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd2e0; border-radius: 24px; cursor: pointer; transition: .2s; }
.switch span:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span:before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }

/* ---------- таблицы ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid #f2f2f2; }
tbody tr:hover td { background: var(--soft); }

.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.tag.on { background: #e8f5e9; color: var(--green); }
.tag.off { background: #ffebee; color: var(--red); }
.tag.wait { background: #fff3e0; color: var(--orange); }
.tag.grey { background: #f0f1f8; color: #666; }

.av { width: 32px; height: 32px; border-radius: 50%; background: #e8eaf6; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; margin-right: 9px; vertical-align: middle; }
.dir-in { color: var(--green); font-weight: 600; }
.dir-out { color: var(--primary); font-weight: 600; }
.dir-miss { color: var(--red); font-weight: 600; }

/* ---------- мастер настройки ---------- */
.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.step.done { border-color: #c8e6c9; background: #f6fbf6; }
.step__num { width: 30px; height: 30px; border-radius: 50%; background: #e8eaf6; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.step.done .step__num { background: var(--green); color: #fff; }
.step__body { flex: 1; min-width: 0; }
.step__title { font-weight: 700; color: var(--title); margin-bottom: 3px; }
.step__text { font-size: 13px; color: #666; }

/* ---------- всплывающее окно ---------- */
.modal { position: fixed; inset: 0; background: rgba(26,35,126,.28); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal.on { display: flex; }
.modal__box { background: #fff; border-radius: 16px; padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal__title { font-size: 17px; font-weight: 700; color: var(--title); margin-bottom: 16px; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal__foot #modalDel { margin-right: auto; }   /* удаление — слева, подальше от «Сохранить» */
.confirm { z-index: 120; }                        /* поверх обычного окна */
.confirm .modal__box { max-width: 400px; }
.confirm__text { color: #333; font-size: 14px; line-height: 1.5; margin-top: 4px; }

/* ---------- сообщение ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--title); color: #fff; padding: 12px 22px; border-radius: 12px; font-size: 14px; opacity: 0; transition: .25s; z-index: 200; max-width: 90vw; }
.toast.on { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--red); }

.field__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.field__link { color: #3949ab; font-size: 13px; font-weight: 600; text-decoration: none; flex-shrink: 0; }
.field__link:hover { text-decoration: underline; }

/* ---------- строки с копированием (данные для звонилки) ---------- */
.crows { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f8f9fc; }
.crow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: none; }
.crow__l { width: 74px; flex-shrink: 0; color: var(--muted); font-size: 12px; }
.crow__v { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: #333; font-size: 13px; }
.crow__b { flex-shrink: 0; background: #fff; border: 1px solid var(--line); color: var(--title); border-radius: 8px;
    padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s; }
.crow__b:hover { background: var(--title); color: #fff; border-color: var(--title); }
.crows__foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty__ic { font-size: 34px; margin-bottom: 10px; }
.err { color: var(--red); font-size: 13px; margin-top: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- телефон ---------- */
@media (max-width: 700px) {
    .topbar { padding: 12px 14px; gap: 8px; }
    .topbar h1 { font-size: 17px; }
    .badge { font-size: 11px; padding: 5px 10px; }
    .badge__lg { display: none; }
    .badge__sm { display: inline; }
}

@media (max-width: 860px) {
    .side { transform: translateX(-100%); transition: .2s; }
    .side.open { transform: none; }
    .main { margin-left: 0; }
    .content { padding: 18px 16px 50px; }
    .grid4, .grid3, .grid2, .row2 { grid-template-columns: 1fr; }
    .burger { display: block !important; }
}
.burger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--title); }
.app.side-hidden .burger { display: block; }

/* ---------- выбор из длинного списка (сотрудники НСРМ) ---------- */
/* Своё окно вместо обычного списка: сотрудников в базе НСРМ бывает под сотню,
   без поиска нужного не найти. */
.picker { position: relative; }
.picker__btn {
    width: 100%; display: flex; align-items: center; gap: 9px; text-align: left;
    padding: 8px 34px 8px 10px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--soft); color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='none' stroke='%233949ab' stroke-width='1.6' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.picker__btn:hover { border-color: #d9dcea; }
.picker.open .picker__btn { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(57,73,171,.08); }
.picker__btn .av { width: 26px; height: 26px; font-size: 10px; margin: 0; }
.picker__none { color: var(--muted); }

.picker__pop {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
    background: #fff; border: 1px solid #e3e5f0; border-radius: 12px;
    box-shadow: 0 12px 34px rgba(26,35,126,.16); overflow: hidden; display: none;
}
.picker.open .picker__pop { display: block; }
.picker__search { border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; padding: 11px 13px; }
.picker__search:focus { box-shadow: none; border-color: var(--line); border-bottom-color: var(--primary); }
.picker__list { max-height: 260px; overflow-y: auto; padding: 6px; }

.picker__item {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 7px 9px; border: none; border-radius: 8px; background: none;
    font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
}
.picker__item:hover { background: var(--soft); }
.picker__item.sel { background: #e8eaf6; color: var(--title); font-weight: 600; }
.picker__item .av { width: 26px; height: 26px; font-size: 10px; margin: 0; flex-shrink: 0; }
.picker__nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* недоступный вариант — виден, но выбрать нельзя */
.picker__item.busy { cursor: not-allowed; color: #b0b3c4; }
.picker__item.busy:hover { background: none; }
.picker__item.busy .av { background: #f1f2f7; color: #b0b3c4; }
.picker__busy { font-size: 11px; color: #b0b3c4; flex-shrink: 0; }
.picker__empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* предупреждение внутри окна */
.warn {
    background: #fff8e1; border: 1px solid #ffe082; border-radius: 10px;
    padding: 11px 13px; font-size: 12.5px; color: #7a5200; line-height: 1.5;
}

/* поиск в шапке карточки */
.search {
    width: 230px; padding: 8px 12px 8px 32px; font-size: 13px;
    background-color: var(--soft); background-repeat: no-repeat; background-position: 10px center;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
}
@media (max-width: 700px) { .search { width: 100%; } }

/* поиск и кнопки — одной строкой, кнопки не переносятся и не сжимаются */
.headrow { display: flex; align-items: center; gap: 9px; flex-wrap: nowrap; }
.headrow .btn { white-space: nowrap; flex-shrink: 0; }
.headrow .search { flex: 0 1 220px; min-width: 130px; }
@media (max-width: 700px) {
    .headrow { flex-wrap: wrap; }
    .headrow .search { flex: 1 1 100%; width: 100%; }
}



/* ---------- мастер настройки таблицы ---------- */
.wiz { display: grid; gap: 14px; }
.wsec { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.wsec__head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: var(--soft); cursor: pointer; }
.wsec__num { width: 26px; height: 26px; border-radius: 50%; background: #e8eaf6; color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.wsec.done .wsec__num { background: var(--green); color: #fff; }
.wsec__ttl { font-weight: 700; color: var(--title); font-size: 14px; }
.wsec__sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.wsec__body { padding: 16px; border-top: 1px solid var(--line); display: none; }
.wsec.open .wsec__body { display: block; }
.wsec__chev { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* строка раскладки: столбец таблицы → поле НСРМ */
.maprow { display: grid; grid-template-columns: 1fr 22px 1fr; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f4f4f8; }
.maprow:last-child { border-bottom: none; }
.maprow__arrow { text-align: center; color: #c5cae9; font-size: 15px; }
.maprow__name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.maprow__req { color: var(--red); font-size: 15px; line-height: 1; }
.maprow__type { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.maprow select, .maprow input { margin: 0; }
.maprow__pair { display: grid; grid-template-columns: 96px 1fr; gap: 7px; }
@media (max-width: 700px) {
    .maprow { grid-template-columns: 1fr; gap: 5px; }
    .maprow__arrow { display: none; }
}

/* блок «дайте доступ этому адресу» */
.share { background: #f0f4ff; border: 1px solid #d6e0ff; border-radius: 12px; padding: 14px 16px; }
.share__t { font-weight: 700; color: var(--title); margin-bottom: 6px; font-size: 13.5px; }
.share__row { display: flex; gap: 8px; align-items: center; margin-top: 9px; }
.share__mail { flex: 1; min-width: 0; background: #fff; border: 1px solid #d6e0ff; border-radius: 8px; padding: 8px 11px; font-size: 12.5px; overflow-x: auto; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* результат проверки «что уйдёт в НСРМ» */
.tres { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 10px; }
.tres.bad { border-color: #ffcdd2; background: #fffafa; }
.tres.good { border-color: #c8e6c9; background: #f8fcf8; }
.tres__h { font-weight: 700; font-size: 13px; color: var(--title); margin-bottom: 8px; display: flex; gap: 9px; align-items: center; }
.tres__list { display: grid; gap: 4px; font-size: 13px; }
.tres__k { color: var(--muted); display: inline-block; min-width: 150px; }
.tres__warn { background: #fff8e1; border-radius: 8px; padding: 8px 11px; font-size: 12.5px; color: #7a5200; margin-top: 8px; line-height: 1.5; }

/* плашка состояния таблицы */
.sheetcard { border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; margin-bottom: 12px; }
.sheetcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheetcard__name { font-weight: 700; color: var(--title); font-size: 14.5px; }
.sheetcard__sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.sheetcard__nums { display: flex; gap: 18px; margin-top: 11px; flex-wrap: wrap; }
.sheetcard__n b { font-size: 17px; font-weight: 800; }
.sheetcard__n span { font-size: 12px; color: var(--muted); margin-left: 5px; }
.sheetcard__err { background: #ffebee; color: #b71c1c; border-radius: 8px; padding: 8px 11px; font-size: 12.5px; margin-top: 10px; line-height: 1.5; }
.sheetcard__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
