:root {
  --abyss: #060a18;
  --deck: #0b1230;
  --deck-2: #111b42;
  --rail: #1b2750;
  --rail-2: #26356a;
  --ink: #e9eefc;
  --haze: #8d99bd;
  --signal: #4c8dff;
  --signal-ink: #04122e;
  --amber: #ffb03a;
  --amber-deep: #e08a14;
  --mint: #3ddc97;
  --coral: #ff6b7d;

  --display: 'Unbounded', 'Segoe UI Variable Display', 'Segoe UI', system-ui, sans-serif;
  --ui: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 700px at 85% -10%, #0f1c4d 0%, transparent 60%), var(--abyss);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ------------------------------- каркас ------------------------------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 36px;
  padding: 30px 18px 24px;
  border-right: 1px solid var(--rail);
}
.mark { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.15; letter-spacing: -0.01em; }
.mark small { display: block; margin-top: 6px; font: 400 12px/1.3 var(--ui); letter-spacing: 0; color: var(--haze); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px;
  color: var(--haze); text-decoration: none; font-weight: 500;
  transition: background-color .12s, color .12s;
}
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.nav a[aria-current='page'] { color: var(--ink); background: var(--deck-2); box-shadow: inset 2px 0 0 var(--signal); }
.rail-foot { margin-top: auto; }

.link { background: none; border: 0; padding: 4px 0; color: var(--haze); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

main { padding: 40px clamp(20px, 4vw, 56px) 96px; max-width: 1180px; width: 100%; }
main:focus { outline: none; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
h1 { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.sub { color: var(--haze); }
.muted { color: var(--haze); }
.mono { font-family: var(--mono); font-size: 13px; }
.err { color: var(--coral); min-height: 1.4em; }

/* -------------------------------- обзор ------------------------------- */
.hero {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(26px, 4.2vw, 50px); line-height: 1.15; letter-spacing: -0.03em;
  max-width: 24ch; margin-bottom: 14px; text-wrap: balance;
}
.hero .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-sub { color: var(--haze); max-width: 62ch; margin-bottom: 44px; }
.hero-sub b { color: var(--ink); font-weight: 600; }

.two { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); margin-bottom: 52px; }

.legend { display: flex; gap: 18px; color: var(--haze); font-size: 12px; margin-bottom: 12px; }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; background: var(--signal); }
.legend .fresh::before { background: var(--amber); }

.pulse { display: flex; align-items: flex-end; gap: 4px; height: 168px; border-bottom: 1px solid var(--rail-2); }
.bar {
  position: relative; flex: 1; min-width: 3px; height: calc(var(--h, 0) * 1%);
  min-height: 2px; background: var(--signal); border-radius: 3px 3px 0 0;
  transform-origin: bottom; animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 14ms);
}
.bar i { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--f, 0) * 1%); background: var(--amber); }
.bar:hover { filter: brightness(1.25); }
@keyframes rise { from { transform: scaleY(0); } }
.axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--haze); font-size: 12px; }

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; }
.ledger .lead { flex: 1; border-bottom: 1px dotted var(--rail-2); transform: translateY(-3px); min-width: 14px; }
.ledger b { font-family: var(--mono); font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }
.ledger .pro b { color: var(--amber); }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.rows li { display: grid; grid-template-columns: 96px minmax(0, 1fr) 56px; align-items: center; gap: 12px; }
.rows .track { height: 6px; border-radius: 3px; background: var(--deck-2); overflow: hidden; }
.rows .fill { display: block; height: 100%; width: calc(var(--w, 0) * 1%); background: var(--signal); border-radius: 3px; }
.rows .cnt { text-align: right; font-family: var(--mono); font-size: 13px; }

/* ------------------------------ формы, кнопки ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--rail-2); background: transparent; color: var(--ink);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, filter .12s;
}
.btn:hover { background: rgba(255, 255, 255, .05); border-color: var(--haze); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.primary:hover { filter: brightness(1.1); background: var(--signal); }
.btn.danger { color: var(--coral); border-color: rgba(255, 107, 125, .4); }
.btn.danger:hover { background: rgba(255, 107, 125, .1); border-color: var(--coral); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; font-weight: 500; }

.f { display: grid; gap: 6px; font-size: 12px; color: var(--haze); }
input[type='text'], input[type='password'], input[type='number'], input[type='search'], textarea, select {
  width: 100%; min-height: 36px; padding: 7px 11px;
  background: var(--deck); border: 1px solid var(--rail); border-radius: 8px; color: var(--ink);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:hover, textarea:hover, select:hover { border-color: var(--rail-2); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--signal); outline-offset: 0; border-color: var(--signal); }
input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--signal); }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }

.seg { display: inline-flex; border: 1px solid var(--rail); border-radius: 8px; padding: 2px; background: var(--deck); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--haze); cursor: pointer; font-weight: 500; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--deck-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rail-2); }

/* ------------------------------ генератор ключей ------------------------------ */
.maker { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding-bottom: 28px; border-bottom: 1px solid var(--rail); }
.maker .grow { flex: 1 1 200px; }
.maker .num { width: 88px; }
.made { margin: 22px 0 6px; padding: 16px 18px; border: 1px solid rgba(61, 220, 151, .35); border-radius: 10px; background: rgba(61, 220, 151, .06); }
.made-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 600; }
.made pre { margin: 0; font: 500 14px/1.9 var(--mono); user-select: all; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 26px 0 14px; align-items: center; }
.tabs .search { margin-left: auto; width: min(100%, 260px); }

