@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Inter:wght@300;400;500;600&display=swap');

:root {
  /* ── Palette — mirrors the Shopify store ── */
  --black:        #000000;
  --bg:           #0C0C0C;
  --surface:      #161616;
  --surface-2:    #1E1E1E;
  --surface-3:    #252525;
  --border:       #2A2A2A;
  --border-light: #333333;

  --text:         #F2EDE6;
  --text-secondary: #A8A39C;
  --muted:        #6B6760;

  --gold:         #C4A35A;
  --gold-light:   #D4B97A;
  --gold-dim:     #8A7040;

  --wine:         #7B1D2A;
  --wine-light:   #9E3040;

  --sold-bg:      rgba(30, 90, 50, 0.35);
  --sold-text:    #6FCF97;
  --expired-bg:   rgba(255,255,255,0.06);
  --expired-text: #6B6760;
  --withdrawn-bg: rgba(196,163,90,0.12);
  --withdrawn-text: #C4A35A;
  --danger:       #E05252;
  --danger-bg:    rgba(224, 82, 82, 0.12);

  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100%;
  margin: 0;
  font-size: 15px;
}

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
  background: var(--black);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-brand span { color: var(--gold); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 13px;
}

.nav-user { color: var(--muted); }

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-link:hover { color: var(--text); }
.nav-link.admin { color: var(--gold); }
.nav-link.admin:hover { color: var(--gold-light); }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.page { padding: 40px 0 80px; }

/* ── Page header ─────────────────────────────────────────────── */
.page-header { margin-bottom: 36px; }

.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}

.page-header .subtitle { color: var(--muted); font-size: 14px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--gold);
  margin: 0 0 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* ── Summary stats ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-card.highlight { border-left: 3px solid var(--gold); }

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-value.gold { color: var(--gold); }
.stat-value.wine { color: var(--gold); }

/* ── Auction list ────────────────────────────────────────────── */
.auction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auction-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.auction-item:hover {
  border-color: var(--gold-dim);
  background: var(--surface-2);
}

.auction-item-name {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--text);
  font-weight: 400;
}

.auction-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.auction-item-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 24px;
}

