:root {
  --bg: #08090a;
  --bg-glow-1: rgba(94, 106, 210, 0.16);
  --bg-glow-2: rgba(130, 90, 220, 0.10);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #f3f4f6;
  --text-muted: #8a8f98;
  --text-dim: #5a5f66;

  --purple: #5e6ad2;
  --purple-2: #8a63f2;
  --purple-soft: rgba(94, 106, 210, 0.16);
  --green: #4cc38a;
  --green-soft: rgba(76, 195, 138, 0.14);
  --red: #eb5757;
  --red-soft: rgba(235, 87, 87, 0.14);
  --yellow: #e2b93b;
  --yellow-soft: rgba(226, 185, 59, 0.14);

  /* aliases kept for admin.css compatibility */
  --mint: var(--green);
  --blue: var(--purple);

  --radius: 14px;
  --radius-sm: 9px;
  --font-display: 'Manrope', sans-serif;
  --font-body: 'Manrope', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
}

/* ambient background glow, Linear-style aurora */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 480px at 14% -6%, var(--bg-glow-1), transparent 60%),
    radial-gradient(620px 460px at 88% 8%, var(--bg-glow-2), transparent 65%);
  animation: auroraDrift 22s ease-in-out infinite alternate;
}
@keyframes auroraDrift {
  from { opacity: 0.85; transform: translate3d(0, 0, 0) scale(1); }
  to   { opacity: 1; transform: translate3d(0, 14px, 0) scale(1.03); }
}

#app, .app { position: relative; z-index: 1; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  margin: 0 0 0.4em;
  letter-spacing: -0.02em;
}

p { color: var(--text-muted); margin: 0 0 0.6em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
button { font-family: inherit; }
input, select { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------- buttons ---------------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), background 0.2s var(--ease),
    border-color 0.2s var(--ease), filter 0.2s var(--ease), box-shadow 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  position: relative;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 8px 20px -10px rgba(94,106,210,0.7);
}
.btn--primary:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset, 0 14px 28px -12px rgba(94,106,210,0.85); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }
.btn--outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--outline:hover { border-color: var(--purple); transform: translateY(-1px); background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn--ghost:hover { color: var(--text); background: var(--surface-2); }
.btn--green { background: var(--green); color: #06210f; }
.btn--green:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--danger-outline { background: transparent; border-color: rgba(235, 87, 87, 0.4); color: var(--red); }
.btn--danger-outline:hover { background: var(--red-soft); }
.btn--lg { padding: 15px 24px; font-size: 1rem; }
.btn--sm { padding: 7px 14px; font-size: 0.82rem; }
.btn--mini { padding: 4px 12px; font-size: 0.76rem; border-radius: 999px; }
.btn--block { width: 100%; }
.btn--icon { padding: 9px; border-radius: 10px; }

.link-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s var(--ease);
}
.link-btn:hover { color: #b0b9f5; }

.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-3); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------------- toggle switch ---------------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: 999px; transition: background 0.2s var(--ease);
}
.switch .slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 2px;
  background: var(--text-muted); border-radius: 50%; transition: transform 0.2s var(--ease-spring), background 0.2s var(--ease);
}
.switch input:checked + .slider { background: var(--purple-soft); border-color: var(--purple); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--purple); }

