* {
  box-sizing: border-box;
}
.hidden {
  display: none !important;
}
:root {
  --bg0: #0a0616;
  --bg1: #100820;
  --grid-a: rgba(139, 92, 246, 0.16);
  --grid-b: rgba(167, 139, 250, 0.07);
  --card: linear-gradient(165deg, rgba(76, 40, 120, 0.38) 0%, rgba(22, 8, 42, 0.92) 100%);
  --stroke: rgba(196, 181, 253, 0.12);
  --stroke-strong: rgba(216, 200, 255, 0.2);
  --text: #f3edff;
  --muted: rgba(210, 198, 240, 0.78);
  --accent: #c4b5fd;
  --accent2: #7c3aed;
  --accent-deep: #5b21b6;
  --radius: 18px;
  --shadow: 0 14px 44px rgba(24, 0, 48, 0.55);
  --glow: rgba(124, 58, 237, 0.35);
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: var(--bg0);
  background-image: linear-gradient(var(--grid-a) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-a) 1px, transparent 1px),
    linear-gradient(var(--grid-b) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-b) 1px, transparent 1px),
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(91, 33, 182, 0.55), transparent 58%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 42%);
  background-size: 40px 40px, 40px 40px, 10px 10px, 10px 10px, 100% 100%, 100% 100%;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: min(440px, 100vw);
  width: 100%;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.hero {
  text-align: center;
  margin-bottom: 8px;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #faf5ff;
  text-shadow: 0 0 40px var(--glow);
}
.sub {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.screen.hidden {
  display: none;
}

.auth-wrap {
  max-width: 440px;
  margin: 0 auto;
}
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(45, 20, 75, 0.45);
  border: 1px solid var(--stroke);
}
.auth-tab {
  flex: 1;
  padding: 12px 14px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: rgba(237, 241, 255, 0.75);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.auth-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.auth-tab.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.55), rgba(91, 33, 182, 0.45));
  color: #fff;
  box-shadow: 0 4px 18px var(--glow);
}
.auth-card {
  padding: 22px 20px 24px;
}
.auth-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.auth-hint {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(215, 222, 247, 0.82);
}
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(215, 222, 247, 0.65);
}
.auth-panel.hidden {
  display: none;
}
label {
  display: block;
  margin: 12px 0;
  color: #d7def7;
  font-size: 14px;
}
input,
select,
button {
  width: 100%;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(14, 20, 36, 0.55);
  color: #f3f6ff;
  padding: 11px 12px;
  font-size: 15px;
}
input::placeholder {
  color: rgba(237, 241, 255, 0.38);
}
input[readonly] {
  cursor: default;
  color: rgba(237, 241, 255, 0.92);
}

select.select-field {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: dark;
  margin-top: 6px;
  padding: 11px 42px 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke-strong);
  background-color: rgba(18, 6, 38, 0.85);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23c4b5fd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
select.select-field:hover {
  border-color: rgba(196, 181, 253, 0.35);
}
select.select-field:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.28);
}
select.select-field option {
  background: #12081f;
  color: #f3edff;
  padding: 10px;
}

.btn-primary {
  margin-top: 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  font-weight: 600;
  font-size: 14px;
  padding: 13px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 22px var(--glow);
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.45);
}
.btn-primary:active {
  transform: scale(0.99);
}

