:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #111315;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #111315;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
}

header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
h1 { margin: 0; font-size: 22px; line-height: 1.2; }
header p { margin: 4px 0 0; color: var(--muted); }
main { max-width: 1180px; margin: 0 auto; padding: 22px; }
.stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stats span {
  padding: 7px 10px;
  background: #f1f2f4;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
}

.search { margin-bottom: 18px; }
.search-line { display: flex; gap: 10px; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 16px;
  background: white;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.filters label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
}
.filters label.proof {
  color: var(--text);
  border-color: #c7c9ce;
  background: #f1f2f4;
}
.filters input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.search-help {
  margin: -6px 0 16px;
  padding: 11px 13px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.search-help strong { color: var(--text); }
button, .actions a, .back {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}

.results { display: grid; gap: 10px; }
.row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.row h2 { margin: 0; font-size: 17px; line-height: 1.32; }
.spec-line {
  display: grid;
  grid-template-columns: minmax(320px, 1.5fr) minmax(190px, .9fr) minmax(145px, .55fr) auto;
  gap: 14px;
  align-items: start;
}
.label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.spec-model strong,
.spec-price strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}
.spec-price strong {
  font-size: 18px;
  white-space: nowrap;
}
.spec-docs {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  min-width: 116px;
}
.doc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 10px 10px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.doc-icon:before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 8px 0 3px;
  background: #f3f4f6;
}
.doc-icon.estimate { background: #fff; }
.doc-icon.expertise {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}
.doc-icon.procurement {
  border-color: #facc15;
  background: #fef3c7;
  color: #92400e;
}
.doc-icon.neutral {
  background: #f9fafb;
  color: var(--muted);
}
.meta { display: flex; gap: 7px; flex-wrap: wrap; margin: 9px 0; }
.meta span {
  color: var(--muted);
  background: #f3f4f6;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
}
.object {
  margin: 10px 0 6px;
  padding-top: 8px;
  border-top: 1px solid #f1f2f4;
  line-height: 1.45;
}
.source-extra {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}
.price { font-size: 20px; font-weight: 700; margin: 8px 0; }
.fragment { color: var(--muted); font-size: 14px; line-height: 1.45; }
.actions { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 12px; }
.actions span { color: var(--muted); font-size: 14px; }
.bang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-weight: 800;
}
.empty { padding: 30px; color: var(--muted); text-align: center; }

.doc-layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; max-width: 1400px; }
.doc-meta { position: sticky; top: 86px; align-self: start; }
.page-view {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  overflow: auto;
}
.page-view img { width: 100%; height: auto; display: block; border-radius: 10px; background: #f3f4f6; }
.pdf-actions { margin-bottom: 12px; }
.pdf-frame {
  width: 100%;
  min-height: 78vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f3f4f6;
}
.xlsx-preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: white;
}
.xlsx-preview td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  vertical-align: top;
  max-width: 280px;
  overflow-wrap: anywhere;
}
.expertise-card {
  display: grid;
  grid-template-columns: 1fr 180px 160px;
  gap: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
}
.expertise-card strong { font-size: 18px; }
.section-title { margin: 22px 0 12px; font-size: 18px; }
.muted { color: var(--muted); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.login-card label { display: block; margin-top: 14px; color: var(--muted); }
.login-card input { margin-top: 6px; }
.login-card button { width: 100%; margin-top: 18px; }
.error { color: var(--danger); }

@media (max-width: 760px) {
  header { position: static; display: block; padding: 16px; }
  .stats { justify-content: flex-start; margin-top: 12px; }
  main { padding: 14px; }
  .search { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 10px 0; }
  .search-line { flex-direction: column; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters label { border-radius: 14px; }
  .spec-line { grid-template-columns: 1fr; }
  .spec-docs { justify-content: flex-start; }
  .expertise-card { grid-template-columns: 1fr; }
  .pdf-frame { min-height: 60vh; }
  button, .actions a, .back { width: 100%; text-align: center; }
  .doc-layout { display: block; }
  .doc-meta { position: static; margin-bottom: 12px; }
  .actions { flex-direction: column; align-items: stretch; }
}
