:root {
  --navy: #12365c; --navy2: #1c4d7d; --accent: #2e9e6b; --bg: #f4f6f9;
  --card: #ffffff; --ink: #1d2733; --muted: #64748b; --line: #dde4ec;
  --err: #c23b3b; --warn-bg: #fff7e0; --warn-ink: #7a5a00;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 8px 0; }
h3 { margin: 2px 0 8px; font-size: 15px; color: var(--navy); }
.muted { color: var(--muted); }
.err { color: var(--err); font-size: 13px; margin-top: 6px; }
.ok { color: var(--accent); font-size: 13px; margin-left: 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

header { display: flex; justify-content: space-between; align-items: center;
  background: var(--navy); color: #fff; padding: 10px 22px; }
.brand { display: flex; align-items: center; gap: 10px; line-height: 1.1; }
.brand-text { display: flex; flex-direction: column; }
.head-logo { height: 34px; width: 34px; object-fit: contain; }
.login-logo { height: 74px; display: block; margin: 0 auto 8px; }
.brand-main { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; opacity: .75; }
.brand.clickable { cursor: pointer; }
.head-right { display: flex; align-items: center; gap: 14px; }
.crumb { font-size: 13px; opacity: .9; }

main { max-width: 1160px; margin: 20px auto; padding: 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: 0 4px 14px rgba(18,54,92,.12); transform: translateY(-1px); }
.pcard .pname { font-weight: 600; color: var(--navy); font-size: 16px; }
.pcard .pmeta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #e8f4ee; color: var(--accent); font-weight: 600; margin-top: 8px; }
.badge.gray { background: #eef1f5; color: var(--muted); }
.badge.run { background: #e8effa; color: var(--navy2); }

.row { display: flex; align-items: center; gap: 10px; }
.row.space { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 16px; }
label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
input, select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; color: var(--ink); background: #fff; }
input[type=file] { border: 1px dashed var(--line); background: #fafbfd; padding: 14px; width: 100%; margin-bottom: 8px; }

.btn { border: 1px solid var(--line); background: #fff; color: var(--navy); padding: 8px 16px;
  border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: #f0f4f8; }
.btn.primary { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.btn.primary:hover { background: var(--navy); }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.big { font-size: 16px; padding: 12px 26px; }
.btn:disabled { opacity: .5; cursor: default; }

.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy2) 60%, #2a6d9e 100%); }
.login-card { background: #fff; border-radius: 12px; padding: 30px 34px; width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login-card .brand-text { margin-bottom: 6px; }
.login-card .brand-main { color: var(--navy); font-size: 24px; }
.login-card .brand-sub { color: var(--muted); }
.login-card input { width: 100%; margin-top: 12px; }
.brand-text.center { align-items: center; }
.center { text-align: center; }
.login-logo { height: 64px; }

.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step { padding: 8px 18px; background: #e8edf3; border-radius: 20px; cursor: pointer;
  font-size: 14px; color: var(--muted); }
.step b { margin-right: 6px; }
.step.active { background: var(--navy2); color: #fff; }
.tab { display: none; }
.tab.active { display: block; }

.filelist { list-style: none; padding: 0; margin: 8px 0 0; }
.filelist li { display: flex; justify-content: space-between; padding: 5px 8px;
  border-bottom: 1px solid var(--line); font-size: 13px; }
.filelist .x { color: var(--err); cursor: pointer; font-weight: 700; }
.pill { font-size: 11px; padding: 1px 8px; border-radius: 9px; background: #eef1f5; color: var(--muted); }
.pill.opt { background: #eef7f1; color: var(--accent); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl input { padding: 5px 7px; font-size: 13px; width: 100%; }
.tbl input.narrow { width: 70px; }
.tbl .drag { cursor: grab; color: var(--muted); }
.swatch { width: 42px; height: 26px; padding: 0; border: 1px solid var(--line); }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-top: 8px; }
.errbox { background: #fdeaea; color: var(--err); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-top: 8px; font-weight: 600; }
.okbox { background: #e8f4ee; color: var(--accent); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-top: 8px; }
.flagtxt { color: var(--warn-ink); font-size: 12px; }
.revbadge { color: var(--accent); font-weight: 700; margin-left: 3px; }
.step.active .revbadge { color: #b8f5d0; }
.quickstart { border: 2px solid var(--navy2); background: linear-gradient(180deg, #fff, #f4f8fc); }
.quickstart h3 { font-size: 17px; }
.btn.ghost2 { background: transparent; border: none; color: var(--muted); font-weight: 500;
  text-decoration: underline; font-size: 13px; }
.prov { color: var(--accent); font-size: 11px; margin-top: 2px; min-height: 13px; }
.lbl { display: flex; align-items: center; gap: 5px; }
.tip { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; background: #dbe4ee; color: var(--navy2); font-size: 10px; font-weight: 700;
  font-style: normal; cursor: help; position: relative; flex-shrink: 0; }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: 130%; transform: translateX(-50%);
  width: 300px; background: var(--navy); color: #fff; font-weight: 400; font-size: 12px; line-height: 1.45;
  padding: 10px 12px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50; white-space: normal; }
.tip:hover::after { opacity: 1; }

.progress { height: 12px; background: #e8edf3; border-radius: 8px; margin: 14px 0 6px; overflow: hidden; }
.progress .bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--navy2), var(--accent));
  transition: width .4s; }

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.side .card { margin-bottom: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.legend .li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.legend .chip { cursor: pointer; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px;
  user-select: none; }
.legend .chip.off { opacity: .35; text-decoration: line-through; }
.legend .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.toggle { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; }
.row.wrap { flex-wrap: wrap; }
.viewer-controls { gap: 16px; }
#viewer3d { position: relative; width: 100%; height: 520px; border-radius: 10px; overflow: hidden;
  background: #eef2f6; }
#viewer3d canvas { display: block; }
.viewer-hint { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--muted);
  background: rgba(255,255,255,.75); padding: 2px 8px; border-radius: 8px; pointer-events: none; }
#infoPanel { position: absolute; top: 12px; right: 12px; z-index: 5; width: 270px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  font-size: 13px; box-shadow: 0 6px 22px rgba(18,54,92,.18); }
#infoPanel .closex { position: absolute; top: 6px; right: 10px; cursor: pointer; color: var(--muted);
  font-size: 15px; font-weight: 700; }
#map { height: 340px; border-radius: 8px; }

.dlrow { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.dlrow a { color: var(--navy2); font-weight: 600; text-decoration: none; }
.dlrow a:hover { text-decoration: underline; }
.dlrow .fmt { color: var(--muted); font-size: 12px; }

.report { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; font-size: 12.5px; overflow: auto; white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv b { color: var(--navy); font-weight: 600; }

@media (max-width: 900px) {
  .split, .grid2, .grid3 { grid-template-columns: 1fr; }
}
