:root {
  color-scheme: dark;
  --bg: #050b0a;
  --bg-soft: #0a1512;
  --panel: rgba(10, 22, 19, 0.88);
  --panel-border: rgba(173, 255, 209, 0.13);
  --text: #f3fff8;
  --muted: #8ba69a;
  --primary: #dfff69;
  --primary-soft: #6cf5c6;
  --success: #65f0b7;
  --warning: #ffd166;
  --danger: #ff6b79;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.38);
}

body.tier-bronze {
  --primary: #e0a06a;
  --primary-soft: #b8734f;
}

body.tier-silver {
  --primary: #d9e3ea;
  --primary-soft: #91a8b8;
}

body.tier-gold {
  --primary: #ffd968;
  --primary-soft: #f2a93b;
}

body.tier-platinum {
  --primary: #9ff4e5;
  --primary-soft: #70b9ef;
}

body.tier-diamond {
  --primary: #9be7ff;
  --primary-soft: #b892ff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 11%, transparent), transparent 34rem),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--primary-soft) 10%, transparent), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.5rem;
  background: rgba(3, 10, 8, 0.82);
  border-right: 1px solid var(--panel-border);
  backdrop-filter: blur(22px);
}

.brand,
.connection-card,
.panel-header,
.topbar,
.button-row,
.account-card-head,
.topbar-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.85rem;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--primary-soft) 18%, transparent);
}

.brand h1 {
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.brand-caption {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.brand h1,
.topbar h2,
.hero-card h3,
.panel h2,
.panel h3,
.auth-hero h1 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.nav {
  display: grid;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.8rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.nav-link:hover,
.nav-link.active {
  border-color: color-mix(in srgb, var(--primary) 24%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--text);
}

.connection-card {
  gap: 0.75rem;
  margin-top: auto;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.74);
}

.connection-card p {
  margin: 0;
  font-size: 0.82rem;
}

.status-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 0.4rem rgba(245, 158, 11, 0.12);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 0.4rem rgba(34, 197, 94, 0.12);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 0.4rem rgba(239, 68, 68, 0.12);
}

.main {
  min-width: 0;
  padding: 2rem;
}

.topbar {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.topbar-actions,
.button-row {
  gap: 0.75rem;
}

.loot-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.65rem 0.78rem;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.loot-pill strong {
  color: var(--primary);
}

.tier-pill,
.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  text-decoration: none;
}

.loot-orb {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--primary) 35%, #52b99a 100%);
  box-shadow: 0 0 1rem rgba(223, 255, 105, 0.45);
}

.user-pill {
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

.language-switch {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.58);
}

.auth-language-switch {
  width: max-content;
  margin: 0;
}

.auth-form-panel {
  max-width: 38rem;
  margin-left: auto;
}

.auth-action-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: rgba(2, 6, 23, 0.38);
}

.auth-action-button {
  min-height: 2.65rem;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-action-button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  color: #04111f;
}

