@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --bg-dark: #0d0d0d;
  --bg-card: #161616;
  --bg-surface: #1c1c1c;
  --fg: #e8e4df;
  --fg-muted: #9a9590;
  --accent: #d4a039;
  --accent-light: #e8c06a;
  --accent-dim: rgba(212, 160, 57, 0.12);
  --accent-dim2: rgba(212, 160, 57, 0.06);
  --border: #2a2725;
  --border-light: #333;
  --radius: 12px;
  --radius-sm: 8px;
  --green: #4caf7d;
  --green-dim: rgba(76, 175, 125, 0.12);
  --red: #e05252;
  --red-dim: rgba(224, 82, 82, 0.12);
  --blue: #5b8dee;
  --blue-dim: rgba(91, 141, 238, 0.12);
}

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

body {
  background: var(--bg-dark);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === NAV === */
.nav {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--fg);
  background: var(--bg-surface);
}

/* === HERO (landing) === */
.hero {
  padding: 100px 0 80px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -150px;
  right: -200px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 65%);
  pointer-events: none;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
  padding: 6px 16px;
  background: var(--accent-dim);
  border-radius: 100px;
  border: 1px solid rgba(212, 160, 57, 0.2);
}

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -2px;
  color: var(--fg);
  max-width: 700px;
  margin-bottom: 24px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--fg-muted);
  max-width: 500px;
  margin-bottom: 40px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
}

.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(212, 160, 57, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border-light);
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
  background: var(--bg-surface);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(224, 82, 82, 0.3);
  font-size: 0.8rem;
  padding: 6px 14px;
}

.btn-danger:hover {
  background: var(--red-dim);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.card-body {
  padding: 24px;
}

/* === STAT GRID === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }
.stat-value.accent { color: var(--accent); }

.stat-sub {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* === PAGE HEADER === */
.page-header {
  padding: 32px 0 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left {}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.breadcrumb a {
  color: var(--fg-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--fg); }

.breadcrumb .sep { opacity: 0.4; }

/* === UNITS LIST === */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin: 8px 0 32px;
}

.unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}

.unit-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.unit-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.unit-card-meta {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.unit-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.unit-card-stat-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.unit-card-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.unit-profit-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}

.unit-profit-tag.pos { background: var(--green-dim); color: var(--green); }
.unit-profit-tag.neg { background: var(--red-dim); color: var(--red); }
.unit-profit-tag.neutral { background: var(--bg-surface); color: var(--fg-muted); }

/* === ITEMS TABLE === */
.items-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 14px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--accent-dim2); }

.item-name-link {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}

.item-name-link:hover { color: var(--accent); }

/* === STATUS BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-sold { background: var(--green-dim); color: var(--green); }
.badge-listed { background: var(--blue-dim); color: var(--blue); }
.badge-unlisted { background: var(--bg-surface); color: var(--fg-muted); }
.badge-active { background: var(--accent-dim); color: var(--accent); }

/* === ITEM PHOTO === */
.item-photo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.item-photo-placeholder {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 1.1rem;
}

/* === FORMS === */
.form-section {
  max-width: 600px;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="email"],
select,
textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a9590' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea { resize: vertical; min-height: 90px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 5px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.error-banner {
  background: var(--red-dim);
  border: 1px solid rgba(224, 82, 82, 0.2);
  border-radius: var(--radius-sm);
  color: var(--red);
  padding: 12px 16px;
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* === ITEM DETAIL === */
.item-detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}

.item-photo-large {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.item-photo-empty {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--fg-muted);
  opacity: 0.4;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-field {}

.detail-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 3px;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--fg);
}

/* === LISTINGS === */
.listing-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px 4px 8px;
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin: 3px;
}

.listing-pill-remove {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  margin-left: 2px;
}

.listing-pill-remove:hover { color: var(--red); }

/* === SELL MODAL === */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  position: relative;
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* === CHANNEL CHANNEL ICONS === */
.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.channel-eBay { background: #e43137; }
.channel-FB { background: #1877f2; }
.channel-OfferUp { background: #20c05c; }
.channel-Etsy { background: #f1641e; }
.channel-Craigslist { background: #9b59b6; }

/* === CHART BARS === */
.profit-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.profit-bar-label {
  font-size: 0.82rem;
  color: var(--fg);
  min-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profit-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}

.profit-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.6s ease;
}

.profit-bar-fill.neg { background: var(--red); }

.profit-bar-val {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 70px;
  text-align: right;
  color: var(--fg-muted);
}

/* === LANDING SPECIFIC === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 60px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.feature-icon {
  font-size: 1.6rem;
  margin-bottom: 14px;
}

.feature-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 0.85rem;
  color: var(--fg-muted);
  line-height: 1.55;
}

.landing-cta {
  text-align: center;
  padding: 80px 0;
  border-top: 1px solid var(--border);
}

.landing-cta h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

/* === EMPTY STATES === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.87rem;
  margin-bottom: 20px;
}

/* === FILE UPLOAD === */
.file-drop {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.file-drop:hover { border-color: var(--accent); }

.file-drop input[type="file"] { display: none; }

/* === UTIL === */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--fg-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: 'Space Grotesk', monospace; }
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.section { margin-bottom: 32px; }

@media (max-width: 680px) {
  .item-detail-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}
