/* ============ BASICS ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0d13;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --panel-hover: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f4f8;
  --muted: #97a0b3;
  --faint: #5c6577;

  --amber: #f59e0b;
  --amber-2: #fbbf24;
  --green: #10b981;
  --red: #f43f5e;
  --blue: #3b82f6;

  --grad: linear-gradient(135deg, #f59e0b 0%, #f97316 45%, #ef4444 100%);
  --grad-text: linear-gradient(100deg, #fbbf24, #fb923c 55%, #f87171);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow: 0 20px 45px -20px rgba(0, 0, 0, 0.65);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ambient background glows */
.bg-glow { position: fixed; border-radius: 50%; filter: blur(120px); opacity: 0.35; pointer-events: none; z-index: -1; }
.bg-glow-1 { width: 520px; height: 520px; top: -180px; left: -120px; background: radial-gradient(circle, rgba(245,158,11,0.55), transparent 65%); }
.bg-glow-2 { width: 480px; height: 480px; bottom: -180px; right: -140px; background: radial-gradient(circle, rgba(59,130,246,0.4), transparent 65%); }

/* ============ TOPBAR ============ */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 24px 12px;
}

.brand { display: flex; align-items: center; gap: 16px; }

.brand-logo {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 30px -8px rgba(249,115,22,0.55);
}
.brand-logo svg { width: 32px; height: 32px; }

.brand-text h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1;
}
.brand-text h1 span { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text p { font-size: 12.5px; color: var(--muted); margin-top: 3px; letter-spacing: 0.2px; }

/* ============ CONTAINER ============ */
.container { max-width: 1160px; margin: 0 auto; padding: 22px 24px 60px; }

/* ============ STATS ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.tile {
  position: relative;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.tile::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(200px 120px at 100% 0%, rgba(255,255,255,0.07), transparent 70%);
  pointer-events: none;
}
.tile:hover { transform: translateY(-3px); border-color: var(--stroke-strong); box-shadow: var(--shadow); }

.tile-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  margin-bottom: 12px;
  background: rgba(148,163,184,0.12);
  color: var(--muted);
}
.tile-icon svg { width: 21px; height: 21px; }

.tile-emerald .tile-icon { background: rgba(16,185,129,0.16); color: var(--green); }
.tile-amber .tile-icon { background: rgba(245,158,11,0.16); color: var(--amber); }
.tile-red .tile-icon { background: rgba(244,63,94,0.16); color: var(--red); }

.tile-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); }
.tile-value {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.tile-value.green { color: var(--green); }
.tile-value.red { color: var(--red); }
.tile-value.amber { color: var(--amber); }
.tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============ CONTROLS ============ */
.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.search {
  flex: 1 1 260px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 11px 15px;
  color: var(--faint);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: rgba(249,115,22,0.5); box-shadow: 0 0 0 4px rgba(249,115,22,0.12); }
.search svg { width: 18px; height: 18px; flex-shrink: 0; }
.search input {
  flex: 1;
  background: none; border: none; outline: none;
  color: var(--text); font-size: 14px; font-family: inherit;
}
.search input::placeholder { color: var(--faint); }

.chips { display: flex; gap: 8px; }
.chip {
  padding: 9px 16px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--muted);
  border-radius: 12px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all .18s ease;
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
.chip.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 22px -8px rgba(249,115,22,0.6);
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--stroke-strong);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 12px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all .18s ease;
}
.btn:hover { background: var(--panel-hover); transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px -10px rgba(249,115,22,0.6);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost { background: transparent; border-color: var(--stroke); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel); }

.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(244,63,94,0.14); }

.btn-small { font-size: 13px; padding: 8px 13px; border-radius: 10px; }

/* ============ CARD GRID ============ */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.card {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.2,.7,.3,1), border-color .3s, box-shadow .3s;
  animation: fadeUp .5s ease both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.card:hover {
  transform: translateY(-5px);
  border-color: rgba(249,115,22,0.4);
  box-shadow: var(--shadow), 0 0 0 1px rgba(249,115,22,0.12);
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* photo */
.card-media { position: relative; height: 190px; background: #0e1119; overflow: hidden; }
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform .5s ease;
}
.card:hover .card-media img { transform: scale(1.04); }

.card-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,13,19,0.15), rgba(11,13,19,0.85) 92%);
  pointer-events: none;
}

