/* ═══ BBTracker Design System v2 — graphite / champagne ═══ */
:root {
  --bg: #0B0D10;
  --bg2: #0E1116;
  --panel: #12151A;
  --panel2: #171B22;
  --field: #0E1114;
  --line: #1E242C;
  --line2: #2B333D;
  --text: #E7EAEE;
  --muted: #8A939E;
  --gold: #F2C464;
  --gold2: #D9A93F;
  --green: #3FCE7F;
  --red: #F0647A;
  --blue: #5CA8FF;
  --font: 'Rajdhani', system-ui, sans-serif;
  --disp: 'Orbitron', sans-serif;
  --r: 10px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
::selection { background: rgba(242,196,100,0.22); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232A33; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #2E3742; }
a { color: var(--gold); }

/* ── Layout ── */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
#sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg2); border-right: 1px solid var(--line);
  padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.main { padding: 26px 30px; min-width: 0; }
.main > * { animation: rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both; }
.main > *:nth-child(2) { animation-delay: 0.06s; }
.main > *:nth-child(3) { animation-delay: 0.12s; }
.main > *:nth-child(4) { animation-delay: 0.18s; }
.main > *:nth-child(5) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Sidebar ─ */
.sb-logo { padding: 2px 8px 16px; }
.sb-logo img { height: 26px; display: block; opacity: 0.95; }
.sb-sec { padding: 12px 10px 5px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.8px; color: var(--muted); }
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #AEB6C0; text-decoration: none; font-size: 13px; font-weight: 600; transition: all 0.15s;
}
.sb-item svg { width: 15px; height: 15px; opacity: 0.7; flex-shrink: 0; }
.sb-item:hover { color: var(--text); background: var(--panel); }
.sb-item.active { color: var(--gold); background: var(--panel2); box-shadow: inset 2px 0 0 var(--gold); }
.sb-item.active svg { opacity: 1; }
.sb-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.sb-status { display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.sb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); transition: all 0.3s; }
.sb-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.sb-logout {
  display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 700; transition: all 0.15s;
}
.sb-logout svg { width: 13px; height: 13px; }
.sb-logout:hover { color: var(--red); border-color: rgba(240,100,122,0.35); background: rgba(240,100,122,0.06); }

/* ── Topbar + user chip ── */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; position: relative; z-index: 60; }
.ph-title { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
.ph-sub { color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.uchip {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel);
  text-decoration: none; color: var(--text); transition: all 0.15s; flex-shrink: 0;
}
.uchip:hover { border-color: var(--line2); background: var(--panel2); }
.uchip .ava {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, var(--gold2), var(--gold));
  color: #141008; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.uchip .nm { font-size: 12.5px; font-weight: 700; }
.uchip svg { width: 12px; height: 12px; color: var(--muted); }

/* ── Language Switcher ── */
.lang-sw { position: relative; flex-shrink: 0; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text);
  font-family: var(--font); font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.lang-btn:hover { border-color: var(--line2); background: var(--panel2); }
.lang-btn svg { width: 12px; height: 12px; color: var(--muted); transition: transform 0.2s; }
.lang-sw.open .lang-btn svg { transform: rotate(180deg); }
.lang-drop {
  position: absolute; top: calc(100% + 5px); right: 0;
  min-width: 140px; background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 9px; padding: 4px; box-shadow: 0 14px 36px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity 0.18s, transform 0.18s; z-index: 200;
}
.lang-sw.open .lang-drop { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lang-opt {
  display: block; width: 100%; text-align: left;
  padding: 7px 11px; border: none; background: transparent; color: #C4CAD2;
  font-family: var(--font); font-size: 12.5px; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: all 0.12s;
}
.lang-opt:hover { background: var(--panel); color: var(--text); }
.lang-opt.active { color: var(--gold); background: rgba(242,196,100,0.06); }

/* Публичные страницы (landing/login) — без uchip */
.lang-public {
  position: fixed; top: 20px; right: 30px; z-index: 200;
}

/* ── Panels ─ */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted);
}
.panel-head svg { width: 13px; height: 13px; color: var(--gold); }
.panel-body { padding: 16px; }
.mb { margin-bottom: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1100px) { .row-2 { grid-template-columns: 1fr; } }

