:root {
  --bg: #edf2f7;
  --card: #ffffff;
  --paper: #f8fbff;
  --text: #10213a;
  --muted: #607189;
  --line: #d8e3ef;
  --brand: #0d4b92;
  --brand-dark: #0a3b71;
  --brand-soft: #eaf2fb;
  --table-head: #d8e7f7;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --stale: #1d4ed8;
  --stale-bg: #dbeafe;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #f4f8fd 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.shell {
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.hero,
.controls,
.section,
.empty.global,
#sectionNav {
  background: var(--card);
  border: 1px solid rgba(16, 33, 58, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(16, 33, 58, 0.05);
}

.hero {
  margin-bottom: 14px;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 58%, #2362a9 100%);
  border-color: rgba(10, 59, 113, 0.35);
}

.hero-main {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hero-logo {
  flex: 0 0 auto;
  min-width: 136px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(13, 75, 146, 0.08);
}

.hero-logo img {
  width: 108px;
  height: auto;
  object-fit: contain;
}

.hero-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: rgba(232, 242, 255, 0.88);
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  max-width: 640px;
  color: rgba(232, 242, 255, 0.92);
  font-size: 14px;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.hero-link.active {
  background: rgba(255, 255, 255, 0.16);
}

.hero-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-top: 8px;
}

.hero-code.is-placeholder {
  min-width: 128px;
  min-height: 24px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.hero-stat {
  min-height: 74px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: rgba(232, 242, 255, 0.82);
}

.hero-stat-value {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
}

.controls {
  margin-bottom: 14px;
  padding: 14px 16px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.search-input {
  flex: 1 1 420px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  background: #fff;
}

.search-input:focus {
  outline: 0;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
}

.search-help {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.search-clear,
.copy-link,
.print-link,
.reset-all {
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  color: var(--brand);
  background: #fff;
  cursor: pointer;
}

.copy-link {
  background: #eff6ff;
}

.utility-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.search-meta strong {
  color: var(--text);
}

.search-hints,
.preset-row {
  margin-top: 12px;
}

.search-hint-list,
.filter-list,
.active-state-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-hint,
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.search-hint {
  padding: 8px 12px;
  border-color: #d5e4f4;
}

.filter-chip {
  padding: 7px 11px;
}

.search-hint:hover,
.filter-chip:hover {
  border-color: #93c5fd;
  color: var(--brand);
}

.filter-chip.active,
.filter-chip.is-active {
  border-color: #bfdbfe;
  background: #f0f6ff;
  color: var(--brand);
}

.search-hint-count,
.filter-chip-count,
.preset-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(13, 75, 146, 0.08);
  color: inherit;
  font-size: 11px;
  font-weight: 800;
}

.active-state {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.active-state-label,
.filter-box-title {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #d4e6fb;
  cursor: pointer;
}

.active-chip-remove {
  font-size: 13px;
  line-height: 1;
}

.copy-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.preset-card {
  text-align: left;
  border: 1px solid #cfe0f3;
  border-radius: 14px;
  padding: 12px 13px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  color: var(--text);
  cursor: pointer;
}

.preset-card:hover {
  border-color: #93c5fd;
  background: #eef6ff;
}

.preset-card-title {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--brand);
}

.preset-card-note {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.preset-card-count {
  margin-top: 8px;
  height: auto;
  padding: 4px 8px;
}

.advanced-filters {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  overflow: hidden;
}

.advanced-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-summary-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.advanced-summary::after {
  content: "+";
  font-size: 18px;
  line-height: 1;
  color: var(--brand);
}

.advanced-filters[open] .advanced-summary::after {
  content: "-";
}

.advanced-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.filter-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.filter-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--paper);
}

#sectionNav {
  margin-bottom: 14px;
  padding: 12px 14px;
}

.nav-group {
  margin: 0 0 10px;
}

.nav-group:last-child {
  margin-bottom: 0;
}

.nav-group-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.nav-pill:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

.group {
  margin-bottom: 20px;
}

.group-head {
  margin-bottom: 10px;
  padding: 0 2px 8px;
  border-bottom: 2px solid #d7e3f0;
}

.group-head h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0;
}

.group-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.section {
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 10px 14px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
}

.section h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.price-table thead th {
  padding: 10px 12px;
  background: #f3f7fb;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: #617790;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: left;
  white-space: nowrap;
}

.price-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.price-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.price-table tbody tr:hover {
  background: #f4f9ff;
}

.cell-product {
  min-width: 260px;
}

.product-name {
  font-weight: 700;
  line-height: 1.4;
}

