/* «Номера телефонии». Живёт внутри Битрикс24, поэтому спокойная палитра портала: белые панели с тонкой рамкой без теней,
 * один акцент (синий портала) - только для действий и выбора, красный - только для замечаний. Каждый номер - одна строка
 * таблицы, подробности раскрываются под строкой. Статусы - точка и текст, без цветных «таблеток». */
:root {
    --ink: #1f2329; --text: #333a45; --muted: #5f6873; --faint: #8a929b;
    --line: #e3e6ea; --line2: #cfd4d9; --bg: #eef2f5; --panel: #fff; --soft: #f5f7f9; --hover: #f6f8fa;
    --accent: #0075ff; --accent-d: #0063d6; --accent-l: #eaf3ff;
    --ok: #137a4c; --ok-dot: #1bab6a; --bad: #c2343b; --bad-dot: #e0464d; --bad-l: #fdf2f2; --bad-line: #f1c9cb;
    --warn: #8a5a00; --warn-dot: #e09b1a; --warn-l: #fff7e8; --warn-line: #f3dcb0; --gray-dot: #aab2ba;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --r: 10px; --ease: cubic-bezier(.22, .9, .3, 1);
}
html { scrollbar-gutter: stable; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; }
h1 { font-size: 18px; line-height: 1.3; }
h2 { font-size: 15px; line-height: 1.35; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.mt { margin-top: 12px; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }

/* --- каркас */
.nm { padding: 18px 20px 36px; min-width: 760px; }
.nm-head { display: flex; align-items: center; gap: 10px; }
.nm-head img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.sum { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.sum .bad-t b { color: var(--bad); }
.sum .sep { margin: 0 8px; color: var(--line2); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 0; }
.search { position: relative; width: 300px; }
.search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search .in { width: 100%; padding-left: 32px; }
.foot { color: var(--faint); font-size: 12px; margin-top: 18px; text-align: center; }
.load { display: flex; align-items: center; gap: 10px; margin-top: 24px; color: var(--muted); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade { animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* --- кнопки, поля, переключатели */
.btn { appearance: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
    font: inherit; font-weight: 500; padding: 0 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { border-color: var(--muted); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .seg button:focus-visible, .tab:focus-visible, th button:focus-visible, tr.row:focus-visible, .lnk:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lnk { appearance: none; height: 34px; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--muted); padding: 0 10px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.lnk:hover { background: var(--soft); color: var(--ink); }
.lnk.danger:hover { background: var(--bad-l); color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { appearance: none; height: 32px; border: 0; border-left: 1px solid var(--line2); background: #fff; font: inherit; font-size: 13px; color: var(--text); padding: 0 12px; cursor: pointer; transition: background .15s, color .15s; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--soft); }
.seg button.on { background: var(--accent-l); color: var(--accent-d); font-weight: 500; }
.in { font: inherit; font-size: 13.5px; color: var(--ink); height: 34px; border: 1px solid var(--line2); border-radius: 8px; padding: 0 10px; background: #fff; transition: border-color .15s, box-shadow .15s; min-width: 0; }
textarea.in { height: auto; padding: 7px 10px; resize: vertical; line-height: 1.4; }
.in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 117, 255, .14); }
.in:disabled { background: var(--soft); color: var(--muted); }

/* --- вкладки над таблицей */
.tabs { display: flex; align-items: flex-end; gap: 2px; margin-top: 14px; border-bottom: 1px solid var(--line2); }
.tab { appearance: none; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--muted); padding: 8px 11px 9px; cursor: pointer; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab i { font-style: normal; color: var(--faint); font-weight: 400; margin-left: 6px; font-variant-numeric: tabular-nums; }
.tab.attn i { color: var(--bad); font-weight: 600; }

/* --- таблица: каждая строка в одну линию */
.tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); }
.tw { overflow-x: auto; }
table.grid { width: 100%; min-width: 1000px; border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
.grid col.c-num { width: 164px; } .grid col.c-kind { width: 13%; } .grid col.c-purp { width: auto; } .grid col.c-src { width: 10%; }
.grid col.c-in { width: 88px; } .grid col.c-miss { width: 76px; } .grid col.c-lead { width: 56px; } .grid col.c-last { width: 78px; } .grid col.c-cost { width: 82px; } .grid col.c-st { width: 126px; } .grid col.c-flag { width: 22px; }
.grid th, .grid td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.grid th { font-weight: 500; font-size: 12px; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--soft); }
.grid th button { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.grid th button:hover { color: var(--ink); }
.grid th button[data-dir]::after { content: attr(data-dir); margin-left: 3px; }
.grid th.n, .grid td.n { text-align: right; }
.grid td { padding: 0 10px; height: 40px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.grid tbody tr:first-child td { border-top: 0; }
.grid tr.row { cursor: pointer; }
.grid tr.row td { transition: background .18s; }
.grid tr.row:hover td { background: var(--hover); }
.grid tr.row.open td { background: var(--accent-l); }
.grid tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #d9ecff; } to { background: transparent; } }
.numc { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.numc.txt { font-family: inherit; font-size: 13.5px; }
.m { color: var(--faint); }
.n b { font-weight: 600; color: var(--ink); }
.kd { color: var(--text); }
.kd::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 7px; vertical-align: 1px; background: #c3cad1; }
.kd.rent::before { background: #2fc6f6; } .kd.sip::before { background: #7a5cff; } .kd.app::before, .kd.ext::before { background: #1bab6a; }
.kd.calls::before { background: #e0a21a; } .kd.manual::before { background: #aab2ba; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line2); flex: none; vertical-align: 1px; }
.dot.ok { background: var(--ok-dot); box-shadow: none; } .dot.bad { background: var(--bad-dot); box-shadow: none; } .dot.warn { background: var(--warn-dot); box-shadow: none; } .dot.gray { background: var(--gray-dot); box-shadow: none; }
.stv { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.stv.ok { color: var(--ok); } .stv.warn { color: var(--warn); }
td.flag { text-align: center; padding: 0; }
.empty { padding: 28px 14px; color: var(--muted); text-align: center; }
.note-line { margin: 10px 2px 0; color: var(--muted); font-size: 13px; }

/* --- карточка номера под строкой: раскрывается плавно */
.grid tr.det td { padding: 0; height: auto; white-space: normal; overflow: visible; border-top: 0; background: var(--accent-l); }
.slide { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s var(--ease), opacity .25s; }
.slide.on { grid-template-rows: 1fr; opacity: 1; }
.slide-in { overflow: hidden; min-height: 0; }
.slide.done .slide-in { overflow: visible; }
.det-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; padding: 4px 14px 14px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px 14px; min-width: 0; }
.box h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.facts .sub { display: block; color: var(--muted); font-size: 12.5px; }
.probs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 7px; }
.probs li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-size: 13px; color: var(--text); background: var(--soft); }
.probs li b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.probs li.bad { background: var(--bad-l); border-color: var(--bad-line); } .probs li.bad b { color: var(--bad); }
.probs li.warn { background: var(--warn-l); border-color: var(--warn-line); } .probs li.warn b { color: var(--warn); }
.ok-line { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--ok); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.form .w { grid-column: 1 / -1; }
.form .in, .form .dd-btn { width: 100%; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; }
.acts .lnk, .acts .btn { white-space: nowrap; }
.msg { font-size: 13px; color: var(--muted); }
.msg.ok { color: var(--ok); } .msg.err { color: var(--bad); }

/* --- добавление номера */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.panel > .sec { padding: 14px 18px; }
.addp { margin-top: 12px; }
.addp .form { max-width: 760px; }
.sec-h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }

/* --- предупреждение */
.alert { display: flex; gap: 10px; align-items: flex-start; background: var(--bad-l); border: 1px solid var(--bad-line); border-radius: var(--r); padding: 11px 14px; margin: 0 0 12px; color: var(--ink); max-width: 720px; }
.alert svg { flex: none; width: 18px; height: 18px; color: var(--bad); margin-top: 1px; }
.alert b { display: block; color: var(--bad); font-weight: 600; }
.alert.warn { background: var(--warn-l); border-color: var(--warn-line); }
.alert.warn svg, .alert.warn b { color: var(--warn); }

/* --- свой выпадающий список */
.dd { position: relative; }
.dd-btn { appearance: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 34px; font: inherit; font-size: 13.5px; color: var(--ink);
    background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: 0 10px; cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn .ph { color: var(--faint); }
.dd-btn:hover { border-color: var(--muted); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 117, 255, .14); }
.chev { width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-top: -3px; transition: transform .18s var(--ease); flex: none; }
.dd-btn[aria-expanded="true"] .chev { transform: rotate(-135deg); margin-top: 3px; }
.dd-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; background: #fff; border: 1px solid var(--line2);
    border-radius: 10px; padding: 4px; box-shadow: 0 6px 18px rgba(20, 24, 28, .1); opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top; transition: opacity .14s, transform .16s var(--ease); }
.dd-pop.on { opacity: 1; transform: none; }
.dd-pop.up { top: auto; bottom: calc(100% + 4px); transform-origin: bottom; }
.dd-q { width: 100%; margin-bottom: 4px; height: 30px; }
.dd-l { max-height: 260px; overflow: auto; }
.dd-opt { display: block; width: 100%; text-align: left; appearance: none; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--text); padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-opt:hover, .dd-opt:focus { background: var(--soft); outline: none; }
.dd-opt.on { color: var(--accent-d); font-weight: 500; }

/* --- просьба об отзыве: одна серая строка */
.nm-rate { margin-top: 20px; color: var(--muted); font-size: 12.5px; text-align: center; }
.nm-rate a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.nm-rate__sep { margin: 0 6px; }
.nm-rate + .foot { margin-top: 8px; }

.nm-install { min-width: 0; max-width: 640px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
