:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #171b21;
  --panel-3: #1d2229;
  --line: #2a3039;
  --line-strong: #3a424e;
  --text: #f5f7fa;
  --muted: #929ba8;
  --muted-2: #68717e;
  --red: #ed4b4b;
  --red-dark: #b72f35;
  --green: #49c98d;
  --amber: #e6ad4e;
  --blue: #62a8e5;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.muted { color: var(--muted); }
.danger-text { color: #ff7676; }
.success-text { color: var(--green); }
.nowrap { white-space: nowrap; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr);
  background: #090b0e;
}
.auth-visual {
  position: relative;
  min-height: 100vh;
  background: #080a0c url("/assets/auth-hardware.png") center / cover no-repeat;
  overflow: hidden;
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 8, 10, .05), rgba(7, 8, 10, .15) 58%, rgba(7, 8, 10, .9));
}
.auth-brand {
  position: absolute;
  z-index: 1;
  left: clamp(28px, 5vw, 76px);
  top: clamp(28px, 6vh, 72px);
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--red);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(237, 75, 75, .25);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { font-size: 20px; font-weight: 750; letter-spacing: 0; }
.auth-status {
  position: absolute;
  z-index: 1;
  left: clamp(28px, 5vw, 76px);
  bottom: clamp(28px, 7vh, 72px);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c8ced7;
  font-size: 13px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(73, 201, 141, .1); }
