:root {
  --void: #050505;
  --panel: #141414;
  --panel-2: #1b1b1b;
  --line: #2a2a2a;
  --muted: #8f8f8f;
  --brand: #ff2233;
  --brand-deep: #d2071a;
  --gold: #ffc94a;
  --ok: #37d67a;
  --warn: #ffb020;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--void);
  color: #fff;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.root { min-height: 100svh; }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100svh; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.96);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 8px; }
.logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ff3d3d, #e2081c);
  font-weight: 900;
  box-shadow: 0 6px 18px -8px rgba(255, 34, 51, 0.9);
}
.brand-name { font-size: 17px; font-weight: 900; letter-spacing: 0.16em; }

.top-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--panel); color: #fff; }
.icon-btn svg { width: 18px; height: 18px; }

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--void);
}

.lang-select {
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
}

.main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  flex: 1;
  padding: 12px 12px 104px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(13, 13, 13, 0.98);
  backdrop-filter: blur(8px);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { color: var(--brand); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(255, 34, 51, 0.55)); }

/* ---------- typography / layout ---------- */
.muted { color: var(--muted); }
.small { font-size: 11px; }
.tiny { font-size: 10.5px; }
.center { text-align: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) {
  .grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .main { padding: 16px 20px 110px; }
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: linear-gradient(180deg, #ff3d3d, #e2081c); color: #fff; box-shadow: 0 10px 24px -14px rgba(255, 34, 51, 0.95); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-line { background: transparent; border: 1px solid rgba(255, 34, 51, 0.7); color: #fff; }
.btn-line:hover { background: rgba(255, 34, 51, 0.1); }
.btn-ghost { background: var(--panel-2); border: 1px solid var(--line); color: #fff; }
.btn-ghost:hover { border-color: rgba(255, 34, 51, 0.5); }
.btn-danger { background: rgba(255, 34, 51, 0.15); border: 1px solid rgba(255, 34, 51, 0.45); color: #ff8b95; }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }

/* ---------- forms ---------- */
.label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; }
.field {
  width: 100%;
  border-radius: 9px;
  border: 1px solid #303030;
  background: #161616;
  padding: 12px 13px;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
}
.field::placeholder { color: #6d6d6d; }
.field:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 34, 51, 0.15); }
textarea.field { min-height: 78px; resize: vertical; }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.form-error { border: 1px solid rgba(255, 34, 51, 0.5); background: rgba(255, 34, 51, 0.1); border-radius: 8px; padding: 9px 11px; font-size: 12px; }
.help { font-size: 11px; color: var(--muted); line-height: 1.55; }

/* ---------- auth ---------- */
.auth { min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 24px 14px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; border-radius: 12px; background: #000; border: 1px solid var(--line); margin-bottom: 14px; }
.auth-logo .mark { font-size: 26px; font-weight: 900; letter-spacing: 0.22em; }
.auth-logo svg { width: 22px; height: 22px; color: var(--brand); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; margin-bottom: 16px; }
.tab { border: 0; background: transparent; color: rgba(255, 255, 255, 0.7); padding: 9px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.tab.active { background: linear-gradient(180deg, #ff3d3d, #e2081c); color: #fff; }

/* ---------- home ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  min-height: 208px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  background:
    radial-gradient(120% 90% at 80% 0%, rgba(255, 34, 51, 0.35), transparent 60%),
    linear-gradient(180deg, #1a0508, #0b0b0b);
}
.hero h1 { font-size: 24px; line-height: 1.15; letter-spacing: 0.02em; text-transform: uppercase; font-weight: 900; max-width: 420px; }
.hero p { color: rgba(255, 255, 255, 0.72); font-size: 12px; margin-top: 6px; max-width: 380px; line-height: 1.6; }
.hero .kicker { color: var(--brand); font-size: 10px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; margin-bottom: 8px; }

.wallet-strip { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 8px; }
.wallet-strip .value { font-size: 17px; font-weight: 800; }
.wallet-strip .label { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.tile { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); color: #fff; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.tile:hover { border-color: rgba(255, 34, 51, 0.55); background: #191919; }
.tile .icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 34, 51, 0.1); color: var(--brand); }
.tile .icon svg { width: 18px; height: 18px; }
.tile span { font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, 0.85); }

/* ---------- stats / lists ---------- */
.stat { text-align: center; padding: 12px 6px; }
.stat .value { font-size: 17px; font-weight: 800; }
.stat .label { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.amount.pos { color: var(--ok); font-weight: 700; }
.amount.neg { color: rgba(255, 255, 255, 0.7); font-weight: 700; }
.empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 10px; }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 5px; padding: 3px 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pill.ok { background: rgba(55, 214, 122, 0.15); color: var(--ok); }
.pill.warn { background: rgba(255, 176, 32, 0.15); color: var(--warn); }
.pill.err { background: rgba(255, 34, 51, 0.15); color: #ff8b95; }
.pill.dim { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.55); }

/* ---------- packages ---------- */
.package { overflow: hidden; }
.package-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; }
.package-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 14px; text-align: center; }
.package-grid .value { font-size: 15px; font-weight: 800; }
.package-grid .label { font-size: 10px; color: var(--muted); margin-top: 2px; }
.package-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.package-buy { padding: 10px 14px 14px; }

.progress { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff3d3d, #e2081c); }
.task-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (min-width: 640px) { .task-grid { grid-template-columns: repeat(5, 1fr); } }
.task {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 9px; font-size: 11px; font-weight: 600;
  border: 1px solid rgba(255, 34, 51, 0.4); background: rgba(255, 34, 51, 0.1); color: #fff; cursor: pointer;
}
.task:hover { background: rgba(255, 34, 51, 0.2); }
.task:disabled { border-color: var(--line); background: var(--panel-2); color: var(--muted); cursor: default; }
.task svg { width: 16px; height: 16px; color: var(--brand); }
.task.done svg { color: var(--ok); }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-body { display: flex; flex-direction: column; gap: 8px; max-height: 58vh; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0d0d0d; }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(180deg, #ff3d3d, #d8071b); color: #fff; border-bottom-right-radius: 4px; }
.msg.admin { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg .time { display: block; margin-top: 3px; font-size: 9.5px; opacity: 0.6; }
.chat-form { display: flex; gap: 8px; }
.chat-form .field { flex: 1; }

/* ---------- modal / toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.75); }
@media (min-width: 640px) { .overlay { align-items: center; padding: 16px; } }
.modal { width: 100%; max-width: 460px; max-height: 90svh; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px 16px 0 0; background: var(--panel); padding: 16px; }
@media (min-width: 640px) { .modal { border-radius: 14px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-head h2 { font-size: 15px; font-weight: 700; }
.modal-close { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: rgba(255, 255, 255, 0.6); font-size: 20px; cursor: pointer; }
.modal-close:hover { background: var(--panel-2); color: #fff; }

.toast-root { position: fixed; top: 12px; left: 0; right: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none; }
.toast { width: 100%; max-width: 420px; border-radius: 10px; padding: 10px 13px; font-size: 12.5px; font-weight: 500; line-height: 1.45; box-shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.9); }
.toast.ok { background: #102016; border: 1px solid rgba(55, 214, 122, 0.4); }
.toast.error { background: #210f11; border: 1px solid rgba(255, 34, 51, 0.5); }

/* ---------- crypto / deposit ---------- */
.address-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); padding: 9px 11px; }
.address-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 11.5px; }
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.preset { border: 1px solid var(--line); background: var(--panel-2); color: #fff; border-radius: 8px; padding: 9px 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.preset.active { border-color: var(--brand); background: rgba(255, 34, 51, 0.15); }

/* ---------- admin ---------- */
.admin-shell { display: flex; min-height: 100svh; flex-direction: column; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #0a0a0a; flex-wrap: wrap; }
.admin-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #0d0d0d; }
.admin-tab { white-space: nowrap; border: 0; background: transparent; color: rgba(255, 255, 255, 0.6); padding: 8px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.admin-tab.active { background: rgba(255, 34, 51, 0.15); color: #fff; }
.admin-main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 14px 40px; display: flex; flex-direction: column; gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.kpi .value { font-size: 20px; font-weight: 800; }
.kpi .label { font-size: 11px; color: var(--muted); margin-top: 3px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: #101010; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .row { gap: 6px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.admin-section { display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 14px; font-weight: 700; }
.card-body { padding: 14px; }
.two-col { display: grid; gap: 12px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

.chat-list { display: flex; flex-direction: column; }
.chat-thread { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; background: transparent; border-left: 0; border-right: 0; border-top: 0; color: #fff; text-align: left; width: 100%; }
.chat-thread:hover, .chat-thread.active { background: var(--panel-2); }
.chat-thread .name { font-size: 12.5px; font-weight: 600; }
.chat-thread .preview { font-size: 11px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
