/* Резерв РК — общая дизайн-система «Спокойная панель» для страниц сайта.
   Темы: тёмная (по умолчанию) и «Графит» (html[data-theme="graphite"], ключ localStorage rk_theme).
   Подключение: шрифты Onest / IBM Plex Mono, затем /static/rk-tokens.css, затем /static/rk.css. */

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-hover); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: var(--r-sm); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; line-height: 1.2; }
h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.1; }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
code, kbd, .mono { font-family: var(--mono); }
img { max-width: 100%; }
::selection { background: var(--acc-soft); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.kicker { font: 600 12.5px/1.4 var(--font); letter-spacing: 0.02em; color: var(--acc); }
.lead { font-size: 17px; color: var(--muted); max-width: 60ch; }
.hidden { display: none !important; }

/* ---------- logo ---------- */
.rk-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--fg); white-space: nowrap; }
.rk-logo:hover { color: var(--fg); }
.rk-logo i { font: 800 11px var(--font); font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; background: var(--acc); color: var(--acc-ink); border-radius: 7px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 38px; border-radius: var(--r); border: 1px solid transparent; font: 500 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s; background: var(--panel-2); color: var(--fg); }
.btn:hover { background: var(--panel-3); color: var(--fg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--acc); color: var(--acc-ink); font-weight: 600; }
.btn-primary:hover { background: var(--acc-hover); color: var(--acc-ink); }
.btn-ghost { background: var(--panel-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--panel-3); }
.btn-danger { background: transparent; border-color: rgba(var(--bad-rgb), .4); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); color: var(--bad); }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: 36px; min-height: 36px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; color: var(--muted); }
.input, .select, .textarea { width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 9px 12px; font: 14.5px/1.4 var(--font); min-height: 40px; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.input::placeholder { color: var(--dim); }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.hint { font-size: 12.5px; color: var(--dim); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--acc); width: 16px; height: 16px; margin-top: 2px; flex: none; }

/* ---------- surfaces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 15px; margin-right: auto; }
.card-body { padding: 16px; }
.ruled { border-top: 1px solid var(--line); }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--panel-2); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.run, .pill.info { background: var(--acc-soft); color: var(--acc); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.plain::before { display: none; }

/* ---------- alerts ---------- */
.note { border: 1px solid var(--line); border-left: 3px solid var(--acc); background: var(--panel); border-radius: var(--r-lg); padding: 12px 14px; font-size: 14px; color: var(--muted); }
.note.warn { border-left-color: var(--warn); }
.note.bad { border-left-color: var(--bad); }
.note.ok { border-left-color: var(--ok); }
.note b, .note strong { color: var(--fg); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font: 500 12px/1.3 var(--font); color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 11px 12px; font: 500 14px var(--font); cursor: pointer; white-space: nowrap; margin-bottom: -1px; text-decoration: none; }
.tab:hover { color: var(--fg); }
.tab.active, .tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--acc); }
.seg { display: inline-flex; background: var(--panel-2); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 5px 10px; border-radius: var(--r-sm); font: 500 13px var(--font); cursor: pointer; }
.seg button.active { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.35); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin-right: auto; font-size: 16px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

/* ---------- site header / footer (public pages) ---------- */
.site-top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.site-top .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.site-nav { display: flex; gap: 2px; margin-left: 20px; }
.site-nav a { color: var(--muted); font-size: 14px; padding: 6px 10px; border-radius: var(--r-sm); }
.site-nav a:hover { color: var(--fg); background: var(--panel-2); }
.site-top .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.theme-btn { background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--fg); border-radius: var(--r); height: 34px; padding: 0 10px; font: 500 12.5px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.theme-btn:hover { color: var(--fg); }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-block: 26px calc(26px + env(safe-area-inset-bottom, 0px)); }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--fg); }

/* ---------- document pages (оферта, политика, инструкции) ---------- */
.doc { max-width: 780px; padding-block: 40px 64px; }
.doc h1 { font-size: clamp(26px, 3.6vw, 34px); margin-bottom: 8px; }
.doc h2 { font-size: 19px; margin: 34px 0 10px; }
.doc h3 { margin: 22px 0 8px; }
.doc p, .doc li { color: color-mix(in srgb, var(--fg) 82%, var(--muted)); }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 12px; }
.doc li { margin-bottom: 5px; }
.doc code { background: var(--panel-2); padding: 1px 6px; border-radius: var(--r-sm); font-size: 13px; }
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--panel); font-weight: 500; }

@media (max-width: 860px) {
  .site-nav { display: none; }
  .site-top .btn { padding: 6px 11px; min-height: 34px; font-size: 13px; }
}
@media (max-width: 420px) {
  .rk-logo span.full { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
