:root {
  --bg: #0c0e13;
  --bg-soft: #11141b;
  --card: #161a23;
  --card-hover: #1b2029;
  --border: #232836;
  --text: #e7ebf3;
  --muted: #8a93a6;
  --muted-dim: #5b6376;
  --green: #38d39f;
  --red: #f0556a;
  --accent: #5b8cff;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(91, 140, 255, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(12, 14, 19, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 20px; }
.brand-logo {
  height: 32px; width: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 0.3px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search, .select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search { min-width: 220px; }
.search:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
.select { cursor: pointer; }

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6f9bff; }
.btn-ghost { background: var(--bg-soft); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--card-hover); }
.btn-ghost.on { border-color: var(--green); color: var(--green); }

/* ---------- Stats ---------- */
.stats {
  display: flex;
  gap: 22px;
  padding: 18px 22px 4px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.stats b { color: var(--text); font-size: 15px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 18px 22px 60px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #2f3647;
  box-shadow: var(--shadow);
}
.card.rented { opacity: 0.72; }

.card-top {
  padding: 14px 14px 8px;
  min-height: 56px;
}
.card-name {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-wear { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.card-img-wrap {
  position: relative;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120px 80px at 50% 40%, rgba(255,255,255,0.05), transparent 70%);
}
.card-img-wrap::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2px;
  background: var(--rarity, var(--accent));
  box-shadow: 0 0 12px var(--rarity, var(--accent));
}
.card-img {
  max-width: 86%;
  max-height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.5));
}
.card-img.placeholder {
  font-size: 40px;
  color: var(--muted-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.badge-rented { background: rgba(240, 85, 106, 0.16); color: var(--red); }
.badge-disc { background: rgba(56, 211, 159, 0.14); color: var(--green); }

.card-bottom { padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.price-row { display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.market { font-size: 12px; color: var(--muted-dim); text-decoration: line-through; }

.meta { display: flex; justify-content: space-between; margin-top: 9px; font-size: 12px; color: var(--muted); }
.meta .float { font-variant-numeric: tabular-nums; }
.meta .pattern { color: var(--muted-dim); }

.status-line { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.available { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.rented { background: var(--red); }

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.card-actions.hidden { display: none; }
.mini {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mini:hover { background: var(--card-hover); }
.mini.danger:hover { background: rgba(240,85,106,0.14); color: var(--red); border-color: var(--red); }

.rent-btn {
  width: 100%;
  margin-top: 12px;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s;
}
.rent-btn:hover { background: #6f9bff; }
.rent-btn:disabled { background: var(--bg-soft); color: var(--muted-dim); cursor: not-allowed; }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 15px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.hidden { display: none !important; }

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .search { min-width: 140px; flex: 1; }
}