.lang-link {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.lang-link.active {
  background: rgba(56, 189, 248, 0.16);
  color: var(--text);
}

.notice {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 1rem;
  background: rgba(56, 189, 248, 0.1);
  color: #dff6ff;
}

.notice.error {
  border-color: rgba(239, 68, 68, 0.38);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.hero-card,
.metric-card,
.panel,
.auth-hero,
.auth-card {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 11rem;
  margin-bottom: 1rem;
  padding: 1.4rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(130deg, color-mix(in srgb, var(--primary) 10%, transparent), transparent 40%),
    linear-gradient(310deg, color-mix(in srgb, var(--primary-soft) 8%, transparent), transparent 44%),
    var(--panel);
  overflow: hidden;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-actions {
  margin-top: 1.35rem;
}

.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero-card p {
  max-width: 52rem;
}

.hero-card h3 {
  font-size: clamp(2rem, 4vw, 4rem);
  letter-spacing: -0.06em;
}

.hero-metric {
  min-width: 16rem;
  padding: 1.25rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(223, 255, 105, 0.14);
  background: rgba(3, 12, 9, 0.52);
  text-align: right;
}

.hero-metric-label {
  margin-bottom: 0.7rem;
  color: var(--muted);
  font-size: 0.72rem !important;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.allocation-bar {
  height: 0.35rem;
  margin-top: 1.2rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.allocation-bar span {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-soft));
}

.hero-metric span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.hero-metric small {
  color: var(--muted);
}

.metric-grid,
.content-grid,
.form-grid,
.template-grid {
  display: grid;
  gap: 1rem;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-grid.compact {
  grid-template-columns: repeat(2, minmax(17rem, 1fr));
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.template-grid,
.account-list {
  display: grid;
  gap: 1rem;
}

.metric-card,
.panel {
  border-radius: 1.2rem;
}

.metric-card {
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  position: absolute;
  right: -1.4rem;
  bottom: -2.2rem;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: rgba(108, 245, 198, 0.055);
  content: "";
}

.metric-card span {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-card strong {
  font-size: 1.55rem;
}

.metric-card small {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.panel {
  min-width: 0;
  padding: 1.15rem;
}

.panel-header {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h4 {
  margin: 1rem 0 0.2rem;
  color: var(--text);
}

.profile-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.45);
}

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

.profile-list dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.level-panel,
.positions-archive {
  margin-top: 1rem;
}

.strategy-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.strategy-card {
  display: grid;
  gap: 1rem;
}

.strategy-description {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  white-space: pre-line;
}

.strategy-pairs-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border);
}

.current-level-row {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  font-weight: 900;
}

.current-level-row td:first-child {
  color: var(--primary);
}

.wallet-address {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(223, 255, 105, 0.16);
  border-radius: 1rem;
  background: rgba(223, 255, 105, 0.05);
}

.wallet-address span {
  color: var(--muted);
  font-size: 0.8rem;
}

.wallet-address code,
.transaction-hash {
  overflow-wrap: anywhere;
  color: var(--primary);
}

.badge {
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.11);
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

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

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

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.78rem 0.65rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.positive {
  color: var(--success);
}

.negative {
  color: var(--danger);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 2.65rem;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 0.85rem;
  color: #04111f;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
}

.primary-button:disabled,
.danger-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.ghost-button {
  border: 1px solid var(--panel-border);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.small-button {
  min-height: 2.15rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.65rem;
  font-size: 0.86rem;
}

.form,
.inline-form,
.inline-admin-form {
  display: grid;
  gap: 1rem;
}

.form.dense {
  gap: 0.75rem;
}

.form-hint {
  margin: -0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.form label,
.inline-form label,
.template-card label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

.form input,
.form select,
.form textarea,
.inline-form select,
.inline-admin-form input,
.standalone-label select,
.template-card input,
.template-card select,
.template-card textarea {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.85rem;
  outline: none;
  background: rgba(2, 6, 23, 0.42);
  color: var(--text);
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.inline-form select:focus,
.inline-admin-form input:focus,
.standalone-label select:focus,
.template-card input:focus,
.template-card select:focus,
.template-card textarea:focus {
  border-color: color-mix(in srgb, var(--primary) 58%, transparent);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--primary) 9%, transparent);
}

.checkbox-label {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-label input {
  width: auto;
}

.steps {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.account-card,
.template-card {
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.45);
}

.account-card-head {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.account-card-head p {
  margin: 0.25rem 0 0;
}

.strategy-stats,
.pair-tags,
.auth-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.strategy-stats span,
.pair-tags span,
.auth-badges span {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  font-size: 0.82rem;
}

.pair-select option {
  padding: 0.35rem;
}

.standalone-label {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.strategy-pair-tags {
  align-content: flex-start;
  max-height: 28rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.template-card {
  display: grid;
  gap: 0.8rem;
}

.template-options {
  display: grid;
  gap: 0.85rem;
}

.template-options summary {
  color: var(--primary);
  font-weight: 800;
}

.template-card p {
  margin: 0;
}

.inline-admin-form {
  grid-template-columns: minmax(12rem, 1fr) auto;
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  padding: 2rem;
  overflow: hidden;
}

.auth-shell.single {
  display: grid;
  grid-template-columns: minmax(20rem, 42rem);
  justify-content: center;
}

.auth-card {
  border-radius: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.auth-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 8rem);
  margin-top: 1rem;
  padding: clamp(1.5rem, 6vw, 6rem);
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 85% 15%, rgba(223, 255, 105, 0.2), transparent 17rem),
    linear-gradient(145deg, rgba(15, 35, 29, 0.95), rgba(6, 15, 13, 0.96));
}

.auth-hero::after {
  position: absolute;
  right: -8rem;
  bottom: -11rem;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgba(223, 255, 105, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 3rem rgba(108, 245, 198, 0.025), 0 0 0 7rem rgba(223, 255, 105, 0.018);
  content: "";
  pointer-events: none;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.1rem;
}

.auth-brand img {
  width: 2.5rem;
  height: 2.5rem;
}

.auth-hero h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 5vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.auth-dialog {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.auth-dialog.open {
  visibility: visible;
  opacity: 1;
}

.auth-dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 7, 5, 0.78);
  backdrop-filter: blur(14px);
}

.auth-dialog .auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.auth-dialog-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 1.3rem;
}

body.dialog-open {
  overflow: hidden;
}

.auth-hero p {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.auth-market-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(7rem, 1fr) auto;
  gap: 1.2rem;
  align-items: center;
  margin: 2rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(223, 255, 105, 0.12);
  border-radius: 1.2rem;
  background: rgba(3, 10, 8, 0.55);
}

.auth-market-card strong,
.market-symbol {
  display: block;
}

.market-symbol {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.market-change {
  color: var(--success);
  font-weight: 800;
}

.market-sparkline {
  display: flex;
  align-items: end;
  gap: 0.22rem;
  height: 2.8rem;
}

.market-sparkline span {
  flex: 1;
  min-width: 0.24rem;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(to top, rgba(108, 245, 198, 0.18), var(--primary-soft));
}

.market-sparkline span:nth-child(1) { height: 22%; }
.market-sparkline span:nth-child(2) { height: 42%; }
.market-sparkline span:nth-child(3) { height: 34%; }
.market-sparkline span:nth-child(4) { height: 58%; }
.market-sparkline span:nth-child(5) { height: 48%; }
.market-sparkline span:nth-child(6) { height: 72%; }
.market-sparkline span:nth-child(7) { height: 64%; }
.market-sparkline span:nth-child(8) { height: 92%; }

.blocked-panel {
  display: grid;
  gap: 1rem;
}

.blocked-reason {
  padding: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 1rem;
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

@media (max-width: 1080px) {
  .app-shell,
  .content-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main,
  .sidebar,
  .auth-shell {
    padding: 1rem;
  }

  .topbar,
  .hero-card,
  .account-card-head,
  .topbar-actions,
  .auth-topbar,
  .auth-topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-market-card {
    grid-template-columns: 1fr auto;
  }

  .market-sparkline {
    display: none;
  }

  .loot-pill {
    justify-content: center;
  }

  .button-row,
  .form-grid,
  .content-grid.compact,
  .inline-admin-form {
    grid-template-columns: 1fr;
  }

  .hero-metric {
    min-width: 0;
    text-align: left;
  }
}
