:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-light: #f0fdfa;
  --ink: #1a2a33;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button {
  cursor: pointer;
  font: inherit;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  padding: 10px 16px;
  font-weight: 600;
}
button:hover { background: var(--teal-dark); }
button.ghost { background: #fff; color: var(--teal); border: 1px solid var(--teal); }
button.danger { background: #ef4444; }
button.danger:hover { background: #dc2626; }
input, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin: 10px 0 3px; }

/* ---- login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: #fff; padding: 36px; border-radius: 16px; width: 320px;
  box-shadow: 0 12px 40px rgba(13,148,136,0.15); text-align: center;
}
.login-card h1 { color: var(--teal); margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 14px; }
.err { color: #dc2626; font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---- app layout ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--teal); color: #fff; padding: 12px 20px;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar nav button { background: rgba(255,255,255,0.15); margin-left: 8px; }
.topbar nav button:hover { background: rgba(255,255,255,0.3); }

/* Estimator page fills the viewport via flex so the layout sits exactly below
   the header regardless of the header's height (fixes Street View dropping off). */
.app-body { height: 100vh; display: flex; flex-direction: column; }
.app-body .topbar { flex: 0 0 auto; }
.layout { display: grid; grid-template-columns: 1fr 380px; gap: 0; flex: 1 1 auto; min-height: 0; }
.list-view { flex: 1 1 auto; min-height: 0; overflow: auto; }
@media (max-width: 900px) {
  .app-body { display: block; height: auto; }
  .layout { grid-template-columns: 1fr; height: auto; flex: none; }
}

.map-col { position: relative; display: flex; flex-direction: column; }
#searchWrap { padding: 10px; background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
#searchWrap input { flex: 1; }
#map { flex: 2; min-height: 240px; }
#streetview { flex: 1; min-height: 170px; border-top: 1px solid var(--line); background: #ddd; }
#searchWrap button.active { background: var(--teal); color: #fff; }
.hint { font-size: 12px; color: var(--muted); margin: -2px 0 8px; }
.dim-btn { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--teal-light); color: var(--teal-dark); border: 1px solid var(--teal); border-radius: 999px; padding: 3px 9px; font-size: 12px; }
.chip button { background: none; color: var(--teal-dark); border: 0; padding: 0 1px; font-size: 15px; line-height: 1; cursor: pointer; }

.readout {
  display: flex; gap: 12px; padding: 10px; background: var(--teal-light);
  border-top: 1px solid var(--line);
}
.readout .stat { flex: 1; text-align: center; }
.readout .stat b { display: block; font-size: 22px; color: var(--teal); }
.readout .stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; }

.panel { background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--teal); margin: 18px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.panel h2:first-child { margin-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.price-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.price-grid td { padding: 5px 4px; vertical-align: middle; }
.price-grid input { width: 90px; text-align: right; padding: 6px; }
.price-grid .amt { text-align: right; font-weight: 600; }

.estimate-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.estimate-table th { text-align: right; color: var(--muted); font-size: 11px; padding: 4px; border-bottom: 1px solid var(--line); }
.estimate-table th:first-child { text-align: left; }
.estimate-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.estimate-table td.r { text-align: right; }
.estimate-table .total-row td { font-size: 17px; font-weight: 700; color: var(--teal); border: none; padding-top: 10px; }
.estimate-table .min-row td { color: #d97706; font-size: 12px; }

.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.actions button { flex: 1; }

.banner { background: #fef3c7; color: #92400e; padding: 12px; text-align: center; font-size: 14px; }
.shapes-list { font-size: 12px; color: var(--muted); margin: 6px 0; }

/* ---- saved list view ---- */
.list-view { padding: 24px; max-width: 1000px; margin: 0 auto; }
.list-view table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.list-view th { background: var(--teal-light); text-align: left; padding: 10px; font-size: 12px; text-transform: uppercase; color: var(--teal); }
.list-view td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-view tr:hover td { background: #f8fafc; cursor: pointer; }
.hidden { display: none !important; }
