:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1d2330; --muted: #6b7280; --line: #e5e7eb;
  --accent: #0f766e; --accent-soft: #ccfbf1; --warn: #b45309; --warn-soft: #fef3c7; --prec: #db2777;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: grid; grid-template: 56px 1fr / 320px 1fr; background: var(--bg); }
header { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: #111827; color: #fff; }
.brand { font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand small { font-weight: 400; color: #9ca3af; margin-left: 6px; }
.logo { color: #2dd4bf; }
#search { position: relative; flex: 1; max-width: 520px; }
#q { width: 100%; padding: 8px 12px; border-radius: 8px; border: 0; font: inherit; }
#suggest { position: absolute; z-index: 10; left: 0; right: 0; top: 38px; margin: 0; padding: 0; list-style: none;
  background: #fff; color: var(--ink); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); overflow: hidden; }
#suggest li { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
#suggest li:hover { background: var(--accent-soft); }
#suggest li button { font-size: 12px; }
#job { font-size: 13px; color: #a7f3d0; }

#filters { overflow-y: auto; padding: 14px 16px; background: var(--panel); border-right: 1px solid var(--line); }
#filters h2 { margin: 0 0 10px; font-size: 15px; }
#filters label { display: block; margin: 10px 0; font-size: 12px; color: var(--muted); }
#filters select, #filters input[type=number] { width: 100%; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; color: var(--ink); margin-top: 3px; }
#filters input[type=range] { width: 100%; accent-color: var(--accent); }
output { float: right; font-weight: 600; color: var(--ink); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.presets { display: grid; gap: 6px; margin: 14px 0; }
.presets span { font-size: 12px; color: var(--muted); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px; text-align: left; }
button:hover { border-color: var(--accent); }
.muted { color: var(--muted); font-size: 12px; }
#results { list-style: none; margin: 0; padding: 0; }
#results li { padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
#results li:hover { background: var(--bg); }
#results small { color: var(--muted); display: block; }
.pill { min-width: 34px; text-align: center; font-weight: 700; border-radius: 999px; padding: 2px 8px; color: #fff; align-self: center; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 12px; }
.legend i { flex: 1; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #e5e7eb, #fde68a, #f59e0b, #dc2626); }

#map { position: relative; }
#detail { position: fixed; top: 56px; right: 0; bottom: 0; width: min(520px, 100vw); overflow-y: auto; background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.08); padding: 16px 18px 40px; z-index: 5; }
#close { position: absolute; right: 12px; top: 10px; font-size: 20px; border: 0; }
#detail h1 { font-size: 18px; margin: 0 28px 2px 0; }
#detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 20px 0 8px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { background: var(--bg); border-radius: 8px; padding: 8px; }
.kv b { display: block; font-size: 16px; }
.kv span { font-size: 11px; color: var(--muted); }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.score { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.score.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.score b { font-size: 22px; }
.score span { display: block; font-size: 11px; color: var(--muted); }
.factor { display: grid; grid-template-columns: 1fr 120px 46px; gap: 8px; align-items: center; font-size: 12px; padding: 4px 0; }
.factor .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.factor .bar i { display: block; height: 100%; background: var(--accent); }
.factor small { color: var(--muted); display: block; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-top: 10px; }
.estimate { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.estimate big { font-size: 20px; font-weight: 700; }
.estimate ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
tr.prec td:first-child { border-left: 3px solid var(--prec); }
tr:hover td { background: var(--bg); cursor: pointer; }
.fin { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }
.fin input { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.fin .total { grid-column: 1 / -1; font-size: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
a { color: var(--accent); }
@media (max-width: 800px) {
  body { grid-template: 56px 45vh 1fr / 1fr; }
  #filters { grid-row: 3; } #map { grid-row: 2; }
  .brand small { display: none; }
}

#filters label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chips span { background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
ul.plus, ul.minus { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; }
ul.plus li::marker { content: "＋ "; color: var(--accent); }
ul.minus li::marker { content: "！ "; color: var(--warn); }
.wh-legend { position: absolute; left: 12px; bottom: 28px; background: #fff; padding: 8px 10px; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15); font-size: 12px; z-index: 2; }
.wh-legend i { display: inline-block; width: 120px; height: 8px; border-radius: 4px; vertical-align: middle; margin: 0 6px;
  background: linear-gradient(90deg, #eff6ff, #93c5fd, #2563eb, #1e3a8a); }

#userbox { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: #d1d5db; white-space: nowrap; }
#userbox button { background: transparent; color: #fff; border-color: #4b5563; padding: 4px 10px; }
.panel { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.panel h2 { font-size: 13px; margin: 0 0 6px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-head button { font-size: 12px; padding: 4px 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
ul.plain li small { display: block; color: var(--muted); font-size: 11px; }
#watchlist li { cursor: pointer; }
.s-actions { display: flex; gap: 2px; flex-shrink: 0; }
.s-actions button { padding: 2px 6px; font-size: 12px; }
#login { position: fixed; inset: 0; z-index: 50; background: rgba(17, 24, 39, .75); display: grid; place-items: center; padding: 16px; }
#login[hidden] { display: none; }
#login form { background: #fff; border-radius: 12px; padding: 24px; width: min(380px, 100%); display: grid; gap: 10px; }
#login .brand { color: var(--ink); }
#login h2 { margin: 0; font-size: 18px; }
#login label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
#login label[hidden] { display: none; }
#login input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
#login button { background: var(--accent); color: #fff; border: 0; padding: 10px; text-align: center; font-weight: 600; }
#login-error { color: #b91c1c; font-size: 13px; margin: 0; min-height: 1em; }

#analyse-view { background: #2dd4bf; color: #0f172a; border: 0; font-weight: 600; padding: 7px 12px; white-space: nowrap; }
#analyse-view:hover { background: #5eead4; }
#analyse-view:disabled { opacity: .6; cursor: wait; }
#suggest li button { background: var(--accent); color: #fff; border: 0; white-space: nowrap; }
@media (max-width: 800px) { #analyse-view { display: none; } }
