:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --border: #dbe4f0;
  --text: #0f172a;
  --muted: #5b6472;

  --primary: #1d4ed8;
  --primary-dark: #1e40af;

  --success-bg: #dcfce7;
  --success-text: #166534;

  --warning-bg: #fef3c7;
  --warning-text: #92400e;

  --orange-bg: #ffedd5;
  --orange-text: #c2410c;

  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;

  --neutral-bg: #e2e8f0;
  --neutral-text: #334155;

  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.page {
  min-height: 100vh;
}

/* =========================
   HERO
========================= */

.hero {
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.12), transparent 30%),
    linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 20px 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
}

.subtitle {
  margin: 12px 0 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

/* =========================
   LAYOUT
========================= */

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.panel {
  margin-bottom: 20px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel__title {
  margin: 0 0 18px;
  font-size: 22px;
}

/* =========================
   FORM
========================= */

.form .grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}

.field input::placeholder {
  color: #94a3b8;
}

.field input:focus,
.field select:focus {
  border-color: rgba(29, 78, 216, 0.6);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.08);
}

.field input:disabled,
.field select:disabled {
  color: #64748b;
  background: #f8fafc;
  cursor: not-allowed;
}

/* =========================
   AUTOCOMPLETE
========================= */

.autocomplete-field {
  position: relative;
}

.autocomplete {
  position: relative;
}

.autocomplete__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.autocomplete__item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.autocomplete__item:hover,
.autocomplete__item.is-active {
  background: #f3f6fb;
}

.autocomplete__title {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.autocomplete__meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #64748b;
}

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

/* =========================
   ACTIONS / BUTTONS
========================= */

.actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.button {
  min-height: 46px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  transition:
    background-color 0.18s ease,
    transform 0.04s ease,
    opacity 0.18s ease;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.button--primary {
  color: #fff;
  background: var(--primary);
}

.button--primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

/* =========================
   GENERIC HELPERS
========================= */

.hidden {
  display: none !important;
}

.muted {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* =========================
   STATUS
========================= */

.status {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
}

.status--info {
  color: #1d4ed8;
  background: #eff6ff;
}

.status--error {
  color: var(--danger-text);
  background: var(--danger-bg);
}

/* =========================
   RESULT HEADER
========================= */

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--neutral-text);
  background: var(--neutral-bg);
  border-radius: 999px;
}

.badge--success {
  color: var(--success-text);
  background: var(--success-bg);
}

.badge--warning {
  color: var(--warning-text);
  background: var(--warning-bg);
}

.badge--orange {
  color: var(--orange-text);
  background: var(--orange-bg);
}

.badge--danger {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.badge--neutral {
  color: var(--neutral-text);
  background: var(--neutral-bg);
}

/* =========================
   ESTIMATE HERO
========================= */

.estimate-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.estimate-label {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.estimate-value {
  margin: 0;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--primary-dark);
}

.estimate-side {
  display: grid;
  gap: 14px;
  align-content: center;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.metric__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* =========================
   STATS GRID
========================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat-card {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.stat-card__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.stat-card__value {
  font-size: 18px;
  line-height: 1.3;
  color: var(--text);
}

/* =========================
   DETAILS
========================= */

.details-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-top: 18px;
}

.detail-box {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.detail-box h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.kv {
  display: grid;
  gap: 10px;
  margin: 0;
}

.kv div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.kv div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.kv dt {
  font-size: 14px;
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
  color: var(--text);
}

.note-list {
  display: grid;
  gap: 12px;
}

.note {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 960px) {
  .form .grid,
  .stats-grid,
  .details-grid,
  .estimate-hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .hero__inner,
  .container {
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .estimate-value {
    font-size: 34px;
  }

  .kv div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .panel {
    padding: 18px;
  }
}
