:root {
  --crimson: #a30f35;
  --crimson-dark: #760b27;
  --crimson-soft: #fce7eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --ink: #1c1c1e;
  --muted: #6b7280;
  --line: #e5e7eb;
  --shadow: 0 14px 34px rgba(17, 24, 39, .08);
  font-family: Inter, Segoe UI, Roboto, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { border: 0; border-radius: 999px; padding: 12px 18px; background: var(--crimson); color: white; font-weight: 900; cursor: pointer; box-shadow: 0 8px 20px rgba(163,15,53,.16); }
button.secondary { background: #fff; color: var(--crimson); border: 1px solid #dbc6cd; box-shadow: none; }
button.ghost { background: transparent; color: var(--crimson); border: 0; padding: 4px; box-shadow: none; }
button:disabled { opacity: .55; cursor: not-allowed; }
input { width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; background: #fff; color: var(--ink); outline: none; }
input:focus { border-color: var(--crimson); box-shadow: 0 0 0 4px rgba(163,15,53,.08); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #fff 0, var(--bg) 58%); }
.login-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 30px; box-shadow: var(--shadow); }
.login-logo { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; background: var(--crimson); color: #fff; font-weight: 1000; letter-spacing: .08em; margin-bottom: 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -.03em; }
.login-card p { margin: 0 0 24px; color: var(--muted); }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 800; }
.message { margin-top: 14px; color: var(--crimson-dark); font-weight: 800; }

.shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 16px max(18px, env(safe-area-inset-left)) 14px; background: rgba(247,248,250,.92); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(229,231,235,.86); }
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: max-content; }
.brand-mark { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--crimson); color: #fff; font-weight: 1000; letter-spacing: .05em; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.brand small { color: var(--muted); }
.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.nav button { padding: 10px 14px; box-shadow: none; }
.nav button.active { background: var(--crimson); color: #fff; }
.nav button:not(.active) { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.content { width: min(1240px, 100%); margin: 0 auto; padding: 22px; }

.hero { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: center; background: linear-gradient(135deg, #fff, #fff7f9); border: 1px solid var(--line); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px; }
.hero h2 { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: .95; letter-spacing: -.06em; }
.hero p { color: var(--muted); font-size: 18px; max-width: 620px; }
.eyebrow { margin: 0 0 8px; color: var(--crimson); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 1000; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 22px 0 14px; }
.section-title h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.section-title span, .muted { color: var(--muted); }
.searchbar { display: flex; gap: 10px; margin-bottom: 16px; }
.searchbar input { flex: 1; }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 10px; }

.grid { display: grid; gap: 14px; }
.category-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.product-grid.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 6px 20px rgba(17,24,39,.04); overflow: hidden; }
.clickable { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #decbd1; }
.category-card { display: grid; grid-template-columns: 92px minmax(0,1fr); gap: 14px; align-items: center; padding: 14px; min-height: 126px; }
.category-card h3, .product-card h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.03em; }
.category-card p, .product-card p { margin: 0; color: var(--muted); }
.product-card { display: grid; grid-template-rows: 190px auto; min-height: 316px; }
.product-info { padding: 14px; }
.product-info strong, .price-text { color: var(--crimson); font-weight: 1000; }
.image-box { width: 100%; height: 100%; min-height: 92px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.image-box img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 8px; }
.category-card .image-box { border-radius: 18px; border: 1px solid var(--line); background: #fff; }
.placeholder { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--crimson-soft); color: var(--crimson); font-weight: 1000; }
.missing-image img { display: none; }

.product-detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 16px; margin-top: 14px; }
.media-card { min-height: 460px; padding: 16px; }
.media-card .image-box { min-height: 428px; border-radius: 18px; }
.detail-card { padding: 24px; }
.detail-card h2 { margin: 0; font-size: clamp(34px, 5vw, 54px); line-height: .92; letter-spacing: -.06em; }
.price-text { font-size: 30px; margin: 18px 0; }
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.specs div { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: #fff; }
.specs span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.specs strong { display: block; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.matrix-card { padding: 18px; margin-top: 16px; }
.matrix-card h2 { margin: 0 0 12px; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 440px; }
th { background: var(--crimson-dark); color: #fff; text-align: center; font-weight: 1000; }
th, td { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
td:first-child { font-weight: 900; color: var(--ink); }
tbody tr:nth-child(even) { background: #fafafa; }
.empty { padding: 44px 22px; text-align: center; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 24px; }
.empty.error h2 { color: var(--crimson-dark); }

@media (max-width: 780px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav { margin-left: 0; width: 100%; justify-content: stretch; }
  .nav button { flex: 1 1 auto; }
  .content { padding: 16px; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .category-grid { grid-template-columns: 1fr; }
  .product-grid, .product-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-card { grid-template-rows: 150px auto; min-height: 280px; }
  .product-detail { grid-template-columns: 1fr; }
  .media-card { min-height: 320px; }
  .media-card .image-box { min-height: 290px; }
  .specs { grid-template-columns: 1fr; }
  .searchbar { flex-direction: column; }
}

@media print {
  .topbar, .searchbar, .breadcrumb, button { display: none !important; }
  body, .content { background: #fff; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}