:root {
  --bg: #0f172a;
  --surface: #111827;
  --panel: #1e293b;
  --panel-strong: #273449;
  --line: #334155;
  --muted: #94a3b8;
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --accent: #14b8a6;
  --accent-strong: #0f766e;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --gray: #64748b;
  --shadow: 0 24px 60px rgba(2, 6, 23, 0.42);
  --radius: 8px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 360px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-box {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: #ecfeff;
  font-weight: 800;
  font-size: 24px;
}

.brand-mark.compact {
  width: 38px;
  height: 38px;
  margin: 0;
  font-size: 18px;
}

.auth-box h1 {
  margin: 16px 0 10px;
  color: #99f6e4;
  text-align: center;
  font-size: 28px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1220;
  margin-bottom: 20px;
}

.tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
}

.tab.active {
  background: var(--accent-strong);
  color: var(--text);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1220;
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

.form-message {
  min-height: 36px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(239, 68, 68, 0.34);
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.35;
}

.form-message.success {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.1);
  color: #bbf7d0;
}

.form-message:empty {
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
}

.btn,
.nav-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: var(--panel-strong);
  font-weight: 800;
  white-space: nowrap;
}

.btn.primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn.secondary,
.nav-button {
  background: #152033;
  border-color: var(--line);
  color: var(--text-soft);
}

.btn.wide {
  width: 100%;
}

.topbar {
  min-height: 70px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: #0b1220;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-button.active {
  background: rgba(20, 184, 166, 0.16);
  border-color: rgba(20, 184, 166, 0.42);
  color: var(--text);
}

.profile-content {
  width: min(1180px, calc(100% - 48px));
  margin: 26px auto;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.22);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  color: #99f6e4;
}

.license-panel {
  min-height: 285px;
}

.license-panel.active {
  border-color: rgba(34, 197, 94, 0.46);
}

.license-panel.expired {
  border-color: rgba(239, 68, 68, 0.46);
}

.license-panel.none {
  border-color: rgba(100, 116, 139, 0.58);
}

.license-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.license-status {
  display: grid;
  gap: 10px;
}

.license-status strong {
  font-size: 40px;
  line-height: 1;
}

.license-status span {
  color: var(--text-soft);
}

.license-progress {
  width: 100%;
  height: 12px;
  margin: 20px 0 12px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: #0b1220;
}

.license-progress::-webkit-progress-bar {
  background: #0b1220;
}

.license-progress::-webkit-progress-value {
  background: var(--green);
  border-radius: 999px;
}

.license-progress::-moz-progress-bar {
  background: var(--green);
  border-radius: 999px;
}

.license-panel.expired .license-progress::-webkit-progress-value {
  background: var(--red);
}

.license-panel.expired .license-progress::-moz-progress-bar {
  background: var(--red);
}

.license-panel.none .license-progress::-webkit-progress-value {
  background: var(--gray);
}

.license-panel.none .license-progress::-moz-progress-bar {
  background: var(--gray);
}

.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.nick-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.good {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.32);
}

.badge.warn {
  color: #fed7aa;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.32);
}

.badge.danger {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.32);
}

.badge.gray {
  color: #cbd5e1;
  background: rgba(100, 116, 139, 0.14);
  border-color: rgba(100, 116, 139, 0.32);
}

.badge.info {
  color: #99f6e4;
  background: rgba(20, 184, 166, 0.16);
  border-color: rgba(20, 184, 166, 0.38);
}

.muted {
  color: var(--muted);
}

.notice {
  margin: 18px 0 0;
  padding: 12px 13px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #fed7aa;
  border-radius: var(--radius);
}

.loader-row,
.empty-state {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(248, 250, 252, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 14px;
  height: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 13px 14px;
  border-radius: var(--radius);
  background: #0b1220;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.5);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.6);
}

.toast.warning {
  border-color: rgba(245, 158, 11, 0.6);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(2, 6, 23, 0.76);
}

.confirm-panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.confirm-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-panel p {
  margin: 0 0 18px;
  color: var(--text-soft);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 20px;
  }

  .profile-content {
    width: min(100% - 32px, 1180px);
  }
}

@media (max-width: 520px) {
  .auth-view {
    padding: 20px;
  }

  .auth-box {
    padding: 22px;
  }

  .kv {
    grid-template-columns: 1fr;
  }

  .license-status strong {
    font-size: 32px;
  }
}
