@font-face {
  font-family: "Panama";
  src: url("../assets/fonts/Panama-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Panama";
  src: url("../assets/fonts/Panama-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #080909;
  --surface: #111313;
  --surface-raised: #191c1b;
  --card: rgb(17 19 19 / 90%);
  --card-strong: rgb(17 19 19 / 94%);
  --input: #0b0d0c;
  --button-hover: #d2ff91;
  --line: #303633;
  --muted: #9da7a1;
  --text: #f2f4f1;
  --accent: #b8f36b;
  --accent-ink: #0b1108;
  --danger: #ff8b83;
  --shadow: 0 20px 70px rgb(0 0 0 / 28%);
}

:root[data-telegram-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-raised: #e9eee8;
  --card: rgb(255 255 255 / 92%);
  --card-strong: rgb(255 255 255 / 96%);
  --input: #f7faf6;
  --button-hover: #245f11;
  --line: #c6cec4;
  --muted: #536057;
  --text: #111612;
  --accent: #2d7514;
  --accent-ink: #f7fff4;
  --danger: #a92f29;
  --shadow: 0 20px 70px rgb(43 65 43 / 14%);
}

:root[data-telegram-theme="light"] body {
  background: radial-gradient(circle at 92% 4%, rgb(45 117 20 / 10%), transparent 28rem), linear-gradient(145deg, #f3f5f1 0%, #e9eee8 54%, #f3f5f1 100%);
}

:root[data-telegram-theme="light"] body::before { opacity: .08; background-image: linear-gradient(rgb(0 0 0 / 5%) 1px, transparent 1px), linear-gradient(90deg, rgb(0 0 0 / 5%) 1px, transparent 1px); }

:root[data-telegram-theme="light"] .brand-mark { filter: invert(1); }

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 92% 4%, rgb(184 243 107 / 12%), transparent 28rem),
    linear-gradient(145deg, #080909 0%, #0d1110 54%, #080909 100%);
  font-family: "Panama", ui-sans-serif, sans-serif;
  line-height: 1.45;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .14;
  background-image: linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px);
  background-size: 42px 42px;
}

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 52px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

.brand-mark { width: 34px; height: 28px; object-fit: contain; }

.topbar-note { color: var(--muted); font-size: .85rem; }

.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: .76rem; letter-spacing: .17em; text-transform: uppercase; }

h1, h2, h3, p { margin-top: 0; }

h1 { max-width: 680px; margin-bottom: 18px; font-size: clamp(2.2rem, 6vw, 5rem); line-height: .98; letter-spacing: -.055em; }

h2 { margin-bottom: 8px; font-size: clamp(1.4rem, 2.8vw, 2.2rem); letter-spacing: -.035em; }

h3 { margin-bottom: 4px; font-size: 1.05rem; }

.lede { max-width: 570px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }

.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 50px; align-items: end; margin-bottom: 38px; }

.signal-panel { position: relative; min-height: 190px; padding: 25px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(135deg, rgb(184 243 107 / 10%), transparent 65%), var(--surface); box-shadow: var(--shadow); }

.signal-panel::after { position: absolute; right: -22px; bottom: -62px; width: 210px; height: 210px; border: 1px solid rgb(184 243 107 / 45%); border-radius: 50%; content: ""; box-shadow: 0 0 0 24px rgb(184 243 107 / 5%), 0 0 0 48px rgb(184 243 107 / 4%); }

.signal-label { position: relative; z-index: 1; color: var(--muted); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }

.signal-value { position: relative; z-index: 1; margin: 26px 0 0; color: var(--accent); font-size: 2.5rem; font-weight: 700; letter-spacing: -.06em; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }

.card { grid-column: span 6; padding: 26px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }

.card-wide { grid-column: span 12; }

.card-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }

.card-header p { margin-bottom: 0; color: var(--muted); font-size: .92rem; }

