/* === Hero === */
.hero { text-align: center; padding: 4rem 1rem 3rem; position: relative; overflow: hidden; }
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 900px;
  background: radial-gradient(ellipse at center, rgba(37,99,235,0.06) 0%, rgba(99,102,241,0.03) 40%, transparent 70%);
  pointer-events: none;
  animation: heroPulse 8s ease-in-out infinite;
}
@keyframes heroPulse { 0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); } 50% { opacity: 1; transform: translateX(-50%) scale(1.05); } }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--surface);
  color: var(--primary);
  padding: 0.4rem 1.125rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border: 1px solid var(--primary-light);
  box-shadow: var(--shadow-sm), 0 0 30px rgba(37,99,235,0.08);
  position: relative;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2.25rem;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.hero-search {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  gap: 0.5rem;
  background: var(--surface);
  padding: 0.375rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.04), 0 0 40px rgba(37,99,235,0.08);
  transition: box-shadow var(--duration-slow) var(--ease);
}
.hero-search:focus-within {
  box-shadow: var(--shadow-lg), 0 0 0 2px var(--primary-light), 0 0 50px rgba(37,99,235,0.12);
}
.hero-search input {
  flex: 1;
  padding: 0.8rem 1.125rem;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: transparent;
  color: var(--text);
}
.hero-search input::placeholder { color: var(--text-muted); }
.hero-search input:focus { outline: none; }
.hero-search button {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  border: none;
  padding: 0.8rem 2rem;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
.hero-search button:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,0.4); }

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.stat-card {
  --sa: var(--primary);
  --sa-bg: var(--primary-50);
  --sa-border: #bfdbfe;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-slow) var(--ease);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--sa);
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease);
}
.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
  border-color: var(--sa-border);
}
.stat-card:hover::before { opacity: 1; }
.stat-card-link { cursor: pointer; }
.stat-card[data-accent="blue"] { --sa: #2563eb; --sa-bg: #eff6ff; --sa-border: #bfdbfe; }
.stat-card[data-accent="indigo"] { --sa: #6366f1; --sa-bg: #eef2ff; --sa-border: #c7d2fe; }
.stat-card[data-accent="emerald"] { --sa: #059669; --sa-bg: #ecfdf5; --sa-border: #a7f3d0; }
.stat-card[data-accent="amber"] { --sa: #d97706; --sa-bg: #fffbeb; --sa-border: #fde68a; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--sa-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: var(--sa);
  transition: transform var(--duration) var(--ease);
}
.stat-card:hover .stat-icon { transform: scale(1.08); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sa);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
  min-height: 2.4rem;
}
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.15; }
}
.skeleton-pulse {
  display: inline-block;
  width: 5rem;
  height: 1.8rem;
  border-radius: 0.375rem;
  background: var(--sa, #94a3b8);
  animation: skeletonPulse 1.6s ease-in-out infinite;
  vertical-align: middle;
}
.stat-label {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-subtitle {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  min-height: 1em;
}

/* === Sections === */
.section { margin: 2.5rem 0; }
.section h2 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.2em;
  background: var(--gradient-brand);
  border-radius: 2px;
}

/* === Card List === */
.card-list { display: flex; flex-direction: column; gap: 0.625rem; }
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--duration-slow) var(--ease);
  position: relative;
  border-left: 3px solid transparent;
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-left-color: var(--primary);
  transform: translateX(2px);
}
.card-title { font-weight: 600; color: var(--text); margin-bottom: 0.125rem; line-height: 1.4; font-size: 0.9375rem; }
.contr-badges { display: inline-flex; gap: 0.3rem; margin-right: 0.4rem; vertical-align: middle; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  align-items: center;
}
.card-meta span { display: flex; align-items: center; gap: 0.25rem; }
.card-contractor { font-size: 0.8125rem; margin-top: 0.375rem; color: var(--text-secondary); font-weight: 500; }
.cat-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.375rem; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.6875rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--primary-50);
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
  white-space: nowrap;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
}
.cat-pill:hover { background: var(--primary-light); }

