:root {
  --bg: #0f1419;
  --bg2: #1a222c;
  --line: #2a3542;
  --text: #e8eef4;
  --muted: #9aa8b6;
  --accent: #3d9cf0;
  --ok: #3cba7a;
  --warn: #d4a017;
  --err: #e05858;
  --radius: 10px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1c3348 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243028 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(960px, calc(100% - 2rem)); margin: 0 auto; }
.top {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
}
.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
}
.nav { display: flex; gap: 1rem; align-items: center; }
.nav a { color: var(--muted); }
.inline { display: inline; margin: 0; }
.linkish {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
main.wrap { padding: 1.5rem 0 3rem; }
h1 { margin: 0 0 1rem; font-size: 1.6rem; }
h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
h3 { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
.muted { color: var(--muted); }
.auth { max-width: 400px; margin: 2rem auto; }
.form { display: grid; gap: 0.85rem; }
.form label { display: grid; gap: 0.35rem; font-size: 0.92rem; color: var(--muted); }
.form--row {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: end;
}
.form--inline { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
input, textarea, select, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.sub-link-label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--muted);
  width: 100%;
}
.sub-link {
  width: 100%;
  min-height: 0;
  height: auto;
  resize: none;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  field-sizing: content;
}
.rotate-form { margin: 0.75rem 0 0; }
.block--connect h3 { margin-top: 1.1rem; }
.apps-lead { margin: 0.25rem 0 0.75rem; text-align: center; }
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  gap: 0.65rem;
  margin: 0 auto 1rem;
  justify-content: center;
  justify-items: stretch;
  max-width: 900px;
}
.app-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 20, 25, 0.55);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: left;
}
.app-card:hover {
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.08);
  text-decoration: none;
}
.app-card__logo {
  flex: 0 0 auto;
  border-radius: 11px;
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
}
.app-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.app-card__body strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.app-card__body span {
  color: var(--muted);
  font-size: 0.82rem;
}
.block--connect h3 { margin-top: 1.1rem; text-align: center; }
.block--clients h2 { text-align: center; }
.block--clients .steps {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.block--connect .steps {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.rotate-form {
  margin: 0.75rem 0 0;
  display: flex;
  justify-content: center;
}
.qr-wrap { display: none; }
select, button { width: auto; }
button {
  background: var(--accent);
  border-color: transparent;
  color: #041018;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
.btn-secondary { background: #334155; color: var(--text); }
.btn-danger { background: var(--err); color: #fff; }
.block {
  background: rgba(26, 34, 44, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 1rem 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.35rem;
  text-align: left;
  vertical-align: top;
}
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  background: #334155;
}
.badge--active { background: rgba(60, 186, 122, 0.2); color: var(--ok); }
.badge--expired, .badge--disabled { background: rgba(224, 88, 88, 0.15); color: var(--err); }
.badge--none { background: rgba(154, 168, 182, 0.15); color: var(--muted); }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.flash--success { background: rgba(60, 186, 122, 0.15); border: 1px solid var(--ok); }
.flash--error { background: rgba(224, 88, 88, 0.15); border: 1px solid var(--err); }
.qr-wrap { margin: 0.75rem 0; }
.steps { color: var(--muted); padding-left: 1.2rem; }
.steps li { margin: 0.35rem 0; }
.stat { font-size: 1.8rem; font-weight: 700; margin: 0; }
.admin-nav { display: flex; gap: 1rem; list-style: none; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.check { display: flex !important; align-items: center; gap: 0.4rem; }
@media (max-width: 640px) {
  .actions { flex-direction: column; }
  .table { display: block; overflow-x: auto; }
}
