:root {
  --bg: #f3f4f7; --card: #fff; --fg: #1a1d21; --muted: #667080; --line: #e3e6eb;
  --accent: #5b5bf0; --accent-fg: #fff; --ok: #1f9d55; --warn: #c27c0e; --bad: #d64545;
  --soft: rgba(91, 91, 240, .08); --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #0e1117; --card: #161b22; --fg: #e6e9ef; --muted: #8b95a5; --line: #262d38;
    --accent: #7c7cff; --soft: rgba(124, 124, 255, .12);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.top {
  max-width: 680px; margin: 0 auto; padding: 16px 16px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.logo { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
main { max-width: 680px; margin: 0 auto; padding: 8px 16px 48px; }
h1 { font-size: 26px; margin: 8px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0; }
p { margin: 0; }
.hero { padding: 16px 0 4px; }
.hero p { color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.card.status { background: linear-gradient(135deg, var(--soft), transparent 60%), var(--card); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; padding: 32px 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.flush { margin: 0; }
.stack > * + * { margin-top: 12px; }

button, .btn {
  font: inherit; font-size: 15px; font-weight: 600; border: 0; border-radius: 12px; padding: 10px 14px;
  cursor: pointer; background: var(--accent); color: var(--accent-fg); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.2;
}
button.secondary, .btn.secondary { background: transparent; color: var(--fg); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 4px 0; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
.wide { width: 100%; }

input {
  font: inherit; width: 100%; padding: 11px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }

/* segmented switchers */
.seg { display: inline-flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 14px; border: 1px solid var(--line); }
.seg button { background: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; white-space: nowrap; font-weight: 600; }
.seg button.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.scroll-x { overflow-x: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
nav.tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; margin: 4px 0; }
nav.tabs .seg { display: flex; width: 100%; }
nav.tabs .seg button { flex: 1; padding: 9px 4px; font-size: 14px; }
.card .seg { margin-top: 2px; }

.ico { width: 20px; height: 20px; display: block; }
.ico-sm { width: 16px; height: 16px; display: block; }

.badge { display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 14px; }
.stats > div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stats span { display: block; font-size: 12px; color: var(--muted); }
.stats b { font-size: 15px; }
.status > p { margin-top: 12px; }

/* installation steps */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.steps li:last-child { padding-bottom: 0; }
.steps li:not(:last-child)::before {
  content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line);
}
.step-ico {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; background: #7950f2;
}
.step-ico[data-color="cyan"] { background: #1098ad; }
.step-ico[data-color="teal"] { background: #0ca678; }
.step-ico[data-color="blue"] { background: #1c7ed6; }
.step-ico[data-color="green"] { background: #37b24d; }
.step-ico[data-color="orange"] { background: #f76707; }
.step-ico[data-color="red"] { background: #e03131; }
.step-ico[data-color="pink"] { background: #d6336c; }
.step-ico[data-color="grape"] { background: #ae3ec9; }
.step-ico[data-color="indigo"] { background: #4263eb; }
.step-ico[data-color="yellow"] { background: #f59f00; }
.step-body { flex: 1; min-width: 0; padding-top: 6px; }
.step-body > * + * { margin-top: 8px; }

.country { padding: 10px 0; border-top: 1px solid var(--line); }
.country:first-child { border-top: 0; }
.country .name { font-weight: 600; }
.country button { padding: 8px 12px; }
.qr { display: block; width: 100%; max-width: 240px; margin-top: 10px; background: #fff; border-radius: 12px; padding: 6px; image-rendering: pixelated; }

.plan { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.durations { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.durations button { flex-direction: column; gap: 2px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); }
.durations button span { font-size: 13px; color: var(--muted); font-weight: 500; }

.error { color: var(--bad); font-size: 14px; }
.error:empty { display: none; }
.big-ok { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 28px; color: #fff; background: var(--ok); }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; max-width: calc(100% - 32px);
}
code.url { display: block; word-break: break-all; font-size: 13px; background: var(--bg); padding: 10px 12px; border-radius: 10px; }

.seg + form { margin-top: 14px; }
