:root {
  --bg: #0a1020;
  --bg-soft: #101a31;
  --panel: rgba(15, 23, 42, 0.9);
  --panel-2: rgba(12, 18, 34, 0.98);
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #ecf2ff;
  --muted: #91a3bf;
  --accent: #4f8cff;
  --accent-2: #7a5cff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(122, 92, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #0a1020 0%, #070b14 100%);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.shell {
  max-width: 1800px;
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.panel,
.login-panel,
.stat-card,
.subcard {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 26px;
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.topbar-title,
h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
}

.muted { color: var(--muted); }
.large { font-size: 15px; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.row { display: flex; align-items: center; gap: 12px; }
.wrap { flex-wrap: wrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -28px auto;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.22), transparent 70%);
}
.stat-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 12px;
  font-weight: 700;
}
.stat-value {
  margin-top: 12px;
  font-size: 38px;
  font-weight: 900;
}
.stat-subtitle {
  margin-top: 8px;
  color: #bfd0ec;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 20px;
}
.sidebar { position: sticky; top: 24px; }
.content { display: grid; gap: 20px; }
.hero-panel { padding: 24px; }
.hero-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.hero-chips { justify-content: flex-end; }

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.section-title {
  font-size: 18px;
  font-weight: 800;
}
.section-title.xl { font-size: 30px; }
.section-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}
.section-subtitle.large { font-size: 15px; }

.top-gap { margin-top: 16px; }
.top-gap-lg { margin-top: 20px; }
.top-gap-sm { margin-top: 8px; }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.input-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.form-grid { display: grid; gap: 12px; }
.form-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  outline: none;
  transition: .18s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(79, 140, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, 0.12);
}
.textarea { min-height: 110px; resize: vertical; }
.select-compact { width: auto; min-width: 140px; }

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--accent), #3a78ec);
  box-shadow: 0 16px 28px rgba(79, 140, 255, 0.22);
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.danger {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.24);
  color: #ffc9c9;
  box-shadow: none;
}

.player-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  max-height: calc(100vh - 270px);
  overflow: auto;
  padding-right: 4px;
}
.player-row {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: .18s ease;
}
.player-row:hover,
.player-row.active {
  border-color: rgba(79, 140, 255, 0.32);
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.12), rgba(79, 140, 255, 0.04));
}
.player-row-name { font-size: 15px; font-weight: 800; }
.player-row-meta { margin-top: 4px; color: var(--muted); font-size: 13px; }
.player-row-id {
  margin-top: 8px;
  color: #adc0de;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.mini-badge,
.license-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: #dce8ff;
  font-size: 12px;
  font-weight: 700;
}
.mini-badge.accent { background: rgba(79, 140, 255, 0.14); border-color: rgba(79, 140, 255, 0.24); }
.mini-badge.success { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.24); }
.mini-badge.warning { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.24); }
.mini-badge.muted { color: var(--muted); }

.chip-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.license-chip button {
  background: transparent;
  border: 0;
  color: #ffb3b3;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.json-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.json-grid.compact-gap { gap: 10px; }
.json-field {
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.json-field.full { grid-column: 1 / -1; }
.json-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}
.json-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}
.json-single-value {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.json-card-list { display: grid; gap: 12px; }
.json-object-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.028);
}
.json-object-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.json-object-title { font-size: 14px; font-weight: 800; }
.json-raw {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--line);
  color: #dbe7ff;
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.inventory-grid,
.vehicle-list,
.stash-list,
.notes-list {
  display: grid;
  gap: 14px;
}
.inventory-grid {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.item-card,
.subcard {
  border-radius: 18px;
  padding: 16px;
}
.subcard {
  background: rgba(255,255,255,0.028);
}
.subcard-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.subcard-title { font-size: 16px; font-weight: 800; }
.subcard-subtitle { color: var(--muted); font-size: 12px; }

.item-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
}
.item-top {
  display: grid;
  grid-template-columns: 68px minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
}
.item-thumb-wrap {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.item-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.item-name { font-size: 16px; font-weight: 800; }
.item-subline { color: var(--muted); font-size: 12px; margin-top: 4px; }
.item-count {
  font-size: 22px;
  font-weight: 900;
  color: #dce7ff;
}
.item-meta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.details-block {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.16);
  overflow: hidden;
}
.details-block summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-weight: 700;
}
.details-block summary::-webkit-details-marker { display: none; }
.details-content { padding: 0 14px 14px; }

.vehicle-actions { margin-top: 14px; }

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,0.02);
}
.empty-state.compact {
  padding: 14px;
  border-radius: 14px;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.clean-table th,
.clean-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  text-align: left;
  vertical-align: top;
}
.clean-table th {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(520px, 100%);
  padding: 34px;
  border-radius: 28px;
}
.logo-badge {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 900;
  margin-bottom: 18px;
  box-shadow: 0 18px 30px rgba(79, 140, 255, 0.24);
}
.helper-box {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .player-list { max-height: 360px; }
}

@media (max-width: 860px) {
  .shell { padding: 16px; }
  .stats-grid,
  .two-col,
  .input-grid-3,
  .form-inline { grid-template-columns: 1fr; }
  .topbar,
  .panel,
  .login-panel { padding: 18px; }
  .topbar-title,
  h1,
  .section-title.xl { font-size: 24px; }
  .item-top { grid-template-columns: 56px minmax(0,1fr); }
  .item-count { grid-column: 2; }
}


.danger-panel {
  border-color: rgba(255, 93, 108, 0.25);
  box-shadow: 0 18px 40px rgba(120, 10, 20, 0.16);
}
.danger-box {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.08), rgba(255, 93, 108, 0.03));
  border: 1px solid rgba(255, 93, 108, 0.2);
}
.danger-callout {
  color: #ffd5da;
  line-height: 1.6;
}
.danger-input {
  border-color: rgba(255, 93, 108, 0.28);
}


.json-editor-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.json-editor-form {
  display: grid;
  gap: 12px;
}
.json-editor-group,
.json-editor-field {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255,255,255,0.025);
}
.json-editor-group.full,
.json-editor-field.full {
  grid-column: 1 / -1;
}
.json-editor-group-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #d5e3ff;
}
.json-editor-textarea {
  min-height: 110px;
}
.json-editor-actions {
  display: flex;
  justify-content: flex-end;
}