.auction-item-amount {
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.auction-item-lots { font-size: 12px; color: var(--muted); }

.chevron { color: var(--muted); margin-left: 16px; font-size: 18px; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.breadcrumb a { color: var(--gold-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-section { margin-bottom: 40px; }

.table-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.table-section h2 .count-badge {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 10px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.lots {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

table.lots thead th {
  background: var(--black);
  color: var(--text-secondary);
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

table.lots.unsold thead th { background: var(--surface-2); }

table.lots tbody tr:nth-child(even) td { background: var(--surface-2); }
table.lots tbody tr:hover td { background: var(--surface-3); }

table.lots td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
}

table.lots tbody tr:last-child td { border-bottom: none; }
table.lots .lot-num { font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
table.lots .title-cell { font-weight: 500; max-width: 280px; line-height: 1.4; color: var(--text); }
table.lots .price { font-weight: 600; white-space: nowrap; color: var(--text); }
table.lots.unsold td { color: var(--muted); }

/* ── Status badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.badge-sold       { background: var(--sold-bg);      color: var(--sold-text); }
.badge-expired    { background: var(--expired-bg);   color: var(--expired-text); border: 1px solid var(--border-light); }
.badge-withdrawn  { background: var(--withdrawn-bg); color: var(--withdrawn-text); }
.badge-unsold     { background: var(--expired-bg);   color: var(--expired-text); }
.badge-info       { background: rgba(196,163,90,0.15); color: var(--gold); }

/* ── Payout card ─────────────────────────────────────────────── */
.payout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 32px;
}

.payout-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--gold);
  margin: 0 0 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.payout-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.payout-line:last-child {
  border-bottom: none;
  padding-top: 14px;
  font-size: 18px;
  font-weight: 700;
}

.payout-line:last-child .payout-label { color: var(--text); }
.payout-line:last-child .payout-amount { color: var(--gold); font-size: 22px; }

.payout-label { color: var(--text-secondary); }
.payout-amount { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.payout-amount.deduction { color: var(--danger); }

/* ── Download bar ────────────────────────────────────────────── */
.download-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.download-bar .label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.02em;
}

.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: var(--gold-light); }

.btn-gold { background: var(--gold); color: #000; }
.btn-gold:hover { background: var(--gold-light); }

.btn-wine { background: var(--wine); color: white; }
.btn-wine:hover { background: var(--wine-light); }

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}
.btn-outline:hover { background: rgba(196,163,90,0.1); border-color: var(--gold); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
input[type="file"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(196,163,90,0.12);
}

input::placeholder { color: var(--muted); }
select option { background: var(--surface-2); }

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--black);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-logo span { color: var(--gold); }

.login-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 32px;
  letter-spacing: 0.04em;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-error   { background: var(--danger-bg);  color: var(--danger);      border-color: rgba(224,82,82,0.25); }
.alert-success { background: var(--sold-bg);    color: var(--sold-text);   border-color: rgba(111,207,151,0.25); }
.alert-info    { background: var(--withdrawn-bg); color: var(--gold);      border-color: rgba(196,163,90,0.25); }

/* ── Admin panel ─────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ── Upload area ─────────────────────────────────────────────── */
.upload-area {
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface-2);
}

.upload-area:hover { border-color: var(--gold-dim); background: var(--surface-3); }
.upload-area .icon { font-size: 32px; margin-bottom: 8px; }
.upload-area p { color: var(--muted); font-size: 13px; margin: 0; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; filter: grayscale(0.5); }
.empty-state h3 { font-family: 'Playfair Display', serif; color: var(--text-secondary); margin-bottom: 6px; }

/* ── Admin table ─────────────────────────────────────────────── */
table.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}

table.admin-table th {
  background: var(--black);
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

table.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

table.admin-table tbody tr:last-child td { border-bottom: none; }
table.admin-table tbody tr:hover td { background: var(--surface-2); }

/* ── Table toolbar (search/filter) ───────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.table-toolbar input[type="search"] { max-width: 440px; flex: 1 1 280px; }

.filter-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ── Sortable headers ────────────────────────────────────────── */
table.lots th.sortable { cursor: pointer; user-select: none; }
table.lots th.sortable:hover { color: var(--gold); }
table.lots th.sorted-asc::after  { content: " ▲"; font-size: 9px; color: var(--gold); }
table.lots th.sorted-desc::after { content: " ▼"; font-size: 9px; color: var(--gold); }

/* ── Upload preview ──────────────────────────────────────────── */
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.preview-auction-name {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--text);
  font-weight: 400;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.preview-stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.preview-stat.highlight { border-color: var(--sold-text); }
.preview-stat.highlight-gold { border-color: var(--gold-dim); }

.preview-stat-value       { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.preview-stat-value.sold  { color: var(--sold-text); }
.preview-stat-value.gold  { color: var(--gold); font-size: 16px; }
.preview-stat-value.muted { color: var(--muted); }
.preview-stat-label       { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 4px; }

.preview-consignors { border-top: 1px solid var(--border); padding-top: 20px; }
.preview-consignors-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }
.preview-consignors-list { display: flex; flex-wrap: wrap; gap: 8px; }

.consignor-chip {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.preview-actions { padding: 24px 28px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.preview-note { font-size: 13px; color: var(--muted); margin: 0 0 16px; }

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-grid { grid-template-columns: 1fr; }
  .nav { padding: 0 16px; }
  .container { padding: 0 16px; }
  .page { padding: 24px 0 60px; }
  .page-header h1 { font-size: 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-user { display: none; }
}

@media (max-width: 760px) {
  .table-wrapper { overflow: visible; border: none; }

  table.lots,
  table.lots tbody,
  table.lots tr,
  table.lots td { display: block; width: 100%; }

  table.lots thead { display: none; }

  table.lots tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 6px 14px;
  }

  table.lots tbody tr:nth-child(even) td { background: transparent; }
  table.lots tbody tr:hover td { background: transparent; }

  table.lots td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    text-align: right;
  }

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

  table.lots td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    flex-shrink: 0;
  }

  table.lots td.title-cell {
    max-width: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    display: block;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
    margin-bottom: 4px;
  }

  table.lots td.title-cell::before { display: none; }
}
