/* Палитра приложения RS Connect (тёмная тема). */
:root {
  color-scheme: dark;
  --bg: #0A0E14; --surface: #111821; --surface2: #19222E; --border: #1F2A37; --border-input: #5F7086;
  --text: #EEF2F6; --muted: #9AA7B6; --disabled: #687689;
  --accent: #4ADE80; --accent2: #22C55E; --on-accent: #06120B; --accent-soft: #0F2A1C;
  --danger: #F87171; --danger-soft: #3A1A1A; --warning: #FBBF24; --info: #60A5FA;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font: 15px/1.5 Inter, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }

/* Переключатель языка: таблетка с флагами. Общий для обоих каркасов. */
.lang { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.lang a, .lang .on { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; color: var(--muted); text-decoration: none; }
.lang .flag { width: 18px; height: 12px; border-radius: 2px; display: block; }
.lang .on { background: var(--surface2); color: var(--text); }
.lang a:hover { color: var(--text); }

/* ---------- Каркас входа: карта мира на фоне, карточка по центру ---------- */
header { position: relative; z-index: 2; display: flex; justify-content: flex-end; align-items: center; padding: 14px 24px; }
header nav { display: flex; align-items: center; gap: 18px; }
body.hero { background: var(--bg) url("/map.svg") center 48% / max(100%, 1100px) auto no-repeat; }
/* Затухание по бокам прячет шов проекции на 180° (Чукотка и Аляска на разных краях). */
body.hero::before { content: ""; position: fixed; inset: 0; background: linear-gradient(90deg, var(--bg) 0%, rgba(10, 14, 20, 0) 14%, rgba(10, 14, 20, 0) 86%, var(--bg) 100%), radial-gradient(ellipse at 50% 45%, rgba(10, 14, 20, .1) 0%, rgba(10, 14, 20, .4) 55%, rgba(10, 14, 20, .9) 100%); pointer-events: none; }
body.hero main { position: relative; z-index: 1; min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 28px 16px 56px; }
body.hero .card { width: 100%; max-width: 420px; padding: 28px; background: rgba(17, 24, 33, .92); box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
body.hero .card h2 { margin-top: 0; }
body.hero .msg { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3; }
.tagline { color: var(--muted); font-size: 14px; margin: -6px 0 18px; }

/* ---------- Каркас кабинета: боковое меню и страница ---------- */
.shell { display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; align-self: flex-start; display: flex; flex-direction: column; width: var(--side); flex: 0 0 var(--side); height: 100vh; padding: 20px 14px; border-right: 1px solid var(--border); background: var(--surface); }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; }
.logo .mark { width: 26px; height: 26px; border-radius: 8px; background: radial-gradient(circle at 35% 35%, #7cf0a4, var(--accent2) 65%); box-shadow: 0 0 0 4px var(--accent-soft); }
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.menu a:hover { background: var(--surface2); color: var(--text); }
.menu a.on { background: var(--accent-soft); color: var(--accent); }
.ico { width: 20px; height: 20px; flex: 0 0 20px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.side-foot .lang { align-self: flex-start; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 2px; min-width: 0; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); color: var(--accent); font-weight: 600; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.who b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot form { margin: 0; }
button.logout { display: flex; align-items: center; gap: 10px; width: 100%; margin: 0; padding: 9px 12px; font-size: 14px; }
.content { flex: 1; min-width: 0; max-width: 1120px; padding: 32px 36px 56px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Карточки, сетки, показатели ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; margin-bottom: 18px; }
.card h2, .card h3 { margin: 0 0 12px; }
.card h3 { font-size: 15px; }
.card > p:last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.two .card { margin-bottom: 0; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 18px 16px; }
.stat::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--border); }
.stat:first-child::after { background: var(--accent); }
.stat .n { font-size: 30px; font-weight: 600; line-height: 1.1; color: var(--text); }
.stat:first-child .n { color: var(--accent); }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Код провайдера: описание слева, сам заголовок справа. */
.code-card { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-color: #244532; background: linear-gradient(135deg, var(--surface) 55%, var(--accent-soft)); }
.code-card > div:first-child { flex: 1 1 320px; }
.code-card p { margin: 0 0 6px; }
.snippet { margin: 0; padding: 12px 16px; font-size: 14px; color: var(--accent); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; user-select: all; cursor: text; white-space: pre; }
.snippet:hover { border-color: var(--border-input); }
.step { display: flex; gap: 18px; align-items: flex-start; }
.step > div { flex: 1; min-width: 0; }
.step .snippet { margin-top: 10px; overflow: auto; }
.num { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }

/* ---------- Формы ---------- */
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password] { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 15px; outline: none; transition: border-color .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 222, 128, .18); }
button, .btn { display: inline-block; margin-top: 16px; padding: 11px 18px; border-radius: 10px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; transition: filter .15s; }
button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary, .btn.secondary { background: var(--surface2); color: var(--text); font-weight: 500; }
button.danger { background: var(--danger-soft); color: var(--danger); font-weight: 500; }
button.link { background: none; color: var(--muted); padding: 0; margin: 0; font-size: 14px; font-weight: 400; }
button.link:hover { color: var(--text); filter: none; }
form.wide button { width: 100%; }
td form { margin: 0; }
td form button { margin: 0; padding: 7px 12px; font-size: 13px; }

.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.msg.err { background: var(--danger-soft); color: #FFB3B3; }
.msg.ok { background: var(--accent-soft); color: var(--accent); }
code, pre { font-family: "JetBrains Mono", Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--surface2); padding: 1px 6px; border-radius: 6px; }
pre { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow: auto; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
table.compact th, table.compact td { padding: 7px 6px; }
.bar-cell { width: 45%; }
.bar-cell span { font-size: 13px; color: var(--muted); }
svg.bar { width: calc(100% - 44px); height: 6px; margin-right: 8px; vertical-align: middle; }
svg.bar .track { fill: var(--surface2); }
svg.bar .fill { fill: var(--accent); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.pager .btn { margin: 0; padding: 7px 12px; font-size: 13px; }
.empty { text-align: center; padding: 48px 22px; color: var(--muted); }
.empty p { margin: 0; max-width: 460px; margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- График ---------- */
svg.chart { width: 100%; height: 180px; display: block; }
svg.chart rect { fill: var(--accent); opacity: .85; }
svg.chart rect.zero { fill: var(--surface2); opacity: 1; }
svg.chart line { stroke: var(--border); }
svg.chart text { fill: var(--muted); font-size: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { position: static; align-self: stretch; width: auto; flex: none; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .logo { padding: 0 6px; margin-right: auto; }
  .logo .name { display: none; }
  .menu { flex-direction: row; order: 3; width: 100%; min-width: 0; overflow-x: auto; }
  .menu a { padding: 8px 10px; white-space: nowrap; }
  .menu a span { font-size: 13px; }
  .side-foot { margin: 0; padding: 0; border: 0; flex-direction: row; align-items: center; gap: 8px; }
  .me .who { display: none; }
  button.logout { width: auto; padding: 8px 10px; }
  button.logout span { display: none; }
  .content { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 22px; }
}
@media (max-width: 600px) {
  header { padding: 12px 16px; }
  body.hero .card { padding: 22px; }
}

/* ---------- Домены ---------- */
.logo img { width: 36px; height: 36px; border-radius: 9px; display: block; }
dl.rec { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; align-items: center; }
dl.rec dt { color: var(--muted); font-size: 13px; }
dl.rec dd { margin: 0; min-width: 0; }
dl.rec dd small { display: block; margin-top: 4px; }
dl.rec .snippet { padding: 10px 14px; }
.domain { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.domain .dom { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.domain .dom b { font-size: 15px; font-weight: 600; }
.domain .dom small { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.wait { background: var(--surface2); color: var(--muted); }
.acts { display: flex; gap: 8px; flex-shrink: 0; }
.acts form { margin: 0; }
.acts button { margin: 0; padding: 7px 12px; font-size: 13px; display: inline-flex; align-items: center; }
.acts button.danger .ico { width: 16px; height: 16px; flex-basis: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 50%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--bg); border: 1px solid #244532; color: var(--accent); font-size: 14px; font-weight: 500; }
.chip .ico { width: 16px; height: 16px; flex-basis: 16px; }
.code-card .btn { margin: 0; }
@media (max-width: 860px) {
  .logo img { width: 30px; height: 30px; }
  .chips { max-width: none; justify-content: flex-start; }
  .domain { flex-direction: column; align-items: stretch; }
}