/* ---------------- app shell ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex: none;
  background: rgba(13, 14, 16, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar__logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  padding: 6px 8px 18px;
  letter-spacing: -0.02em;
  animation: fadeSlideDown 0.5s var(--ease) both;
}
.sidebar__logo .logo__accent {
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  cursor: pointer;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease-spring);
  animation: fadeSlideDown 0.5s var(--ease) both;
}
.sidebar__nav .nav-btn:nth-child(1) { animation-delay: 0.02s; }
.sidebar__nav .nav-btn:nth-child(2) { animation-delay: 0.06s; }
.sidebar__nav .nav-btn:nth-child(3) { animation-delay: 0.1s; }
.sidebar__nav .nav-btn:nth-child(4) { animation-delay: 0.14s; }
.sidebar__nav .nav-btn:nth-child(5) { animation-delay: 0.18s; }
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn:hover { color: var(--text); background: var(--surface-2); transform: translateX(2px); }
.nav-btn.is-active { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.nav-btn--primary {
  border: none;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px -12px rgba(94,106,210,0.9);
}
.nav-btn--primary:hover { filter: brightness(1.08); transform: translateX(2px) translateY(-1px); }

.sidebar__spacer { flex: 1; }

.sidebar__user {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}
.sidebar__user-email {
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px 6px;
}
.sidebar__user-balance {
  font-family: var(--font-mono);
  color: var(--green);
  font-size: 1rem;
  padding: 0 8px 10px;
}

.app__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.6);
  backdrop-filter: blur(2px);
  z-index: 35;
  animation: fadeIn 0.2s var(--ease);
}
.app__backdrop.is-open { display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(8, 9, 10, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.sidebar-toggle { display: none; }

.search-wrap { position: relative; flex: 1; min-width: 0; max-width: 420px; }
.search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px 10px 38px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.88rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search:focus { outline: none; border-color: var(--purple); background: var(--surface-3); box-shadow: 0 0 0 3px var(--purple-soft); }
.search-wrap svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-dim); pointer-events: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(17, 18, 20, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 30;
  animation: fadeSlideDown 0.16s var(--ease);
}
.search-results.is-open { display: block; }
.search-results__group { padding: 8px 0; }
.search-results__group:not(:last-child) { border-bottom: 1px solid var(--border); }
.search-results__label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); padding: 6px 14px;
}
.search-results__item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; font-size: 0.86rem;
  transition: background 0.12s var(--ease);
}
.search-results__item:hover { background: var(--surface-2); }
.search-results__empty { padding: 16px; text-align: center; }

.topbar__spacer { flex: 1; }

.balance-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  flex: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.balance-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.balance-chip__value { font-family: var(--font-mono); font-size: 0.9rem; }

.discount-ring {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  cursor: default;
}
.discount-ring__badge {
  width: 30px; height: 30px; border-radius: 50%;
  background: conic-gradient(from 180deg, #5e6ad2, #eb5757, #e2b93b, #4cc38a, #5e6ad2);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  animation: spinSlow 6s linear infinite;
}
.discount-ring__badge::after {
  content: "";
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2);
}
.discount-ring__label { font-size: 0.72rem; color: var(--text-muted); line-height: 1.1; }
.discount-ring__value { font-weight: 700; font-size: 0.86rem; line-height: 1.1; }

/* ---------------- view container ---------------- */
.view-container { flex: 1; padding: 24px; max-width: 1080px; width: 100%; margin: 0 auto; }
.view { display: block; }
.view[hidden] { display: none; }
.view:not([hidden]) { animation: viewIn 0.35s var(--ease) both; }

.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 { margin: 0; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-muted);
  font-size: 0.86rem; cursor: pointer; padding: 6px 0; margin-bottom: 4px;
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}
.back-btn[hidden] { display: none; }
.back-btn:hover { color: var(--text); transform: translateX(-2px); }
.back-btn svg { width: 16px; height: 16px; }

/* ---------------- network list ---------------- */
.network-list { display: flex; flex-direction: column; gap: 8px; }
.network-row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease-spring);
  animation: fadeSlideUp 0.4s var(--ease) both;
}
.network-list .network-row:nth-child(1) { animation-delay: 0.02s; }
.network-list .network-row:nth-child(2) { animation-delay: 0.05s; }
.network-list .network-row:nth-child(3) { animation-delay: 0.08s; }
.network-list .network-row:nth-child(4) { animation-delay: 0.11s; }
.network-list .network-row:nth-child(5) { animation-delay: 0.14s; }
.network-list .network-row:nth-child(6) { animation-delay: 0.17s; }
.network-row:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateX(3px); }
.network-row__icon {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; font-weight: 700; color: #fff;
}
.network-row__icon.has-image {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  padding: 6px;
}
.network-icon-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.network-row__name { flex: 1; }
.network-row__chevron { color: var(--text-dim); transition: transform 0.15s var(--ease); }
.network-row:hover .network-row__chevron { transform: translateX(2px); color: var(--purple); }
.network-row__chevron svg { width: 16px; height: 16px; }

