/*
 * Магазин VPS — стили Mini App.
 * Цвета берутся из темы Telegram (--tg-theme-*); запасные значения (--fb-*) нужны для предпросмотра в браузере
 * и для старых клиентов. Схема задаётся атрибутом data-scheme на <html> (см. app.js), до запуска JS — медиа-запросом.
 */

:root {
  --fb-bg: #efeff4;
  --fb-section: #ffffff;
  --fb-text: #000000;
  --fb-hint: #8e8e93;
  --fb-link: #2481cc;
  --fb-button: #2481cc;
  --fb-button-text: #ffffff;
  --fb-header: #6d6d72;
  --fb-separator: #d1d1d6;
  --fb-destructive: #e53935;

  /* App-owned status text colours: >= 4.5:1 on light/dark sections and on their own badge tints. */
  --ok: #146c2e;
  --warn: #8a5300;
  --danger-text: #b3261e;
  --neutral-text: #595d62;
  --badge-alert: #d32f2f;
  --ok-bg: rgba(52, 199, 89, 0.15);
  --warn-bg: rgba(255, 159, 10, 0.16);
  --danger-bg: rgba(255, 59, 48, 0.11);
  --neutral-bg: rgba(142, 142, 147, 0.16);
  --tint-bg: rgba(36, 129, 204, 0.11);
  --chip-bg: rgba(118, 118, 128, 0.12);
  --pressed: rgba(118, 118, 128, 0.14);
  --hover: rgba(118, 118, 128, 0.06); /* light enough to keep badge text >= 4.5:1 on hovered rows */
  --sk: rgba(118, 118, 128, 0.13);
  --sk-shine: rgba(255, 255, 255, 0.55);
  --toast-bg: rgba(28, 28, 30, 0.92);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-section)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-link));
  --button: var(--tg-theme-button-color, var(--fb-button));
  --button-text: var(--tg-theme-button-text-color, var(--fb-button-text));
  --header: var(--tg-theme-section-header-text-color, var(--fb-header));
  --separator: var(--tg-theme-section-separator-color, var(--fb-separator));
  --subtitle: var(--tg-theme-subtitle-text-color, var(--hint));
  --destructive: var(--tg-theme-destructive-text-color, var(--fb-destructive));
  --tint-text: var(--link); /* text on --tint-bg; darkened/lightened below where color-mix() works */

  --radius: 12px;
  --gutter: 16px;
  --tabbar-h: 56px;
  --actionbar-h: 66px;
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

:root[data-scheme="dark"] {
  --fb-bg: #000000;
  --fb-section: #1c1c1e;
  --fb-text: #ffffff;
  --fb-hint: #98989e;
  --fb-link: #3e88f7;
  --fb-button: #3e88f7;
  --fb-header: #8d8e93;
  --fb-separator: #38383a;
  --fb-destructive: #ff453a;
  --ok: #4cd97b;
  --warn: #ffbf47;
  --danger-text: #ff8f87;
  --neutral-text: #b4b8be;
  --ok-bg: rgba(52, 199, 89, 0.18);
  --warn-bg: rgba(255, 159, 10, 0.18);
  --danger-bg: rgba(255, 69, 58, 0.17);
  --neutral-bg: rgba(142, 142, 147, 0.22);
  --tint-bg: rgba(62, 136, 247, 0.18);
  --chip-bg: rgba(118, 118, 128, 0.24);
  --pressed: rgba(255, 255, 255, 0.08);
  --hover: rgba(255, 255, 255, 0.04);
  --sk: rgba(255, 255, 255, 0.08);
  --sk-shine: rgba(255, 255, 255, 0.08);
  --toast-bg: rgba(58, 58, 60, 0.96);
  --shadow: none;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-scheme]) {
    --fb-bg: #000000;
    --fb-section: #1c1c1e;
    --fb-text: #ffffff;
    --fb-hint: #98989e;
    --fb-link: #3e88f7;
    --fb-button: #3e88f7;
    --fb-header: #8d8e93;
    --fb-separator: #38383a;
    --sk: rgba(255, 255, 255, 0.08);
    --sk-shine: rgba(255, 255, 255, 0.08);
    --shadow: none;
    color-scheme: dark;
  }
}

