:root {
  color-scheme: light;
  --bg: #e8f1f7;
  --text: #102a43;
  --muted: #486c86;
  --line: #d8e3ea;
  --line-strong: #b8c9d4;
  --panel: rgba(255, 255, 255, 0.92);
  --button: #1f4f8b;
  --button-text: #ffffff;
  --button-alt: #f4f8ff;
  --button-alt-text: #1f4f8b;
  --button-danger: #b12d3c;
  --button-danger-bg: #fff1f4;
  --focus: #1f6ad9;
  --radius: 18px;
  --accent: #eaf4ff;
  --accent-strong: #cddff4;
  --accent-green: #e6f3ea;
  --accent-amber: #fff5db;
  --accent-violet: #f0e9ff;
  --shadow: 0 20px 50px rgba(15, 42, 67, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-image: radial-gradient(circle at top left, rgba(226, 246, 255, 0.72), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 238, 214, 0.5), transparent 28%),
    linear-gradient(180deg, #eef5fb 0%, #dfeaf3 100%);
  color: var(--text);
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.app {
  width: min(1040px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 35px rgba(15, 42, 67, 0.08);
  backdrop-filter: blur(20px);
}

.brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(244, 248, 255, 0.95);
  border: 1px solid rgba(173, 199, 232, 0.9);
}

.brand-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(223, 234, 255, 0.92);
  border: 1px solid rgba(185, 207, 245, 0.9);
  color: #27446f;
  font-size: 0.82rem;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.brand-badge.is-hiding {
  opacity: 0;
  transform: translateY(-4px);
}

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

.nav a,
.button,
.button-secondary,
.button-danger,
.nav button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.nav a,
.button-secondary,
.nav button {
  background: var(--button-alt);
  color: var(--button-alt-text);
}

.button {
  border-color: var(--button);
  background: var(--button);
  color: var(--button-text);
}

.button-danger {
  border-color: var(--button-danger);
  background: var(--button-danger-bg);
  color: var(--button-danger);
}

.nav a:hover,
.button-secondary:hover,
.nav button:hover {
  background: #ebf3ff;
}

.button:hover {
  background: #1a4075;
}

.button-danger:hover {
  background: #ffd7dc;
}

.shell {
  display: grid;
  gap: 18px;
}

.hero {
  text-align: center;
  padding: 42px 32px;
  border: 1px solid rgba(157, 177, 185, 0.35);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(248, 252, 255, 0.96), rgba(232, 240, 247, 0.96));
  box-shadow: 0 26px 60px rgba(15, 42, 67, 0.08);
}

.hero h1,
.page-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.hero p,
.help,
.empty,
.summary-label,
.field-label {
  color: var(--muted);
}

.hero p {
  margin: 16px auto 0;
  max-width: 48ch;
  line-height: 1.75;
}

.search-panel,
.form-panel,
.summary-panel,
.results-panel,
.catalog-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.search-panel {
  display: grid;
  gap: 16px;
  width: min(100%, 780px);
  margin: 0 auto;
}

.catalog-panel {
  width: min(100%, 780px);
  margin: 0 auto;
}

.catalog-list {
  display: grid;
  gap: 14px;
  max-height: 430px;
  min-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  scroll-behavior: smooth;
}

.catalog-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 251, 0.96));
  padding: 18px;
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 24px rgba(15, 42, 67, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.catalog-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(15, 42, 67, 0.08);
  border-color: rgba(31, 106, 217, 0.25);
}

.catalog-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

.catalog-job {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.field {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 16px;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 42, 67, 0.05);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(31, 106, 217, 0.12);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

select {
  background: #ffffff;
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.results {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.results-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

.results-head {
  display: grid;
  gap: 6px;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.job-title {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.summary-panel {
  border-color: rgba(156, 178, 187, 0.95);
  background:
    linear-gradient(180deg, rgba(246, 250, 250, 0.97), rgba(229, 237, 240, 0.96));
}

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

.summary-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: rgba(250, 252, 252, 0.88);
}

.summary-value {
  display: block;
  margin-top: 4px;
  font-size: 1.18rem;
  font-weight: 700;
}

.summary-item.full {
  grid-column: 1 / -1;
}

.result-note {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.55;
}

.empty {
  margin: 0;
  line-height: 1.6;
}

.helper-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.tiny {
  font-size: 0.92rem;
}

.entry-list {
  display: grid;
  gap: 10px;
}

.entry-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 251, 0.96));
  padding: 18px;
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 24px rgba(15, 42, 67, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(15, 42, 67, 0.09);
  border-color: rgba(31, 106, 217, 0.25);
}

.entry-card.is-selected {
  border-color: #2e4f7c;
  background: linear-gradient(180deg, #f8fbfc, #dfeaf0);
}

.entry-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.entry-job {
  font-weight: 700;
  line-height: 1.3;
}

.entry-owner {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7f1ff;
  border: 1px solid #b9cff5;
  color: #27446f;
  font-size: 0.82rem;
  font-weight: 700;
}

.entry-owner--detail {
  margin-top: -2px;
}

.entry-detail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 100%;
}

.detail-price {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #27446f;
}

.detail-job {
  font-size: 1.15rem;
  font-weight: 700;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-strong);
  background: #fff;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.chip--size {
  background: var(--accent);
  border-color: rgba(185, 207, 245, 0.9);
}

.chip--misc {
  background: #e5edef;
  border-color: #b9c8ce;
}

.chip--modifier {
  background: var(--accent-violet);
  border-color: rgba(203, 190, 255, 0.95);
}

.chip--context {
  background: var(--accent-green);
  border-color: rgba(187, 229, 206, 0.95);
}

.chip--location {
  background: var(--accent-amber);
  border-color: rgba(245, 220, 171, 0.95);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(185, 207, 245, 0.9);
  background: #fafdff;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.tag-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.tag-toggle span {
  line-height: 1;
}

.tag-toggle:has(input:checked) {
  border-color: #2e4f7c;
  background: #ebf4ff;
}

.tag-toggle input:checked + span {
  font-weight: 700;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

@media (max-width: 860px) {
  .app {
    width: min(100%, calc(100% - 24px));
    padding-top: 16px;
  }

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

  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 28px 18px;
  }

  .summary-grid,
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .chip-row {
    gap: 6px;
    align-items: flex-start;
  }

  .chip {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
  }

  .entry-card {
    overflow: hidden;
  }
}
/* Footer removed: navigation is available in the topbar */
/* Compact site footer: small sitemap + copyright */
.site-footer {
  margin-top: 28px;
  padding: 12px 0 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer .sitemap {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.site-footer .sitemap a {
  color: var(--button);
  text-decoration: none;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.04);
  background: rgba(255,255,255,0.02);
}
.site-footer .sitemap a:hover {
  text-decoration: underline;
  color: #163a65;
}
.site-footer .copyright {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