.btn-dash {
  margin-top: 0;
  width: 100%;
  min-height: 46px;
}
.field-with-copy {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  align-items: stretch;
}
.field-with-copy input {
  flex: 1;
  margin-top: 0;
}
.btn-icon {
  width: auto;
  min-width: 100px;
  flex-shrink: 0;
  margin-top: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #edf1ff;
  cursor: pointer;
}
.btn-icon:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(11, 16, 28, 0.65);
  white-space: pre-wrap;
}
.alert.error {
  border-color: rgba(255, 100, 120, 0.45);
  background: rgba(60, 20, 30, 0.45);
}
.alert.success {
  border-color: rgba(100, 220, 160, 0.35);
  background: rgba(20, 50, 40, 0.4);
}
.alert.hidden {
  display: none;
}
.seed-block {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 12, 22, 0.55);
}
.seed-block.hidden {
  display: none;
}
.seed-label {
  margin: 0 0 10px;
  font-size: 13px;
  color: #d7def7;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 180, 80, 0.25);
  border: 1px solid rgba(255, 200, 120, 0.35);
  color: #ffe8c8;
}
.seed-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.seed-row code {
  flex: 1;
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline input {
  width: auto;
  margin: 0;
}
pre {
  white-space: pre-wrap;
  background: rgba(11, 16, 28, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px;
  min-height: 42px;
}
.cabinet-panel {
  margin-top: 12px;
  padding: 14px;
  min-height: 100px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(237, 241, 255, 0.95);
  background: rgba(11, 16, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}
.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.topbar-main {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.topbar-balance {
  flex-shrink: 0;
  text-align: right;
  min-width: 120px;
}

.balance-value {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8ecff;
  letter-spacing: 0.02em;
}

.topbar-identity {
  flex: 1 1 200px;
  min-width: 0;
}

.tiny {
  margin: 0 0 8px;
  font-size: 12px;
  opacity: 0.72;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.current-user {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}

.user-id-pill {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--stroke-strong);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  word-break: break-all;
  color: #e8ecff;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.topbar-actions .btn-secondary {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
}
.badge-soft--block {
  flex: 1 1 100%;
  width: 100%;
  text-align: center;
  padding: 9px 12px;
}

.btn-secondary {
  width: auto;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--stroke-strong);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}
.btn-tight {
  margin-top: 0;
}
@media (max-width: 860px) {
  .grid-2,
  .grid {
    grid-template-columns: 1fr;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 18, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: auto;
}
.modal-box h2 {
  margin: 0 0 10px;
  font-size: 20px;
}
.modal-lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(237, 241, 255, 0.88);
}
.modal-field {
  margin-bottom: 14px;
}
.modal-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.72;
  margin-bottom: 8px;
}
.modal-code-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.modal-code-row code {
  flex: 1;
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  color: #f0f4ff;
}
.modal-code-row--seed code {
  min-height: 88px;
}
.modal-code-row .btn-icon {
  align-self: flex-start;
}
.modal-actions {
  margin-top: 20px;
}
.modal-actions .btn-primary {
  margin-top: 0;
  width: 100%;
}

.modal-actions--split {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.modal-actions--split .btn-primary,
.modal-actions--split .btn-secondary {
  flex: 1;
  margin-top: 0;
}

.badge-soft {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.18);
  border: 1px solid rgba(196, 181, 253, 0.4);
  color: #e9ddff;
}

.badge-tg {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.55);
  color: #bbf7d0;
}

.dash-actions .grid-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.dash-actions .grid-actions .btn-primary {
  margin-top: 0;
}

.section-title {
  margin: 0 0 8px;
  font-size: 17px;
}
.section-lead {
  margin-top: 0 !important;
}

.trial-modal-note {
  margin-top: 0;
  opacity: 0.92;
  font-size: 14px;
  line-height: 1.55;
}

.auto-renew-row {
  margin-top: 4px;
}
.auto-renew-hint {
  margin-top: 6px;
}

.configs-list {
  margin-top: 8px;
}

.config-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.config-item__header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border: none;
  background: rgba(8, 12, 24, 0.45);
  color: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.config-item__header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.config-item__title {
  word-break: break-word;
}
.config-item__chev {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.75;
}
.config-item__body {
  padding: 0 14px 14px;
}
.config-item__body.hidden {
  display: none;
}
.config-item__body:not(.hidden) {
  padding-top: 4px;
}

.config-meta {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: 6px 12px;
  font-size: 14px;
  margin: 0 0 12px;
}
.config-meta dt {
  opacity: 0.75;
  margin: 0;
}
.config-meta dd {
  margin: 0;
  word-break: break-word;
}

.config-row-label {
  margin: 0 0 6px;
  font-size: 12px;
  opacity: 0.75;
}

.config-link-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke-strong);
  background: rgba(20, 8, 40, 0.55);
  color: #d8c8ff;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.config-link-btn:hover {
  border-color: rgba(196, 181, 253, 0.55);
  background: rgba(50, 20, 90, 0.5);
}

.site-footer {
  padding: 24px 4px 12px;
  margin-top: 8px;
}
.footer-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
}
.footer-link {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: #c4b5fd;
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 10px;
  transition: color 0.15s ease, background 0.15s ease;
  word-break: break-word;
  hyphens: auto;
}
.footer-link:hover {
  color: #ede9fe;
  background: rgba(124, 58, 237, 0.15);
  text-decoration: none;
}
@media (min-width: 400px) {
  .footer-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 20px;
  }
  .footer-link {
    width: auto;
    max-width: none;
  }
}

.dashboard-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(480px, 92vw);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 22, 40, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1100;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
}
.dashboard-toast.error {
  border-color: rgba(255, 100, 120, 0.45);
  background: rgba(40, 18, 24, 0.96);
}
.dashboard-toast.hidden {
  display: none;
}