/* ---------------- service list ---------------- */
.service-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.service-row:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateX(3px); }
.service-row__star { color: var(--yellow); flex: none; }
.service-row__body { flex: 1; min-width: 0; }
.service-row__name { font-weight: 500; font-size: 0.92rem; }
.service-row__meta { font-size: 0.76rem; color: var(--text-dim); font-family: var(--font-mono); margin-top: 2px; }
.service-row__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.service-row__rate { font-family: var(--font-mono); color: var(--green); white-space: nowrap; font-size: 0.86rem; text-align: right; flex: none; }
.service-row__rate small { display: block; color: var(--text-dim); font-size: 0.68rem; }

.badge {
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge--warn { background: var(--red-soft); color: var(--red); }
.badge--ok { background: var(--green-soft); color: var(--green); }

.empty-state { padding: 40px 16px; text-align: center; animation: fadeIn 0.4s var(--ease); }

/* ---------------- order view ---------------- */
.order-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.order-head__icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 1.1rem;
}
.order-head__icon.has-image {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  padding: 8px;
}
.order-head h2 { font-size: 1.15rem; margin-bottom: 6px; }
.order-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.order-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }

.order-main { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; margin: 14px 0 8px; }
.field-label:first-child { margin-top: 0; }

.qty-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qty-chip {
  position: relative;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.qty-chip:hover { border-color: var(--purple); transform: translateY(-1px); }
.qty-chip.is-active { border-color: var(--purple); background: var(--purple-soft); color: #c3caf7; }
.qty-chip__icon { width: 16px; height: 16px; flex: none; opacity: 0.8; display: flex; align-items: center; justify-content: center; }
.qty-chip__icon.has-image { opacity: 1; }
.qty-chip--custom { color: var(--text-muted); }

.qty-custom { margin-top: 10px; }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="search"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
input:focus { outline: none; border-color: var(--purple); background: var(--surface-3); box-shadow: 0 0 0 3px var(--purple-soft); }
input::placeholder { color: var(--text-dim); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 6px;
}
.toggle-row__label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.info-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-dim);
  font-size: 0.68rem; cursor: help;
}

.drip-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.drip-fields[hidden] { display: none; }
.drip-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }

.promo-field { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.promo-field[hidden] { display: none; }
.promo-field input { flex: 1; min-width: 140px; }
.promo-msg { width: 100%; font-size: 0.8rem; margin: 6px 0 0; }
.promo-msg.is-ok { color: var(--green); }
.promo-msg.is-error { color: var(--red); }

.order-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s var(--ease);
}
.order-summary__row { display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; }
.order-summary__row strong { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); }
.order-summary__price { color: var(--green); font-size: 1.05rem; transition: transform 0.2s var(--ease-spring); }
.order-summary__old { color: var(--text-dim); font-weight: 400; font-size: 0.82rem; }
.discount-badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--red-soft); color: var(--red);
}

.form-error { color: var(--red); font-size: 0.85rem; margin: 8px 0 0; min-height: 1em; }

.order-description {
  width: 100%;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 14px 0 0;
}
.order-description a { color: var(--purple); text-decoration: underline; word-break: break-all; }
.form-ok { color: var(--green); font-size: 0.85rem; margin: 8px 0 0; }

.order-side { display: flex; flex-direction: column; gap: 14px; }
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.side-card:hover { border-color: var(--border-strong); }
.side-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0;
}
.side-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.side-row span:first-child { font-size: 0.82rem; color: var(--text-muted); }
.side-row strong { font-family: var(--font-mono); font-size: 0.86rem; }
.side-row .icon-btn { width: 30px; height: 30px; border-radius: 8px; }

.speed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s var(--ease);
}
.speed-card:hover { border-color: var(--border-strong); }
.speed-gauge { width: 64px; height: 64px; flex: none; }
.speed-label { font-size: 0.78rem; color: var(--text-muted); }
.speed-label strong { display: block; font-size: 1rem; color: var(--text); margin-top: 2px; }

.feature-list { display: flex; flex-direction: column; gap: 8px; }
.feature-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 0.82rem; color: var(--text-muted);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.feature-item:hover { border-color: var(--border-strong); transform: translateX(2px); }
.feature-item svg { width: 16px; height: 16px; flex: none; color: var(--purple); }

