/* Админка телефонии: тёмная тема в стиле виджета (slate + градиент blue→purple). Без внешних шрифтов и библиотек. */
:root {
  --bg: #0b1220; --bg2: #0f172a; --panel: #111c33; --panel2: #16233f; --line: rgba(71, 85, 105, .45);
  --text: #e2e8f0; --muted: #94a3b8; --dim: #64748b; --blue: #3b82f6; --purple: #9333ea;
  --ok: #22c55e; --warn: #eab308; --bad: #ef4444; --radius: 14px;
  --grad: linear-gradient(90deg, #2563eb, #9333ea);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: radial-gradient(1200px 600px at 80% -10%, rgba(147, 51, 234, .12), transparent), var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #60a5fa; text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12px; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }

/* оболочка */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: rgba(15, 23, 42, .8); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 16px; }
.logo { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(59, 130, 246, .35); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); margin-bottom: 2px; }
.nav a:hover { background: rgba(51, 65, 85, .35); color: #fff; text-decoration: none; }
.nav a.on { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(59, 130, 246, .25); }
.nav .sec { margin: 16px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.main { padding: 22px 28px 60px; max-width: 1280px; width: 100%; min-width: 0; }
.shell > * { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 13px; }

/* карточки и сетка */
.card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: rgba(30, 41, 59, .45); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: 12px; color: var(--dim); } .stat b { display: block; font-size: 22px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.sp { justify-content: space-between; } .grow { flex: 1; min-width: 160px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(30, 41, 59, .5); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 8px 14px; border-radius: 9px; color: var(--muted); white-space: nowrap; } .tabs a:hover { color: #fff; text-decoration: none; background: rgba(51, 65, 85, .35); }
.tabs a.on { background: var(--grad); color: #fff; box-shadow: 0 2px 10px rgba(59, 130, 246, .25); }

/* формы */
label.f { display: block; margin-bottom: 12px; } label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; background: rgba(15, 23, 42, .8); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 80px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 130, 246, .18); }
input.err, select.err, textarea.err { border-color: var(--bad); }
.errtext { color: #fca5a5; font-size: 12px; margin-top: 4px; }
input[type=checkbox] { accent-color: var(--blue); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 14px; cursor: pointer; }
.hint { font-size: 12px; color: var(--dim); margin-top: 4px; }
.btn { border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; background: rgba(51, 65, 85, .6); transition: background .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: rgba(71, 85, 105, .7); } .btn:active { transform: scale(.97); }
.btn.pri { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(59, 130, 246, .3); } .btn.pri:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(239, 68, 68, .18); color: #fca5a5; } .btn.danger:hover { background: rgba(239, 68, 68, .3); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; } .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* таблицы и метки */
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid rgba(71, 85, 105, .3); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; } tbody tr:hover { background: rgba(51, 65, 85, .18); } tr.click { cursor: pointer; }
.tw { overflow-x: auto; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: rgba(51, 65, 85, .5); color: var(--muted); white-space: nowrap; }
.chip.ok { background: rgba(34, 197, 94, .15); color: #86efac; } .chip.warn { background: rgba(234, 179, 8, .15); color: #fde047; } .chip.bad { background: rgba(239, 68, 68, .15); color: #fca5a5; } .chip.blue { background: rgba(59, 130, 246, .18); color: #93c5fd; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; } .dot.ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.code { scrollbar-width: thin; scrollbar-color: #334155 transparent; background: #070d1a; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: 12.5px/1.6 ui-monospace, Menlo, monospace; overflow-x: auto; white-space: pre; color: #cbd5e1; position: relative; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; } .tag { display: inline-flex; gap: 6px; align-items: center; background: rgba(59, 130, 246, .15); color: #bfdbfe; border-radius: 8px; padding: 3px 4px 3px 10px; font-size: 13px; } .tag button { border: 0; background: none; cursor: pointer; color: #93c5fd; padding: 0 6px; font-size: 16px; line-height: 1; }
.warnbox { background: rgba(234, 179, 8, .1); border: 1px solid rgba(234, 179, 8, .35); color: #fde68a; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.okbox { background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .35); color: #bbf7d0; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.empty { text-align: center; padding: 36px 10px; color: var(--dim); }

/* графики */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 6px; } .bars .b { flex: 1; min-width: 4px; background: linear-gradient(180deg, #60a5fa, #6366f1); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bars .b.m { background: linear-gradient(180deg, #f87171, #dc2626); } .bars .b:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: #000; color: #fff; padding: 2px 6px; border-radius: 6px; font-size: 11px; white-space: nowrap; z-index: 5; }
.axis { display: flex; gap: 4px; font-size: 10px; color: var(--dim); } .axis span { flex: 1; text-align: center; overflow: hidden; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* окна */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 6, 23, .72); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, .5); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--panel); border-left: 1px solid var(--line); padding: 22px; overflow-y: auto; z-index: 90; box-shadow: -20px 0 50px rgba(0, 0, 0, .4); animation: slide .18s; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toast { position: fixed; right: 18px; bottom: 18px; background: #0b1220; border: 1px solid var(--line); border-left: 3px solid var(--blue); padding: 10px 14px; border-radius: 10px; z-index: 200; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: slide .2s; max-width: 380px; }
.toast.bad { border-left-color: var(--bad); } .toast.ok { border-left-color: var(--ok); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(400px, 100%); padding: 28px; } .login .logo { width: 48px; height: 48px; border-radius: 15px; margin: 0 auto 14px; }
.spin { width: 18px; height: 18px; border: 2px solid rgba(148, 163, 184, .3); border-top-color: var(--blue); border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; vertical-align: middle; } @keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; } .nav .sec { display: none; } .main { padding: 16px; } .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* вкладка «Интеграция»: нумерованные разделы */
.part { margin: 26px 0 10px; padding-top: 6px; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.part h2 { font-size: 18px; margin: 0 0 4px; } .part p { margin: 0 0 8px; }
.intro { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.intro .chip { text-decoration: none; cursor: pointer; }

/* встроенная документация */
.doc { background: var(--card, rgba(30,41,59,.5)); border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; margin-bottom: 10px; }
.doc > summary { cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 15px; }
.doc-body { padding: 0 18px 16px; }
.doc-p { color: var(--muted); line-height: 1.55; margin: 8px 0; }
.doc-note { margin: 12px 0; padding: 10px 14px; border-radius: 10px; background: rgba(59, 130, 246, .12); color: #bfdbfe; line-height: 1.5; }
.doc-list { color: var(--muted); line-height: 1.6; padding-left: 22px; margin: 8px 0; }
.doc-code { margin: 8px 0; } .doc-code-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.doc-code .code { white-space: pre; overflow-x: auto; }
.doc-table td, .doc-table th { vertical-align: top; }
.intro button.chip { border: 0; font: inherit; font-size: 12px; }

/* раздел «АТС»: разделы станции в меню, содержимое — страница панели АТС во фрейме */
.nav a.sub { padding: 7px 12px; }
.nav a.sub.gap { margin-top: 10px; }
.nav a small { margin-left: auto; font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 999px; color: var(--dim); background: rgba(51, 65, 85, .5); }
.nav a.on small { color: #fff; background: rgba(255, 255, 255, .2); }
.nav a i.dirty { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.main.wide { max-width: none; padding-bottom: 0; }
.pbx-frame { display: block; width: 100%; height: calc(100vh - 98px); border: 0; background: transparent; color-scheme: dark; }
@media (max-width: 900px) { .pbx-frame { height: 85vh; } }

/* скрываемое боковое меню (кнопка ☰ слева в шапке) */
.top-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.burger { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(30, 41, 59, .5); color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.burger:hover { color: #fff; background: rgba(51, 65, 85, .7); }
.shell.side-off { grid-template-columns: 1fr; }
.shell.side-off .side { display: none; }

/* полосы прокрутки в стиле админки: тонкие, тёмные (меню, страница, таблицы) */
html, .side { scrollbar-width: thin; scrollbar-color: rgba(71, 85, 105, .6) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(71, 85, 105, .55); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(100, 116, 139, .8); }
