:root {
  --bg: var(--tg-theme-bg-color, #080d18);
  --bg-soft: var(--tg-theme-secondary-bg-color, #0e1627);
  --surface: color-mix(in srgb, var(--tg-theme-secondary-bg-color, #162238) 88%, #fff 12%);
  --surface-2: color-mix(in srgb, var(--tg-theme-secondary-bg-color, #162238) 72%, #fff 28%);
  --text: var(--tg-theme-text-color, #f6f8ff);
  --muted: var(--tg-theme-hint-color, #94a0b8);
  --link: var(--tg-theme-link-color, #7cb7ff);
  --button: var(--tg-theme-button-color, #5b7cfa);
  --button-text: var(--tg-theme-button-text-color, #fff);
  --line: color-mix(in srgb, var(--muted) 22%, transparent);
  --success: #42d7a0;
  --warning: #ffbd59;
  --danger: #ff6d7a;
  --violet: #8f76ff;
  --cyan: #44c7f4;
  --shadow: 0 24px 70px rgba(0, 0, 0, .26);
  --radius: 24px;
  --radius-sm: 16px;
  font-family: Inter, "SF Pro Display", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--link); }
[hidden] { display: none !important; }

.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 88% 2%, rgba(82, 115, 255, .18), transparent 28rem),
    radial-gradient(circle at 12% 88%, rgba(68, 199, 244, .1), transparent 28rem);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #7594ff, #6649e8 54%, #37c9ec);
  box-shadow: 0 10px 28px rgba(91, 124, 250, .32);
  font-weight: 950;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
  max-width: 1520px;
  min-height: 100vh;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(22px);
}
.side-nav { display: grid; gap: 7px; margin-top: 38px; }
.nav-item {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  font-weight: 760;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item span { width: 22px; font-size: 21px; text-align: center; }
.nav-item i {
  width: 7px; height: 7px; margin-left: auto; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
}
.nav-item:hover, .nav-item.active {
  color: #fff;
  background: linear-gradient(115deg, rgba(91, 124, 250, .96), rgba(116, 81, 230, .92));
  box-shadow: 0 10px 30px rgba(70, 77, 202, .22);
}
.sidebar-account {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
}
.sidebar-account > div:last-child { min-width: 0; }
.sidebar-account strong, .sidebar-account small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account strong { white-space: nowrap; font-size: 14px; }
.sidebar-account small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #25a8d6, #725eea);
  font-weight: 900;
}
.avatar.large { width: 68px; height: 68px; border-radius: 22px; font-size: 25px; }

.content { min-width: 0; padding: 38px clamp(22px, 4vw, 62px) 70px; }
.mobile-header, .bottom-nav { display: none; }
.view { display: none; max-width: 1180px; margin: 0 auto; animation: view-in .24s ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-heading {
  min-height: 72px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #8ba7ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 4vw, 43px); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 21px; line-height: 1.2; letter-spacing: -.025em; }
h3 { margin-bottom: 6px; font-size: 16px; }
p { color: var(--muted); line-height: 1.56; }
.muted { color: var(--muted); }

.icon-button {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  cursor: pointer;
  font-size: 22px;
}
.icon-button:active { transform: rotate(35deg); }

.subscription-hero {
  min-height: 315px;
  padding: clamp(26px, 5vw, 50px);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: center;
  background:
    linear-gradient(128deg, rgba(32, 74, 188, .98), rgba(94, 68, 210, .96) 58%, rgba(25, 151, 183, .9)),
    var(--surface);
  box-shadow: 0 28px 90px rgba(30, 53, 150, .3);
}
.subscription-hero::before {
  content: "";
  position: absolute;
  width: 420px; height: 420px; right: -170px; top: -180px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: 0 0 0 58px rgba(255,255,255,.035), 0 0 0 116px rgba(255,255,255,.025);
}
.subscription-hero.inactive { filter: saturate(.72); background: linear-gradient(128deg, #2b3448, #3f3b62 60%, #244d59); }
.hero-copy { position: relative; z-index: 2; max-width: 620px; }
.hero-copy h2 { margin: 18px 0 10px; font-size: clamp(28px, 4vw, 42px); color: #fff; }
.hero-copy p { max-width: 560px; color: rgba(255,255,255,.78); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.status-pill {
  width: fit-content;
  min-height: 31px;
  padding: 6px 11px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: rgba(5, 13, 33, .24);
  font-size: 12px;
  font-weight: 850;
}
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.status-pill.active i, .status-pill.online i { background: var(--success); box-shadow: 0 0 0 5px rgba(66,215,160,.15); }
.status-pill.inactive i { background: var(--danger); }
.status-pill.loading i { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.status-pill.online { color: var(--text); background: var(--surface); border-color: var(--line); }

.access-orbit {
  position: relative;
  z-index: 1;
  width: 260px; height: 260px;
  display: grid; place-items: center;
  justify-self: end;
}
.orbit-ring {
  position: absolute; inset: 12px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.27);
  box-shadow: inset 0 0 45px rgba(255,255,255,.06), 0 0 0 23px rgba(255,255,255,.035);
}
.orbit-ring::before, .orbit-ring::after {
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 20px rgba(255,255,255,.9);
}
.orbit-ring::before { top: 26px; right: 35px; }
.orbit-ring::after { bottom: 23px; left: 37px; }
.orbit-core {
  width: 145px; height: 145px; border-radius: 50%; display: grid; place-items: center;
  align-content: center; color: #fff; background: rgba(5,15,42,.3); border: 1px solid rgba(255,255,255,.24);
  box-shadow: inset 0 0 50px rgba(255,255,255,.08), 0 20px 60px rgba(0,0,0,.2);
  font-size: 29px; font-weight: 950; letter-spacing: -.04em;
}
.orbit-core small { display: block; margin-top: 5px; font-size: 12px; font-weight: 750; letter-spacing: 0; color: rgba(255,255,255,.72); }

.button {
  min-height: 45px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 850;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .45; pointer-events: none; }
.button.primary { color: var(--button-text); background: linear-gradient(130deg, var(--button), #7556e8); box-shadow: 0 10px 24px rgba(91,124,250,.2); }
.button.secondary { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.button.light { color: #25325d; background: #fff; }
.button.glass { color: #fff; border-color: rgba(255,255,255,.24); background: rgba(4,13,40,.2); backdrop-filter: blur(10px); }
.button.danger { color: #ffd9dd; border-color: rgba(255,109,122,.25); background: rgba(255,109,122,.11); }
.button.full { width: 100%; }
.text-button { padding: 5px 0; border: 0; color: var(--link); background: none; cursor: pointer; font-weight: 800; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 17px 0; }
.metric-card, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 16px 46px rgba(0,0,0,.12);
}
.metric-card { min-height: 98px; padding: 18px; display: flex; align-items: center; gap: 14px; }
.metric-icon {
  width: 47px; height: 47px; flex: 0 0 auto; border-radius: 16px; display: grid; place-items: center;
  color: #b9c9ff; background: rgba(91,124,250,.15); font-size: 24px;
}
.metric-card small, .metric-card strong { display: block; }
.metric-card small { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 18px; }
.card { padding: 24px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-heading p { margin: 5px 0 0; font-size: 13px; }
.trial-promo-card {
  margin: 17px 0 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 0, rgba(255, 255, 255, .2), transparent 12rem),
    linear-gradient(125deg, #7050dd, #405fd3 55%, #1689ac);
}
.trial-promo-card p { margin-bottom: 0; color: rgba(255,255,255,.78); }
.trial-promo-card .eyebrow { color: #d8e1ff; }
.trial-promo-card .form-message { grid-column: 2 / -1; margin: -8px 0 0; color: rgba(255,255,255,.84); }
.trial-promo-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 19px;
  background: rgba(255,255,255,.12);
  font-size: 29px;
}
.content-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(290px,.6fr); gap: 17px; }
.stars-payment-card { grid-column: 1 / -1; }
.stars-recurring-row {
  margin: -2px 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-soft);
}
.stars-recurring-row span { display: grid; gap: 3px; }
.stars-recurring-row small { color: var(--muted); }
.stars-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(255, 189, 89, .25);
  border-radius: 12px;
  color: #ffcf6d;
  background: rgba(255, 189, 89, .1);
  font-size: 12px;
  font-weight: 900;
}
.stars-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.star-plan {
  min-height: 102px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--text);
  background: var(--bg-soft);
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}
.star-plan:hover { transform: translateY(-2px); border-color: rgba(255, 189, 89, .5); }
.star-plan strong { margin-top: auto; font-size: 20px; color: #ffd376; }
.star-plan small { margin-top: 4px; color: var(--muted); }
.star-plan.recurring { background: linear-gradient(145deg, rgba(91,124,250,.17), rgba(143,118,255,.09)); }
.compact-steps { margin: 0; padding: 0; display: grid; gap: 11px; list-style: none; }
.compact-steps li { min-height: 66px; padding: 12px; display: flex; align-items: center; gap: 13px; border-radius: 17px; background: var(--bg-soft); border: 1px solid var(--line); }
.compact-steps li > b { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; color: #b9c8ff; background: rgba(91,124,250,.14); }
.compact-steps strong, .compact-steps small { display: block; }
.compact-steps small { margin-top: 4px; color: var(--muted); }
.support-shortcut { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; }
.support-shortcut::after { content: ""; position: absolute; width: 180px; height: 180px; right: -75px; top: -85px; border-radius: 50%; background: rgba(68,199,244,.1); }
.support-shortcut .button { margin-top: auto; }
.support-orb { width: 50px; height: 50px; margin-bottom: 26px; border-radius: 17px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg,#43c8f0,#6657e4); font-size: 24px; font-weight: 900; }

.platform-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 17px; }
.platform-card {
  min-height: 160px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: flex-start; color: var(--text); background: var(--surface); text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
}
.platform-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb,var(--button) 65%,transparent); }
.platform-symbol { width: 47px; height: 47px; margin-bottom: 24px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-soft); font-size: 23px; }
.platform-card strong, .platform-card small { display: block; }
.platform-card small { margin-top: 5px; color: var(--muted); }
.platform-actions { width: 100%; margin-top: auto; padding-top: 17px; display: flex; gap: 7px; }
.platform-actions a {
  flex: 1; min-height: 34px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 11px;
  display: grid; place-items: center; color: var(--text); background: var(--bg-soft); text-decoration: none; font-size: 12px; font-weight: 850;
}
.connection-card { margin-bottom: 17px; }
.secure-label { padding: 6px 9px; border-radius: 9px; color: var(--success); background: rgba(66,215,160,.11); font-size: 11px; font-weight: 900; }
.subscription-link {
  min-height: 53px; margin-bottom: 13px; padding: 15px;
  border: 1px solid var(--line); border-radius: 15px; overflow-wrap: anywhere;
  color: #cbd5ed; background: var(--bg-soft); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.55;
}
.setup-notice { margin-top: 15px; padding: 13px 15px; border-radius: 15px; color: var(--muted); background: rgba(68,199,244,.075); border: 1px solid rgba(68,199,244,.15); line-height: 1.5; font-size: 13px; }
.guide-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.guide-card span { display: block; margin-bottom: 28px; color: #8fa6ff; font-size: 13px; font-weight: 900; letter-spacing: .08em; }
.guide-card p { margin-bottom: 0; }

.device-list { display: grid; gap: 12px; }
.device-card {
  min-height: 92px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 21px;
  display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 14px; background: var(--surface);
}
.device-symbol { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; color: #c9d4ff; background: rgba(91,124,250,.14); font-size: 22px; }
.device-info { min-width: 0; }
.device-info strong { display: block; margin-bottom: 5px; }
.device-info small { color: var(--muted); overflow-wrap: anywhere; }
.device-state { padding: 6px 9px; border-radius: 10px; color: var(--success); background: rgba(66,215,160,.1); font-size: 11px; font-weight: 900; }
.device-state.revoked { color: var(--danger); background: rgba(255,109,122,.1); }

.support-layout { padding: 0; overflow: hidden; }
.chat-head { min-height: 78px; padding: 14px 19px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.support-avatar { width: 45px; height: 45px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(145deg,#42c3e9,#6355e5); font-weight: 950; }
.chat-head > div:nth-child(2) { min-width: 0; }
.chat-head strong, .chat-head small { display: block; }
.chat-head small { margin-top: 4px; color: var(--muted); }
.chat-head > span:last-child { margin-left: auto; color: var(--muted); font-size: 12px; }
.chat-messages {
  height: min(55vh, 520px);
  min-height: 360px;
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background:
    linear-gradient(rgba(8,13,24,.58),rgba(8,13,24,.58)),
    radial-gradient(circle at 20% 20%,rgba(91,124,250,.12),transparent 25rem);
}
.chat-message { max-width: min(78%, 650px); padding: 11px 14px 8px; border-radius: 17px 17px 17px 5px; background: var(--surface-2); box-shadow: 0 8px 22px rgba(0,0,0,.13); }
.chat-message.user { align-self: flex-end; border-radius: 17px 17px 5px 17px; color: #fff; background: linear-gradient(140deg,#5278ea,#7058d8); }
.chat-message p { margin: 0 0 5px; color: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message time { display: block; color: color-mix(in srgb,currentColor 58%,transparent); text-align: right; font-size: 10px; }
.empty-chat, .empty-state { margin: auto; text-align: center; color: var(--muted); }
.empty-chat span, .empty-state span { width: 52px; height: 52px; margin: 0 auto 13px; display: grid; place-items: center; border-radius: 18px; background: rgba(91,124,250,.1); font-size: 25px; }
.empty-chat p, .empty-state p { max-width: 360px; margin-bottom: 0; }
.chat-compose { padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) 48px; gap: 9px; border-top: 1px solid var(--line); }
.chat-compose textarea {
  width: 100%; max-height: 150px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; resize: none;
  outline: none; color: var(--text); background: var(--bg-soft);
}
.chat-compose textarea:focus { border-color: color-mix(in srgb,var(--button) 70%,transparent); }
.send-button { width: 48px; height: 48px; align-self: end; border: 0; border-radius: 16px; color: #fff; background: linear-gradient(140deg,var(--button),#7456e6); cursor: pointer; font-size: 23px; font-weight: 900; }

.profile-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-items: start; }
.profile-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-identity h2, .profile-identity p { margin-bottom: 3px; }
.profile-card dl { margin: 0; display: grid; gap: 9px; }
.profile-card dl div { padding: 12px 0; display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); }
.profile-card dt { color: var(--muted); }
.profile-card dd { margin: 0; font-weight: 800; }
.toggle-list { display: grid; gap: 8px; }
.toggle-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { width: 48px; height: 28px; padding: 3px; border: 0; border-radius: 999px; background: var(--surface-2); cursor: pointer; transition: .18s; }
.switch::after { content: ""; width: 22px; height: 22px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 3px 9px rgba(0,0,0,.2); transition: .18s; }
.switch.on { background: var(--button); }
.switch.on::after { transform: translateX(20px); }
.inline-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
.inline-form input, .inline-form select, .stack-form input, .stack-form textarea, .stack-form select, .admin-toolbar input {
  width: 100%; min-height: 45px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 14px; outline: 0; color: var(--text); background: var(--bg-soft);
}
.stack-form { display: grid; gap: 10px; }
.stack-form textarea { resize: vertical; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.form-message.ok { color: var(--success); }
.form-message.error { color: var(--danger); }

.admin-tabs { margin-bottom: 17px; padding: 5px; border: 1px solid var(--line); border-radius: 17px; display: flex; gap: 5px; width: fit-content; max-width: 100%; overflow-x: auto; background: var(--surface); }
.admin-tabs { scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button { min-height: 39px; padding: 7px 15px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; white-space: nowrap; }
.admin-tabs button.active { color: #fff; background: linear-gradient(130deg,var(--button),#7456e6); }
.admin-panel { display: none; }
.admin-panel.active { display: block; animation: view-in .2s ease both; }
.admin-metrics { display: grid; grid-template-columns: repeat(4,1fr); gap: 13px; margin-bottom: 16px; }
.admin-metric { min-height: 128px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.admin-metric small { color: var(--muted); }
.admin-metric strong { display: block; margin: 17px 0 4px; font-size: 30px; letter-spacing: -.04em; }
.admin-metric span { color: #8fa6ff; font-size: 12px; }
.server-list, .admin-list { display: grid; gap: 9px; }
.server-row, .admin-row {
  min-height: 62px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 13px; background: var(--bg-soft);
}
.admin-row { width: 100%; color: var(--text); text-align: left; cursor: pointer; }
.admin-row:hover { border-color: color-mix(in srgb,var(--button) 58%,transparent); }
.admin-row strong, .admin-row small, .server-row strong, .server-row small { display: block; }
.admin-row small, .server-row small { margin-top: 4px; color: var(--muted); }
.server-health { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(66,215,160,.1); }
.server-health.down { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,109,122,.1); }
.panel-monitor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.panel-monitor-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-soft);
}
.panel-monitor-card.attention { border-color: rgba(255,109,122,.32); }
.panel-monitor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-monitor-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-monitor-title strong, .panel-monitor-title small { display: block; }
.panel-monitor-title small { margin-top: 4px; color: var(--muted); }
.panel-score { padding: 6px 9px; border-radius: 10px; color: var(--success); background: rgba(66,215,160,.1); font-size: 11px; font-weight: 900; }
.panel-score.attention { color: var(--danger); background: rgba(255,109,122,.1); }
.resource-list { display: grid; gap: 9px; }
.resource-row { display: grid; grid-template-columns: 61px minmax(0,1fr) 38px; align-items: center; gap: 8px; font-size: 11px; }
.resource-row > span:first-child { color: var(--muted); }
.resource-bar { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.resource-bar i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg,var(--cyan),var(--violet)); }
.resource-bar i.hot { background: linear-gradient(90deg,var(--warning),var(--danger)); }
.panel-kpis { margin-top: 14px; display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; }
.panel-kpis div { padding: 9px 6px; border-radius: 12px; text-align: center; background: var(--surface); }
.panel-kpis strong, .panel-kpis small { display: block; }
.panel-kpis small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.panel-network { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.panel-warning { margin: 11px 0 0; padding: 9px 10px; border-radius: 12px; color: #ffd38a; background: rgba(255,189,89,.09); font-size: 11px; }
.panel-inbounds { margin: 12px 0 0; }
.panel-inbounds summary { color: var(--link); cursor: pointer; font-size: 12px; font-weight: 800; }
.panel-inbound-list { margin-top: 9px; display: grid; gap: 6px; }
.panel-inbound-row { padding: 8px 9px; border-radius: 11px; display: flex; justify-content: space-between; gap: 8px; background: var(--surface); font-size: 11px; }
.reconciliation-note { margin: -4px 0 13px; color: var(--muted); font-size: 12px; }
.live-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.live-dot.online { background: var(--success); box-shadow: 0 0 0 4px rgba(66,215,160,.1); }
.panel-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.panel-tag { padding: 3px 6px; border-radius: 7px; color: #aebeff; background: rgba(91,124,250,.11); font-size: 9px; font-weight: 800; }
.panel-client-list { display: grid; gap: 7px; margin: 14px 0; }
.panel-client-row { padding: 10px; border-radius: 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-soft); }
.panel-client-row small, .panel-client-row strong { display: block; overflow-wrap: anywhere; }
.panel-client-row small { margin-top: 3px; color: var(--muted); }
.danger-zone {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid rgba(255,109,122,.28);
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255,109,122,.07);
}
.danger-zone strong, .danger-zone small { display: block; }
.danger-zone small { max-width: 650px; margin-top: 5px; color: var(--muted); line-height: 1.45; }
.danger-zone .button { flex: 0 0 auto; }
.success-state > span { color: var(--success); }
.admin-toolbar { margin-bottom: 14px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
.search-field { min-height: 45px; padding-left: 13px; border: 1px solid var(--line); border-radius: 14px; display: flex; align-items: center; gap: 6px; background: var(--bg-soft); }
.search-field input { border: 0; background: transparent; padding-left: 5px; }
.detail-card { margin-top: 16px; min-height: 160px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 17px; }
.detail-stat { padding: 12px; border-radius: 15px; background: var(--bg-soft); }
.detail-stat small, .detail-stat strong { display: block; }
.detail-stat small { color: var(--muted); }
.detail-stat strong { margin-top: 5px; }
.ticket-workspace { display: grid; grid-template-columns: minmax(280px,.7fr) minmax(0,1.3fr); gap: 16px; align-items: start; }
.admin-ticket-detail { min-height: 420px; }
.admin-ticket-messages { max-height: 390px; margin: 15px 0; padding: 14px; overflow-y: auto; display: grid; gap: 9px; border-radius: 16px; background: var(--bg-soft); }
.admin-ticket-message { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.admin-ticket-message.user { border-left: 3px solid var(--cyan); }
.admin-ticket-message.admin { border-left: 3px solid var(--violet); }
.admin-ticket-message small { color: var(--muted); }
.tools-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-items: start; }
.admin-list.compact { margin-top: 15px; max-height: 300px; overflow-y: auto; }
.panel-config-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr); gap: 16px; align-items: start; }
.panel-config-row { padding: 14px 0; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-config-row:first-child { padding-top: 0; }
.panel-config-row:last-child { padding-bottom: 0; border-bottom: 0; }
.panel-config-meta > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel-config-meta strong, .panel-config-meta small { display: block; }
.panel-config-meta small { margin-top: 5px; color: var(--muted); overflow-wrap: anywhere; }
.panel-source { padding: 4px 7px; border-radius: 999px; color: #aebeff; background: rgba(91,124,250,.13); font-size: 10px; font-weight: 850; }
.panel-name-editor { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.panel-name-editor input {
  min-width: 0; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 13px; outline: 0; color: var(--text); background: var(--bg-soft);
}
.check-row { padding: 11px 12px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); cursor: pointer; }
.check-row input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--button); }
.check-row span, .check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 3px; color: var(--muted); line-height: 1.4; }

.skeleton { min-height: 110px; border-radius: 20px; background: linear-gradient(100deg,var(--surface) 30%,var(--surface-2) 50%,var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.3s infinite; }
.skeleton.tall { min-height: 180px; }
@keyframes shimmer { to { background-position: -150% 0; } }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: rgba(20,30,50,.94); box-shadow: var(--shadow); animation: toast-in .22s ease both; }
.toast.error { border-color: rgba(255,109,122,.35); }
@keyframes toast-in { from { opacity: 0; transform: translateY(9px); } }

/* Browser login */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 13% 10%,rgba(81,113,240,.25),transparent 30rem),
    radial-gradient(circle at 88% 90%,rgba(56,190,222,.16),transparent 30rem),
    #080d18;
}
.auth-shell { width: min(1080px,100%); min-height: 650px; display: grid; grid-template-columns: 1.15fr .85fr; border: 1px solid rgba(255,255,255,.1); border-radius: 34px; overflow: hidden; background: rgba(14,22,39,.86); box-shadow: 0 40px 120px rgba(0,0,0,.42); backdrop-filter: blur(20px); }
.auth-story { padding: clamp(34px,6vw,72px); display: flex; flex-direction: column; background: linear-gradient(145deg,rgba(33,70,170,.56),rgba(21,28,55,.35)); }
.auth-copy { margin: auto 0; max-width: 610px; }
.auth-copy h1 { font-size: clamp(39px,6vw,66px); }
.auth-copy p { max-width: 550px; font-size: 18px; }
.auth-benefits { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.auth-benefits div { padding: 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.045); }
.auth-benefits b, .auth-benefits span { display: block; }
.auth-benefits b { margin-bottom: 18px; color: #98acff; font-size: 12px; }
.auth-benefits span { font-size: 13px; font-weight: 750; }
.auth-card { padding: clamp(30px,5vw,55px); display: flex; flex-direction: column; justify-content: center; }
.auth-card-head { margin-bottom: 25px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(66,215,160,.12); }
.auth-card h2 { font-size: 30px; }
.auth-card .button.primary { margin-top: 17px; }
.auth-separator { margin: 25px 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 11px; align-items: center; color: var(--muted); font-size: 11px; }
.auth-separator::before, .auth-separator::after { content: ""; height: 1px; background: var(--line); }
.field { display: grid; gap: 7px; margin-bottom: 11px; color: var(--muted); font-size: 12px; font-weight: 800; }
.field input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 14px; outline: 0; color: var(--text); background: var(--bg-soft); }
.auth-footnote { margin: 20px 0 0; font-size: 11px; text-align: center; }
.auth-mode-toggle { margin: 14px auto 0; }
.miniapp-loader { height: 24px; display: flex; align-items: center; gap: 5px; }
.miniapp-loader span { width: 6px; height: 6px; border-radius: 50%; background: #8fa6ff; animation: loader 1s infinite; }
.miniapp-loader span:nth-child(2) { animation-delay: .13s; }
.miniapp-loader span:nth-child(3) { animation-delay: .26s; }
@keyframes loader { 50% { transform: translateY(-5px); opacity: .45; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 205px minmax(0,1fr); }
  .content { padding-inline: 25px; }
  .subscription-hero { grid-template-columns: minmax(0,1fr) 220px; }
  .access-orbit { width: 210px; height: 210px; }
  .orbit-core { width: 125px; height: 125px; }
  .admin-metrics, .platform-grid { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 760px) {
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .content { padding: calc(75px + env(safe-area-inset-top)) 14px calc(95px + env(safe-area-inset-bottom)); }
  .mobile-header {
    position: fixed; z-index: 40; inset: 0 0 auto;
    min-height: calc(64px + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--line); background: color-mix(in srgb,var(--bg) 88%,transparent); backdrop-filter: blur(22px);
  }
  .mobile-header .brand-lockup { font-size: 18px; }
  .mobile-header .brand-mark { width: 35px; height: 35px; border-radius: 12px; }
  .role-pill { padding: 6px 9px; border-radius: 10px; color: #b7c6ff; background: rgba(91,124,250,.12); font-size: 11px; font-weight: 850; }
  .bottom-nav {
    position: fixed; z-index: 50; inset: auto 0 0;
    min-height: calc(67px + env(safe-area-inset-bottom)); padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    display: flex; align-items: flex-start; justify-content: space-around;
    border-top: 1px solid var(--line); background: color-mix(in srgb,var(--bg) 90%,transparent); backdrop-filter: blur(24px);
  }
  .bottom-nav button { min-width: 56px; padding: 3px 7px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; display: grid; justify-items: center; gap: 2px; cursor: pointer; }
  .bottom-nav button span { font-size: 21px; line-height: 1; }
  .bottom-nav button small { font-size: 9px; font-weight: 800; }
  .bottom-nav button.active { color: #9fb2ff; background: rgba(91,124,250,.12); }
  .page-heading { min-height: 0; margin-bottom: 17px; }
  .page-heading p { margin-bottom: 0; }
  h1 { font-size: 30px; }
  .subscription-hero { min-height: 405px; padding: 24px; grid-template-columns: 1fr; }
  .access-orbit { position: absolute; width: 180px; height: 180px; right: -38px; top: -34px; opacity: .42; }
  .orbit-core { width: 104px; height: 104px; font-size: 23px; }
  .hero-copy { align-self: end; }
  .hero-copy h2 { font-size: 31px; max-width: 80%; }
  .hero-actions .button { flex: 1 1 140px; }
  .metric-grid { grid-template-columns: 1fr; gap: 9px; }
  .metric-card { min-height: 76px; }
  .content-grid, .profile-grid, .guide-grid, .tools-grid, .ticket-workspace, .panel-config-layout { grid-template-columns: 1fr; }
  .trial-promo-card { grid-template-columns: auto minmax(0,1fr); }
  .trial-promo-card .button { grid-column: 1 / -1; width: 100%; }
  .trial-promo-card .form-message { grid-column: 1 / -1; }
  .platform-grid { grid-template-columns: repeat(2,1fr); }
  .platform-card { min-height: 138px; padding: 17px; }
  .platform-symbol { margin-bottom: 18px; }
  .card { padding: 19px; border-radius: 21px; }
  .chat-messages { height: calc(100dvh - 570px); min-height: 220px; padding: 14px; }
  .chat-message { max-width: 88%; }
  .admin-metrics { grid-template-columns: repeat(2,1fr); }
  .panel-monitor-grid { grid-template-columns: 1fr; }
  .admin-tabs { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
  .admin-tabs button { white-space: normal; }
  .admin-metric { min-height: 105px; }
  .admin-metric strong { font-size: 25px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .toast-region { inset: auto 12px calc(80px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .auth-page { padding: 0; place-items: stretch; }
  .auth-shell { min-height: 100dvh; display: block; border: 0; border-radius: 0; }
  .auth-story { min-height: 310px; padding: 28px 23px; }
  .auth-copy { margin: 58px 0 20px; }
  .auth-copy h1 { font-size: 40px; }
  .auth-copy p { font-size: 15px; }
  .auth-benefits { display: none; }
  .auth-card { padding: 31px 23px calc(31px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .platform-grid { grid-template-columns: 1fr; }
  .platform-card { min-height: 104px; display: grid; grid-template-columns: 48px 1fr; column-gap: 13px; align-content: center; }
  .platform-symbol { grid-row: span 2; margin: 0; }
  .platform-actions { grid-column: 1 / -1; }
  .button-row .button { width: 100%; }
  .inline-form, .admin-toolbar { grid-template-columns: 1fr; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .panel-name-editor { grid-template-columns: 1fr; }
  .panel-name-editor .button { width: 100%; }
}

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