:root {
  --bg: #edf2f7;
  --panel: #fff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ec;
  --navy: #0a1f36;
  --blue: #075fd0;
  --red: #c5232d;
  --green: #15803d;
  --amber: #b7791f;
  --copper: #b95f2b;
  --graphite: #26313d;
  --shadow: 0 18px 48px rgba(8, 33, 61, 0.12);
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 250px 180px minmax(260px, 1fr) auto;
  gap: 12px; align-items: center; padding: 10px 18px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--blue); color: #fff; font-weight: 800; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 12px; }
.city-select, .search { display: flex; align-items: center; gap: 8px; min-width: 0; background: #f8fafc; border: 1px solid var(--line); padding: 0 12px; height: 42px; }
.city-select select, .search input { width: 100%; border: 0; outline: 0; background: transparent; min-width: 0; }
.top-actions { display: flex; gap: 8px; }
.icon-action, .icon-only {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.icon-action { padding: 0 12px; }
.icon-only { width: 38px; padding: 0; }
.icon-action svg, .icon-only svg, .filters-panel svg, .flow-steps svg { width: 18px; height: 18px; }
.cart-toggle span { display: grid; place-items: center; min-width: 22px; height: 22px; background: var(--red); color: #fff; font-size: 12px; }

.mainnav {
  display: grid; grid-template-columns: repeat(5, auto) 1fr; gap: 22px; align-items: center;
  padding: 10px 22px; background: var(--navy); color: #fff;
}
.mainnav a { color: #fff; text-decoration: none; font-size: 14px; }

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; padding: 18px; }
.catalog-nav { position: sticky; top: 118px; align-self: start; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.catalog-title { width: 100%; display: flex; align-items: center; gap: 8px; padding: 14px; border: 0; background: var(--blue); color: #fff; font-weight: 700; }
.category-list { display: grid; padding: 8px; gap: 4px; }
.category-list button { display: flex; justify-content: space-between; gap: 8px; border: 0; background: transparent; padding: 10px; text-align: left; color: var(--ink); }
.category-list button.active { background: #e8f1ff; color: var(--blue); font-weight: 700; }
.category-list small { color: var(--muted); }
.content { min-width: 0; display: grid; gap: 16px; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); gap: 24px; align-items: stretch;
  min-height: 360px; padding: 28px; background: linear-gradient(135deg, #0a1f36, #17456f); color: #fff; overflow: hidden;
}
.hero-copy { max-width: 780px; align-self: center; }
.eyebrow { margin: 0 0 8px; color: #b8d4f6; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.hero h1 { margin: 0; font-size: 42px; line-height: 1.05; letter-spacing: 0; }
.hero p { font-size: 17px; color: #dbeafe; max-width: 720px; }
.hero-search { display: flex; gap: 8px; max-width: 650px; }
.hero-search input { flex: 1; min-width: 0; border: 0; padding: 14px; }
.hero-search button, .primary-button { border: 0; background: var(--red); color: #fff; padding: 12px 18px; font-weight: 700; }
.hero-media { display: grid; align-self: center; }
.hero-media figure { position: relative; margin: 0; overflow: hidden; background: #fff; }
.hero-media img { width: 100%; height: 300px; object-fit: cover; display: block; }
.hero-main-photo {
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 18px 42px rgba(0,0,0,.22);
}

.hero-stats, .flow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hero-stats div, .flow-steps div, .info-grid article, .knowledge-card {
  background: var(--panel); border: 1px solid var(--line); padding: 16px;
}
.hero-stats strong, .hero-stats span, .flow-steps strong, .flow-steps span { display: block; }
.hero-stats strong, .flow-steps strong { margin-top: 8px; font-size: 20px; }
.hero-stats span, .flow-steps span, .info-grid span { color: var(--muted); font-size: 14px; }

.popular-categories, .filters-panel, .tool-tabs, .tool-view, .site-section { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.mini-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mini-heading h2, .section-heading h2 { margin: 0; font-size: 22px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); }
.link-button { border: 0; color: var(--blue); background: transparent; font-weight: 700; }
.category-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.category-tile { min-height: 110px; padding: 14px; border: 0; color: #fff; text-align: left; background: linear-gradient(135deg, #075fd0, #0a1f36); }
.category-tile strong, .category-tile span { display: block; }
.category-tile span { margin-top: 8px; color: #dbeafe; font-size: 13px; }

.filters-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.filter-group { display: grid; gap: 6px; }
.filter-group label { color: var(--muted); font-size: 12px; }
.filter-group select, .filter-group input, textarea, .checkout input {
  width: 100%; border: 1px solid var(--line); padding: 10px; background: #fff; outline: 0;
}
.toggle-filter { display: flex; gap: 8px; align-items: center; min-height: 40px; white-space: nowrap; }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 10px 14px; }

.tool-tabs { display: flex; gap: 8px; overflow-x: auto; }
.tool-tab { border: 1px solid var(--line); background: #f8fafc; padding: 10px 14px; white-space: nowrap; }
.tool-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tool-view { display: none; }
.tool-view.active { display: block; }
.seo-snapshot { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.seo-snapshot div { border: 1px solid var(--line); background: #f8fafc; padding: 12px; }
.seo-snapshot span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.view-controls { display: flex; gap: 6px; }
.view-controls .active { background: var(--navy); color: #fff; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { border: 1px solid var(--line); background: #fff; overflow: hidden; position: relative; }
.product-card::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--red), var(--copper));
}
.product-image { height: 190px; background: #eef3f8; position: relative; }
.product-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-image img { image-rendering: auto; }
.product-source { position: absolute; top: 10px; left: 10px; background: rgba(38,49,61,.92); color: #fff; padding: 5px 8px; font-size: 12px; }
.product-body { padding: 14px; display: grid; gap: 10px; }
.product-body h3 { margin: 0; font-size: 18px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badges span { background: #edf2f7; color: #344054; padding: 5px 8px; font-size: 12px; }
.badges span:nth-child(2n) { background: #f6e8df; color: #8a3f1d; }
.badges span:nth-child(3n) { background: #e8f1ff; color: #075fd0; }
.product-marking {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--red);
  background: #f8fafc;
  padding: 9px 10px;
}
.product-marking strong {
  color: var(--navy);
  font-size: 12px;
  text-transform: uppercase;
}
.product-marking span {
  color: #344054;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.product-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: var(--muted); font-size: 13px; }
.product-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; flex-wrap: wrap; }
.product-actions .primary-button { margin-left: auto; }
.quote-badge { font-weight: 800; font-size: 14px; color: var(--copper); white-space: normal; }
.quote-note { margin-top: 0; color: var(--muted); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { background: #f8fafc; color: #475467; font-size: 13px; }
.status-ok { color: var(--green); font-weight: 700; }
.status-warn { color: var(--amber); font-weight: 700; }

.knowledge-grid, .info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.knowledge-card strong, .info-grid strong { display: block; margin-bottom: 8px; }
.normalizer-box { display: grid; gap: 12px; }
textarea { min-height: 96px; resize: vertical; }
.normalize-card { border: 1px solid var(--line); background: #f8fafc; padding: 14px; }
.price-actions, .import-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.seo-strategy, .production-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.seo-strategy article, .production-grid article { border: 1px solid var(--line); background: #f8fafc; padding: 12px; }
.seo-strategy strong, .seo-strategy span, .production-grid strong, .production-grid span { display: block; }
.seo-strategy span, .production-grid span { margin-top: 5px; color: var(--muted); font-size: 13px; }
.wordstat-dashboard { display: grid; gap: 12px; margin-bottom: 14px; }
.wordstat-note, .wordstat-import {
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 12px;
  color: #344054;
}
.wordstat-note strong, .wordstat-import strong { color: var(--navy); }
.wordstat-import { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wordstat-import code {
  background: #fff;
  border: 1px solid var(--line);
  padding: 4px 7px;
}
.wordstat-summary, .wordstat-clusters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.wordstat-summary article, .wordstat-cluster {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}
.wordstat-summary strong {
  display: block;
  color: var(--blue);
  font-size: 24px;
}
.wordstat-summary span, .wordstat-cluster small, .wordstat-cluster em, .wordstat-cluster p {
  color: var(--muted);
  font-size: 13px;
}
.wordstat-cluster {
  display: grid;
  gap: 6px;
  border-top: 4px solid var(--blue);
}
.wordstat-cluster.priority-p2 { border-top-color: var(--copper); }
.wordstat-cluster.priority-p3 { border-top-color: var(--amber); }
.wordstat-cluster > span {
  width: max-content;
  background: #e8f1ff;
  color: var(--blue);
  padding: 3px 7px;
  font-weight: 800;
  font-size: 12px;
}
.wordstat-cluster strong { color: var(--navy); }
.wordstat-cluster em { font-style: normal; }
.wordstat-cluster p { margin: 0; line-height: 1.35; }
.wordstat-table td:first-child span {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.cart-panel {
  position: fixed; top: 0; right: 0; z-index: 60; width: min(420px, 100vw); height: 100vh;
  background: #fff; border-left: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(105%); transition: transform .2s ease; display: grid; grid-template-rows: auto 1fr auto;
}
.cart-panel.open { transform: translateX(0); }
.cart-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.cart-items { overflow: auto; padding: 12px; display: grid; align-content: start; gap: 10px; }
.cart-item { border: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; }
.cart-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 28px; height: 28px; border: 1px solid var(--line); background: #fff; }
.checkout { border-top: 1px solid var(--line); padding: 14px; display: grid; gap: 10px; }
.checkout label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }

dialog { width: min(760px, calc(100vw - 28px)); border: 0; padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 31, 54, .55); }
.dialog-content { padding: 18px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dialog-grid { display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin-top: 12px; }
.dialog-grid img { width: 100%; height: 180px; object-fit: cover; background: #edf2f7; }
.dialog-pack-label {
  border: 1px solid var(--line);
  background: #f8fafc;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.dialog-pack-label strong,
.dialog-pack-label span {
  display: block;
}
.dialog-pack-label span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}
.footer { display: flex; justify-content: space-between; gap: 18px; padding: 18px; color: #fff; background: var(--navy); font-size: 14px; }

.landing-page,
.admin-page {
  background: #f3f6f9;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.landing-header nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.landing-header nav a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 700;
}

.landing-main,
.admin-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  gap: 16px;
}

.landing-hero,
.admin-hero {
  background: linear-gradient(135deg, #0a1f36, #17456f);
  color: #fff;
  padding: 30px;
}

.landing-hero h1,
.admin-hero h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.08;
}

.landing-hero p,
.admin-hero p {
  color: #dbeafe;
  max-width: 780px;
}

.landing-hero .primary-button {
  display: inline-flex;
  text-decoration: none;
  margin-top: 8px;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.landing-grid article {
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px;
}

.landing-grid strong,
.landing-grid span {
  display: block;
}

.landing-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-search {
  min-width: min(380px, 100%);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 1fr auto; }
  .city-select, .search { grid-column: span 1; }
  .app-shell { grid-template-columns: 1fr; }
  .catalog-nav { position: static; }
  .hero { grid-template-columns: 1fr; }
  .filters-panel { grid-template-columns: repeat(3, 1fr); }
  .product-grid, .knowledge-grid, .info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr; padding: 10px; }
  .top-actions { justify-content: stretch; }
  .icon-action { flex: 1; }
  .mainnav { grid-template-columns: 1fr 1fr; gap: 10px; }
  .app-shell { padding: 10px; }
  .hero { padding: 18px; }
  .hero h1 { font-size: 30px; }
  .hero-search { flex-direction: column; }
  .hero-stats, .flow-steps, .category-tiles, .filters-panel, .product-grid, .knowledge-grid, .info-grid, .seo-snapshot, .seo-strategy, .production-grid, .wordstat-summary, .wordstat-clusters, .landing-grid { grid-template-columns: 1fr; }
  .landing-header, .admin-hero { align-items: stretch; flex-direction: column; }
  .dialog-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
}
