/* SIDI Pre-order — "pit lane" utilitarian: asphalt, racing red, condensed type */
@import url('https://fonts.googleapis.com/css2?family=Saira+Condensed:wght@600;700;800&family=Barlow:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --asphalt: #16181c;
  --asphalt-2: #22252b;
  --paper: #f4f2ee;
  --card: #ffffff;
  --ink: #1c1e22;
  --ink-soft: #5c6066;
  --line: #d9d5cd;
  --red: #c8102e;
  --red-dark: #9d0c24;
  --amber: #b45309;
  --amber-bg: #fdf3e3;
  --green: #1a7f4b;
  --radius: 4px;
  --display: 'Saira Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', Consolas, monospace;
  --shadow: 0 1px 3px rgba(20, 20, 25, .12), 0 4px 14px rgba(20, 20, 25, .06);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 130px; }
body {
  margin: 0;
  font: 14px/1.45 var(--body);
  background: var(--paper);
  color: var(--ink);
}
/* subtle grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: radial-gradient(rgba(0,0,0,.028) 1px, transparent 1px);
  background-size: 4px 4px;
}
#app { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: .03em; }
button { font-family: var(--body); cursor: pointer; }
input, select, textarea { font-family: var(--body); font-size: 14px; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--asphalt); color: #eceae6;
  border-bottom: 3px solid var(--red);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
/* brand lockup — same as the SidiMoto platform: logo | divider | MOTO • CZ */
.brand { display: flex; align-items: center; gap: 14px; margin-right: auto; }
.brand img.logo { height: 22px; width: auto; display: block; }
.topbar .brand img.logo { filter: invert(1); }
.brand .divider { width: 1px; height: 24px; background: #3a3e46; }
.brand .btext { display: flex; flex-direction: column; gap: 2px; }
.brand .moto {
  font-size: 14px; font-weight: 600; letter-spacing: .14em; line-height: 1;
  text-transform: uppercase; color: #fff;
}
.brand .sub {
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: #9aa0a8; white-space: nowrap; font-weight: 500;
}
.topbar a { color: #cfd3d9; text-decoration: none; font-weight: 600; font-size: 13px; }
.topbar a:hover { color: #fff; }

/* currency switch */
.cur-switch { display: inline-flex; border: 1px solid #3a3e46; border-radius: 999px; overflow: hidden; }
.cur-switch button {
  border: 0; background: transparent; color: #9aa0a8; padding: 5px 14px;
  font-weight: 700; font-size: 13px; letter-spacing: .05em;
}
.cur-switch button.on { background: var(--red); color: #fff; }

.userbox { font-size: 13px; color: #9aa0a8; display: flex; align-items: center; gap: 10px; }
.userbox b { color: #eceae6; }
.linkbtn { background: none; border: 0; color: #cfd3d9; font-weight: 600; font-size: 13px; padding: 0; }
.linkbtn:hover { color: #fff; text-decoration: underline; }

/* ---------- toolbar (search + tabs) ---------- */
.toolbar {
  position: sticky; top: 53px; z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 20px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.searchwrap { position: relative; flex: 1 1 320px; max-width: 460px; }
.searchwrap input {
  width: 100%; padding: 9px 34px 9px 36px; border: 1.5px solid var(--line);
  border-radius: var(--radius); background: var(--card); outline: none;
}
.searchwrap input:focus { border-color: var(--asphalt); }
.searchwrap .icon { position: absolute; left: 11px; top: 9px; color: var(--ink-soft); }
.searchwrap .clear {
  position: absolute; right: 6px; top: 6px; border: 0; background: none;
  font-size: 16px; color: var(--ink-soft); padding: 2px 6px;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink-soft);
  padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .06em; font-family: var(--display);
}
.tabs button.on { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }

/* ---------- content ---------- */
.content { max-width: 1280px; margin: 0 auto; padding: 18px 20px 130px; }

.notice {
  background: var(--amber-bg); border: 1px solid #e8c896; border-left: 4px solid var(--amber);
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13.5px;
}
.notice.closed { background: #fdecec; border-color: #efb2b2; border-left-color: var(--red); }
.notice b.flag { color: var(--amber); }

/* ---------- product groups ---------- */
.group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 18px;
  /* no overflow:hidden here — it would become the scrollport for the
     sticky size header and pin it inside the card instead of the viewport */
}
.group-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px 8px; border-bottom: 2px solid var(--asphalt);
}
.group-head h3 { margin: 0; font-size: 21px; font-weight: 800; }
.group-head .cat {
  font-family: var(--display); font-size: 12px; letter-spacing: .12em;
  color: var(--red); font-weight: 700; text-transform: uppercase;
}
.group-head .new-badge {
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800;
  padding: 2px 8px; border-radius: 2px; letter-spacing: .1em; font-family: var(--display);
}
.group-head .prices { margin-left: auto; font-size: 13px; color: var(--ink-soft); }
.group-head .prices b { color: var(--ink); font-size: 15px; }

/* no overflow wrapper on desktop — an overflow container would break
   position:sticky of the size header; small screens get scroll instead */
.gtable-wrap { overflow-x: visible; }
table.gtable { border-collapse: collapse; width: 100%; }
.gtable th, .gtable td { padding: 4px 6px; border-bottom: 1px solid #eeebe5; font-size: 13px; }
.gtable thead th {
  position: sticky; top: var(--stickytop, 110px); z-index: 5;
  background: #eceae4; font-family: var(--display); font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: #43464c;
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
.gtable th.szh { text-align: center; min-width: 46px; }
.gtable td.thumb { width: 42px; padding: 3px 2px 3px 8px; }
.gtable td.thumb img {
  width: 36px; height: 36px; object-fit: contain; background: #fff;
  border: 1px solid #eee; border-radius: 3px; display: block;
  transition: transform .12s ease; cursor: zoom-in;
}
.gtable td.thumb img:hover { transform: scale(3.2); position: relative; z-index: 30; box-shadow: var(--shadow); }
.gtable td.thumb .noimg {
  width: 36px; height: 36px; border: 1px dashed #ddd; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; color: #ccc; font-size: 15px;
}
.gtable td.color { min-width: 150px; }
.gtable td.color .cdesc { font-weight: 600; }
.gtable td.color .ccode { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); }
.gtable td.price { white-space: nowrap; font-size: 12.5px; color: var(--ink-soft); }
.gtable td.price b { color: var(--ink); }
.gtable td.sz { text-align: center; padding: 3px; position: relative; }
.gtable td.sz input {
  width: 44px; padding: 5px 3px; text-align: center; border: 1.5px solid var(--line);
  border-radius: 3px; background: #fff; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.gtable td.sz input::-webkit-outer-spin-button, .gtable td.sz input::-webkit-inner-spin-button { display: none; }
.gtable td.sz input:focus { border-color: var(--asphalt); outline: none; }
.gtable td.sz input.filled { border-color: var(--green); background: #eef8f1; font-weight: 700; }
.gtable td.sz.nostock input { border-color: #e5b877; background: var(--amber-bg); }
.gtable td.sz.nostock::after {
  content: '▲'; position: absolute; top: 1px; right: 3px;
  font-size: 8px; color: var(--amber);
}
.gtable td.sz.na { color: #c9c5bd; }
.gtable td.rowsum { font-weight: 700; }
.gtable tr.hit { animation: hitflash 2.2s ease-out; }
@keyframes hitflash { 0%, 55% { background: #ffe9a8; } 100% { background: transparent; } }

/* ---------- subtotal bar ---------- */
.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  background: var(--asphalt); color: #eceae6;
  border-top: 3px solid var(--red);
  transform: translateY(110%); transition: transform .18s ease;
}
.totalbar.show { transform: none; }
.totalbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.totalbar .stat { font-size: 12px; color: #9aa0a8; text-transform: uppercase; letter-spacing: .08em; }
.totalbar .stat b { display: block; font-size: 19px; color: #fff; font-family: var(--display); letter-spacing: .02em; }
.totalbar .stat b.net { color: #ffd7de; }
.btn {
  border: 0; border-radius: var(--radius); padding: 11px 26px;
  font-weight: 800; font-size: 14px; letter-spacing: .06em; text-transform: uppercase;
  font-family: var(--display); background: var(--red); color: #fff;
}
.btn:hover { background: var(--red-dark); }
.btn:disabled { background: #555; cursor: not-allowed; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #14653c; }
.btn.ghost { background: transparent; border: 1.5px solid #4a4e56; color: #cfd3d9; }
.btn.ghost:hover { border-color: #fff; color: #fff; background: transparent; }
.btn.small { padding: 7px 14px; font-size: 12.5px; }

/* ---------- auth gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(160deg, rgba(22,24,28,.96) 55%, rgba(157,12,36,.88)),
    repeating-linear-gradient(-45deg, #1a1c21 0 26px, #202329 26px 52px);
}
.gate-card {
  width: min(430px, 92vw); background: var(--paper); border-radius: 6px;
  padding: 30px 34px 26px; box-shadow: 0 24px 70px rgba(0,0,0,.5);
  border-top: 5px solid var(--red);
}
.gate-card .brand { margin-bottom: 22px; }
.gate-card .brand img.logo { height: 26px; }
.gate-card .brand .divider { background: var(--line); }
.gate-card .brand .moto { color: var(--ink); }
.gate-card label { display: block; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin: 13px 0 4px; color: #43464c; }
.gate-card input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.gate-card input:focus { border-color: var(--asphalt); outline: none; }
.gate-card .btn { width: 100%; margin-top: 20px; padding: 13px; }
.gate-card .err { color: var(--red); font-weight: 600; font-size: 13px; margin-top: 12px; }
.gate-card .hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 14px; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 90; background: rgba(15,16,19,.55);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px;
}
.modal {
  background: var(--paper); border-radius: 6px; border-top: 5px solid var(--red);
  width: min(860px, 100%); max-height: 88vh; overflow: auto; padding: 22px 26px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.modal h2 { margin: 0 0 4px; font-size: 24px; }
.modal table { border-collapse: collapse; width: 100%; margin: 12px 0; }
.modal th, .modal td { border-bottom: 1px solid var(--line); padding: 5px 8px; font-size: 13px; text-align: left; }
.modal th { font-family: var(--display); text-transform: uppercase; font-size: 11.5px; letter-spacing: .06em; color: #43464c; }
.modal textarea { width: 100%; min-height: 64px; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 8px 10px; resize: vertical; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal .btn.gray { background: #6a6e75; }

/* status chips */
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.chip.new { background: #fff3cd; color: #7a5b00; border: 1px solid #e8d489; }
.chip.confirmed { background: #e2f4e9; color: var(--green); border: 1px solid #a9dcbd; }
.chip.cancelled { background: #fdecec; color: var(--red); border: 1px solid #efb2b2; }
.chip.draft { background: #e9edf3; color: #3d5573; border: 1px solid #bfcbdb; }

/* ---------- orders list (customer + admin) ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px;
}
table.list { border-collapse: collapse; width: 100%; }
.list th, .list td { padding: 7px 9px; border-bottom: 1px solid #eeebe5; font-size: 13px; text-align: left; }
.list thead th { font-family: var(--display); text-transform: uppercase; font-size: 11.5px; letter-spacing: .07em; color: #43464c; border-bottom: 2px solid var(--line); }
.list tr:hover td { background: #faf8f4; }

/* group header rows in the admin product list (mirrors .group-head of the order form) */
.list tr.phead td {
  padding: 14px 9px 6px; font-size: 16px; font-weight: 800;
  border-bottom: 2px solid var(--asphalt); background: none;
}
.list tr.phead .cat {
  font-family: var(--display); font-size: 11px; letter-spacing: .12em;
  color: var(--red); font-weight: 700; text-transform: uppercase; margin-left: 12px;
}
.list tr.phead:hover td { background: none; }

.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 120;
  background: var(--asphalt); color: #fff; padding: 12px 22px; border-radius: 4px;
  border-left: 4px solid var(--green); box-shadow: var(--shadow); font-weight: 600;
}
.toast.error { border-left-color: var(--red); }

.empty { text-align: center; color: var(--ink-soft); padding: 46px 0; font-size: 15px; }

/* ---------- admin specifics ---------- */
.admin-tabs { display: flex; gap: 2px; margin: 16px 0; border-bottom: 2px solid var(--asphalt); flex-wrap: wrap; }
.admin-tabs button {
  border: 0; background: transparent; padding: 9px 18px; font-family: var(--display);
  font-size: 14.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft);
  border-radius: 4px 4px 0 0;
}
.admin-tabs button.on { background: var(--asphalt); color: #fff; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; color: #43464c; }
.field input[type=text], .field input[type=number] {
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); width: 220px; background: #fff;
}
.inline-input { width: 84px !important; padding: 4px 6px !important; text-align: right; }
.sizeflags { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 0; }
.sizeflags label {
  display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 3px; font-size: 12px; cursor: pointer; background: #fff;
}
.sizeflags label.on { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); font-weight: 700; }

@media (max-width: 1000px) {
  .gtable-wrap { overflow-x: auto; }
  .gtable thead th { position: static; }
  .brand .sub { display: none; }
}