/* Accent tints follow the Telegram button colour where color-mix() is supported. Text on a tint keeps the
 * link hue but is pulled towards the text colour, so it stays >= 4.5:1 on the tint (light and dark themes). */
@supports (background: color-mix(in srgb, red 50%, blue)) {
  :root {
    --tint-bg: color-mix(in srgb, var(--button) 13%, transparent);
    --tint-text: color-mix(in srgb, var(--link) 65%, var(--text));
  }
  :root[data-scheme="dark"] {
    --tint-bg: color-mix(in srgb, var(--button) 22%, transparent);
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
label,
summary {
  touch-action: manipulation; /* no double-tap zoom delay */
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--button);
  outline-offset: 2px;
}

h1:focus {
  outline: none;
}

/* Rows inside cards (overflow: hidden) get an inset focus ring so it is never clipped. */
.cell:focus-visible,
.offer:focus-visible,
.seg:focus-visible,
.srv-head--link:focus-visible,
.howto-summary:focus-visible,
.collapse-summary:focus-visible {
  outline-offset: -2px;
}

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

.clipboard-proxy {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mono {
  font-family: var(--mono);
  font-size: 14px;
}

.text-warn {
  color: var(--warn) !important;
}

.text-danger {
  color: var(--danger-text) !important;
}

/* ---------- Layout ---------- */

.screens {
  margin: 0 auto;
  max-width: 680px;
  padding: calc(var(--safe-top) + 2px) var(--safe-right) calc(var(--safe-bottom) + 28px) var(--safe-left);
}

.has-tabbar .screens {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.has-actionbar .screens {
  padding-bottom: calc(var(--actionbar-h) + var(--safe-bottom) + 24px);
}

.has-topbar .screens {
  padding-top: 0;
}

.screens--standalone {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.screen--enter {
  animation: screen-in 0.22s ease-out;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: var(--safe-top) calc(6px + var(--safe-right)) 0 calc(6px + var(--safe-left));
  background: var(--bg);
}

.backbtn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 12px 0 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--link);
  font-size: 17px;
}

.backbtn .icon {
  width: 24px;
  height: 24px;
}

.backbtn:active {
  background: var(--pressed);
}

/* ---------- Page header ---------- */

.page-head {
  padding: 14px var(--gutter) 0;
}

.page-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  min-width: 0;
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.page-title .badge {
  position: relative;
  top: -4px;
  vertical-align: middle;
  letter-spacing: 0;
}

.page-head--brand .page-title {
  font-size: 24px;
  line-height: 1.2;
}

.page-head-row .icon-btn {
  margin: -6px -10px 0 0;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.4;
}

.page-desc {
  margin: 10px 0 0;
  color: var(--subtitle);
  font-size: 15px;
  line-height: 1.45;
}

.page-head .chips {
  margin-top: 12px;
}

.page-foot {
  margin: 18px calc(var(--gutter) + 16px) 0;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.45;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px var(--gutter) 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.demo-banner .icon {
  color: var(--warn);
}

/* ---------- Sections and cards ---------- */

.section {
  margin: 22px var(--gutter) 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 8px 16px;
}

.section-title {
  margin: 0;
  color: var(--header);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.section-foot {
  margin: 8px 16px 0;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin: -10px -6px -10px 0;
}

.head-note {
  color: var(--hint);
  font-size: 13px;
  white-space: nowrap;
}

.notes {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.card {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--section);
  box-shadow: var(--shadow);
}

.card--pad {
  padding: 14px 16px;
}

.card-text {
  margin: 0;
  padding: 14px 16px;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.45;
}

.card-block {
  padding: 14px 16px;
}

.card-block .card-text {
  margin-top: 6px;
  padding: 0;
}

.block-price {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Cells (list rows) ---------- */

.cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.cell + .cell::before,
.kv + .kv::before,
.card-block + .cell::before,
.collapse-body::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
  transform-origin: top;
}

.cell + .cell--lead::before,
.cell + .cell--action::before,
.card-block + .cell--action::before {
  left: 50px;
}

button.cell:active,
.offer:active,
.srv-head--link:active,
.howto-summary:active,
.collapse-summary:active {
  background: var(--pressed);
}

.cell-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cell-title {
  overflow: hidden;
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  color: var(--hint);
  font-size: 13px;
  line-height: 1.35;
}

.cell--multi {
  padding-top: 11px;
  padding-bottom: 11px;
}


.cell-end {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.cell-icon {
  width: 22px;
  height: 22px;
  color: var(--link);
}

.chev {
  width: 16px;
  height: 16px;
  color: var(--hint);
  opacity: 0.7;
}

.row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.row-top .cell-title {
  flex: 1 1 auto;
  min-width: 0;
}

.cell--action {
  color: var(--link);
}

.cell--action .cell-title {
  font-weight: 500;
}

.cell--danger,
.cell--danger .cell-icon {
  color: var(--destructive);
}

.cell--action .spinner {
  width: 22px;
  height: 22px;
}

.cell--action.is-busy .cell-icon {
  display: none;
}

/* ---------- Key–value rows ---------- */

.kv {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 46px;
  padding: 12px 16px;
}

.kv-key {
  flex: none;
  max-width: 48%;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.4;
}

.kv-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
  text-align: right;
}

.kv-val {
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.kv-val.mono {
  font-size: 14px;
  line-height: 21px;
}

.kv-val--strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kv-sub {
  color: var(--hint);
  font-size: 13px;
  line-height: 1.35;
}

.kv .copy-btn {
  margin: -11px -12px -11px -6px;
}

.kv--total {
  align-items: center;
}

/* Long values (service names): key above, value below, copy button on the right. */
.kv--stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
}

.kv--stack .kv-key {
  max-width: none;
  font-size: 13px;
}

.kv--stack .kv-main {
  grid-column: 1;
  align-items: flex-start;
  text-align: left;
}

.kv--stack .copy-btn {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.kv--total .kv-key {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.kv-val.total {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Badges and chips ---------- */

.badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.badge--info,
.badge--lz {
  background: var(--tint-bg);
  color: var(--tint-text);
}

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

.chip {
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--chip-bg);
  font-size: 13px;
  font-weight: 500;
  line-height: 17px;
  white-space: nowrap;
}

/* ---------- Catalog ---------- */

.offers {
  display: grid;
  gap: 10px;
}

/* A column flexbox keeps the button's content within its width (block buttons size content as fit-content). */
.offer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  padding: 14px 16px 15px;
  border: 0;
  border-radius: var(--radius);
  background: var(--section);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}

.offer-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.offer-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offer .chips {
  margin-top: 10px;
}

.offer-hint {
  display: block;
  margin-top: 8px;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.35;
}

.offer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 14px;
}

.offer-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.price {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-unit {
  color: var(--hint);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.price-sub {
  color: var(--hint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.offer-meta {
  flex: none;
  margin-left: auto;
  color: var(--hint);
  font-size: 13px;
  text-align: right;
}

/* Own line with a fixed height, so the skeleton -> text change never moves the cards. */
.offer-avail {
  display: flex;
  align-items: center;
  height: 20px;
  margin-top: 10px;
  font-size: 13px;
}

.avail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  font-weight: 500;
  white-space: nowrap;
}

.avail::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.avail--ok {
  color: var(--ok);
}

.avail--none {
  color: var(--danger-text);
}

.avail--unknown {
  color: var(--neutral-text);
}

.avail--loading {
  position: relative;
  width: 104px;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sk);
}

.avail--loading::before {
  display: none;
}

.howto-summary,
.collapse-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.howto-summary::-webkit-details-marker,
.collapse-summary::-webkit-details-marker {
  display: none;
}

.howto-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.howto-chev {
  width: 18px;
  height: 18px;
  color: var(--hint);
  transition: transform 0.2s;
}

details[open] > summary .howto-chev {
  transform: rotate(180deg);
}

.collapse-body {
  position: relative;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 2px 16px 16px;
  list-style: none;
  counter-reset: step;
}

.card--pad .steps {
  padding: 0;
}

.steps li {
  position: relative;
  padding-left: 36px;
  font-size: 15px;
  line-height: 1.45;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: -1px;
  left: 0;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--tint-bg);
  color: var(--tint-text);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Controls ---------- */

.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--section);
  box-shadow: var(--shadow);
}

.seg {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.seg[aria-checked="true"] {
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
}

.radio {
  display: grid;
  flex: none;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid var(--hint);
  border-radius: 50%;
  transition: border-color 0.15s;
}

.radio::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--button);
  transform: scale(0);
  transition: transform 0.15s;
}

[aria-checked="true"] > .radio {
  border-color: var(--button);
}

[aria-checked="true"] > .radio::after {
  transform: scale(1);
}

.switch-row {
  cursor: pointer;
}

.switch {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--chip-bg);
  cursor: pointer;
  transition: background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s;
}

.switch:checked {
  background: var(--button);
}

.switch:disabled {
  cursor: default;
  opacity: 0.45;
}

.switch:checked::after {
  transform: translateX(20px);
}

.check-row {
  cursor: pointer;
}

.check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  display: grid;
  flex: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid var(--hint);
  border-radius: 7px;
  transition: background 0.15s, border-color 0.15s;
}

.check-box .icon {
  width: 16px;
  height: 16px;
  stroke: transparent;
  stroke-width: 3;
}

.check-input:checked + .check-box {
  border-color: var(--button);
  background: var(--button);
}

.check-input:checked + .check-box .icon {
  stroke: var(--button-text);
}

.check-input:focus-visible + .check-box {
  outline: 2px solid var(--button);
  outline-offset: 2px;
}

/* ---------- Configurator ---------- */

.filter-card {
  margin-bottom: 14px;
}

.loc-group + .loc-group {
  margin-top: 14px;
}

.loc-country {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 6px;
  color: var(--header);
  font-size: 13px;
  font-weight: 600;
}

.flag {
  font-size: 17px;
  line-height: 1;
}

.flag-icon {
  width: 16px;
  height: 16px;
}

/* One line: when space is short the (secondary) datacenter code is truncated, so rows keep their height
   when the availability badge replaces its skeleton. */
.loc-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.loc-sub .badge,
.loc-sub .sk-badge {
  flex: none;
}

.dc {
  min-width: 0;
  overflow: hidden;
  color: var(--hint);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loc-price {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.loc-monthly {
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.is-dim .loc-price {
  color: var(--hint);
  font-weight: 500;
}

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

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 12px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: var(--section);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.15s;
}

.choice-check {
  width: 20px;
  height: 20px;
  padding: 3px;
  border: 1.5px solid var(--hint);
  border-radius: 50%;
  stroke: transparent;
  stroke-width: 3;
  transition: background 0.15s, border-color 0.15s;
}

.choice[aria-checked="true"] {
  border-color: var(--button);
}

.choice[aria-checked="true"] .choice-check {
  border-color: var(--button);
  background: var(--button);
  stroke: var(--button-text);
}

.summary {
  padding-top: 6px;
}

.sum-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 16px;
  font-size: 15px;
  line-height: 1.4;
}

.sum-key {
  flex: none;
  color: var(--hint);
}

.sum-val {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.sum-val.is-missing {
  color: var(--hint);
}

.summary-total {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 14px 16px 14px;
}

.summary-total::before {
  content: "";
  position: absolute;
  top: 0;
  right: 16px;
  left: 16px;
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
}

.summary-total-label {
  font-weight: 600;
}

.summary-total-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-note {
  margin-top: -8px;
  padding: 0 16px 14px;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
  text-align: right;
}

.sum-head {
  padding: 14px 16px 6px;
}

.sum-name {
  font-size: 18px;
  font-weight: 600;
}

.sum-name .badge {
  vertical-align: 2px;
}

.sum-head .chips {
  margin-top: 10px;
}

.sum-head + .kv::before {
  display: none;
}

/* ---------- Notices ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--section);
  font-size: 14px;
  line-height: 1.45;
}

.notice > .icon {
  margin-top: 1px;
  color: var(--hint);
}

.notice--info {
  background: var(--tint-bg);
}

.notice--info > .icon {
  color: var(--link);
}

.notice--warn {
  background: var(--warn-bg);
}

.notice--warn > .icon {
  color: var(--warn);
}

.notice--danger {
  background: var(--danger-bg);
}

.notice--danger > .icon {
  color: var(--destructive);
}

.notice-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-title {
  font-weight: 600;
}

.notice-title + .notice-text {
  margin-top: 2px;
}

/* ---------- Order ---------- */

.status-card {
  padding: 14px 16px 16px;
}

.status-top .badge {
  padding: 4px 10px;
  font-size: 13px;
}

.status-text {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.45;
}

.tracker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--hint);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.step::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--chip-bg);
}