/* ── Controls ── */
.inp {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 8px 11px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.inp:focus { border-color: var(--line2); box-shadow: 0 0 0 3px rgba(242,196,100,0.06); }
.inp::placeholder { color: rgba(138,147,158,0.5); }
.lbl { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin-bottom: 5px; display: block; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: none; cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  transition: all 0.15s; white-space: nowrap; text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 13px; height: 13px; }
.btn-gold { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #141008; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--panel2); color: #C4CAD2; border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--line2); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(240,100,122,0.25); }
.btn-danger:hover { background: rgba(240,100,122,0.08); }
.btn-success { background: transparent; color: var(--green); border: 1px solid rgba(63,206,127,0.3); }
.btn-success:hover { background: rgba(63,206,127,0.08); }
.btn-sm { padding: 5px 9px; font-size: 10.5px; border-radius: 7px; }
.btn-full { width: 100%; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; transition: border-color 0.2s; }
.stat:hover { border-color: var(--line2); }
.stat-l { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); }
.stat-v { font-family: var(--disp); font-size: 15px; font-weight: 700; margin-top: 5px; }
.stat-s { font-size: 10.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.c-gold { color: var(--gold); } .c-green { color: var(--green); } .c-red { color: var(--red); } .c-blue { color: var(--blue); }

/* ── Balance ── */
.bal-val { font-family: var(--disp); font-size: 26px; font-weight: 700; color: var(--gold); }
.bal-sub { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-top: 3px; }

/* ── Table ── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 14px; font-size: 13px; font-weight: 600; border-bottom: 1px solid rgba(30,36,44,0.6); vertical-align: middle; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.015); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tr-active { background: rgba(242,196,100,0.04); box-shadow: inset 2px 0 0 var(--gold); animation: rowpulse 2.6s ease-in-out infinite; }
@keyframes rowpulse { 0%,100% { background: rgba(242,196,100,0.04); } 50% { background: rgba(242,196,100,0.09); } }
.tr-pending { opacity: 0.5; } .tr-completed { opacity: 0.85; }

/* ── Chips ─ */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-family: var(--disp); font-size: 9.5px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.chip-win { background: rgba(63,206,127,0.09); color: var(--green); border: 1px solid rgba(63,206,127,0.25); }
.chip-loss { background: rgba(240,100,122,0.09); color: var(--red); border: 1px solid rgba(240,100,122,0.25); }
.chip-pend { background: rgba(255,255,255,0.04); color: var(--muted); border: 1px solid var(--line); }
.chip-gold { background: rgba(242,196,100,0.1); color: var(--gold); border: 1px solid rgba(242,196,100,0.28); }
.chip-blue { background: rgba(92,168,255,0.1); color: var(--blue); border: 1px solid rgba(92,168,255,0.28); }

/* ── Catalog dropdown ── */
.cat-wrap { position: relative; }
.cat-drop { position: absolute; left: 0; right: 0; top: 100%; margin-top: 5px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; max-height: 250px; overflow-y: auto; z-index: 60; display: none; box-shadow: 0 14px 36px rgba(0,0,0,0.5); }
.cat-item { display: flex; gap: 9px; padding: 7px 9px; cursor: pointer; align-items: center; border-bottom: 1px solid rgba(30,36,44,0.6); transition: background 0.12s; }
.cat-item:hover { background: rgba(242,196,100,0.06); }
.cat-img { width: 26px; height: 34px; border-radius: 5px; background: var(--field); overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; }
.cat-prov { font-size: 9.5px; color: var(--muted); font-weight: 600; }

/* ── Slots grid ── */
.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.slot { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; position: relative; transition: all 0.2s; }
.slot:hover { border-color: var(--line2); transform: translateY(-2px); }
.slot-img { width: 100%; aspect-ratio: 3/4; background: var(--field); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot-img svg { width: 28px; height: 28px; opacity: 0.25; }
.slot-info { padding: 9px 11px; }
.slot-name { font-size: 11.5px; font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-prov { font-size: 9.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.slot-del { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 6px; background: rgba(11,13,16,0.8); border: 1px solid rgba(240,100,122,0.4); color: var(--red); cursor: pointer; display: none; align-items: center; justify-content: center; }
.slot-del svg { width: 11px; height: 11px; }
.slot:hover .slot-del { display: flex; }

/* ── Misc ── */
.img-prev { width: 38px; height: 30px; border-radius: 7px; background: var(--field); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.img-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-prev svg { width: 13px; height: 13px; opacity: 0.3; }
.empty { padding: 38px 18px; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.mono { font-family: 'Courier New', monospace; font-weight: 700; }
.key-code { color: var(--gold); }
.date-inp { background: var(--field); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-family: var(--font); font-size: 11px; padding: 4px 6px; }
.wbox { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 14px; }
.wurl { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; font-family: 'Courier New', monospace; font-size: 11px; word-break: break-all; color: var(--gold); margin: 7px 0 11px; user-select: all; }
.help { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-top: 11px; }
.help b { color: var(--text); }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .pgrid { grid-template-columns: 1fr; } }
.prow { background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; }
.prow-l { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); margin-bottom: 4px; }
.prow-v { font-size: 13.5px; font-weight: 700; word-break: break-all; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: var(--panel2); border: 1px solid var(--line2); color: var(--text);
  padding: 9px 18px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  pointer-events: none; opacity: 0; transition: all 0.22s; z-index: 9999;
  box-shadow: 0 10px 34px rgba(0,0,0,0.5);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { border-color: rgba(240,100,122,0.4); color: var(--red); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #sidebar { position: relative; height: auto; }
  .main { padding: 18px 14px; }
  .lang-public { top: 12px; right: 14px; }
}
