/* Hom VPN Mini App */
:root {
  --ink: #071321;
  --panel: transparent;
  --panel-strong: transparent;
  --line: rgba(140, 180, 230, 0.12);
  --text: #eef3fb;
  --muted: #8a9bb3;
  --accent: #5B92E5;
  --accent-dim: #3d74c7;
  --accent-bright: #7aa9eb;
  --accent-soft: rgba(91, 146, 229, 0.18);
  --mint: var(--accent);
  --mint-dim: var(--accent-dim);
  --mint-soft: var(--accent-soft);
  --warn: #f0b429;
  --danger: #ff6b5c;
  --ok: #5B92E5;
  --radius: 18px;
  --radius-sm: 14px;
  --font: "Russo One", Impact, "Arial Black", "Segoe UI", sans-serif;
  --display: "Russo One", Impact, "Arial Black", sans-serif;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background: #071321 !important;
  background-color: #071321 !important;
}

button,
input,
select,
textarea {
  font-family: var(--font);
}

/* Default brand atmosphere (no external images required) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #071321;
  background-image:
    radial-gradient(120% 80% at 8% -12%, rgba(91, 146, 229, 0.28), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(45, 90, 160, 0.32), transparent 52%),
    radial-gradient(80% 60% at 50% 110%, rgba(18, 40, 80, 0.65), transparent 48%),
    linear-gradient(165deg, #071321 0%, #0c1c36 45%, #081526 100%);
}

/* фото + затемнение 75% поверх */
body.has-custom-bg::before {
  background-color: #071321;
  background-image: var(--app-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  filter: none;
}

body.has-custom-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(7, 19, 33, 0.75);
}

#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  background: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  overflow-x: hidden;
}

