:root {
  --bg: #0e0e10;
  --card: #17171a;
  --card-2: #1e1e22;
  --line: #2a2a30;
  --text: #ececf0;
  --muted: #9a9aa6;
  --accent: #12a9e0;
  --accent-ink: #04212e;
  --ok: #3ccf8e;
  --bad: #ff5d5d;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; margin-top: 1.6em; }
h3 { font-size: 1.05rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1280px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 40px; }

.topbar { border-bottom: 1px solid var(--line); background: rgba(14, 14, 16, .9); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .2px; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.logo {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .18);
}
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a { color: var(--text); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; padding-top: 20px; padding-bottom: 28px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 24px auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h1, .card-head h3 { margin: 0; }
.card > .card-head { margin-bottom: 12px; }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 14px; }

.hero { text-align: center; padding: 56px 0 24px; }
.hero h1 { font-size: 2.4rem; }
.hero .row { justify-content: center; margin: 24px 0; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.form-grid { grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.span2 { grid-column: span 2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.prewrap { white-space: pre-wrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.inline { display: inline; margin: 0; }

label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
  width: 100%;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search { margin-bottom: 16px; }
.search input { flex: 1; min-width: 200px; width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(255, 93, 93, .45); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; justify-content: space-between; }
.btn-block .muted { color: rgba(20, 20, 20, .7); }
button.link { background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 0; }
button.link:hover { color: var(--accent); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); text-transform: capitalize; }
.badge.ok { color: var(--ok); border-color: rgba(60, 207, 142, .4); }
.badge.bad { color: var(--bad); border-color: rgba(255, 93, 93, .4); }

.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { border-color: rgba(60, 207, 142, .45); background: rgba(60, 207, 142, .08); }
.flash.err { border-color: rgba(255, 93, 93, .45); background: rgba(255, 93, 93, .08); }

.keybox { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0 10px; flex-wrap: wrap; }
.keybox code { font-size: 1.05rem; letter-spacing: 1px; color: var(--accent); flex: 1; word-break: break-all; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.card .table { margin-top: 8px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: 0; }
.table td.right { white-space: nowrap; }

.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.subnav a { color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

.inline-details { display: inline-block; text-align: left; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; margin-bottom: 8px; }
.inline-details form { margin-top: 8px; min-width: 260px; }

.news h3 { margin-bottom: .2em; }
progress { width: 200px; vertical-align: middle; accent-color: var(--accent); }

@media (max-width: 760px) {
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.9rem; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 6px; }
}