.step:first-child::before {
  display: none;
}

.step--done::before,
.step--current::before {
  background: var(--button);
}

.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid var(--chip-bg);
  border-radius: 50%;
  background: var(--section);
}

.step-dot .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.step--done .step-dot {
  border-color: var(--button);
  background: var(--button);
  color: var(--button-text);
}

.step--current .step-dot {
  border-color: var(--button);
}

.step--current .step-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--button);
}

.step--current {
  color: var(--text);
  font-weight: 600;
}

.step-label {
  white-space: nowrap;
}

.tracker--warn .step--current .step-dot {
  border-color: var(--warn);
}

.tracker--warn .step--current .step-dot::after,
.tracker--warn .step--current::before {
  background: var(--warn);
}

/* ---------- Servers ---------- */

.search {
  position: relative;
  margin: 16px var(--gutter) 0;
}

.search .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--hint);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  border: 0;
  border-radius: var(--radius);
  background: var(--section);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--hint);
}

.search-input:focus-visible {
  outline: 2px solid var(--button);
  outline-offset: 0;
}

.srv-list,
.item-list {
  display: grid;
  gap: 12px;
}

.srv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px 8px;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
}

.srv-flag {
  flex: none;
  font-size: 28px;
  line-height: 1;
}

.srv-icon {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--tint-bg);
  color: var(--link);
}

