* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(20px + env(safe-area-inset-bottom));
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-image);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
.shell { position: relative; z-index: 1; width: 100%; max-width: 520px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; color: var(--header-text);
  background: var(--header-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark { font-size: 24px; line-height: 1; }
.brand-name { font-weight: 800; font-size: 18px; white-space: nowrap; }
.brand-name b { color: var(--accent); }
[data-theme="winx"] .brand-name b, [data-theme="vk2010"] .brand-name b { color: var(--accent-2); }
.theme-form select {
  max-width: 150px; min-height: 40px; padding: 6px 8px;
  font: inherit; font-size: 12px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.content { display: grid; gap: 12px; }
.card {
  position: relative; padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.2; }
h2 { margin: 16px 0 8px; font-size: 17px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.chip { padding: 3px 9px; font-size: 11px; font-weight: 700; color: var(--chip-text); background: var(--chip-bg); border-radius: 999px; white-space: nowrap; }
.traffic { margin: 10px 0 12px; }
.traffic-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.traffic-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.actions form { flex: 1 1 130px; }
.actions .btn { width: 100%; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 10px 16px;
  font: 700 15px var(--font); color: var(--text); text-decoration: none; text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; box-shadow: none;
  touch-action: manipulation;
}
.btn.primary { color: var(--button-text); background: var(--button-bg); border-color: var(--button-border); }
.btn.big { min-height: 52px; font-size: 16px; width: 100%; }
.btn.small { min-height: 40px; padding: 7px 11px; font-size: 13px; }
.btn.danger { color: #fff; background: #d64545; border-color: #a92f2f; }
.btn:active { transform: translateY(1px); filter: brightness(.97); }
.link-button { padding: 0; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.link-box { margin-top: 12px; padding: 10px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.link-box label { display: block; margin-bottom: 6px; font-weight: 700; }
.link-row { display: flex; flex-direction: column; gap: 8px; }
.link-row input { width: 100%; min-height: 44px; padding: 8px 10px; font: 12px ui-monospace, monospace; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.devices { display: grid; gap: 8px; }
.device { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.device > div { min-width: 0; overflow-wrap: anywhere; }
.plan-price { text-align: right; font-size: 20px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.plan-price small { display: block; font-size: 12px; color: var(--muted); }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.welcome { text-align: center; padding: 22px 14px; }
.login-mark { font-size: 54px; margin-bottom: 6px; }
.dev-login { margin-top: 14px; }
.orders, .admin-orders { display: grid; gap: 8px; }
.order-row, .admin-order { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.order-main, .order-side { display: grid; gap: 3px; }
.order-side { align-items: flex-start; }
.order-price { font-weight: 800; color: var(--accent); }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--chip-bg); color: var(--chip-text); width: fit-content; }
.status.ok { background: #d9f2d9; color: #1d5b1d; }
.status.bad { background: #ffe0dc; color: #8c1d14; }
.order-actions, .admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.alert { margin: 8px 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.alert.error { background: #ffe1e8; border-color: #d99ab0; color: #7a1030; }
.alert.notice { background: #e8ffe8; border-color: #6bbf6b; color: #1b5e20; }
.amount { font-size: 34px; font-weight: 900; color: var(--accent); margin: 8px 0; }
.amount small { font-size: 16px; color: var(--muted); }
.methods { display: grid; gap: 8px; margin-top: 12px; }
.method { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 10px 12px; font: 700 15px var(--font); color: var(--text); text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.method-code { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: var(--accent); font: 700 12px sans-serif; }
.row { display: flex; flex-direction: column; gap: 8px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--accent); text-decoration: none; font-weight: 700; }
.help summary { cursor: pointer; font-weight: 800; }
.help ol { padding-left: 18px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
.form input, .form select { min-height: 44px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check { display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
.check input { min-height: 0; width: 20px; height: 20px; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs a { padding: 7px 10px; color: var(--text); text-decoration: none; font-weight: 700; border-radius: var(--radius-sm); }
.tabs a.active { color: var(--button-text); background: var(--button-bg); }
.tabs form { margin-left: auto; }
.admin-plans { display: grid; gap: 10px; }
.admin-plan { display: grid; gap: 8px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.admin-plan .plan-name { font: 12px ui-monospace, monospace; color: var(--muted); overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 460px) {
  .order-row, .admin-order { flex-direction: row; justify-content: space-between; }
  .order-side { align-items: flex-end; text-align: right; }
}

.app-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.app-links .btn { width: 100%; }
.configurator { display: grid; gap: 12px; }
.config-step { display: grid; gap: 7px; }
.step-label { font-size: 13px; font-weight: 800; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-button {
  min-height: 42px; padding: 8px 13px;
  font: 700 14px var(--font); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer;
}
.chip-button.active {
  color: var(--button-text); background: var(--button-bg);
  border-color: var(--button-border);
  box-shadow: inset 0 0 0 1px var(--button-border);
}
.config-summary {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.config-summary .plan-price { font-size: 28px; }
