:root {
  color-scheme: dark;
  --accent: #2aabee;
  --accent-text: #ffffff;
  --bg: #111315;
  --surface: #1c1f22;
  --surface-alt: #24282d;
  --surface-pressed: #2c3136;
  --text: #ffffff;
  --muted: #8f969e;
  --line: #343a40;
  --success: #32c48d;
  --warning: #e7b55e;
  --danger: #ee6868;
  --nav-height: 54px;
  --radius: 15px;
  --ease-ios: cubic-bezier(.32, .72, 0, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; }
html { background: var(--bg); }
body { margin: 0; min-width: 300px; min-height: 100dvh; overflow: hidden; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 20px; height: 20px; display: block; flex: none; }
.icon-loader { animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.launch-screen, .locked-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 28px; text-align: center; color: var(--muted); }
.launch-screen .icon { width: 26px; height: 26px; color: var(--accent); }
.launch-screen p { margin: 0; font-size: 13px; }
.locked-screen > .icon { width: 38px; height: 38px; color: var(--danger); }
.locked-screen h1 { margin: 0; color: var(--text); font-size: 21px; }
.locked-screen p { max-width: 300px; margin: 0; line-height: 1.45; }

.app-shell { width: min(100%, 680px); height: 100dvh; min-height: 0; margin: 0 auto; padding: max(9px, env(safe-area-inset-top)) 10px calc(var(--nav-height) + 17px + env(safe-area-inset-bottom)); overflow: hidden; }
.page { height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }

.detail-head { min-height: 40px; display: grid; grid-template-columns: 36px minmax(0,1fr) 36px; align-items: center; margin-bottom: 10px; }
.detail-head h2 { grid-column: 2; margin: 0; overflow: hidden; font-size: 17px; line-height: 1.2; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.back-button { grid-column: 1; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: transparent; color: var(--accent); cursor: pointer; transition: transform 150ms var(--ease-ios), background 160ms ease-out; }
.back-button:active { background: var(--surface-alt); transform: scale(.94); }
.detail-subtitle { margin: -5px 0 10px; color: var(--muted); font-size: 12px; text-align: center; }

.home-stage { min-height: 100%; display: grid; place-items: center; }
.home-stage .hero { width: 100%; }
.hero { position: relative; padding: 15px; background: var(--surface); border-radius: var(--radius); }
.hero-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .45px; text-transform: uppercase; }
.expiry { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: -.45px; }
.status-dot { position: absolute; top: 15px; right: 15px; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.active { background: var(--success); box-shadow: 0 0 5px var(--success), 0 0 10px color-mix(in srgb, var(--success) 60%, transparent); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 5px var(--danger), 0 0 10px color-mix(in srgb, var(--danger) 55%, transparent); }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 15px 0 13px; }
.stat-block + .stat-block { padding-left: 15px; }
.stat-block small { display: block; color: var(--muted); font-size: 11px; }
.stat-block strong { display: block; margin-top: 4px; font-size: 16px; }
.traffic-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 11px; }
.traffic-row span { color: var(--muted); }
.progress { height: 5px; overflow: hidden; border-radius: 3px; background: var(--surface-alt); }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 190ms ease-out; }
.compact-stack { display: grid; gap: 7px; margin-top: 13px; }
.subscription-empty { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.subscription-empty h2 { margin: 9px 0 11px; font-size: 18px; }
.subscription-empty .compact-stack { width: min(100%, 320px); }
.empty-state-icon { width: 50px; height: 50px; display: grid; place-items: center; color: var(--muted); }
.empty-state-icon .icon { width: 36px; height: 36px; }

.primary, .secondary, .danger-button, .text-button { min-height: 40px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 11px; font-size: 13px; font-weight: 680; line-height: 1.15; cursor: pointer; transition: transform 150ms var(--ease-ios), background 160ms ease-out, color 160ms ease-out, opacity 150ms ease-out; }
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: var(--surface-alt); color: var(--text); }
.danger-button { background: var(--danger); color: #ffffff; }
.text-button { min-height: 34px; padding: 0 7px; color: var(--accent); background: transparent; }
.primary:active, .secondary:active, .danger-button:active { transform: scale(.97); opacity: .9; }
.primary:disabled, .secondary:disabled { opacity: .42; cursor: default; }
.primary .icon, .secondary .icon, .danger-button .icon { width: 18px; height: 18px; }
.full-width { width: 100%; }
.top-gap { margin-top: 10px; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 15px 2px 8px; }
.section-title h3 { margin: 0; font-size: 14px; }
.section-title span { color: var(--muted); font-size: 12px; }
.list { overflow: hidden; background: var(--surface); border-radius: var(--radius); }
.list-row { width: 100%; min-height: 51px; padding: 8px 10px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 9px; color: var(--text); background: transparent; text-align: left; cursor: pointer; transition: background 160ms ease-out, transform 150ms var(--ease-ios); }
.list-row:hover { background: var(--surface-alt); }
.list-row:active { transform: scale(.992); }
.list-row .icon-box { width: 28px; height: 28px; display: grid; place-items: center; color: var(--accent); }
.list-row .icon-box .icon { width: 19px; height: 19px; }
.list-row strong { display: block; font-size: 13px; }
.list-row small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.list-row .chevron { color: var(--muted); }
.list-row .chevron .icon, .list-row > .icon { width: 17px; height: 17px; }

.tariffs-stage { padding-bottom: 4px; }
.tariff-list { display: grid; gap: 8px; }
.tariff { position: relative; width: 100%; padding: 13px; background: var(--surface); color: var(--text); border-radius: var(--radius); text-align: left; cursor: pointer; transition: transform 160ms var(--ease-ios), background 180ms ease-out, box-shadow 180ms ease-out; }
.tariff:hover { background: color-mix(in srgb, var(--surface) 88%, var(--surface-alt)); }
.tariff:active { transform: scale(.985); }
.tariff.selected { background: color-mix(in srgb, var(--surface) 86%, var(--accent)); box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 11%, transparent); }
.tariff-badge { position: absolute; top: 11px; right: 11px; color: var(--accent); font-size: 10px; font-weight: 700; }
.tariff h3 { margin: 0 68px 4px 0; font-size: 17px; }
.tariff p { min-height: 17px; margin: 0; color: var(--muted); font-size: 12px; }
.tariff-meta { display: flex; flex-wrap: wrap; gap: 9px; margin: 12px 0; color: var(--muted); font-size: 11px; }
.tariff-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tariff-meta .icon { width: 15px; height: 15px; }
.tariff-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-size: 19px; font-weight: 760; letter-spacing: -.3px; }
.tariff-selection { min-width: 70px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--accent); font-size: 10px; font-weight: 700; }
.tariff-selection .icon { width: 15px; height: 15px; }
.tariff-pay { width: 100%; margin-top: 10px; }

