:root {
  --bg: #07070a;
  --sidebar: #0b0c10;
  --panel: #12141a;
  --panel2: #181b24;
  --border: #2a2e3a;
  --text: #f4f4f5;
  --muted: #8b8b96;
  --accent: #e11d2e;
  --accent-hover: #f12a3c;
  --accent-pressed: #b81422;
  --success: #34d399;
  --font: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100%;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}
.nav {
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.nav a:hover { color: var(--text); }

.hero {
  position: relative;
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  padding: 48px 56px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(7,7,10,.92) 0%, rgba(7,7,10,.55) 45%, rgba(7,7,10,.35) 100%),
    linear-gradient(135deg, #12080c 0%, #07070a 45%, #1a0a10 100%);
}
.hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.hero-inner { max-width: 720px; position: relative; z-index: 1; }
.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-bottom: 14px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 84px);
  line-height: 0.95;
  letter-spacing: 0.04em;
}
.hero p {
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 16px;
  max-width: 480px;
}
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  border-radius: 2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: #151822; }

.footer {
  border-top: 1px solid var(--border);
  background: var(--sidebar);
  padding: 16px 24px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page {
  padding: 28px 24px 48px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.page h1 {
  margin: 0 0 8px;
  font-size: 32px;
}
.page .sub {
  color: var(--muted);
  margin-bottom: 24px;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
select, input[type="text"], input[type="password"], input[type="number"], textarea {
  background: #0e1016;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 2px;
  font: inherit;
  min-width: 180px;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card .thumb {
  aspect-ratio: 16/10;
  background: var(--panel2);
  object-fit: cover;
  width: 100%;
  height: auto;
}
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.card .price {
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
}
.card .body .btn { margin-top: auto; width: 100%; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 22px;
}
.modal h2 { margin: 0 0 12px; font-size: 22px; }
.modal .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.modal .total {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 700;
}
.field { margin: 16px 0; }
.field label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.hint {
  position: relative;
  display: inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  cursor: help;
}
.hint:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  background: #0e1016;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  z-index: 2;
  white-space: normal;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}
.error {
  color: #f87171;
  font-size: 13px;
  margin-top: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
}
.stat .k { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.stat .v { font-size: 28px; font-weight: 700; margin-top: 8px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
}
.table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; }

/* display:grid/flex on views must not override the hidden attribute */
[hidden] {
  display: none !important;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.admin-box {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 28px;
}
.admin-box .btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.panel-section { display: none; }
.panel-section.active { display: block; }

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 20px;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.chip {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip-count {
  opacity: .7;
  margin-left: 4px;
}
.card-cat {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}
.empty {
  color: var(--muted);
  padding: 32px 0;
  text-align: center;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 720px) {
  .hero { padding: 32px 20px; }
  .topbar {
    padding: 0 14px;
    position: relative;
    z-index: 40;
  }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 56px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--sidebar);
    border-bottom: 1px solid var(--border);
    padding: 8px 14px 14px;
  }
  .nav.open { display: flex; }
  .nav a, .nav > span, .nav .btn {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
  }
  .nav .btn { width: 100%; margin-top: 8px; border-bottom: 0; }
  .page { padding: 20px 14px 40px; }
  .page h1 { font-size: 26px; }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar select,
  .toolbar input,
  .ban-toolbar input,
  select, input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea {
    min-width: 0;
    width: 100%;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .card h3 { font-size: 13px; }
  .card .price { font-size: 16px; }
  .btn { padding: 12px 16px; }
  .modal { padding: 16px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .hint:hover::after {
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(240px, 70vw);
  }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .v { font-size: 22px; }
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .tab { flex: 0 0 auto; }
  .table { min-width: 640px; }
  .admin-box { padding: 20px 16px; }
  .footer { padding: 14px; font-size: 11px; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr; }
  .hero h1 { font-size: 42px; }
}