.srv-titles {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.srv-name,
.srv-host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srv-name {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.srv-host {
  color: var(--hint);
  font-family: var(--mono);
  font-size: 12px;
}

.srv-body {
  display: grid;
  gap: 6px;
  padding: 0 16px 14px;
}

.srv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.srv-key {
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
}

.srv-val {
  min-width: 0;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.srv-row .copy-btn {
  margin: -6px -10px -6px -6px;
}

.srv-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.srv-meta {
  color: var(--subtitle);
  font-size: 14px;
  line-height: 1.4;
}

.srv-note {
  color: var(--hint);
  font-size: 12px;
}

.srv-exp {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  line-height: 1.4;
}

.srv-exp .icon {
  width: 16px;
  height: 16px;
}

.srv-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Stock ---------- */

.item-card {
  padding: 14px 16px;
}

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-titles {
  min-width: 0;
}

.item-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.item-sub {
  margin-top: 2px;
  color: var(--subtitle);
  font-size: 14px;
}

.item-warning {
  margin-top: 10px;
}

.item-warning .notice {
  padding: 10px 12px;
}

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

.item-actions {
  margin-top: 12px;
}

.plan-loc {
  min-height: 60px;
}

.plan-loc .cell-end {
  flex-direction: row;
  align-items: center;
}

.covered {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ok);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.covered .icon {
  width: 16px;
  height: 16px;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  opacity: 0.85;
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
}

.btn.is-busy:disabled {
  opacity: 0.75;
}

.btn--tinted {
  background: var(--tint-bg);
  color: var(--tint-text);
}

.btn--plain {
  background: transparent;
  color: var(--link);
}

.btn--danger {
  background: transparent;
  color: var(--destructive);
}

.btn--sm {
  padding: 8px 14px;
  font-size: 14px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.spinner {
  display: none;
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.is-busy > .spinner {
  display: inline-block;
}

.is-busy > .icon {
  display: none;
}

.icon-btn {
  display: inline-grid;
  flex: none;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--link);
}

.icon-btn:active {
  background: var(--pressed);
}

.icon-btn:disabled {
  color: var(--hint);
}

.is-spinning .icon {
  animation: spin 1s linear infinite;
}

/* ---------- Empty, error and special screens ---------- */

.empty {
  padding: 44px 28px 16px;
  text-align: center;
}

.empty-icon,
.fatal-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 20px;
  background: var(--tint-bg);
  color: var(--link);
}

.empty-icon .icon,
.fatal-icon .icon {
  width: 30px;
  height: 30px;
}

.empty-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}

.empty-text {
  max-width: 320px;
  margin: 8px auto 20px;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.45;
}

.empty-inline {
  margin: 28px 16px;
  color: var(--hint);
  text-align: center;
}

.fatal {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 64px 28px 24px;
  text-align: center;
}

.fatal-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.fatal-text {
  margin: 10px 0 24px;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.fatal-actions {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.fatal-actions:empty {
  display: none;
}

.screens > .fatal {
  display: flex;
  min-height: 72vh;
  flex-direction: column;
  justify-content: center;
}

/* ---------- Skeletons ---------- */

.skeleton {
  display: grid;
  gap: 10px;
}

.sk,
.avail--loading {
  position: relative;
  overflow: hidden;
  background: var(--sk);
}

.sk {
  display: block;
  border-radius: var(--radius);
}

.sk::after,
.avail--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--sk-shine), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk-offer {
  height: 156px;
}

.sk-card {
  height: 120px;
}

.sk-row {
  height: 72px;
}

.sk-server {
  height: 196px;
}

.sk-title {
  width: 72%;
  height: 30px;
  border-radius: 8px;
}

.sk-line {
  width: 86%;
  height: 16px;
  margin-bottom: 12px;
  border-radius: 6px;
}

.sk-badge {
  display: inline-block;
  width: 72px;
  height: 22px; /* same as .badge: no row height change when statuses arrive */
  border-radius: 999px;
}

.boot {
  display: grid;
  gap: 12px;
  padding: 18px var(--gutter) 0;
}

/* ---------- Bars ---------- */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--section);
  box-shadow: 0 -0.5px 0 var(--separator);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  min-width: 0;
  padding: 6px 2px 4px;
  border: 0;
  background: none;
  color: var(--hint);
  font-size: 11px;
  font-weight: 500;
}

.tab[aria-current="page"] {
  color: var(--button);
}

.tab-icon {
  position: relative;
  display: block;
  line-height: 0;
}

.tab .icon {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
}

.tab-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-badge {
  position: absolute;
  top: -4px;
  left: 15px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge-alert);
  box-shadow: 0 0 0 2px var(--section);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.actionbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 45;
  display: flex;
  gap: 8px;
  padding: 8px calc(var(--gutter) + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(var(--gutter) + var(--safe-left));
  background: var(--bg);
  box-shadow: 0 -0.5px 0 var(--separator);
}

.actionbar .btn {
  flex: 1 1 0;
  min-height: 50px;
  font-size: 16px;
}

.toast-host {
  position: fixed;
  right: 0;
  bottom: calc(var(--safe-bottom) + 16px);
  left: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.has-tabbar .toast-host {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
}

.has-actionbar .toast-host {
  bottom: calc(var(--actionbar-h) + var(--safe-bottom) + 12px);
}

.toast {
  max-width: 440px;
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--toast-bg);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  color: #ffffff;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast--in {
  opacity: 1;
  transform: none;
}

.toast--error {
  background: rgba(190, 38, 38, 0.95);
}

.toast--action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 4px 16px;
  pointer-events: auto;
  text-align: left;
}

