:root {
  --accent: #d9772f;
  --accent-dark: #b85e1f;
  --accent-light: #fbeee0;
  --bg: #faf9f7;
  --card: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #6b6b6b;
  --ink-faint: #a3a3a3;
  --border: #e6e5e0;
  --danger: #e5484d;
  --danger-light: #fdeceb;
  --success: #2fa86f;
  --success-light: #e7f7ee;
  --warn: #f5a623;
  --warn-light: #fff6e6;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font-family: inherit;
  font-size: 15px;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 8px; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.app-body {
  flex: 1;
  padding: 20px;
  padding-bottom: 40px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
  background: #fff;
}

.field .hint { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  font-size: 15.5px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 9px 16px; font-size: 13px; width: auto; }

/* Destination autocomplete */
.autocomplete-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  z-index: 30;
  overflow: hidden;
}
.autocomplete-list.visible { display: block; }
.autocomplete-item {
  padding: 11px 14px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: var(--accent-light); color: var(--accent-dark); }
.autocomplete-item-main { font-weight: 600; }
.autocomplete-item-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }

.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.error-msg.visible { display: block; }

.notice {
  background: var(--warn-light);
  color: #8a5a00;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.5;
}
.notice-success { background: var(--success-light); color: #1b6b46; }

.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px 20px;
  color: var(--ink-soft);
  font-size: 13.5px;
  text-align: center;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result card */
.result-card {
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--card) 55%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

.result-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

.result-station {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 2px;
}

.result-address {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.result-stat-box {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.result-stat-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.result-stat-value { font-size: 17px; font-weight: 800; margin-top: 2px; }
.result-stat-value.savings { color: var(--success); }

.confidence-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.confidence-high { background: var(--success-light); color: #1b6b46; }
.confidence-medium { background: var(--warn-light); color: #8a5a00; }
.confidence-low { background: var(--border); color: var(--ink-soft); }

.result-actions { display: flex; gap: 10px; }
.result-actions .btn { flex: 1; }

.alt-list { margin-top: 4px; }
.alt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.alt-item:last-child { border-bottom: none; }
.alt-item-name { font-weight: 600; }
.alt-item-sub { font-size: 11.5px; color: var(--ink-faint); }
.alt-item-price { font-weight: 700; }

/* Report price mini-form */
.report-toggle {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 10px;
  cursor: pointer;
  text-decoration: underline;
}
.report-form { display: none; margin-top: 12px; gap: 8px; }
.report-form.visible { display: flex; }
.report-form input { flex: 1; }

/* Ad slot */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-faint);
  margin: 20px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.6;
  padding: 10px 6px 20px;
}
.footer-note a { color: var(--ink-soft); text-decoration: underline; }

.install-banner {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 12px 40px 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}
.install-banner strong { display: block; margin-bottom: 2px; }
.install-banner-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}
.install-banner-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