/* ---------------- orders (my orders) ---------------- */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
  animation: fadeSlideUp 0.4s var(--ease) both;
}
.order-card:hover { border-color: var(--border-strong); }
.order-card__top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.order-card__name { font-weight: 600; }
.order-card__meta { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-muted); margin-top: 6px; }
.status-pill { font-family: var(--font-mono); font-size: 0.68rem; padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.status-completed { background: var(--green-soft); color: var(--green); }
.status-progress { background: var(--purple-soft); color: #c3caf7; }
.status-partial, .status-awaiting { background: var(--yellow-soft); color: var(--yellow); }
.status-error, .status-fail, .status-canceled { background: var(--red-soft); color: var(--red); }
.order-card__actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------- profile view ---------------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  transition: border-color 0.2s var(--ease);
}
.profile-header:hover { border-color: var(--border-strong); }
.profile-header__avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
}
.profile-header__info { flex: 1; min-width: 160px; }
.profile-header__email { font-weight: 600; font-size: 1.02rem; word-break: break-word; }
.profile-header__since { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.profile-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.topup-note { margin-top: 14px; font-size: 0.82rem; }

.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; max-width: 700px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-card__icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.stat-card__icon svg { width: 17px; height: 17px; }
.stat-card__icon--purple { background: var(--purple-soft); color: #c3caf7; }
.stat-card__icon--green { background: var(--green-soft); color: var(--green); }
.stat-card__icon--yellow { background: var(--yellow-soft); color: var(--yellow); }
.stat-card__value { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 600; }
.stat-card__label { font-size: 0.76rem; color: var(--text-muted); }

/* ---------------- order detail ---------------- */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  transition: border-color 0.2s var(--ease);
}
.detail-card:hover { border-color: var(--border-strong); }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; }
.detail-row[hidden] { display: none; }
.detail-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.detail-row span:first-child { font-size: 0.84rem; color: var(--text-muted); flex: none; }
.detail-row strong { font-family: var(--font-mono); font-size: 0.9rem; text-align: right; }
.detail-row__value { display: flex; align-items: center; gap: 6px; }
.detail-row__value .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.detail-link {
  font-family: var(--font-mono); font-size: 0.86rem; color: var(--purple);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-link:hover { color: #b0b9f5; text-decoration: underline; }
.detail-subhead { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin: 20px 0 2px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}
.status-card:hover { border-color: var(--border-strong); }
.status-card__icon {
  width: 52px; height: 52px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 6px;
}
.status-card__icon.has-image { background: var(--surface-3); border: 1px solid var(--border-strong); padding: 10px; }
.status-card__progress { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; }
.status-card__divider { width: 100%; height: 1px; background: var(--border); margin: 16px 0; }
.status-card__line { display: flex; align-items: flex-start; gap: 10px; text-align: left; width: 100%; }
.status-card__lineicon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple-soft); color: #c3caf7;
}
.status-card__lineicon svg { width: 16px; height: 16px; }
.status-card__lineicon--green { background: var(--green-soft); color: var(--green); }
.status-card__lineicon--red { background: var(--red-soft); color: var(--red); }
.status-card__lineicon--yellow { background: var(--yellow-soft); color: var(--yellow); }
.status-card__linetitle { font-weight: 600; font-size: 0.9rem; }
.status-card__linedesc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ---------------- balance history ---------------- */
.balance-history-list { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.balance-history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  transition: border-color 0.15s var(--ease);
}
.balance-history-item:hover { border-color: var(--border-strong); }
.balance-history-item__label { font-weight: 600; }
.balance-history-item__note { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.balance-history-item__date { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; }
.balance-history-item__amount { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.balance-history-item__amount.is-positive { color: var(--green); }
.balance-history-item__amount.is-negative { color: var(--red); }

/* ---------------- topup page ---------------- */
.topup-page-inner { max-width: 460px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; max-width: 360px; }
.auth-form[hidden] { display: none; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }
.auth-tabs { display: flex; gap: 20px; margin-bottom: 20px; }
.auth-tab {
  background: none; border: none; color: var(--text-muted);
  font-family: var(--font-display); font-size: 1rem; cursor: pointer;
  padding-bottom: 6px; border-bottom: 2px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.auth-tab.is-active { color: var(--text); border-color: var(--purple); }

/* ---------------- modal ---------------- */
.modal {
  position: fixed; inset: 0; background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal.is-open { display: flex; animation: fadeIn 0.18s var(--ease); }
.modal__box {
  background: rgba(17, 18, 20, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 30px; width: 100%; max-width: 400px; position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
  animation: modalIn 0.22s var(--ease-spring);
}
.modal__close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  color: var(--text-muted); font-size: 1.4rem; cursor: pointer; line-height: 1;
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}
.modal__close:hover { color: var(--text); transform: rotate(90deg); }

/* ---------------- top-up modal ---------------- */
.modal__box--wide { max-width: 460px; }

.topup-title { margin: 0 0 16px; font-size: 1.05rem; }
.back-btn--modal { margin-bottom: 10px; }

.paymethod-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.paymethod-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}
.paymethod-item:hover { border-color: var(--purple); transform: translateY(-1px); }
.paymethod-item.is-disabled { cursor: not-allowed; opacity: 0.55; }
.paymethod-item.is-disabled:hover { border-color: var(--border); transform: none; }
.paymethod-icon {
  width: 34px; height: 34px; flex: none; border-radius: 9px; object-fit: cover;
}
.paymethod-icon--emoji {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-size: 1.1rem;
}
.paymethod-body { flex: 1; min-width: 0; }
.paymethod-name { font-weight: 600; font-size: 0.9rem; }
.paymethod-sub { font-size: 0.74rem; color: var(--text-muted); margin-top: 3px; line-height: 1.35; }
.paymethod-bonus {
  display: inline-block; margin-top: 6px; font-size: 0.72rem; font-weight: 600;
  color: var(--yellow); background: var(--yellow-soft); padding: 3px 8px; border-radius: 999px;
}
.paymethod-soon { display: inline-block; margin-top: 6px; font-size: 0.72rem; color: var(--text-dim); }
.paymethod-chevron { width: 18px; height: 18px; flex: none; color: var(--text-dim); }

.topup-asset-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.topup-asset-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.topup-asset-btn.is-active { border-color: var(--purple); background: var(--purple-soft); color: #c3caf7; }

.topup-amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.chip-btn {
  padding: 10px 4px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.82rem; cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.chip-btn:hover { border-color: var(--purple); transform: translateY(-1px); }
.chip-btn.is-active { border-color: var(--purple); background: var(--purple-soft); color: #c3caf7; }
.topup-input { margin-bottom: 4px; }

.topup-wait { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0; }
.topup-wait__spinner { width: 40px; height: 40px; color: var(--purple); animation: spinSlow 1s linear infinite; }
.topup-wait__title { font-weight: 600; font-size: 1rem; margin: 4px 0 0; }
.topup-wait__sub { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 8px; }
.topup-wait .btn { width: 100%; }

/* ---------------- toast ---------------- */
.toast-stack {
  position: fixed; bottom: 20px; right: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: rgba(23, 24, 27, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  color: var(--text); padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.86rem; max-width: 320px; box-shadow: 0 14px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s var(--ease-spring);
}
.toast--ok { border-color: rgba(76,195,138,0.4); }
.toast--error { border-color: rgba(235,87,87,0.4); }

/* ---------------- shared keyframes ---------------- */
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeSlideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes spinSlow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; }
  .order-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .search-wrap { order: 3; max-width: none; flex-basis: 100%; }
  .discount-ring__label { display: none; }
}
@media (max-width: 520px) {
  .qty-grid { grid-template-columns: 1fr 1fr; }
  .view-container { padding: 16px; }
  .balance-chip__value { display: none; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body::before { animation: none; }
}

/* ---------------- telegram login ---------------- */
.telegram-login-container { display: flex; margin-top: 4px; min-height: 40px; }

/* ---------------- support chat ---------------- */
.support-chat {
  display: flex;
  flex-direction: column;
  height: min(640px, calc(100vh - 220px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.support-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.support-msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.4;
  animation: fadeSlideUp 0.25s var(--ease) both;
}
.support-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: #fff;
  border-bottom-right-radius: 3px;
}
.support-msg--admin {
  align-self: flex-start;
  background: var(--surface-3);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.support-msg__body { white-space: pre-wrap; word-break: break-word; }
.support-msg__body a { color: inherit; text-decoration: underline; }
.support-msg__time { margin-top: 4px; font-size: 0.7rem; opacity: 0.65; text-align: right; }
.support-chat__form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.support-chat__form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-body);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.support-chat__form input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