/* -------------------------------- таблицы --------------------------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--haze); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rail-2); }
.tbl td { padding: 13px 12px 13px 0; border-bottom: 1px solid var(--rail); vertical-align: top; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.tbl .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tbl .sub-row td { background: var(--deck); padding: 12px 16px; }
.keycell { white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; font: 500 13px var(--mono); letter-spacing: .02em; color: var(--ink); }
.keycell:hover { color: var(--signal); }
.note { color: var(--haze); max-width: 24ch; overflow-wrap: anywhere; }
.empty { padding: 44px 0; color: var(--haze); max-width: 52ch; }
.empty b { color: var(--ink); }

.st { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.st::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st.ok { color: var(--mint); }
.st.free { color: var(--signal); }
.st.warn { color: var(--amber); }
.st.bad { color: var(--coral); }
.st.off { color: var(--haze); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: rgba(255, 176, 58, .14); color: var(--amber); border: 1px solid rgba(255, 176, 58, .4); }

/* -------------------------------- релизы -------------------------------- */
.composer { display: grid; gap: 16px; padding-bottom: 32px; margin-bottom: 8px; border-bottom: 1px solid var(--rail); }
.composer .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.composer .wide { grid-column: 1 / -1; }
.composer details { color: var(--haze); }
.composer summary { cursor: pointer; width: fit-content; }
.composer details[open] summary { margin-bottom: 12px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 1px; background: var(--rail-2); }
.rel { position: relative; padding: 26px 0; border-bottom: 1px solid var(--rail); }
.rel::before { content: ''; position: absolute; left: -26px; top: 33px; width: 11px; height: 11px; border-radius: 50%; background: var(--abyss); border: 2px solid var(--haze); }
.rel.published::before { border-color: var(--mint); background: var(--mint); }
.rel.draft::before { border-color: var(--amber); }
.rel-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.rel-ver { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.rel-text { display: grid; gap: 8px; justify-items: start; max-width: 72ch; margin: 12px 0 18px; }
.rel-text .f { width: 100%; }
.adopt { display: grid; grid-template-columns: minmax(0, 340px) auto; gap: 14px; align-items: center; margin-bottom: 18px; }
.adopt .track { height: 8px; border-radius: 4px; background: var(--deck-2); overflow: hidden; }
.adopt .fill { display: block; height: 100%; width: calc(var(--w, 0) * 1%); background: var(--mint); }
.rel-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }

.hold {
  position: relative; overflow: hidden; isolation: isolate;
  height: 44px; padding: 0 22px; border: 0; border-radius: 10px;
  background: var(--amber); color: #2a1900; font-weight: 700; cursor: pointer; user-select: none; touch-action: none;
}
.hold::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--amber-deep); transform-origin: left; transform: scaleX(var(--p, 0)); }
.hold small { display: block; font-weight: 500; font-size: 11px; opacity: .8; }
.hold:disabled { opacity: .5; cursor: default; }
.hold-hint { color: var(--haze); font-size: 12px; }

/* ------------------------------ вход, окна, тосты ------------------------------ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(100%, 340px); display: grid; gap: 18px; }
.login .mark { font-size: 26px; }

dialog { width: min(calc(100% - 32px), 460px); padding: 24px; background: var(--deck); color: var(--ink); border: 1px solid var(--rail-2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog::backdrop { background: rgba(3, 6, 16, .74); backdrop-filter: blur(4px); }
dialog h2 { font-family: var(--display); font-size: 17px; letter-spacing: -0.01em; margin-bottom: 14px; }
.dlg-body { display: grid; gap: 14px; color: var(--haze); }
.dlg-body b { color: var(--ink); }
/* Кнопка подтверждения идёт первой в DOM, чтобы Enter в поле её и нажимал; визуально она справа. */
.dlg-actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 10px; margin-top: 22px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 24px);
  padding: 10px 16px; border-radius: 10px; background: var(--deck-2); border: 1px solid var(--rail-2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { border-color: rgba(255, 107, 125, .6); color: var(--coral); }

.more { display: flex; justify-content: center; padding: 22px 0 0; }
.skeleton { color: var(--haze); padding: 32px 0; }

/* ------------------------------- адаптив ------------------------------- */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--rail); }
  .rail .mark small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .nav a { white-space: nowrap; }
  .rail-foot { margin: 0 0 0 auto; }
  .two { grid-template-columns: 1fr; }
  .composer .grid { grid-template-columns: 1fr; }
  .adopt { grid-template-columns: 1fr; }
  .tbl { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .bar { animation: none; }
  #toast { transition: none; }
}
