/* ============================================================
   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__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; }


/* ---------- таблицы ---------- */
.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; }


/* ---------- мастер настройки ---------- */
.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; }
.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__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; }
/* «идёт работа» — то же место, но спокойным цветом: красным человек читает это как сбой */
.err.wait { color: var(--muted); }
.muted { color: var(--muted); 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; }

/* предупреждение внутри окна */

/* поиск в шапке карточки */
.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%; }
}



/* ---------- мастер настройки: шаги ---------- */
.wsteps { display: flex; gap: 0; padding: 4px 0 0; }
.wstep { flex: 1; text-align: center; padding: 0 6px 13px; position: relative; font-size: 12.5px;
    color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wstep:before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.wstep:hover { color: var(--primary-dark); }
.wstep.done { color: var(--green); }
.wstep.done:before { background: var(--green); }
.wstep.now { color: var(--primary); font-weight: 700; }
.wstep.now:before { background: var(--primary); height: 3px; }
@media (max-width: 760px) {
    /* пять шагов в 360 пикселей не помещаются — даём прокрутку вбок.
       Ширину не задаём и не обрезаем текст: иначе длинные названия
       («Что уехало в Лидцентр») превращались в многоточие, и человек
       не понимал, куда попадёт. Блок стоит ПОСЛЕ правил .wstep — раньше
       он был выше и просто перебивался ими. */
    .wsteps { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .wstep { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; overflow: visible; }
}

.wbody { padding: 26px 2px 4px; min-height: 300px; }
.wq { font-size: 20px; font-weight: 700; color: var(--title); margin-bottom: 5px; }
.wsub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.wfields { display: grid; gap: 15px; max-width: 470px; }
.wfields .field { margin: 0; }
label .lnote { color: var(--muted); font-weight: 400; }
label .req, .req { color: var(--red); }

.wfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line); }
.wfoot .hint { font-size: 12.5px; color: var(--muted); text-align: center; flex: 1; }

/* столбцы в примечание — плитками */

/* сводка на последнем шаге */
.sum { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sum__r { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px;
    border-bottom: 1px solid #f6f6fa; font-size: 13.5px; }
.sum__r:last-child { border-bottom: none; }
.sum__k { color: var(--muted); flex-shrink: 0; }
.sum__v { font-weight: 600; text-align: right; }

/* блок «дайте доступ этому адресу» */
.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: 12px; line-height: 1.45; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.share__row { align-items: flex-start; }
.share__row .btn { margin-top: 1px; }

/* результат проверки «что уйдёт в НСРМ» */
.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; }

/* подзаголовок группы внутри раскладки */
#wFields { margin-top: 2px; }

/* столбец отметок — прячем, открывается ссылкой «изменить» */

/* поля НСРМ на шаге «Данные» — той же ширины, что и поля сверху */
#wFields .wfields { max-width: 470px; }
#wFields .maprow__pair { grid-template-columns: 118px 1fr; }
.chips { max-width: 470px; }

/* строка раскладки: столбец таблицы → куда кладём */
.pair2 { display: grid; grid-template-columns: 1fr 22px 1fr 28px; align-items: center; gap: 10px; margin-bottom: 10px; }
.pair2__arr { text-align: center; color: #c5cae9; font-size: 15px; }
.pair2__x { background: none; border: none; color: #c9ccdb; font-size: 20px; line-height: 1; cursor: pointer;
    padding: 0 4px; border-radius: 6px; font-family: inherit; }
.pair2__x:hover { color: var(--red); background: #ffebee; }
.addpair { margin-top: 4px; }
@media (max-width: 760px) {
    /* На узком экране складываем строку столбиком: столбец сверху, куда — снизу,
       крестик в углу. Раньше стрелка выпадала из сетки и выбор цели уезжал
       в колонку шириной 28 пикселей — читать было нечего. */
    .pair2 { grid-template-columns: 1fr 28px; grid-template-areas: "src x" "dst x"; gap: 7px; padding-bottom: 10px; border-bottom: 1px solid #f4f4f8; }
    .pair2 > *:nth-child(1) { grid-area: src; }
    .pair2 > *:nth-child(3) { grid-area: dst; }
    .pair2__x { grid-area: x; align-self: center; }
    .pair2__arr { display: none; }
}

/* не удалось прочитать НСРМ */
.failbox { background: #fff5f5; border: 1px solid #ffcdd2; border-radius: 12px;
    padding: 14px 16px; color: #b71c1c; font-size: 13.5px; line-height: 1.6; max-width: 470px; }
.failbox .btn { margin-top: 10px; }

/* ===== добавлено для звонилки: таблицы, метки, галочки ===== */

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
    text-align: left; padding: 8px 10px; color: #999; font-weight: 600;
    font-size: 12px; border-bottom: 1px solid #eee; white-space: nowrap;
}
.tbl td { padding: 7px 10px; border-bottom: 1px solid #f3f3f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl input[type="text"], .tbl select {
    width: 100%; padding: 6px 10px; border: 1px solid #eee; border-radius: 8px;
    font-size: 13px; background: #f8f9fc; color: #333; font-family: inherit;
}
.tbl input[type="text"]:focus, .tbl select:focus {
    border-color: #3949ab; background: #fff; box-shadow: 0 0 0 3px rgba(57,73,171,.08); outline: none;
}
.tbl a { color: #3949ab; }

.pill {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill.ok   { background: #e8f5e9; color: #2e7d32; }
.pill.warn { background: #fff3e0; color: #e65100; }
.pill.bad  { background: #ffebee; color: #c62828; }

.warn {
    background: #fff8e1; color: #8a6100; border-radius: 10px;
    padding: 10px 14px; font-size: 13px; margin-bottom: 8px;
}
.warn:last-child { margin-bottom: 0; }

.check {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 0; font-size: 13px; color: #333; cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: #3949ab; cursor: pointer; }

.badge.off { background: #eceef6; color: #777; }
