:root{
  --bg:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --panel:#f9fafb;

  --accent:#2563eb;
  --accentBg:#eef2ff;

  --okBg:#e9f7ec;
  --okBorder:#bfe3c7;
  --okText:#1a5b2a;

  --badBg:#fdecec;
  --badBorder:#f3bcbc;
  --badText:#7a1f1f;
}

*{ box-sizing:border-box; }

html, body{
  height:100%;
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  line-height:1.35;
}

/* ======= APP LAYOUT ======= */
.app{
  height:100vh;
  display:grid;
  grid-template-columns: 280px 1fr 320px;
  overflow:hidden;
}

/* ======= SIDEBAR ======= */
.sidebar{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:16px;
  border-right:1px solid var(--line);
  overflow:auto;
  background:#fff;
}

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

.brand-logo{
  width:56px;
  height:56px;
  object-fit:contain;
  flex:none;
}

.brand-text{ display:flex; flex-direction:column; }

.brand-title{
  font-weight:700;
  font-size:16px;
  line-height:1.2;
}

.brand-subtitle{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

/* steps container */
.steps-nav{
  display:flex;
  flex-direction:column;
  margin-top:8px;
}

/* step lines (rendered by app.js) */
.step-line{
  appearance:none;
  -webkit-appearance:none;
  width:100%;
  text-align:left;
  background:transparent;
  border:0;
  border-bottom:1px solid var(--line);
  padding:10px 8px;
  cursor:pointer;
  font-size:14px;
}
.step-line:hover{ background:rgba(0,0,0,0.03); }
.step-line.active{
  background:var(--accentBg);
  font-weight:700;
}
.step-line.locked,
.step-line:disabled{
  opacity:0.45;
  cursor:not-allowed;
}
.step-line .num{
  display:inline-block;
  width:26px;
  opacity:0.7;
}
.step-line .name{ display:inline-block; }

.sidebar-bottom{
  margin-top:auto;
  display:grid;
  gap:10px;
  padding-top:12px;
}

.api-indicator{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  font-size:12px;
}
.api-indicator.api-online{
  background:var(--okBg);
  border-color:var(--okBorder);
  color:var(--okText);
}
.api-indicator.api-offline{
  background:var(--badBg);
  border-color:var(--badBorder);
  color:var(--badText);
}

.sidebar-version{
  font-size:12px;
  color:var(--muted);
}

/* ======= MAIN ======= */
.main{
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:18px 18px 14px;
  overflow:hidden;
  background:var(--panel);
}

.main-head{ background:transparent; }

#stepTitle{
  margin:0;
  font-size:28px;
  line-height:1.15;
}

.summary{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
}

.msg{
  margin-top:8px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  font-size:12px;
}

/* content area */
.main-body{
  flex:1;
  min-height:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  overflow:auto;
}

/* buttons row */
.main-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.btn{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  cursor:pointer;
}

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

.btn.danger{
  border-color:var(--badBorder);
}

/* ======= HELP PANEL ======= */
.right{
  border-left:1px solid var(--line);
  background:#fff;
  overflow:auto;
  padding:16px;
  display:none;
}

.right.open{ display:block; }

.help-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.help-title{ font-weight:700; }
.help-body{ font-size:13px; }

/* ======= STEP 1 SEARCH UI (used by app.js) ======= */
.search-wrap{ position:relative; }

.search-results{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  z-index:20;
}

.search-item{
  padding:10px 12px;
  cursor:pointer;
  font-size:13px;
}
.search-item:hover{ background:rgba(0,0,0,0.04); }
.search-empty{ padding:10px 12px; font-size:13px; opacity:.7; }

.pills{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid rgba(0,0,0,0.18);
  border-radius:999px;
  font-size:12px;
  background:#fff;
}
.pill button{
  border:none;
  background:transparent;
  cursor:pointer;
  font-size:14px;
  line-height:1;
  opacity:.7;
}
.pill button:hover{ opacity:1; }

/* Guidance links block */
.links-block{
  margin-top:14px;
  padding-top:10px;
  border-top:1px solid rgba(0,0,0,0.10);
}
.links-block h3{
  margin:10px 0 6px;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.4px;
  opacity:.75;
}
.linklist{ margin:0; padding-left:18px; }
.linklist li{ margin:6px 0; font-size:13px; }
.linklist a{ text-decoration:none; }
.linklist a:hover{ text-decoration:underline; }