.auth-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  border-left: 1px solid #20242a;
  background: #0c0f13;
}
.auth-box { width: min(100%, 410px); }
.auth-box h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: 0; }
.auth-box > p { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 24px;
  background: #15191e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.auth-tab.active { background: #252b33; color: var(--text); box-shadow: 0 1px 8px rgba(0,0,0,.2); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { color: #b5bdc8; font-size: 12px; font-weight: 650; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.control {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #0e1115;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  transition: border-color .16s, box-shadow .16s;
}
textarea.control { min-height: 96px; resize: vertical; line-height: 1.45; }
.control:focus { border-color: #6a7685; box-shadow: 0 0 0 3px rgba(106, 118, 133, .14); }
.control::placeholder { color: #59616d; }
select.control { cursor: pointer; }

.btn {
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel-3);
  color: var(--text);
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .16s;
}
.btn:hover { border-color: var(--line-strong); background: #252b33; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-primary { background: var(--red); border-color: var(--red); color: white; }
.btn-primary:hover { background: #ff5959; border-color: #ff5959; }
.btn-danger { background: rgba(237, 75, 75, .1); color: #ff7777; border-color: rgba(237, 75, 75, .32); }
.btn-success { background: rgba(73, 201, 141, .1); color: #71e6ad; border-color: rgba(73, 201, 141, .3); }
.btn-full { width: 100%; min-height: 44px; }
.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel-3); border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: #0d1014;
  border-right: 1px solid #242930;
}
.sidebar-head {
  height: 68px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #20252b;
}
.sidebar .brand-mark { width: 32px; height: 32px; }
.sidebar .brand-mark svg { width: 18px; height: 18px; }
.nav-scroll { flex: 1; overflow: auto; padding: 14px 10px; }
.nav-label { padding: 14px 10px 7px; color: #626b77; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-item {
  width: 100%;
  min-height: 40px;
  margin: 2px 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #9ca5b1;
  text-align: left;
  cursor: pointer;
}
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { color: #e8ebef; background: #14181d; }
.nav-item.active { color: white; background: #1b2026; border-color: #2d343d; }
.sidebar-user {
  padding: 14px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #20252b;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2c333c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.user-copy { min-width: 0; }
.user-copy strong, .user-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 12px; }
.user-copy span { margin-top: 3px; color: var(--muted-2); font-size: 10px; }

.workspace { min-width: 0; background: #0b0d10; }
.topbar {
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #242930;
  background: rgba(13, 16, 20, .94);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-menu { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.role-badge {
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #aeb7c3;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.role-badge svg { width: 13px; height: 13px; color: var(--red); }
.content { width: min(100%, 1440px); margin: 0 auto; padding: 26px 28px 52px; }
.view-head {
  min-height: 44px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.view-head h2 { margin: 0 0 5px; font-size: 22px; }
.view-head p { margin: 0; color: var(--muted); font-size: 13px; }
.view-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  min-height: 116px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.stat-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.stat-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: #20262d; color: #c7ced7; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { margin-top: 16px; font-size: 27px; font-weight: 780; }
.stat-note { margin-top: 4px; color: var(--muted-2); font-size: 11px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(255,255,255,.015);
}
.panel-head {
  min-height: 52px;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.panel-head h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 16px; }
.split-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th {
  height: 42px;
  padding: 8px 13px;
  color: #777f8c;
  background: #101318;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 11px 13px; border-bottom: 1px solid #242a31; font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.017); }
.cell-title { font-weight: 700; color: #eef1f5; }
.cell-sub { margin-top: 4px; color: var(--muted-2); font-size: 10px; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-actions .icon-btn { width: 30px; height: 30px; }

.badge {
  min-height: 23px;
  padding: 3px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #b7c0cb;
  background: #1a1f25;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.badge.success { color: #73dfaa; border-color: rgba(73,201,141,.28); background: rgba(73,201,141,.08); }
.badge.danger { color: #ff7979; border-color: rgba(237,75,75,.3); background: rgba(237,75,75,.08); }
.badge.warning { color: #f1c36f; border-color: rgba(230,173,78,.28); background: rgba(230,173,78,.08); }
.badge.info { color: #81bde9; border-color: rgba(98,168,229,.28); background: rgba(98,168,229,.08); }

.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card, .release-card, .license-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.product-media {
  height: 148px;
  position: relative;
  background: #171b20;
  border-bottom: 1px solid var(--line);
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-media.empty { display: grid; place-items: center; color: #424a55; }
.product-media.empty svg { width: 34px; height: 34px; }
.game-bit {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(7,9,11,.84);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 10px;
}
.card-body { padding: 15px; }
.card-body h3 { margin: 0 0 7px; font-size: 16px; }
.card-body p { min-height: 38px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-foot { margin-top: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-size: 20px; font-weight: 800; }
.license-card { padding: 16px; }
.license-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.license-key { margin: 16px 0 12px; font-size: 15px; overflow-wrap: anywhere; }
.license-meta { display: grid; gap: 8px; color: var(--muted); font-size: 11px; }
.license-meta span { display: flex; align-items: center; gap: 8px; }
.license-meta svg { width: 14px; height: 14px; }
.release-card { padding: 16px; }
.release-top { display: flex; justify-content: space-between; gap: 10px; }
.release-version { margin: 8px 0 12px; font-size: 24px; font-weight: 800; }
.release-notes { min-height: 58px; color: var(--muted); font-size: 12px; white-space: pre-wrap; line-height: 1.5; }
.release-meta { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted-2); font-size: 10px; }

.empty-state {
  min-height: 240px;
  padding: 34px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed #343b45;
  border-radius: var(--radius);
  color: var(--muted);
}
.empty-state svg { width: 30px; height: 30px; margin-bottom: 12px; color: #59626e; }
.empty-state strong { display: block; margin-bottom: 6px; color: #cbd2db; }
.loader { min-height: 260px; display: grid; place-items: center; color: var(--muted); }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search {
  width: min(320px, 100%);
  position: relative;
}
.search svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; color: #626b77; transform: translateY(-50%); pointer-events: none; }
.search .control { padding-left: 35px; min-height: 38px; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(3, 4, 6, .76);
}
.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #111419;
  box-shadow: var(--shadow);
}
.modal-head {
  min-height: 56px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111419;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 13px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.checks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check {
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0e1115;
  font-size: 12px;
}
.check input { accent-color: var(--red); }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: #171b21;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast svg { width: 16px; height: 16px; margin-top: 1px; flex: 0 0 auto; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 20px; border-left: 0; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    width: 250px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s;
    box-shadow: 18px 0 50px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.56); }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 42px; }
}

@media (max-width: 620px) {
  .field-row, .checks-grid { grid-template-columns: 1fr; }
  .stats-grid, .cards-grid { grid-template-columns: 1fr; }
  .view-head { align-items: stretch; flex-direction: column; }
  .view-actions { justify-content: flex-start; }
  .topbar-actions .role-badge { display: none; }
  .content { padding-inline: 12px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
}