.boot,
.hero,
.section,
.actions,
.empty,
.qr-wrap,
.block,
.hint-box,
.form,
.row,
.err,
.ui-ver,
.tabs,
.chip,
.brand-badge,
.text-panel,
.hero-panel {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

.hero .days,
.hero .days.ok,
.hero .days.warn,
.hero .days.bad,
.hero .days.muted,
.days,
.days.ok,
.days.warn,
.days.bad,
.days.muted {
  color: #ffffff !important;
}

.row .meta,
.section-title,
.hint-box,
.empty,
.muted,
.hero .sub,
.hero .label,
.hero .name {
  color: rgba(238, 243, 251, 0.92) !important;
}

.nick-link {
  color: #5B92E5 !important;
  text-decoration: none;
}

.block {
  border-radius: 0;
  overflow: visible;
  color: #ffffff;
}

.row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.qr-wrap img {
  background: #fff !important;
  background-color: #fff !important;
}

.boot {
  padding: 40px 12px;
  text-align: center;
  color: #d8e6f8;
  font-size: 16px;
  line-height: 1.5;
}

.brand {
  font-family: var(--display);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 18px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.brand span {
  color: #5B92E5;
}

.hero {
  text-align: center;
  padding: 8px 4px 8px;
}

.hero .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero .days {
  font-family: var(--display);
  font-size: clamp(42px, 12vw, 52px);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.05;
}

.hero .days.ok { color: var(--ok); }
.hero .days.warn { color: var(--warn); }
.hero .days.bad { color: var(--danger); }
.hero .days.muted { color: var(--muted); }

.hero .sub {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
}

.hero .name {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.hero .name a,
.nick-link {
  color: var(--mint);
  text-decoration: none;
  font-weight: 700;
}

.section {
  margin-top: 20px;
}

.section-title {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 4px 10px;
}

.block {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
}

.row:last-child { border-bottom: none; }

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

.row .title {
  font-weight: 700;
  font-size: 15px;
  overflow-wrap: anywhere;
  word-break: normal;
}

.device-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.device-card:last-child {
  border-bottom: none;
}

.device-info {
  min-width: 0;
  width: 100%;
}

.device-name {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.3;
}

.device-meta {
  margin-top: 4px;
  font-size: 13px;
  color: rgba(238, 243, 251, 0.85);
}

.device-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.device-actions .btn {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 10px 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.device-actions .btn.danger {
  grid-column: 1 / -1;
}

.row .meta {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.btn,
.btn.ghost,
button.btn,
#app .btn,
#app button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  outline: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 400;
  font-family: var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent !important;
  background-color: transparent !important;
  color: #5B92E5 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  /* рамка: border + inset shadow — чтобы точно было видно в Telegram */
  border: 2px solid #5B92E5 !important;
  box-shadow: inset 0 0 0 1px #5B92E5 !important;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.2;
  text-align: center;
}

.btn:active,
.btn.is-pressed,
button.btn:active,
button.btn.is-pressed,
#app .btn:active,
#app .btn.is-pressed,
#app button.btn:active,
#app button.btn.is-pressed {
  opacity: 1 !important;
  transform: scale(0.97);
  background: rgba(91, 146, 229, 0.28) !important;
  background-color: rgba(91, 146, 229, 0.28) !important;
  color: #ffffff !important;
  border-color: #7aa9eb !important;
  box-shadow:
    inset 0 0 0 1px #7aa9eb,
    0 0 0 2px rgba(91, 146, 229, 0.35) !important;
  transition: transform 0.08s ease, background-color 0.08s ease, color 0.08s ease;
}

.btn,
.btn.ghost,
button.btn,
#app .btn,
#app button.btn {
  transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.btn:disabled {
  opacity: 0.45;
}

.btn.danger {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: transparent !important;
  color: var(--danger) !important;
  border: 1px solid rgba(255, 107, 92, 0.55) !important;
  box-shadow: none !important;
}

.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.form label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.form input,
.form select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  font-family: inherit;
  background: transparent !important;
  color: var(--text);
  outline: none;
  text-shadow: none;
}

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

.chip {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.chip.active {
  border-color: rgba(91, 146, 229, 0.7);
  background: transparent;
  color: var(--mint);
}

.err {
  margin-top: 12px;
  padding: 0;
  border-radius: 0;
  background: transparent !important;
  border: 0 !important;
  color: #ff6b5c;
  font-size: 14px;
}

.hint-box {
  margin-top: 12px;
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hint-box code {
  font-size: 12px;
  color: var(--mint);
}

.connect-steps {
  display: grid;
  gap: 16px;
  margin-top: 4px;
  width: 100%;
  min-width: 0;
}

.connect-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  min-width: 0;
}

.connect-step-body {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.connect-step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #5B92E5;
  color: #5B92E5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.connect-step-title {
  color: #eef3fb;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.connect-step-actions {
  margin-top: 10px;
  width: 100%;
  min-width: 0;
}

.connect-step-actions .btn {
  margin-top: 8px;
}

.connect-flow .qr-wrap {
  margin-top: 12px;
  padding: 12px 0;
  width: 100%;
  overflow: hidden;
}

.connect-flow .qr-wrap img {
  width: min(360px, 100%);
  max-width: 100%;
  height: auto;
}

.qr-wrap {
  text-align: center;
  padding: 18px;
}

.qr-wrap img {
  width: min(240px, 72vw);
  height: auto;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.empty {
  padding: 28px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.ext-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

.ext-row .chip {
  padding: 6px 11px;
  font-size: 12px;
}

.client-row {
  align-items: flex-start;
}

.client-row.pending .meta {
  color: var(--warn);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 11px 10px;
  border-radius: calc(var(--radius) - 4px);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
}

.tab.active {
  background: transparent;
  color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(91, 146, 229, 0.55);
}

.ui-ver {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(238, 243, 251, 0.7);
  background: transparent !important;
  padding: 0;
  border: 0;
  box-shadow: none;
}

/* финальный приоритет для рамок кнопок */
button.btn,
button.btn.ghost,
#app button.btn,
#app .btn {
  border: 2px solid #5B92E5 !important;
  border-top-color: #5B92E5 !important;
  border-right-color: #5B92E5 !important;
  border-bottom-color: #5B92E5 !important;
  border-left-color: #5B92E5 !important;
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: inset 0 0 0 1px #5B92E5 !important;
  color: #5B92E5 !important;
}
