:root {
  color-scheme: dark;
  --background: #080808;
  --surface: #121212;
  --surface-strong: #202020;
  --line: #2b2b2b;
  --line-strong: #656565;
  --text: #e7e7e7;
  --muted: #777777;
  --accent: #57d38c;
  --danger: #ed6a6a;
  --font: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}

button {
  font: inherit;
}

.shell {
  width: min(100% - 32px, 1000px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
}

.site-footer {
  min-height: 66px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  text-decoration: none;
}

.brand-signal {
  width: 22px;
  height: 22px;
  border: 2px solid var(--text);
  border-radius: 50%;
  position: relative;
}

.brand-signal::before,
.brand-signal::after {
  content: "";
  position: absolute;
  background: var(--background);
}

.brand-signal::before {
  width: 10px;
  height: 8px;
  right: -4px;
  bottom: -3px;
  border-left: 2px solid var(--text);
}

.brand-signal::after {
  width: 4px;
  height: 10px;
  left: 7px;
  bottom: -7px;
  border: 2px solid var(--text);
  border-top: 0;
}

.header-meta {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: flex;
  align-items: center;
  padding: 72px 0;
}

.auth-pane,
.dashboard {
  width: 100%;
}

.kicker,
.stat-label {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  color: var(--text);
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.08;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  text-transform: uppercase;
}

.lead {
  max-width: 720px;
  margin-bottom: 32px;
  color: var(--muted);
  line-height: 1.65;
}

.login-line {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, auto);
  align-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
}

.telegram-widget-slot {
  min-height: 64px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
}

.login-state {
  min-height: 64px;
  padding: 0 22px;
  border-left: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.login-state.is-error {
  color: var(--danger);
}

.login-state.is-ok {
  color: var(--accent);
}

.auth-stats,
.profile-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 30px;
}

.auth-stats > div,
.profile-strip > div {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 16px;
}

.auth-stats strong,
.profile-strip strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.dashboard-heading,
.panel-heading,
.subscription-row,
.server,
.identity,
.header-actions {
  display: flex;
  align-items: center;
}

.dashboard-heading,
.panel-heading,
.subscription-row,
.server {
  justify-content: space-between;
}

.dashboard-heading {
  gap: 24px;
  margin-bottom: 30px;
}

.dashboard-heading h1 {
  margin: 0;
}

.header-actions {
  gap: 10px;
}

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.button:hover,
.button:focus-visible {
  border-color: var(--text);
  outline: 0;
}

.button-muted {
  background: transparent;
  color: var(--muted);
}

.button-primary {
  min-width: 180px;
  background: var(--text);
  color: var(--background);
}

.profile-strip {
  grid-template-columns: 1.5fr repeat(3, 1fr);
  margin-bottom: 14px;
}

.identity {
  gap: 12px;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 800;
}

.profile-name {
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
}

.status-active {
  color: var(--accent);
}

.panel {
  margin-top: 14px;
  border: 1px solid var(--line);
}

.panel-heading {
  min-height: 78px;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading .stat-label {
  margin-bottom: 6px;
}

.expiry {
  color: var(--muted);
  font-size: 12px;
}

.subscription-row {
  gap: 20px;
  padding: 18px;
}

.subscription-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.subscription-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.subscription-copy span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.server-list {
  display: grid;
}

.server {
  min-height: 58px;
  gap: 16px;
  padding: 0 18px;
}

.server + .server {
  border-top: 1px solid var(--line);
}

.server strong {
  flex: 1;
}

.server > span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
}

.status-pill.is-muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1000px);
  }

  .site-header {
    min-height: 68px;
  }

  .header-meta,
  .site-footer span:last-child {
    display: none;
  }

  .workspace {
    padding: 48px 0;
    align-items: flex-start;
  }

  .login-line,
  .auth-stats,
  .profile-strip {
    grid-template-columns: 1fr;
  }

  .login-state {
    min-height: 48px;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .auth-stats,
  .profile-strip {
    gap: 8px;
  }

  .dashboard-heading,
  .subscription-row {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button-primary {
    width: 100%;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
  }
}