.product-code {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cell-nowrap {
  white-space: nowrap;
}

.cell-price {
  min-width: 148px;
}

.price-box {
  text-align: center;
  white-space: nowrap;
}

.price-main {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
}

.price-sub {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.incoming {
  color: var(--stale);
  background: var(--stale-bg);
}

.group[hidden],
.nav-group[hidden],
.section[hidden],
.item-row[hidden],
.nav-pill[hidden] {
  display: none !important;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 18px 8px;
  font-size: 13px;
}

.empty.global {
  margin-bottom: 14px;
  padding: 16px 14px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding-top: 6px;
}

.print-summary {
  display: none;
}

.dash {
  color: #9aa8ba;
}

.text-center {
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-grid,
  .preset-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px 10px 24px;
  }

  .hero {
    padding: 16px;
  }

  .hero-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-logo {
    min-width: 0;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .search-row {
    align-items: stretch;
  }

  .search-clear,
  .copy-link,
  .print-link,
  .reset-all {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  .price-table,
  .price-table tbody,
  .price-table tr,
  .price-table td {
    display: block;
    width: 100%;
  }

  .price-table thead {
    display: none;
  }

  .price-table tbody tr {
    padding: 12px;
    background: #fff;
  }

  .price-table tbody tr:nth-child(even),
  .price-table tbody tr:hover {
    background: #fff;
  }

  .price-table td {
    padding: 4px 0;
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
  }

  .price-table td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
  }

  .price-table td.cell-product {
    display: block;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--line);
  }

  .price-table td.cell-product::before,
  .price-table td.cell-price::before {
    content: none;
  }

  .price-table td.cell-price {
    display: block;
    padding-top: 6px;
  }

  .price-box {
    text-align: left;
  }
}

@page {
  size: A4 portrait;
  margin: 7mm;
}

@media print {
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    width: 210mm;
    background: #fff !important;
    color: #000;
  }

  body {
    font-size: 8px;
    line-height: 1.12;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .shell {
    max-width: none;
    padding: 0;
  }

  .hero,
  .controls,
  #sectionNav,
  .footer {
    display: none !important;
  }

  .print-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5mm;
    align-items: baseline;
    margin: 0 0 3mm;
    padding: 0 0 2mm;
    border-bottom: 0.25mm solid #000;
    color: #000;
    font-size: 8px;
  }

  .print-summary strong {
    font-size: 13px;
    line-height: 1;
  }

  .group {
    margin: 0 0 2mm;
    break-inside: auto;
    page-break-inside: auto;
  }

  .group-head {
    margin: 0 0 1mm;
    padding: 0;
    border-bottom: 0.2mm solid #aab7c6;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .group-head h2 {
    margin: 0 0 0.6mm;
    color: #000;
    font-size: 9px;
    line-height: 1.1;
  }

  .group-head p {
    display: none;
  }

  .section {
    margin: 0 0 2.2mm;
    overflow: visible !important;
    border: 0.2mm solid #c9d3de;
    border-radius: 0;
    break-inside: auto;
    page-break-inside: auto;
  }

  .section-head {
    padding: 1mm 1.5mm;
    background: #e8eef5 !important;
    border-bottom: 0.2mm solid #c9d3de;
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .section h2 {
    font-size: 8.5px;
    line-height: 1.1;
  }

  .muted {
    color: #333;
    font-size: 7px;
  }

  .table-wrap {
    overflow: visible !important;
  }

  .price-table {
    display: table !important;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 6.7px;
    line-height: 1.08;
    page-break-inside: auto;
  }

  .price-table thead {
    display: table-header-group !important;
  }

  .price-table tbody {
    display: table-row-group !important;
  }

  .price-table thead th {
    display: table-cell !important;
    padding: 0.9mm 0.8mm;
    background: #f1f4f7 !important;
    color: #000;
    border: 0.15mm solid #cfd7df;
    font-size: 5.8px;
    line-height: 1;
    text-transform: none;
    white-space: normal;
  }

  .price-table td {
    display: table-cell !important;
    padding: 0.75mm 0.8mm;
    border: 0.15mm solid #d8dee6;
    gap: 0;
    justify-content: normal;
    text-align: left;
    vertical-align: top;
  }

  .price-table td::before {
    content: none !important;
    display: none !important;
  }

  .price-table th:nth-child(1),
  .price-table td:nth-child(1) {
    width: 30%;
  }

  .price-table th:nth-child(2),
  .price-table td:nth-child(2) {
    width: 9%;
  }

  .price-table th:nth-child(3),
  .price-table td:nth-child(3) {
    width: 11%;
  }

  .price-table th:nth-child(4),
  .price-table td:nth-child(4),
  .price-table th:nth-child(5),
  .price-table td:nth-child(5) {
    width: 8%;
  }

  .price-table th:nth-child(6),
  .price-table td:nth-child(6) {
    width: 10%;
  }

  .price-table th:nth-child(7),
  .price-table td:nth-child(7) {
    width: 12%;
  }

  .price-table th:nth-child(8),
  .price-table td:nth-child(8) {
    width: 12%;
  }

  .price-table tr {
    display: table-row !important;
    width: auto !important;
    padding: 0 !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .price-table tbody tr:nth-child(even),
  .price-table tbody tr:hover {
    background: transparent;
  }

  .cell-product {
    display: table-cell !important;
    min-width: 0;
    margin: 0;
    padding-bottom: 0.75mm;
    border-bottom: 0.15mm solid #d8dee6;
  }

  .product-name {
    font-weight: 700;
    line-height: 1.12;
  }

  .product-code {
    margin-top: 0.5mm;
    color: #444;
    font-size: 5.8px;
    line-height: 1;
  }

  .cell-nowrap {
    white-space: normal;
  }

  .cell-price {
    display: table-cell !important;
    min-width: 0;
    padding-top: 0.75mm;
  }

  .price-box {
    text-align: center;
    white-space: normal;
  }

  .price-main {
    font-size: 6.9px;
    line-height: 1.08;
  }

  .price-sub {
    margin-top: 0.4mm;
    color: #444;
    font-size: 5.7px;
    line-height: 1;
  }

  .badge {
    padding: 0;
    border: 0;
    background: transparent !important;
    color: #000 !important;
    font-size: 5.8px;
    line-height: 1.1;
    white-space: normal;
  }

  .empty {
    display: none !important;
  }
}
