:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --accent: #6ae4ff;
  --accent2: #8b5cf6;
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #fbbf24;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius2: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(1200px 680px at 15% -10%, rgba(139, 92, 246, 0.35), transparent 55%),
    radial-gradient(900px 600px at 85% 0%, rgba(106, 228, 255, 0.25), transparent 50%),
    radial-gradient(1000px 700px at 50% 110%, rgba(52, 211, 153, 0.14), transparent 55%),
    var(--bg);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  padding: 18px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 12px 6px;
}

.login-form {
  padding: 6px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
}

.topbar-notice {
  flex: 1 1 220px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(251, 113, 133, 0.52);
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.22), rgba(190, 24, 93, 0.12));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
}

.topbar-notice__marker {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--danger);
  animation: topbar-notice-pulse 1.25s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.55);
}

.topbar-notice__text {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
  min-width: 0;
}

.topbar-notice__text strong {
  font-weight: 750;
  color: rgba(255, 255, 255, 0.98);
}

.topbar-notice__text--blink {
  animation: topbar-notice-blink 1.6s ease-in-out infinite;
}

@keyframes topbar-notice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.45);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(251, 113, 133, 0);
    opacity: 0.75;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(251, 113, 133, 0);
    opacity: 1;
  }
}

@keyframes topbar-notice-blink {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  45% {
    opacity: 0.72;
    filter: brightness(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-notice__marker {
    animation: none;
    box-shadow: none;
    opacity: 1;
  }

  .topbar-notice__text--blink {
    animation: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 48px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 4px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  color: rgba(0, 0, 0, 0.88);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 25px rgba(106, 228, 255, 0.18);
}

.logo__mark {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.logo__divider {
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.logo__gate {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  opacity: 0.94;
}

.title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 920px) {
  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar-notice .btn {
    white-space: nowrap;
  }
}

.badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
}

.badge--muted {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
}

.content {
  flex: 1;
  padding: 22px;
  padding-top: 104px;
}

.panel {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.035));
  box-shadow: var(--shadow);
  overflow-x: hidden;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 6px 14px 6px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-sep {
  height: 1px;
  margin: 8px 6px 14px 6px;
  background: rgba(255, 255, 255, 0.1);
}

.hint {
  max-width: 520px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.iface-config-gate {
  position: relative;
  /* Same vertical rhythm as .grid gap between «Сохранить» and the tunnel card when it lived inside interface-grid. */
  margin-top: 14px;
}

.iface-config-gate > .interface-tunnel-card {
  width: 100%;
}

.iface-config-gate.is-locked {
  opacity: 0.55;
}

.iface-config-gate.is-locked > :not(.iface-config-gate__overlay) {
  pointer-events: none;
  user-select: none;
}

.iface-config-gate__overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: start center;
  padding-top: 12px;
}

.iface-config-gate__overlay-text {
  max-width: min(92%, 760px);
  border: 1px solid rgba(251, 113, 133, 0.42);
  border-radius: 12px;
  background: rgba(46, 16, 24, 0.94);
  color: #fecdd3;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--shadow);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 0 6px 10px 6px;
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  padding: 10px;
  min-width: 0;
  position: relative;
}

.metric-title {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.metric-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-value--sm {
  font-size: 16px;
  font-weight: 700;
}

.metric-sub {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.66);
}

.metric-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
  max-width: 75%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 220ms ease;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 6px;
}

.mtproto-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mtproto-grid > .card {
  width: 100%;
}

.interface-grid .card {
  width: 100%;
}

@media (min-width: 980px) {
  .metrics-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .grid .card:first-child {
    grid-column: 1 / -1;
  }

  .mtproto-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .mtproto-grid > .card {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .interface-grid {
    grid-template-columns: 1fr 1fr;
  }

  .interface-grid .card:first-child {
    grid-column: auto;
  }

  .interface-grid .interface-tunnel-card {
    grid-column: 1 / -1;
  }

  .interface-grid .interface-actions-inline {
    grid-column: 1 / -1;
    margin-top: 0;
    padding-top: 0;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
  min-width: 0;
}

.mtproto-config-card {
  margin-top: 14px;
}

#mtprotoPanelRoot.mtproto-panel--locked {
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

.mtproto-config-card .mtp-config-extras {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.geo-routing-settings-card {
  margin-top: 18px;
}

.dns-settings-card {
  margin-top: 12px;
}

.dns-health-card {
  margin-top: 12px;
}

.dns-settings-row {
  margin-top: 8px;
}

.dns-textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.dns-amnezia-watch-field {
  margin-top: 14px;
}

.dns-amnezia-watch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dns-amnezia-watch-text {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.35;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  transition: background 0.2s ease, border-color 0.2s ease;
  border: 1px solid var(--border);
}

.toggle-switch-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-switch input:checked + .toggle-switch-slider {
  background: rgba(52, 211, 153, 0.28);
  border-color: rgba(52, 211, 153, 0.45);
}

.toggle-switch input:checked + .toggle-switch-slider::before {
  transform: translateX(22px);
  background: var(--ok);
}

.toggle-switch input:focus-visible + .toggle-switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.toggle-switch input:disabled + .toggle-switch-slider {
  opacity: 0.55;
  cursor: not-allowed;
}

.dns-amnezia-watch-desc,
.dns-amnezia-watch-apphint {
  margin-top: 8px;
}

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

.card-title {
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.dot--unknown {
  background: rgba(255, 255, 255, 0.35);
}

.dot--muted {
  background: rgba(160, 170, 190, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.dot--ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.dot--warn {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.14);
}

.dot--bad {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.14);
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 10px;
}

@media (min-width: 720px) {
  .row {
    grid-template-columns: 1fr 1fr;
  }
}

.field label {
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.78);
}

.field--spaced {
  margin-top: 12px;
}

input[type="text"],
input[type="password"],
select,
input[type="file"] {
  width: 100%;
}

input[type="text"],
input[type="password"],
select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  outline: none;
}

input[disabled] {
  opacity: 0.85;
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.55) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

select option {
  background: #101622;
  color: #eef3ff;
}

select:disabled,
select:disabled option {
  background: #232938;
  color: rgba(255, 255, 255, 0.55);
}

.help {
  font-size: 12px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.file {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.file-left {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.file-right {
  display: flex;
  margin-left: auto;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  user-select: none;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .content {
    padding: 12px;
    padding-top: 120px;
  }

  .panel {
    padding: 12px;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metrics-grid .metric-card:last-child {
    grid-column: 1 / -1;
  }

  .card-head {
    flex-wrap: wrap;
  }

  .mtp-user-item {
    grid-template-columns: 1fr;
    min-width: 0;
    gap: 6px;
  }

  .mtp-user-main {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .mtp-user-link {
    grid-column: 1 / -1;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .mtp-user-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .users-head-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
  }

  .users-meta {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .routing-modes {
    flex-direction: column;
  }

  .routing-mode-btn {
    width: 100%;
    min-width: 0;
    text-align: left;
    white-space: normal;
  }

  .geo-columns {
    grid-template-columns: 1fr;
  }

  .geo-toggle-row {
    margin-bottom: 8px;
  }

  .mini-btn,
  .user-action {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn:active {
  transform: translateY(0px);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  border-color: rgba(106, 228, 255, 0.35);
  background: linear-gradient(135deg, rgba(106, 228, 255, 0.22), rgba(139, 92, 246, 0.18));
}

.btn--sm {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.btn--ghost {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.topbar-notice .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.actions {
  margin-top: 16px;
  padding: 12px 6px 2px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.interface-grid .interface-actions-inline {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.actions-left {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

#netplanOpenBtn {
  margin-left: auto;
}

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

#netplanErrorHint {
  margin-top: 8px;
  color: #ff6b6b;
  white-space: pre-wrap;
}

.mt-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}

.mt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mt-table th,
.mt-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.mt-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 11px;
}

.mtp-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.mtp-user-item {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1fr) 56px minmax(220px, 1fr) minmax(300px, 340px);
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
}

.mtp-user-main {
  min-width: 0;
}

.mtp-user-name {
  font-weight: 700;
  font-size: 13px;
}

.mtp-user-meta {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn {
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.mini-btn:hover:not([disabled]) {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.mini-btn:active:not([disabled]) {
  transform: translateY(0);
}

.mini-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.mini-btn--danger {
  border-color: rgba(251, 113, 133, 0.4);
  color: #ffd9e0;
}

.switch {
  position: relative;
  width: 44px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 120ms ease;
}

.switch.is-on {
  background: rgba(52, 211, 153, 0.28);
  border-color: rgba(52, 211, 153, 0.5);
}

.switch.is-on::after {
  transform: translateX(16px);
}

.switch:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mt-health-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.mt-health-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  padding: 10px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.mt-health-row:last-child {
  border-right: 0;
}

.mt-health-key {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}

.mt-health-val {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  white-space: normal;
  word-break: break-word;
}

.status--health-cell {
  align-items: flex-start;
  max-width: 100%;
  font-size: 13px;
  line-height: 1.4;
}

.status--health-cell .dot {
  flex-shrink: 0;
  /* совмещаем центр точки с центром первой строки текста */
  margin-top: calc(0.5lh - 4.5px);
}

.status--health-cell .status-text {
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.mt-health-row--ok {
  background: rgba(52, 211, 153, 0.07);
}

.mt-health-row--warn {
  background: rgba(251, 191, 36, 0.1);
}

.mt-health-row--bad {
  background: rgba(251, 113, 133, 0.09);
}

.mt-health-row--unknown {
  background: transparent;
}

.mt-health-row--muted {
  background: rgba(255, 255, 255, 0.035);
}

@media (max-width: 720px) {
  .mt-health-list {
    grid-template-columns: 1fr;
  }

  .mt-health-row {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .mt-health-row:last-child {
    border-bottom: 0;
  }

}

.mtp-user-sessions {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.mtp-user-link {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtp-user-actions {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 6px;
  width: max-content;
  max-width: 100%;
  justify-content: end;
}

.user-action {
  min-width: 78px;
  width: auto;
}

@media (max-width: 720px) {
  .mtp-user-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    justify-content: stretch;
  }

  .mtp-user-actions .mini-btn,
  .mtp-user-actions .user-action {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    font-size: 12px;
    padding: 0 8px;
    box-sizing: border-box;
  }
}

.users-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.users-head-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.users-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.68);
}

#mtpOutboundMeta {
  margin-top: 10px;
}

.routing-modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.routing-mode-btn {
  min-width: 170px;
}

.routing-mode-btn.is-active {
  border-color: rgba(106, 228, 255, 0.35);
  background: linear-gradient(135deg, rgba(106, 228, 255, 0.22), rgba(139, 92, 246, 0.18));
}

.geo-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.geo-fieldset[disabled] {
  opacity: 0.6;
}

.geo-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.geo-modes-field {
  margin-top: 14px;
}

.geo-col {
  min-width: 0;
}

.geo-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.geo-toggle-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
}

.geo-switch.is-on {
  background: rgba(52, 211, 153, 0.28);
  border-color: rgba(52, 211, 153, 0.5);
}

.geo-ready-row {
  margin-bottom: 10px;
}

.geo-ready-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.geo-link-btn {
  width: 100%;
  min-width: 0;
}

.geo-ready-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.geo-ready-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
}

.geo-ready-url {
  min-width: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  overflow-wrap: anywhere;
}

.geo-ready-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

.geo-ready-item .mini-btn {
  min-width: 72px;
}

.geo-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#mtpUserFormStatus {
  min-height: 18px;
}

#mtpUserFormStatus.error {
  color: var(--danger);
}

#mtpUserFormStatus.ok {
  color: var(--ok);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 22, 0.6);
  backdrop-filter: blur(3px);
}

.busy-overlay-card {
  min-width: 210px;
  max-width: min(92vw, 420px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 14, 30, 0.94);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.busy-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: busy-spin 0.9s linear infinite;
  flex-shrink: 0;
}

.busy-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  width: min(820px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius2);
  background: rgba(10, 14, 30, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal--narrow {
  width: min(520px, 100%);
}

.modal-body--prose p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.48;
}

.modal-body--prose p:last-child {
  margin-bottom: 0;
}

.modal-body__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 18px 0 8px !important;
}

.modal-body .muted {
  color: var(--muted);
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.store-link:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.24);
}

.store-link--play {
  border-color: rgba(52, 211, 153, 0.35);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.06));
}

.store-link--apple {
  border-color: rgba(106, 228, 255, 0.35);
  background: linear-gradient(135deg, rgba(106, 228, 255, 0.15), rgba(139, 92, 246, 0.1));
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-weight: 800;
}

.modal-body {
  padding: 14px 16px;
}

.modal-hint {
  font-size: 12px;
  line-height: 1.35;
  margin: 0 0 10px;
}

.modal-hint code {
  font-size: 11px;
}

.modal-actions {
  padding: 12px 16px 16px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
}

textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.toast-wrap {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.reconnect-notice {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1101;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  max-width: min(92vw, 480px);
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(39, 28, 6, 0.96);
  color: #fde68a;
  box-shadow: var(--shadow);
}

.reconnect-notice__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(253, 230, 138, 0.4);
  border-top-color: #f59e0b;
  animation: busy-spin 0.9s linear infinite;
  flex-shrink: 0;
}

.reconnect-notice__text {
  font-size: 12px;
  line-height: 1.25;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(16, 20, 28, 0.92);
  color: var(--text);
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.ok {
  border-color: rgba(52, 211, 153, 0.35);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.4);
}

.toast.warn {
  border-color: rgba(251, 191, 36, 0.45);
}

/* Final authoritative layout for MTProto user action buttons */
.mtp-user-actions {
  display: grid !important;
  grid-template-columns: repeat(4, max-content) !important;
  gap: 6px !important;
  width: max-content !important;
  max-width: 100% !important;
  justify-content: end !important;
}

.mtp-user-actions .mini-btn,
.mtp-user-actions .user-action {
  min-width: 78px !important;
  width: auto !important;
  height: 30px !important;
  padding: 0 8px !important;
  font-size: 11px !important;
  box-sizing: border-box !important;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .file {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .file-left,
  .file-right {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    margin-left: 0 !important;
  }

  .file .btn {
    width: 100% !important;
    white-space: normal !important;
    text-align: left !important;
  }

  .actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .actions-left {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  #netplanOpenBtn {
    margin-left: 0 !important;
    width: 100% !important;
    text-align: center !important;
  }

  .mtp-user-item {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .mtp-user-main,
  .mtp-user-sessions,
  .mtp-user-link,
  .mtp-user-actions {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .mtp-user-link {
    display: block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .mtp-user-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: stretch !important;
  }

  .mtp-user-actions .mini-btn,
  .mtp-user-actions .user-action {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 42px !important;
    height: auto !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    text-align: center !important;
    padding: 8px 10px !important;
  }
}

@media (min-width: 721px) {
  .file {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }

  .file-left {
    width: auto !important;
    flex: 1 1 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
  }

  .file-right {
    width: auto !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    align-items: center !important;
    margin-left: auto !important;
  }

  .file .btn {
    width: auto !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
}

.footer {
  padding: 14px 22px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

