/* Crux Panel mini app — dark + red neon. Tuned to feel like a native
   premium dashboard, deliberately distinct from the blue competitor. */
:root {
  --bg:        #08090d;
  --bg-2:      #0d0f15;
  --card:      rgba(22, 24, 32, 0.72);
  --card-brd:  rgba(255, 255, 255, 0.06);
  --txt:       #f3f4f8;
  --muted:     #8b90a0;
  --faint:     #5a5f70;
  --accent:    #ff2d3f;
  --accent-2:  #ff5a48;
  --accent-dim:rgba(255, 45, 63, 0.14);
  --good:      #2fe08a;
  --warn:      #ffb02e;
  --radius:    18px;
  --shadow:    0 10px 40px rgba(0,0,0,0.5);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(82px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
}

/* Animated red aurora glow behind everything */
.aurora {
  position: fixed; inset: -30% -10% auto -10%; height: 60vh; z-index: 0;
  background:
    radial-gradient(50% 60% at 25% 10%, rgba(255,45,63,0.20), transparent 70%),
    radial-gradient(45% 55% at 85% 0%, rgba(255,90,72,0.14), transparent 70%);
  filter: blur(20px);
  animation: drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes drift {
  from { transform: translateY(-10px) scale(1); opacity: .9; }
  to   { transform: translateY(20px) scale(1.08); opacity: 1; }
}

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 18px 10px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  font-size: 20px; color: #fff; border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #b3121f);
  box-shadow: 0 0 18px rgba(255,45,63,0.55), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-txt b { font-size: 17px; letter-spacing: .5px; }
.brand-txt small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.accent { color: var(--accent); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--card-brd);
  background: var(--card); color: var(--txt); font-size: 18px;
  display: grid; place-items: center; cursor: pointer; transition: .2s;
}
.icon-btn:active { transform: rotate(180deg) scale(.92); color: var(--accent); }

/* ── Layout ──────────────────────────────────────────── */
main { position: relative; z-index: 1; padding: 6px 16px 20px; }
/* Flex column so an empty-state card can grow to fill the viewport and center
   its content; normal (non-grow) children keep their natural size. */
#view { display: flex; flex-direction: column; min-height: calc(100vh - 150px); }
/* Flex column + grow so a child empty-state card can fill the viewport.
   `#view` is the flex parent (see below); `.fade` wraps every tab's content. */
.fade { animation: fade .35s ease; display: flex; flex-direction: column; flex: 1 1 auto; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--card-brd);
  border-radius: var(--radius); padding: 16px; backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

/* Profile hero */
.hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar {
  width: 58px; height: 58px; border-radius: 16px; object-fit: cover;
  border: 2px solid var(--accent); box-shadow: 0 0 18px rgba(255,45,63,.4);
  background: var(--bg-2); display: grid; place-items: center; font-size: 24px; color: var(--accent);
}
.hero-info h2 { margin: 0; font-size: 19px; }
.hero-info .uid { color: var(--muted); font-size: 12.5px; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* Stat grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.stat {
  background: var(--card); border: 1px solid var(--card-brd);
  border-radius: 15px; padding: 14px 15px; position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -16px; top: -16px; width: 60px; height: 60px;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
}
.stat .k { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v.lg { font-size: 25px; }
.stat.glow { border-color: rgba(255,45,63,.3); box-shadow: 0 0 22px rgba(255,45,63,.15); }
.stat .sub { color: var(--faint); font-size: 11px; margin-top: 2px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 4px 11px; font-size: 13px; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
}
.section-title .pill { color: var(--accent); font-size: 12px; }

/* Subscription / VM rows */
.vm {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--card-brd);
  border-radius: 15px; padding: 13px 14px; margin-bottom: 10px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; position: relative; }
.dot.farming { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 1.6s infinite; }
.dot.idle    { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.offline { background: var(--faint); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.vm .name { font-weight: 600; font-size: 15px; }
.vm .meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.vm .meta b { color: var(--txt); font-weight: 600; }
.vm .right { text-align: right; }
.vm .farmed { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.vm .farmed small { color: var(--faint); font-weight: 500; }
.bar { height: 5px; border-radius: 4px; background: rgba(255,255,255,.07); margin-top: 7px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* Period switch */
.seg {
  display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--card-brd);
  padding: 4px; border-radius: 13px; margin-bottom: 14px;
}
.seg button {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 8px 2px; border-radius: 10px; font-size: 11.5px; line-height: 1.15;
  font-weight: 600; cursor: pointer; transition: .2s;
}
.seg button.on { background: linear-gradient(145deg, var(--accent), #c4131f); color: #fff;
  box-shadow: 0 4px 14px rgba(255,45,63,.4); }

/* Item lists (cases / skins) */
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.item:last-child { border-bottom: none; }
.item .ic {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg-2); display: grid; place-items: center; font-size: 17px;
  border: 1px solid var(--card-brd);
}
.item .ic img { width: 100%; height: 100%; object-fit: contain; }
.item .body { flex: 1; min-width: 0; }
.item .nm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sb { color: var(--muted); font-size: 12px; margin-top: 2px; }
.item .pr { text-align: right; }
.item .pr b { font-size: 14px; font-variant-numeric: tabular-nums; }
.item .pr small { display: block; color: var(--faint); font-size: 11px; }
.q { font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--accent-dim); color: var(--accent-2); margin-left: 6px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; opacity: .4; margin-bottom: 10px; }
/* Empty state inside a card (no drops / no panels) — grow to fill the space
   left below the stats and center vertically instead of hugging the top.
   Works together with `#view { display:flex }` below. */
.card.empty { flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; }

/* Skeleton loading */
.skel { background: linear-gradient(90deg, #15171f 25%, #1d2029 50%, #15171f 75%);
  background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 12px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ── Purchase / actions ──────────────────────────────── */
.buy { display: flex; flex-direction: column; gap: 11px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.plan {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px; border-radius: 13px; cursor: pointer;
  background: var(--bg-2); border: 1.5px solid var(--card-brd); color: var(--txt);
  transition: .18s;
}
.plan b { font-size: 14px; }
.plan span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.plan.on { border-color: var(--accent); background: var(--accent-dim);
  box-shadow: 0 0 16px rgba(255,45,63,.2); }
.plan.on span { color: var(--accent-2); }
.plan.sm { padding: 8px 10px; flex-direction: row; }
.plan.sm b { font-size: 13px; }

.inp {
  width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 14px;
  background: var(--bg-2); border: 1px solid var(--card-brd); color: var(--txt);
  outline: none;
}
.inp:focus { border-color: var(--accent); }
.inp::placeholder { color: var(--faint); }

.btn {
  width: 100%; padding: 13px; border-radius: 13px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--card-brd); background: var(--card); color: var(--txt);
  cursor: pointer; transition: .18s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn.primary {
  border: none; color: #fff;
  background: linear-gradient(145deg, var(--accent), #c4131f);
  box-shadow: 0 6px 18px rgba(255,45,63,.38);
}
.btn.ghost { background: transparent; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.mini-btn {
  margin-top: 7px; padding: 5px 10px; font-size: 11px; border-radius: 9px;
  background: var(--accent-dim); color: var(--accent-2);
  border: 1px solid rgba(255,45,63,.25); cursor: pointer;
}
.vm { cursor: pointer; transition: border-color .15s, background .15s; }
.vm.sel { border-color: var(--accent); background: var(--accent-dim); }
.chk { color: var(--accent); font-weight: 700; margin-left: 4px; }
.hint { color: var(--faint); font-size: 12px; margin: 0 4px 10px; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: calc(70px + var(--safe-bottom));
  z-index: 6; margin: 0 12px; padding: 11px; border-radius: 16px;
  display: flex; flex-direction: column; gap: 9px;
  background: rgba(18,20,27,.94); border: 1px solid var(--card-brd);
  backdrop-filter: blur(16px); box-shadow: var(--shadow);
  animation: fade .25s ease;
}
.ab-plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* ── Bottom tab bar ──────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; padding: 8px 14px calc(8px + var(--safe-bottom));
  background: rgba(8,9,13,.82); backdrop-filter: blur(18px);
  border-top: 1px solid var(--card-brd);
}
.tab {
  flex: 1; border: none; background: transparent; color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; padding: 6px 0; cursor: pointer; transition: .2s;
}
.tab .ti { font-size: 19px; }
.tab.active { color: var(--accent); text-shadow: 0 0 12px rgba(255,45,63,.6); }
