/* access-road mock — light "field notebook" theme. No external assets except GSI map tiles. */
:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --panel-2: #faf8f2;
  --ink: #1f2a24;
  --muted: #6b7570;
  --line: #e1dccf;
  --line-strong: #c9c2b2;
  --accent: #1f6f4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3efe7;
  --earth: #b5722f;
  --earth-soft: #f4e7d6;
  --cut: #3b7dd8;
  --fill: #e0893a;
  --lock: #9aa39e;
  --danger: #a33b2c;
  --plan-a: #1f6f4a;
  --plan-b: #2a7fa6;
  --plan-c: #b5722f;
  --shadow: 0 1px 2px rgba(31, 42, 36, 0.06), 0 6px 18px rgba(31, 42, 36, 0.06);
  --radius: 10px;
  --font: "Segoe UI Variable", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
button { font-family: inherit; font-size: inherit; color: inherit; }
input, select { font-family: inherit; font-size: 12.5px; color: var(--ink); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0 55%, var(--earth) 55% 100%);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 14px; height: 4px;
  background: #fff; border-radius: 2px; transform: rotate(-28deg); opacity: .95;
}
.brand-title { font-weight: 650; font-size: 15px; letter-spacing: .01em; }
.brand-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-sample { background: var(--earth-soft); color: var(--earth); border: 1px solid #e8cfae; }
.lang-toggle, .project-chip {
  border: 1px solid var(--line-strong); background: var(--panel-2); border-radius: 8px;
  padding: 5px 10px; cursor: pointer; font-weight: 600;
}
.lang-toggle:hover, .project-chip:hover { border-color: var(--accent); color: var(--accent); }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); font-size: 12px;
}
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ---------- STEP timeline ---------- */
.timeline {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding: 10px 18px 0; background: var(--panel); border-bottom: 1px solid var(--line);
}
.phase-chip {
  text-align: left; border: 1px solid var(--line); border-bottom: 3px solid transparent;
  background: var(--panel-2); border-radius: 10px 10px 0 0; padding: 8px 12px 7px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.phase-chip:hover { background: var(--accent-soft); }
.phase-chip.active { background: #fff; border-color: var(--line-strong); border-bottom-color: var(--accent); }
.phase-chip .step, .phase-chip .name, .phase-chip .period { display: block; }
.phase-chip .step { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.phase-chip .name { font-size: 13.5px; font-weight: 650; margin-top: 1px; }
.phase-chip .period { font-size: 11px; color: var(--muted); margin-top: 2px; }
.phase-chip.active .step { color: var(--accent); }

/* ---------- phase info strip ---------- */
.phase-info {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; align-items: start;
  padding: 8px 18px; background: #fff; border-bottom: 1px solid var(--line);
}
.phase-info h4 { margin: 0 0 5px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.feature-list { display: flex; flex-wrap: wrap; gap: 5px 8px; margin: 0; padding: 0; list-style: none; }
.feature-list li { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: #14513a; }
.feature-list li.prev { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.feature-list li.more { background: none; border: 1px dashed var(--line-strong); color: var(--muted); cursor: pointer; }
.feature-list li.more:hover { color: var(--accent); border-color: var(--accent); }
.phase-info .meta { font-size: 12.5px; line-height: 1.5; }
.phase-info .gate { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 6px; background: var(--earth-soft); color: #7a4a17; font-weight: 600; font-size: 12px; }

/* ---------- layout ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: 270px 1fr 290px; gap: 12px;
  padding: 12px 18px; min-height: 0; overflow: hidden;
}
.rail, .compare {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-y: auto; min-height: 0;
}
.stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }

/* ---------- rail (workflow steps) ---------- */
.rail-head { padding: 12px 14px 6px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.step-item { border-top: 1px solid var(--line); }
.step-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 14px; background: none; border: 0; cursor: pointer;
}
.step-btn:hover { background: var(--panel-2); }
.step-item.active .step-btn { background: var(--accent-soft); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel-2); border: 1.5px solid var(--line-strong); font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.step-item.done .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-item.active .step-num { border-color: var(--accent); color: var(--accent); }
.step-item.locked .step-num { border-style: dashed; color: var(--lock); }
.step-title { font-weight: 650; font-size: 13px; flex: 1; }
.step-item.locked .step-title { color: var(--lock); }
.step-lock { font-size: 10.5px; color: var(--lock); border: 1px dashed var(--lock); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.step-body { padding: 2px 14px 14px 48px; display: none; }
.step-item.active .step-body { display: block; }
.step-desc { color: var(--muted); font-size: 12px; margin: 0 0 8px; line-height: 1.5; }

.field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 6px 0; }
.field.field-stack { grid-template-columns: 1fr; gap: 4px; }
.field label { font-size: 12px; color: var(--ink); min-width: 0; }
.field .unit { color: var(--muted); font-size: 11px; margin-left: 4px; }
.field input[type="number"], .field select {
  width: 96px; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff;
}
.field input[type="range"] { width: 110px; }
.field.locked label, .field.locked .unit { color: var(--lock); }
.field.locked input, .field.locked select { background: var(--panel-2); color: var(--lock); border-style: dashed; }
.field-note { font-size: 11px; color: var(--muted); margin: 2px 0 6px; line-height: 1.5; }
.kv { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.kv .v { color: var(--muted); text-align: right; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-weight: 600; font-size: 12.5px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #185a3c; color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; padding-left: 6px; }
.btn.small { padding: 4px 9px; font-size: 11.5px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; margin-top: 8px; color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.status-dot.ok { background: var(--accent); }
.status-dot.busy { background: var(--earth); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: #fff; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.seg.small button { padding: 4px 9px; font-size: 11.5px; }

/* ---------- map ---------- */
.map-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; box-shadow: var(--shadow);
}
.map-toolbar .spacer { flex: 1; }
.map-toolbar .group-label { font-size: 11px; color: var(--muted); font-weight: 700; margin: 0 4px 0 2px; letter-spacing: .04em; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-size: 12px;
}
.chip .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--line-strong); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: #14513a; }
.chip.locked { color: var(--lock); border-style: dashed; cursor: not-allowed; }

.map-wrap {
  position: relative; flex: 1; min-height: 160px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
#map { width: 100%; height: 100%; display: block; background: #e9ebe0; touch-action: none; }
#lyShade { filter: blur(3px); }
#lyTiles image { image-rendering: auto; }
#map .yard-label { font-size: 12px; font-weight: 700; fill: #1f2a24; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
#map .small-label { font-size: 10.5px; fill: #4a5550; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
#map .contour { fill: none; stroke: #8c9a7c; stroke-width: .6; opacity: .55; }
#map .contour.index { stroke: #6d7d5c; stroke-width: 1.1; opacity: .7; }
#map .route { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; }
#map .route.dim { opacity: .5; stroke-width: 2.5; }
#map .route.selected { stroke-width: 4.5; filter: drop-shadow(0 0 2px rgba(255,255,255,.9)); }
#map .route-casing { fill: none; stroke: #fff; stroke-width: 7.5; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
#map .handle { fill: #fff; stroke: var(--ink); stroke-width: 1.5; cursor: grab; }
#map .handle:hover { fill: var(--accent-soft); }
#map .handle.dragging { cursor: grabbing; fill: var(--accent-soft); }
#map .reveal { animation: reveal 1.1s ease-out both; }
@keyframes reveal { from { stroke-dashoffset: 3000; } to { stroke-dashoffset: 0; } }

.map-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(244, 241, 234, .72); backdrop-filter: blur(1.5px);
}
.gen-card { width: 340px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); }
.gen-title { font-weight: 650; margin-bottom: 10px; }
.gen-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.gen-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #58a37f); transition: width .12s linear; }
.gen-log { margin-top: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 34px; line-height: 1.5; white-space: pre-line; }

.map-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(255,255,255,.92); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; box-shadow: var(--shadow); pointer-events: none;
}
.map-legend {
  position: absolute; right: 10px; bottom: 28px; background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 11.5px; display: grid; gap: 4px; min-width: 120px;
}
.map-legend:empty { display: none; }
.map-legend .row { display: flex; align-items: center; gap: 7px; }
.map-legend .sw { width: 16px; height: 4px; border-radius: 2px; flex: none; }
.map-legend .sw.dot { width: 9px; height: 9px; border-radius: 50%; }
.map-scale { position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: #4a5550; background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); }
.map-scale i { display: inline-block; height: 3px; background: #4a5550; vertical-align: middle; margin-right: 6px; }
.map-attr { position: absolute; right: 8px; bottom: 6px; font-size: 10.5px; color: #4a5550; background: rgba(255,255,255,.8); padding: 1px 6px; border-radius: 4px; }
.map-attr a { color: inherit; }

/* ---------- drawer (profile) ---------- */
.drawer {
  flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 12px 8px; min-height: 120px;
}
.drawer-head { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; flex-wrap: wrap; }
.drawer-head h3 { margin: 0; font-size: 12.5px; font-weight: 700; }
.drawer-head .spacer { flex: 1; }
.drawer.locked { display: grid; place-items: center; color: var(--lock); border-style: dashed; background: var(--panel-2); }
.drawer .lock-msg { text-align: center; line-height: 1.6; }
.drawer .lock-msg b { color: var(--muted); }
#profile { width: 100%; display: block; }
#profile .ground { fill: none; stroke: #6d5a3c; stroke-width: 1.8; }
#profile .design { fill: none; stroke: var(--accent); stroke-width: 2.2; }
#profile .cut { fill: var(--cut); opacity: .35; }
#profile .fill { fill: var(--fill); opacity: .4; }
#profile .axis { stroke: var(--line-strong); stroke-width: 1; }
#profile .tick { font-size: 10px; fill: var(--muted); }
#profile .grid { stroke: var(--line); stroke-width: .8; stroke-dasharray: 2 3; }
.kpi-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kpi-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-row b.warn { color: var(--danger); }

/* ---------- compare (right) ---------- */
.compare-head { padding: 12px 14px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.compare-head h3 { margin: 0; font-size: 12.5px; font-weight: 700; flex: 1 0 auto; white-space: nowrap; }
.compare-head .sub { font-size: 11px; color: var(--muted); width: 100%; }
.compare-body { padding: 0 12px 12px; display: grid; gap: 10px; }
.plan-card {
  border: 1px solid var(--line); border-left: 5px solid var(--plan-a); border-radius: 10px; padding: 10px 12px; background: #fff; cursor: pointer;
  transition: box-shadow .15s;
}
.plan-card:hover { box-shadow: var(--shadow); }
.plan-card.selected { box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); background: #fbfdfb; }
.plan-card.b { border-left-color: var(--plan-b); }
.plan-card.c { border-left-color: var(--plan-c); }
.plan-card .head { display: flex; align-items: center; gap: 8px; }
.plan-card .name { font-weight: 700; font-size: 13.5px; }
.plan-card .method { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.plan-card .rank { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.plan-card .rank.top { background: var(--accent); color: #fff; }
.plan-card .warns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.plan-card .warns span { font-size: 10.5px; color: var(--danger); background: #fbeae6; border-radius: 5px; padding: 1px 6px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin-top: 8px; }
.metric { display: flex; justify-content: space-between; font-size: 12px; border-bottom: 1px dotted var(--line); padding: 2px 0; }
.metric .k { color: var(--muted); }
.metric .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.metric.locked .k, .metric.locked .v { color: var(--lock); }
.metric .v.warn { color: var(--danger); }
.plan-card .actions { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.adopted { font-size: 11px; color: var(--accent); font-weight: 700; }
.weights { border-top: 1px solid var(--line); padding: 10px 14px 6px; }
.weights h4 { margin: 0 0 6px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.weights.locked h4, .weights.locked label { color: var(--lock); }
.compare-empty { color: var(--muted); font-size: 12px; padding: 0 14px 14px; line-height: 1.6; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.calc-table th, .calc-table td { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-table th { color: var(--muted); font-weight: 600; font-size: 11px; }

/* ---------- footer / toast / modal ---------- */
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 5px 18px 9px; font-size: 11.5px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow); z-index: 30;
}
.modal-backdrop { position: fixed; inset: 0; background: rgba(31,42,36,.35); display: grid; place-items: center; z-index: 40; }
.modal { width: min(620px, 92vw); max-height: 86vh; overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 700; font-size: 14px; flex: 1; }
.icon-btn { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.modal-body { padding: 14px 16px; font-size: 12.5px; line-height: 1.6; }
.modal-body pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 11px; overflow: auto; max-height: 220px; }
.modal-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
.modal-body th, .modal-body td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.modal-body th { color: var(--muted); font-weight: 600; font-size: 11px; }
.modal-body .row-btn { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.login-form { display: grid; gap: 10px; max-width: 320px; margin: 6px auto 4px; }
.login-form input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; }
.login-form .hint { font-size: 11.5px; color: var(--muted); }
.project-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.project-row:hover { background: var(--panel-2); }
.project-row .pname { font-weight: 650; }
.project-row .pmeta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.pill { font-size: 10.5px; border-radius: 999px; padding: 2px 8px; background: var(--accent-soft); color: #14513a; font-weight: 600; }
.pill.gray { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- short viewports ---------- */
@media (max-height: 820px) {
  .phase-info { padding: 6px 18px; }
  .phase-chip { padding: 6px 10px 5px; }
  .phase-chip .period { display: none; }
  .drawer { min-height: 90px; padding: 6px 12px; }
  .layout { padding: 10px 18px; gap: 10px; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  .layout { grid-template-columns: 250px 1fr; overflow: visible; }
  .compare { grid-column: 1 / -1; max-height: 320px; }
  .map-wrap { min-height: 380px; }
}
@media (max-width: 820px) {
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .rail { max-height: 320px; }
  .phase-info { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}
