:root {
  --bg:
    var(--tg-theme-bg-color, #0f1720);

  --card:
    var(--tg-theme-secondary-bg-color, #172330);

  --text:
    var(--tg-theme-text-color, #f5f7fa);

  --hint:
    var(--tg-theme-hint-color, #8593a3);

  --link:
    var(--tg-theme-link-color, #5ca9ff);

  --button:
    var(--tg-theme-button-color, #2688eb);

  --button-text:
    var(--tg-theme-button-text-color, #ffffff);

  --border:
    rgba(255,255,255,.08);

  --green:
    #36d47b;

  --red:
    #ff5c66;

  --yellow:
    #ffc857;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
}

body {
  padding:
    calc(14px + env(safe-area-inset-top))
    14px
    calc(92px + env(safe-area-inset-bottom));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.splash {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  font-size: 54px;
  margin-bottom: 8px;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.5px;
}

.muted {
  color: var(--hint);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.identity {
  min-width: 0;
}

.title {
  font-size: 26px;
  line-height: 1.1;
  font-weight: 800;
}

.subtitle {
  margin-top: 4px;
  color: var(--hint);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 21px;
}

.section-title {
  margin:
    20px
    2px
    9px;

  font-size: 13px;
  font-weight: 700;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.grid {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow:
    0 8px 28px rgba(0,0,0,.12);
}

.metric {
  min-height: 108px;
}

.metric-number {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  margin-top: 8px;
  color: var(--hint);
  font-size: 13px;
}

.server,
.user-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.server + .server,
.user-row + .user-row {
  margin-top: 10px;
}

.status {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 11px;
  background: var(--hint);
}

.status.online {
  background: var(--green);
  box-shadow:
    0 0 0 5px rgba(54,212,123,.09);
}

.status.offline {
  background: var(--red);
}

.grow {
  min-width: 0;
  flex: 1;
}

.row-title {
  font-weight: 700;
  font-size: 15px;
}

.row-sub {
  margin-top: 3px;
  color: var(--hint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(92,169,255,.11);
  color: var(--link);
  font-size: 11px;
  font-weight: 700;
}

.primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 700;
}

.secondary {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  background: var(--card);
  font-weight: 700;
}

.actions {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.sub-url {
  margin: 12px 0 0;
  padding: 12px;
  background: rgba(0,0,0,.18);
  border-radius: 12px;
  color: var(--hint);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  word-break: break-all;
}

.empty {
  padding: 32px 18px;
  text-align: center;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom:
    calc(10px + env(safe-area-inset-bottom));

  display: grid;
  grid-template-columns:
    repeat(3, 1fr);

  gap: 6px;
  padding: 6px;

  border-radius: 20px;
  background:
    color-mix(
      in srgb,
      var(--card) 94%,
      transparent
    );

  border: 1px solid var(--border);

  backdrop-filter: blur(16px);
}

.nav-btn {
  border: 0;
  border-radius: 15px;
  min-height: 52px;
  color: var(--hint);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.nav-btn span {
  display: block;
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-btn.active {
  background:
    rgba(92,169,255,.12);
  color: var(--link);
}

.fab {
  position: fixed;
  right: 18px;
  bottom:
    calc(86px + env(safe-area-inset-bottom));

  width: 56px;
  height: 56px;

  border: 0;
  border-radius: 19px;

  background: var(--button);
  color: var(--button-text);

  font-size: 28px;
  line-height: 1;

  box-shadow:
    0 12px 30px rgba(0,0,0,.3);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;

  display: flex;
  align-items: flex-end;

  background: rgba(0,0,0,.48);
}

.sheet {
  width: 100%;
  max-height: 88vh;
  overflow: auto;

  padding:
    18px
    16px
    calc(24px + env(safe-area-inset-bottom));

  border-radius:
    24px
    24px
    0
    0;

  background: var(--bg);

  box-shadow:
    0 -12px 50px rgba(0,0,0,.32);
}

.sheet-title {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 18px;
}

.field {
  margin-bottom: 15px;
}

.field label {
  display: block;
  color: var(--hint);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
}

.input,
.select {
  width: 100%;
  min-height: 48px;

  border-radius: 13px;
  border: 1px solid var(--border);

  padding: 0 13px;

  color: var(--text);
  background: var(--card);

  outline: none;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;

  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;

  padding: 12px;
}

.check input {
  width: 19px;
  height: 19px;
}

.invite-result {
  margin-top: 15px;
}

.error {
  color: #ff8189;
  font-size: 13px;
  margin-top: 10px;
}

.success {
  color: var(--green);
}

.hidden {
  display: none !important;
}

@media (min-width: 700px) {

  body {
    max-width: 680px;
    margin: 0 auto;
  }

  .bottom-nav {
    max-width: 660px;
    margin: 0 auto;
  }

  .sheet {
    max-width: 620px;
    margin: 0 auto;
  }
}


.delete-user-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 80, 90, .25);
  border-radius: 12px;
  background: rgba(255, 80, 90, .08);
  font-size: 17px;
  cursor: pointer;
}

.delete-user-btn:disabled {
  opacity: .4;
}