.status-badge { flex: 0 0 auto; padding: 6px 10px; border: 1px solid var(--accent); color: var(--accent); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.status-badge.is-danger { border-color: var(--danger); color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }

.stat { min-width: 0; padding: 16px; border-left: 2px solid var(--accent); background: var(--surface-raised); }
.stat-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .75rem; }
.stat-value { display: block; overflow: hidden; font-size: 1.05rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.subscription-link-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.subscription-link-block h3 { margin-bottom: 8px; }
.subscription-link-block p { max-width: 760px; margin: 0; color: var(--muted); }
.subscription-link-block .actions { margin-top: 16px; }

.button { min-height: 46px; padding: 11px 16px; border: 1px solid var(--accent); border-radius: 0; color: var(--accent-ink); background: var(--accent); font-weight: 700; text-decoration: none; }
.button:hover { background: var(--button-hover); }
.button-secondary { border-color: var(--line); color: var(--text); background: transparent; }
.button-secondary:hover { border-color: var(--text); background: var(--surface-raised); }
.button-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.button:disabled { cursor: wait; opacity: .5; }

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: .83rem; }
.field input,
.field select { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 0; color: var(--text); background: var(--input); }
.field input:focus,
.field select:focus { border-color: var(--accent); outline: 0; }

.notice { margin: 0 0 18px; padding: 13px 15px; border-left: 3px solid var(--accent); color: var(--muted); background: rgb(184 243 107 / 7%); }
.notice[hidden] { display: none; }
.notice.is-error { border-color: var(--danger); background: rgb(255 139 131 / 7%); }

.modal-backdrop { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(0 0 0 / 58%); backdrop-filter: blur(4px); }
.modal-card { width: min(440px, 100%); padding: 26px; border: 1px solid var(--line); background: var(--card-strong); box-shadow: var(--shadow); }
.modal-card h2 { margin-bottom: 10px; font-size: 1.8rem; }
.modal-card p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; }

.center-card { width: min(560px, 100%); margin: 9vh auto 0; padding: clamp(24px, 6vw, 44px); border: 1px solid var(--line); background: var(--card-strong); box-shadow: var(--shadow); }
.center-card .brand { margin-bottom: 52px; }
.center-card h1 { font-size: clamp(2.4rem, 8vw, 4rem); }
.form-note { margin-top: 14px; color: var(--muted); font-size: .84rem; }
.form-note button { padding: 0; border: 0; color: var(--accent); background: transparent; text-decoration: underline; }
.login-alternative { margin-top: 30px; padding-top: 4px; border-top: 1px solid var(--line); }
.login-divider { width: fit-content; margin: -13px auto 22px; padding: 0 12px; color: var(--muted); background: var(--card-strong); font-size: .8rem; }
.login-alternative h2 { font-size: 1.45rem; }
.field-help { margin: 0; color: var(--muted); font-size: .82rem; }

.loader { display: grid; gap: 20px; justify-items: center; padding: 64px 20px; text-align: center; }
.loader-ring { width: 44px; height: 44px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.table-wrap { overflow-x: auto; }
.device-list { width: 100%; border-collapse: collapse; }
.device-list th, .device-list td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.device-list th { color: var(--muted); font-size: .74rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; }
.device-list td:last-child { text-align: right; }
.device-actions-inner { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.device-actions-inner .button { min-height: 40px; padding: 8px 11px; }
.device-meta { color: var(--muted); font-size: .82rem; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.plan { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); background: var(--surface-raised); }
.plan.is-selected { border-color: var(--accent); }
.plan-price { font-size: 1.5rem; font-weight: 700; }
.plan-duration { color: var(--muted); font-size: .82rem; }
.checkout-actions { margin-top: 20px; }

.checkout-link { display: inline-block; margin-top: 18px; overflow-wrap: anywhere; }
.empty { margin: 0; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 26px; color: var(--muted); font-size: .78rem; }
.footer button { padding: 0; border: 0; color: inherit; background: transparent; text-decoration: underline; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .card { grid-column: span 12; }
}

@media (max-width: 520px) {
  .app-shell { width: min(100% - 28px, 1180px); padding-top: 18px; }
  .topbar { margin-bottom: 34px; }
  .topbar-note { display: none; }
  .card, .center-card { padding: 20px; }
  .stats { grid-template-columns: 1fr; }
  .stat-value { white-space: normal; }
  .device-list th:nth-child(2), .device-list td:nth-child(2) { display: none; }
  .button { width: 100%; text-align: center; }
  .actions { display: grid; }
  .modal-actions { display: grid; }
  .footer { align-items: start; flex-direction: column; }
}

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