.support-intro { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 10px; }
.support-intro p { max-width: 58%; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.support-intro .primary { flex: none; }
.ticket-row { grid-template-columns: 30px minmax(0,1fr) auto; }
.admin-ticket-row { grid-template-columns: minmax(0,1fr) auto; }
.ticket-copy { min-width: 0; }
.ticket-side { display: grid; justify-items: end; gap: 3px; }
.ticket-time { color: var(--muted); font-size: 9px; }
.status { display: inline-flex; align-items: center; min-height: 21px; padding: 3px 7px; border-radius: 7px; background: var(--surface-alt); color: var(--muted); font-size: 10px; font-weight: 650; white-space: nowrap; }
.status.active, .status.online, .status.succeeded { color: var(--success); }
.status.pending, .status.answered, .status.processing { color: var(--warning); }
.status.failed, .status.offline, .status.closed { color: var(--danger); }
.page-ticket { overflow: hidden; }
.ticket-layout { height: 100%; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.ticket-context { display: flex; justify-content: center; margin: -5px 0 9px; }
.chat { min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 3px 2px 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.bubble { align-self: flex-start; max-width: min(84%, 440px); padding: 8px 10px; border-radius: 12px 12px 12px 4px; background: var(--surface-alt); line-height: 1.35; overflow-wrap: anywhere; animation: message-in 180ms var(--ease-ios) both; }
.bubble.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--accent); color: var(--accent-text); }
.bubble strong { display: block; margin-bottom: 2px; font-size: 10px; opacity: .7; }
.bubble p { margin: 0; font-size: 13px; white-space: pre-wrap; }
.bubble time, .bubble small { display: block; margin-top: 4px; font-size: 9px; opacity: .58; text-align: right; }
.chat-compose { position: relative; width: 100%; padding: 5px; display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 5px; background: var(--surface); border-radius: 13px; box-shadow: 0 9px 28px #00000033; transition: background 160ms ease-out, box-shadow 180ms ease-out; }
.chat-compose:focus-within { background: var(--surface-alt); box-shadow: 0 12px 34px #0000004d; }
.chat-compose input { width: 100%; min-width: 0; height: 40px; padding: 0 9px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border-radius: 10px; background: var(--accent); color: var(--accent-text); cursor: pointer; transition: transform 150ms var(--ease-ios), opacity 150ms ease-out; }
.icon-button:active { transform: scale(.92); opacity: .86; }
.icon-button:disabled { opacity: .58; }
.icon-button .icon { width: 18px; height: 18px; }
@keyframes message-in { from { opacity: .72; transform: translateY(5px) scale(.99); } }

.profile-plain { display: grid; justify-items: center; gap: 9px; padding: 18px 0 21px; text-align: center; }
.profile-avatar { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; background: var(--surface-alt); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 23%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 62%, transparent); }
.profile-avatar.avatar-fallback { display: grid; place-items: center; font-size: 21px; font-weight: 750; }
.profile-plain strong { max-width: 90%; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }

.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: max(7px, env(safe-area-inset-bottom)); width: min(calc(100% - 20px), var(--nav-width)); height: 50px; padding: 3px 8px; display: grid; grid-template-columns: repeat(var(--nav-count),1fr); transform: translateX(-50%); background: #1a1e22f2; border-radius: 15px; box-shadow: 0 10px 30px #00000044; backdrop-filter: blur(14px); }
.nav-indicator { position: absolute; z-index: 0; top: 3px; left: 8px; width: calc((100% - 16px) / var(--nav-count)); height: 3px; transform: translateX(var(--indicator-x)); transition: transform 190ms var(--ease-ios); pointer-events: none; }
.nav-indicator::after { content: ""; position: absolute; left: 50%; width: 18px; height: 2px; transform: translateX(-50%); background: var(--accent); border-radius: 0 0 3px 3px; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent); }
.nav-button { position: relative; z-index: 1; min-width: 0; min-height: 44px; display: grid; place-items: center; padding: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; transition: color 160ms ease-in-out, transform 180ms var(--ease-ios); }
.nav-button .icon { width: 20px; height: 20px; transition: transform 180ms var(--ease-ios); }
.nav-button.active { color: var(--accent); transform: translateY(1px); }
.nav-button.active .icon { transform: scale(1.08); }
.nav-button:active .icon { transform: scale(.9); }

.modal-backdrop { position: fixed; z-index: 30; inset: 0; padding: 14px; display: grid; place-items: center; background: #00000099; backdrop-filter: blur(7px); animation: backdrop-in 170ms var(--ease-ios) both; }
.modal { width: min(100%, 440px); max-height: min(84dvh, 720px); overflow: auto; padding: 15px; background: var(--surface); border-radius: 17px; box-shadow: 0 22px 70px #00000088; animation: modal-in 200ms var(--ease-ios) both; }
.modal-backdrop.closing { animation: backdrop-out 150ms ease-in both; pointer-events: none; }
.modal-backdrop.closing .modal { animation: modal-out 140ms ease-in both; }
@keyframes backdrop-in { from { opacity: 0; backdrop-filter: blur(0); } }
@keyframes backdrop-out { to { opacity: 0; backdrop-filter: blur(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border-radius: 9px; background: var(--surface-alt); color: var(--muted); cursor: pointer; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }

.field { display: grid; gap: 5px; margin: 10px 0; }
.field label { color: var(--muted); font-size: 11px; font-weight: 620; }
.field input, .field textarea, .field select { width: 100%; min-height: 40px; padding: 9px 10px; border: 0; border-radius: 10px; outline: 0; background: var(--surface-alt); color: var(--text); transition: background 160ms ease-out, box-shadow 160ms ease-out; }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.4; }
.field input:focus, .field textarea:focus, .field select:focus { background: var(--surface-pressed); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 34%, transparent); }
.field-hint { margin: -2px 0 0; color: var(--muted); font-size: 10px; }
.choice-list { display: grid; gap: 7px; }
.choice { min-height: 46px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border-radius: 11px; background: var(--surface-alt); cursor: pointer; transition: background 160ms ease-out, transform 150ms var(--ease-ios); }
.choice:active { transform: scale(.985); }
.choice input { width: 17px; height: 17px; accent-color: var(--accent); }

.switch-row { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--surface-alt); transition: background 160ms ease-out; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; transition: transform 180ms ease-out; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }

.admin-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.metric { padding: 11px; background: var(--surface); border-radius: 12px; }
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin-top: 4px; font-size: 18px; }
.admin-form { padding: 12px; background: var(--surface); border-radius: var(--radius); }
.admin-form h3 { margin: 1px 0 10px; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.order-actions { display: flex; gap: 4px; }
.compact-button { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--surface-alt); color: var(--text); font-size: 12px; font-weight: 650; cursor: pointer; }
.compact-button.accent { background: var(--accent); color: var(--accent-text); }
.compact-button.danger { color: var(--danger); }
.compact-button.icon-only { width: 34px; padding: 0; }
.compact-button .icon { width: 17px; height: 17px; }
.code { padding: 10px; overflow-wrap: anywhere; border-radius: 10px; background: var(--surface-alt); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.45; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.theme-option { padding: 10px; border: 0; border-radius: 11px; background: var(--surface-alt); cursor: pointer; text-align: left; transition: background 160ms ease-out, transform 150ms var(--ease-ios); }
.theme-option.active { background: color-mix(in srgb, var(--surface-alt) 82%, var(--accent)); }
.swatches { display: flex; gap: 4px; margin-bottom: 7px; }
.swatches i { width: 16px; height: 16px; border-radius: 4px; }
.notice { margin: 9px 0; padding: 9px 11px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.4; }

.empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .icon { width: 31px; height: 31px; margin: 0 auto 9px; }
.loading-state { min-height: 94px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.loading-state .icon { width: 24px; height: 24px; color: var(--accent); }
.toast-region { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--nav-height) + 17px + env(safe-area-inset-bottom)); width: min(calc(100% - 20px), 480px); transform: translateX(-50%); pointer-events: none; }
.toast { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: #f4f4f4; color: #171717; box-shadow: 0 10px 30px #00000077; animation: toast-in 150ms ease-out both; font-size: 12px; }
.toast.error { background: var(--danger); color: #ffffff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@media (min-width: 620px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .tariff-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .support-intro { align-items: stretch; flex-direction: column; }
  .support-intro p { max-width: none; }
  .support-intro .primary { align-self: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