.pill {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-sold { background: rgba(16,185,129,0.18); color: #34d399; border: 1px solid rgba(16,185,129,0.35); }
.pill-stock { background: rgba(245,158,11,0.18); color: #fbbf24; border: 1px solid rgba(245,158,11,0.4); }

.profit-chip {
  position: absolute; bottom: 14px; right: 14px; z-index: 2;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
  backdrop-filter: blur(10px);
  border: 1px solid;
}
.profit-chip.green { background: rgba(16,185,129,0.2); color: #4ade80; border-color: rgba(16,185,129,0.4); }
.profit-chip.red { background: rgba(244,63,94,0.2); color: #fb7185; border-color: rgba(244,63,94,0.4); }
.profit-chip.neutral { background: rgba(148,163,184,0.16); color: var(--muted); border-color: var(--stroke-strong); font-size: 12.5px; font-weight: 600; }

/* carousel arrows over media */
.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(11,13,19,0.45);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, background .2s;
  backdrop-filter: blur(6px);
}
.card-media:hover .car-btn { opacity: 1; }
.car-btn:hover { background: rgba(11,13,19,0.75); }
.car-btn svg { width: 16px; height: 16px; }
.car-prev { left: 12px; }
.car-next { right: 12px; }

.car-dots { position: absolute; bottom: 12px; left: 14px; z-index: 2; display: flex; gap: 5px; }
.car-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.35); transition: all .2s; }
.car-dots i.on { background: #fff; width: 16px; border-radius: 3px; }

.no-photo {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  background:
    radial-gradient(240px 120px at 20% 0%, rgba(245,158,11,0.08), transparent 70%),
    #0e1119;
  font-size: 13px;
}

/* card body */
.card-body { padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 12px; flex: 1; }

.card-name { font-size: 17.5px; font-weight: 700; letter-spacing: -0.2px; line-height: 1.25; }

.card-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card-meta .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }

.prices { display: flex; gap: 22px; align-items: flex-end; }
.price .label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); margin-bottom: 2px; }
.price .value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-buy .value { color: #d1d5db; }
.price-sell .value { color: #34d399; }
.price-sell .value.sold-off { color: var(--text); }

/* margin bar */
.margin {
  display: flex; flex-direction: column; gap: 5px;
}
.margin-track { position: relative; height: 6px; border-radius: 999px; background: rgba(148,163,184,0.15); overflow: hidden; }
.margin-track .fill { position: absolute; inset: 0; border-radius: 999px; transform-origin: left; }
.margin-track .fill-buy { background: var(--amber-2); }
.margin-track .fill-sell { background: linear-gradient(90deg, #10b981, #34d399); }
.margin-caption { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }

.notes { font-size: 13px; color: var(--muted); white-space: pre-wrap; background: rgba(148,163,184,0.06); border: 1px dashed var(--stroke); border-radius: 10px; padding: 10px 12px; }

.card-actions { display: flex; gap: 10px; padding: 4px 18px 18px; margin-top: auto; }
.card-actions .btn { flex: 1; justify-content: center; }

/* ============ EMPTY ============ */
.empty {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--stroke-strong);
  border-radius: var(--radius-xl);
  background: var(--panel);
}
.empty-art {
  width: 120px; height: 120px;
  margin: 0 auto 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(249,115,22,0.25), rgba(11,13,19,0) 70%);
  color: var(--amber);
}
.empty-art svg { width: 64px; height: 64px; opacity: 0.9; }
.empty h2 { font-size: 22px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 22px; }

/* ============ FOOTER ============ */
.footer { text-align: center; padding: 8px 24px 40px; color: var(--faint); font-size: 12px; }

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(7,9,14,0.72);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  width: 100%; max-width: 540px;
  max-height: 92vh; overflow-y: auto;
  background: linear-gradient(180deg, #171b26, #12151f);
  border: 1px solid var(--stroke-strong);
  border-radius: 22px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,0.8);
  animation: popIn .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 4px; }
.modal-header h2 { font-size: 19px; letter-spacing: -0.3px; }

.modal-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 24px 24px; }

label { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 7px; }
label input, label textarea {
  background: rgba(11,13,19,0.6);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14.5px; font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
label input:focus, label textarea:focus {
  border-color: rgba(249,115,22,0.55);
  box-shadow: 0 0 0 4px rgba(249,115,22,0.12);
}
label textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.photo-preview { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-preview .thumb { position: relative; }
.photo-preview img { width: 92px; height: 70px; object-fit: cover; border-radius: 12px; border: 1px solid var(--stroke); }
.photo-preview .remove {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); color: #fff; border: none;
  cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.photo-preview .remove:hover { filter: brightness(1.15); }

.btn-icon {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 6px;
  border-radius: 10px;
  display: grid; place-items: center;
  transition: all .15s;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { color: var(--text); background: var(--panel-strong); }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5,7,11,0.88);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  animation: fadeIn .2s ease;
}
.lb-wrap { position: relative; max-width: 92vw; max-height: 88vh; }
.lb-wrap img { max-width: 100%; max-height: 88vh; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff; cursor: pointer;
  transition: background .2s, transform .2s;
}
.lb-nav:hover { background: rgba(255,255,255,0.2); }
.lb-nav svg { width: 22px; height: 22px; }
.lb-prev { left: 22px; }
.lb-next { right: 22px; }
.lb-counter {
  position: absolute; bottom: -34px; left: 0; right: 0;
  text-align: center; color: var(--muted); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.lightbox > .btn-icon {
  position: absolute; top: 20px; right: 24px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
}
.lightbox > .btn-icon:hover { background: rgba(255,255,255,0.18); }

.hidden { display: none !important; }

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  .topbar { padding-top: 26px; }
  .container { padding: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .controls { flex-direction: column; align-items: stretch; }
  .chips { justify-content: center; }
  .lb-nav { width: 44px; height: 44px; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}