:root {
  --bg: #f6f4f0;
  --panel: #ffffff;
  --ink: #1d2327;
  --muted: #6b7378;
  --line: #e2ded6;
  --accent: #0e6e8c;
  --accent-ink: #ffffff;
  --wood: #8c5a3c;
  --pass: #1a7f37;
  --warn: #9a6700;
  --fail: #cf222e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); height: 100vh; display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 28px; padding: 0 18px; height: 48px; background: #14232b; color: #fff; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.brand span { font-weight: 400; opacity: .7; }
nav a { color: #cfe3ea; text-decoration: none; margin-right: 18px; padding: 14px 0; border-bottom: 2px solid transparent; }
nav a.active { color: #fff; border-color: #5fc3e4; }
.view { flex: 1; min-height: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* design view */
#design { display: flex; }
.stage { flex: 1; position: relative; display: flex; flex-direction: column; min-width: 0; }
#map { flex: 1; min-height: 0; }
.map-tools { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.map-tools form { display: flex; gap: 4px; }
.hint { position: absolute; top: 52px; left: 10px; background: rgba(20,35,43,.85); color: #fff; padding: 6px 10px;
        border-radius: 6px; font-size: 13px; z-index: 2; pointer-events: none; }
.hint:empty { display: none; }
.preview-dock { height: 42%; min-height: 220px; border-top: 1px solid var(--line); background: #e9edef; display: flex; flex-direction: column; }
.preview-head { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.preview-head .zscale { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.viewer { flex: 1; min-height: 0; position: relative; }
.viewer canvas { display: block; }
.viewer .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); pointer-events: none; }
.panel { width: 380px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.group { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.group > summary { font-weight: 600; cursor: pointer; margin-bottom: 8px; }
.group.sticky { position: sticky; bottom: 0; background: var(--panel); margin-top: auto; border-top: 1px solid var(--line); }
label { display: flex; flex-direction: column; gap: 3px; margin: 6px 0; font-size: 12.5px; color: #3a4246; }
label output { font-weight: 600; color: var(--ink); }
label.check { flex-direction: row; align-items: center; gap: 6px; }
.row { display: flex; gap: 10px; }
.row > label { flex: 1; }
input[type=number], input:not([type]), select { padding: 5px 7px; border: 1px solid #cfcac0; border-radius: 5px; font: inherit; background: #fff; }
input[type=range] { width: 100%; }
button { font: inherit; padding: 6px 11px; border: 1px solid #c8c2b8; border-radius: 6px; background: #fff; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.active { background: #14232b; color: #fff; }
button.big { width: 100%; padding: 10px; font-size: 15px; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; margin-top: 6px; }
.facts b { font-weight: 600; }
.facts .warn { grid-column: 1 / -1; color: var(--warn); }
.facts .err { grid-column: 1 / -1; color: var(--fail); }
table.tools { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 6px; }
table.tools td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
#poiList .poi { display: grid; grid-template-columns: 1fr 76px 82px 20px 22px; gap: 4px; align-items: center; margin: 3px 0; }
#poiList input { width: 100%; padding: 3px 5px; font-size: 12px; }
#poiList button { padding: 0 5px; line-height: 20px; }
label.file input { font-size: 12px; }

/* jobs */
.jobs-wrap, .job-wrap { max-width: 1180px; margin: 0 auto; padding: 18px 24px 60px; overflow-y: auto; height: 100%; }
#jobs, #job { overflow-y: auto; }
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.job-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; text-decoration: none; color: inherit; }
.job-card:hover { border-color: var(--accent); }
.job-card img { width: 100%; height: 170px; object-fit: cover; background: #ddd; display: block; }
.job-card .meta { padding: 10px 12px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--muted); }
.badge.pass, .badge.done { background: var(--pass); }
.badge.warn { background: var(--warn); }
.badge.fail, .badge.error, .badge.failed_verification { background: var(--fail); }
.badge.running, .badge.queued { background: var(--accent); }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.job-head h1 { margin: 0 0 4px; }
.actions { display: flex; gap: 8px; }
.progress { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 16px 0; }
.bar { height: 10px; background: #e6e2da; border-radius: 6px; overflow: hidden; }
.bar div { height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.progress pre { font-size: 11.5px; color: var(--muted); max-height: 160px; overflow-y: auto; margin: 10px 0 0; }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card h2 { font-size: 15px; margin: 0 0 10px; }
.card.wide { grid-column: 1 / -1; }
.card img { width: 100%; border-radius: 6px; display: block; }
.checks div { padding: 3px 0; font-size: 13px; }
.checks .st { display: inline-block; width: 44px; font-weight: 700; font-size: 11.5px; }
.checks .pass .st { color: var(--pass); } .checks .warn .st { color: var(--warn); } .checks .fail .st { color: var(--fail); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv b { font-weight: 600; }
.downloads a { display: inline-block; margin: 0 8px 8px 0; padding: 7px 12px; border-radius: 6px; background: #eef4f6; color: var(--accent); text-decoration: none; border: 1px solid #cfe1e7; }
.downloads a.main { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.result-viewer { height: 420px; border-radius: 8px; overflow: hidden; background: #e9edef; position: relative; }
.files td { padding: 3px 8px 3px 0; font-size: 13px; }

.chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; }
.chips button { padding: 2px 8px; font-size: 12px; border-radius: 12px; }
.chips button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.small { font-size: 12px; }
.save-row { gap: 6px; margin: 4px 0; }
.save-row button { flex: 1; }
.account { margin-left: auto; position: relative; }
.account > button { background: transparent; color: #cfe3ea; border-color: #3b5360; }
.menu { position: absolute; right: 0; top: 38px; background: #fff; color: var(--ink); border: 1px solid var(--line);
        border-radius: 8px; padding: 10px; width: 300px; display: flex; flex-direction: column; gap: 8px; z-index: 10;
        box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.card-actions { display: flex; gap: 6px; margin-top: 8px; }
.card-actions button { padding: 3px 9px; font-size: 12.5px; }
.data-page h2 { margin-top: 28px; }
.data-page table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.data-page th, .data-page td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
.data-page th { background: #f1eee8; font-weight: 600; }
.data-page .note { background: #eef6f8; border: 1px solid #cfe1e7; border-radius: 8px; padding: 12px 16px; line-height: 1.5; }
.data-page .cite { font-size: 11.5px; color: var(--muted); }
.login-page main.login { display: flex; justify-content: center; align-items: flex-start; padding-top: 10vh; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 380px; }
.login-card h1 { margin-top: 0; }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card input { font-size: 15px; padding: 8px; }
.or { text-align: center; color: var(--muted); margin: 18px 0 8px; font-size: 12.5px; }
header { gap: 18px; }
.brand, nav a { white-space: nowrap; }
nav a { margin-right: 12px; }
.account > button { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .brand span { display: none; } nav a { margin-right: 8px; font-size: 13px; } }