/* === Badges === */
.badge { display: inline-block; padding: 0.15rem 0.7rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.01em; }
.badge-construction { background: var(--primary-light); color: var(--primary-dark); }
.badge-supply { background: var(--warning-light); color: var(--warning); }
.badge-service { background: var(--success-light); color: var(--success); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--danger-light); color: var(--danger); }

/* === Deviation badges (vs. national median) === */
.deviation-badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.deviation-badge.dev-high { background: #fee2e2; color: #b91c1c; }
.deviation-badge.dev-low  { background: #dcfce7; color: #15803d; }
.deviation-badge.dev-mid  { background: #f1f5f9; color: #475569; }

/* === Browse Categories === */
.browse-categories { margin-bottom: 1.2rem; }
.browse-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.browse-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.browse-chip {
    display: inline-flex; align-items: center;
    padding: 6px 14px; border-radius: 6px;
    background: #f1f5f9; border: 1px solid transparent;
    font-size: 0.78rem; color: var(--text-primary); font-weight: 500;
    cursor: pointer; transition: all var(--duration) var(--ease);
    white-space: nowrap; font-family: inherit;
    letter-spacing: -0.01em;
}
.browse-chip:hover { background: #dbeafe; color: var(--primary); }
.browse-chip.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,0.2); }

/* === Quick Answer Card === */
.quick-answer {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.qa-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; }
.qa-title { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.4; }
.qa-title strong { color: var(--text-primary); }
.qa-close { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; padding: 0 0.25rem; line-height: 1; }
.qa-close:hover { color: var(--text-primary); }
.qa-body { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: baseline; }
.qa-metric { min-width: 0; }
.qa-metric-main { margin-right: 0.5rem; }
.qa-metric-main .qa-value { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: -0.02em; }
.qa-metric-main .qa-currency { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.qa-metric .qa-value { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.qa-metric .qa-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.1rem; }
@media (max-width: 768px) {
    .qa-body { gap: 1rem; }
    .qa-metric-main .qa-value { font-size: 1.3rem; }
}

/* === Search Bar === */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 0.75rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  transition: all var(--duration-slow) var(--ease);
}
.search-bar:focus-within {
  box-shadow: var(--shadow-md), 0 0 0 2px rgba(37,99,235,0.08);
  border-color: var(--primary-light);
}
.search-bar input {
  flex: 1;
  min-width: 180px;
  padding: 0.625rem 0.875rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: all var(--duration) var(--ease);
  background: var(--surface);
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.search-bar select {
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--surface);
  min-width: 150px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.search-bar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Autocomplete wrapper */
.autocomplete-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.autocomplete-wrap input {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: all var(--duration) var(--ease);
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
}
.autocomplete-wrap input::placeholder { color: var(--text-muted); }
.autocomplete-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.autocomplete-wrap input.ac-has-value {
  border-color: var(--primary);
  background: #eff6ff;
}
.ac-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.15rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  display: none;
  border-radius: 50%;
  transition: color var(--duration);
}
.ac-clear:hover { color: var(--text); }
.autocomplete-wrap input.ac-has-value ~ .ac-clear { display: block; }
.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.ac-list.open { display: block; }
.ac-list li {
  padding: 0.5rem 0.875rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration);
}
.ac-list li:last-child { border-bottom: none; }
.ac-list li:hover, .ac-list li.ac-active {
  background: #eff6ff;
}
.ac-list li mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.search-bar button {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  border: none;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}
.search-bar button:hover { box-shadow: 0 4px 12px rgba(37,99,235,0.35); transform: translateY(-1px); }

/* === Results === */
.results-area { min-height: 200px; }
.hint { color: var(--text-muted); text-align: center; padding: 3rem 0; font-size: 0.9375rem; }
.loading { color: var(--text-secondary); text-align: center; padding: 2.5rem 0; font-size: 0.9375rem; }
.loading::after {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-count { color: var(--text-secondary); margin-bottom: 1rem; font-size: 0.875rem; }

/* === Pages === */
.page { display: none; padding: 1.5rem 0 4rem; min-height: calc(100vh - 160px); }
.page.active { display: block; animation: pageIn 0.4s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.page h1 {
  font-size: 1.75rem;
  margin-bottom: 0.375rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-desc { color: var(--text-secondary); font-size: 0.9375rem; margin-bottom: 1.25rem; line-height: 1.5; max-width: 640px; }

/* === Price Table (legacy) === */
.price-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.price-table th { background: var(--bg-elevated); padding: 0.75rem 1rem; text-align: left; font-size: 0.8125rem; color: var(--text-secondary); font-weight: 600; border-bottom: 2px solid var(--border); white-space: nowrap; }
.price-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; }
.price-table tr:hover td { background: var(--bg-elevated); }
.price-table .price-value { font-weight: 600; color: var(--success); white-space: nowrap; }
.price-table .description-cell { max-width: 400px; }

/* === Pagination === */
.pagination { display: flex; justify-content: center; gap: 0.375rem; margin-top: 1.5rem; }
.pagination button {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
  color: var(--text-secondary);
}
.pagination button:hover { background: var(--primary-50); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.pagination button.active {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

/* === Price Groups === */
.price-group { background: var(--surface); border-radius: var(--radius-md); margin-bottom: 0.75rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); overflow: hidden; transition: all var(--duration-slow) var(--ease); }
.price-group:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.price-group-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; cursor: pointer; transition: background var(--duration) var(--ease); gap: 1rem; }
.price-group-header:hover { background: var(--bg-elevated); }
.group-main { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 0; }
.group-description { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.group-unit { color: var(--text-secondary); font-size: 0.8rem; }
.group-stats { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.group-price { font-weight: 700; color: var(--success); white-space: nowrap; font-size: 0.95rem; }
.group-count { background: var(--primary-light); color: var(--primary-dark); padding: 0.2rem 0.75rem; border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 3px rgba(37,99,235,0.1); }
.group-arrow { color: var(--text-muted); font-size: 0.85rem; transition: transform var(--duration); user-select: none; }
.price-group-details { border-top: 1px solid var(--border); padding: 0; }
.inner-table { box-shadow: none; border-radius: 0; }
.inner-table th { background: var(--bg-elevated); font-size: 0.8rem; padding: 0.5rem 0.75rem; }
.inner-table td { padding: 0.5rem 0.75rem; font-size: 0.85rem; }

/* === Grouped Price Table === */
.prices-grouped-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.prices-grouped-table th {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, #eef2f7 100%);
  padding: 0.8rem 0.75rem;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--duration) var(--ease);
  letter-spacing: 0.01em;
}
.prices-grouped-table th:hover { color: var(--primary); }
.prices-grouped-table th.sorted { color: var(--primary); }
.prices-grouped-table th .arrow { font-size: 0.7rem; margin-left: 3px; }
.prices-grouped-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border-light); font-size: 0.85rem; transition: background var(--duration) var(--ease); }
.prices-grouped-table tr:hover td { background: var(--primary-50); }
.number { text-align: right; font-variant-numeric: tabular-nums; }

/* === Expandable Row === */
.expand-toggle {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all var(--duration) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  user-select: none;
}
.expand-toggle:hover { background: var(--primary-light); color: var(--primary); }
.expand-toggle.open { transform: rotate(90deg); color: var(--primary); background: var(--primary-50); }
tr.group-row { cursor: pointer; transition: background var(--duration) var(--ease); }
tr.group-row:hover td { background: var(--primary-50); }

/* === Detail Panel === */
.detail-panel { background: var(--bg-elevated); border-left: 4px solid var(--primary); }
.detail-panel td { padding: 0 !important; overflow: visible; }
.detail-inner { padding: 1rem 1.25rem; }