.toast-btn {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #8fc7ff;
  font-size: 14px;
  font-weight: 600;
}

/* Static loading screen (index.html): the hint appears only if loading takes longer than ~8 s. */
.boot-hint {
  margin: 8px 4px 0;
  color: var(--hint);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  visibility: hidden; /* also hidden from screen readers until it is shown */
  opacity: 0;
  animation: boot-hint 0.4s 8s forwards;
}

@keyframes boot-hint {
  to {
    visibility: visible;
    opacity: 1;
  }
}

@media (hover: hover) {
  button.cell:hover,
  .offer:hover,
  .srv-head--link:hover,
  .howto-summary:hover,
  .collapse-summary:hover,
  .icon-btn:hover:not(:disabled),
  .backbtn:hover {
    background: var(--hover);
  }

  .btn:hover:not(:disabled) {
    opacity: 0.9;
  }

  .seg:hover:not([aria-checked="true"]),
  .tab:hover:not([aria-current]) {
    color: var(--link);
  }

  .choice:hover:not([aria-checked="true"]) {
    border-color: var(--separator);
  }
}

/* ---------- Narrow screens, motion ---------- */

@media (max-width: 359px) {
  :root {
    --gutter: 12px;
  }

  .page-title {
    font-size: 25px;
  }

  .page-head--brand .page-title {
    font-size: 21px;
  }

  .price {
    font-size: 20px;
  }

  .step {
    font-size: 11px;
  }
}

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

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