/* ======= MAP ======= */
.mapWrap{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:#fff;
}

#map4{
  width:100%;
  height:420px;
}

.mapStatus{
  padding:8px 10px;
  font-size:12px;
  color:var(--muted);
  border-top:1px solid var(--line);
}

/* ======= RESPONSIVE ======= */
@media (max-width: 1100px){
  .app{ grid-template-columns: 280px 1fr; }
  .right{ display:none !important; }
}

@media (max-width: 820px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{
    border-right:0;
    border-bottom:1px solid var(--line);
  }
  .main{ padding:14px; }
}

/* =========================================================
   [STEP10] Overlay + modal UI (read-only)
   ========================================================= */
.tp-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.25);
  display:flex; align-items:center; justify-content:center;
  z-index:9999;
}
.tp-overlay-box{
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:14px;
  padding:16px 18px;
  width:min(420px, calc(100% - 24px));
  box-shadow:0 20px 60px rgba(0,0,0,.18);
}
.tp-overlay-title{ font-weight:700; font-size:14px; }
.tp-overlay-sub{ margin-top:6px; font-size:12px; opacity:.75; }

.tp-modal-portal{
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  z-index:10000;
}
.tp-modal-backdrop{
  position:absolute; inset:0;
  background:rgba(0,0,0,.35);
}
.tp-modal{
  position:relative;
  background:#fff;
  border:1px solid #e6e6e6;
  border-radius:14px;
  width:min(980px, calc(100% - 24px));
  max-height:min(80vh, 820px);
  display:flex; flex-direction:column;
  box-shadow:0 22px 70px rgba(0,0,0,.22);
}
.tp-modal-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding:12px 12px;
  border-bottom:1px solid #eee;
}
.tp-modal-title{ font-weight:800; }
.tp-modal-body{ padding:12px; overflow:auto; }
.tp-modal-foot{
  padding:12px;
  border-top:1px solid #eee;
  display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap;
}

.tp-pre{
  white-space:pre-wrap;
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  background:#fafafa;
  border:1px solid #eee;
  border-radius:12px;
  padding:10px;
}

.tp-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid #e6e6e6;
  border-radius:12px;
  overflow:hidden;
}
.tp-table th, .tp-table td{
  padding:10px 10px;
  border-bottom:1px solid #eee;
  vertical-align:top;
  font-size:13px;
}
.tp-table th{
  background:#fafafa;
  font-weight:700;
}
.tp-table tr:last-child td{ border-bottom:none; }

/* =========================================================
   [STEP10 UI] Header layout: project summary (left) + location snapshot (right)
   ========================================================= */
.main-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

.main-head-left{
  flex:1 1 420px;
  min-width:280px;
}

.main-head-right{
  flex:0 0 360px;
  max-width:460px;
}

.head-card{
  border:1px solid #e6e6e6;
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
}

.head-card-title{
  font-weight:800;
  font-size:13px;
  margin-bottom:6px;
}

.head-card-line{
  font-size:12px;
  opacity:.85;
  line-height:1.45;
}


/* ------------------------------------------------------------
   Form field styling (Steps 4–9) — improve readability and consistency
   Note: Steps 1–3 use inline styling already; these rules mainly affect
         screens that rely on default browser controls.
   ------------------------------------------------------------ */

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

.mini{
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
}

.req{
  color:var(--badText);
  font-weight:800;
  margin-left:2px;
}

#screenRoot label{
  display:block;
  font-size:13px;
  font-weight:700;
  margin-bottom:6px;
}

#screenRoot select,
#screenRoot input[type="text"],
#screenRoot input[type="number"],
#screenRoot input[type="email"],
#screenRoot input[type="search"],
#screenRoot textarea,
#screenRoot input:not([type]){
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  font-size:14px;
  background:#fff;
  outline:none;
}

#screenRoot textarea{
  min-height:110px;
  resize:vertical;
}

#screenRoot input[disabled],
#screenRoot textarea[disabled],
#screenRoot select[disabled]{
  background:#f7f7f7;
  color:#6b7280;
}

/* Step 10 / request preview blocks */
.tp-card{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:#fff;
}
.tp-card-title{
  font-weight:800;
  font-size:14px;
  margin-bottom:8px;
}
.tp-muted{ color:var(--muted); }
.tp-pill{
  display:inline-block;
  padding:2px 8px;
  border:1px solid var(--line);
  border-radius:999px;
  font-size:12px;
  background:#fff;
}
