:root {
  --kramp-red: #154a8d;
  --kramp-red-dark: #9a0b14;
  --kramp-red-darker: #112b4c;
  --ink: #1a1a1a;
  --ink-muted: #6b6b6b;
  --line: #e4e4e4;
  --line-strong: #c8c8c8;
  --bg: #f5f5f5;
  --card: #ffffff;
  --accent-green: #2e7d32;
  --accent-amber: #b8860b;
  --accent-red: #b00020;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  background: var(--kramp-red);
  color: #fff;
  border-bottom: 4px solid var(--kramp-red-darker);
}
.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff !important;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.brand:hover { text-decoration: none; }
.brand__logo {
  display: block;
  height: 40px;
  width: auto;
}

.header-search {
  flex: 1;
  display: flex;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  max-width: 720px;
}
.header-search input {
  flex: 1;
  border: 0;
  padding: 10px 14px;
  font: inherit;
  outline: none;
  color: var(--ink);
}
.header-search button {
  background: #fff;
  color: var(--ink-muted);
  border: 0;
  padding: 0 14px;
  cursor: pointer;
}
.header-search button:hover { color: var(--kramp-red); }

.cart-btn {
  position: relative;
  color: #fff !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
}
.cart-btn:hover { text-decoration: none; opacity: 0.85; }
.cart-btn__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #f5b400;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- Main ---------- */
.site-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* ---------- Flash ---------- */
.flash {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  border-left: 4px solid;
  background: #fff;
}
.flash.notice { border-color: var(--accent-green); }
.flash.alert  { border-color: var(--accent-red); }

/* ---------- Breadcrumb / page header ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-head h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}
.breadcrumb {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--kramp-red); }
.breadcrumb__sep { margin: 0 6px; color: var(--line-strong); }

/* ---------- Layout: sidebar + main column ---------- */
.with-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .with-sidebar { grid-template-columns: 1fr; }
}

.sidebar .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar .panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
}
.sidebar .panel ul { list-style: none; padding: 0; margin: 0; }
.sidebar .panel li { padding: 4px 0; font-size: 0.92rem; }
.sidebar .panel li a { color: var(--ink); }
.sidebar .panel li a:hover { color: var(--kramp-red); text-decoration: none; }
.sidebar .panel .count { color: var(--ink-muted); font-size: 0.85rem; }

.sidebar .search-input {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
}
.sidebar .search-input input {
  flex: 1; border: 0; padding: 8px 10px; font: inherit; outline: none;
}
.sidebar .search-input button {
  background: var(--bg); color: var(--ink-muted); border: 0; padding: 0 12px; cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--kramp-red);
  color: #fff !important;
  border: 0;
  padding: 10px 18px;
  border-radius: 4px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover { background: var(--kramp-red-dark); }
.btn.secondary {
  background: #fff;
  color: var(--ink) !important;
  border: 1px solid var(--line-strong);
}
.btn.secondary:hover { background: var(--bg); }
.btn.link {
  background: transparent;
  color: var(--kramp-red) !important;
  padding: 0;
  font-weight: 600;
  border-radius: 0;
}
.btn.link:hover { background: transparent; text-decoration: underline !important; }
.btn.danger { background: var(--accent-red); }
.btn.danger:hover { background: #8a0019; }

/* ---------- Product grid ---------- */
.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.product-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.product-card .thumb {
  background: var(--bg);
  border-radius: 4px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--line-strong);
  font-size: 2rem;
  margin-bottom: 4px;
}
.product-card .sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.product-card .desc {
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
  color: var(--ink);
}
.product-card .price {
  font-weight: 700;
  font-size: 1.05rem;
}
.product-card .price .muted { font-weight: 400; }

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 28px 0;
  align-items: center;
}
.pager a, .pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.pager a:hover { border-color: var(--ink); text-decoration: none; }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Product detail ---------- */
.product-show {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 28px;
}
.product-show .layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
@media (max-width: 800px) {
  .product-show .layout { grid-template-columns: 1fr; }
}
.product-show .thumb-lg {
  background: var(--bg);
  border-radius: 4px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--line-strong);
  font-size: 5rem;
}
.product-show h1 { margin: 4px 0 6px; font-size: 1.6rem; }
.product-show .sku { color: var(--ink-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.product-show .price-big { font-size: 1.8rem; font-weight: 700; margin: 12px 0 4px; }
.product-show .price-list { color: var(--ink-muted); font-size: 0.9rem; }
.product-show dl { margin: 0; }
.product-show dt { color: var(--ink-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 8px; }
.product-show dd { margin: 0; }

/* ---------- Live data blocks (price + stock) ---------- */
.live-block {
  padding: 12px 14px;
  border-radius: 4px;
  margin: 12px 0;
  background: var(--card);
  border-left: 4px solid;
}
.live-block.loading { border-color: var(--line-strong); color: var(--ink-muted); background: var(--bg); }
.live-block.ok     { border-color: var(--accent-green); background: #f0f8f1; }
.live-block.warn   { border-color: var(--accent-amber); background: #fdf7e8; }
.live-block.err    { border-color: var(--accent-red);   background: #fdf0f0; }
.live-block strong { color: var(--ink); }

/* ---------- Add-to-cart form ---------- */
.add-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: 4px;
}
.add-form label { font-weight: 600; }
.add-form input[type="number"] {
  width: 80px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: inherit;
}

/* ---------- Cart table ---------- */
table.cart {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
table.cart th, table.cart td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.cart th {
  background: var(--bg);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  font-weight: 600;
}
table.cart tr:last-child td { border-bottom: 0; }
table.cart input[type=number] {
  width: 70px; padding: 6px 8px;
  border: 1px solid var(--line-strong); border-radius: 4px; font: inherit;
}
table.cart tfoot th { background: #fff; font-size: 1rem; color: var(--ink); }

/* ---------- Utility ---------- */
.muted { color: var(--ink-muted); font-size: 0.9rem; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-muted) !important;
  font-size: 0.92rem;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--kramp-red) !important; text-decoration: none; }
