:root {
  --accent: #3b82f6;
  --bg: #0f1115;
  --bg-elevated: #171a21;
  --border: #2a2e37;
  --text: #e6e8eb;
  --text-muted: #9aa1ac;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f7f8fa;
  --bg-elevated: #ffffff;
  --border: #dfe3e8;
  --text: #14161a;
  --text-muted: #5a6270;
}

[data-theme="high-contrast"] {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --border: #ffffff;
  --text: #ffffff;
  --text-muted: #ffffff;
  --accent: #ffdd00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

header.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

header.site-header img.logo { height: 34px; }
header.site-header .brand { font-weight: 600; font-size: 1.1rem; }

nav.site-nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
nav.site-nav a { color: var(--text-muted); font-size: 0.92rem; }
nav.site-nav a:hover, nav.site-nav a.active { color: var(--text); }

.header-right { display: flex; gap: 14px; align-items: center; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

input, select, button {
  font-family: inherit;
  font-size: 0.95rem;
}

input[type="text"], input[type="password"], input[type="search"], select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
}

button {
  background: var(--accent);
  color: #0b0c0f;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.08); }
button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.search-bar { margin-bottom: 20px; max-width: 420px; }

.category-tabs {
  display: flex;
  gap: 8px;
  margin: -6px 0 20px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.category-tab {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 8px 14px;
}
.category-tab:hover { color: var(--text); }
.category-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0c0f;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.product-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #000;
}

.product-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .name { font-weight: 600; }
.product-card .desc { font-size: 0.85rem; color: var(--text-muted); flex: 1; }

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 4px;
  width: fit-content;
}
.tag.special { background: #7c3aed; color: #fff; }
.tag.limited { background: #f59e0b; color: #1a1300; }
.tag.oos { background: var(--danger); color: #fff; }
.tag.low { color: var(--danger); font-size: 0.78rem; }

.price-row { display: flex; align-items: baseline; gap: 8px; }
.price { font-weight: 700; }
.price.strike { text-decoration: line-through; color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }

.qty-controls { display: flex; align-items: center; gap: 10px; }
.qty-controls button { padding: 4px 12px; }

.floating-cart {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #0b0c0f;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 30;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: flex-end;
  justify-content: flex-end;
  z-index: 40;
}
.cart-overlay.open { display: flex; }
.cart-panel {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  width: min(400px, 100%);
  height: 100%;
  padding: 20px;
  overflow-y: auto;
}
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }

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

.form-narrow { max-width: 380px; margin: 40px auto; display: flex; flex-direction: column; gap: 14px; }

.status-badge { padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-pending { background: #f59e0b33; color: #f59e0b; }
.status-approved { background: #22c55e33; color: #22c55e; }
.status-cancelled { background: #ef444433; color: #ef4444; }

.error-msg { color: var(--danger); font-size: 0.88rem; }
.success-msg { color: var(--success); font-size: 0.88rem; }

.toolbar { margin-bottom: 18px; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar-actions input,
.toolbar-actions select { min-width: 180px; }

.admin-order-card { display: flex; flex-direction: column; gap: 12px; }
.admin-order-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.muted { color: var(--text-muted); font-size: 0.8rem; }
.inline-list { display: flex; flex-wrap: wrap; gap: 8px; }
.link-button { background: transparent; border: none; color: var(--accent); padding: 0; font-weight: 600; cursor: pointer; }
.admin-order-actions { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.admin-order-actions label { display: flex; flex-direction: column; gap: 6px; min-width: 160px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.modal-card.narrow { width: min(420px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form label { display: flex; flex-direction: column; gap: 6px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input { flex: 1; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(59,130,246,0.12);
  border: 1px solid var(--border);
}
.removable-tag { padding-right: 6px; }
.remove-tag-btn {
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
}
.muted-text { color: var(--text-muted); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.theme-option { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; text-align: center; }
.theme-option.active { border-color: var(--accent); }
