:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #5f6b7a;
  --line: #dfe3e8;
  --accent: #0b6e99;
  --accent-ink: #ffffff;
  --ok: #2e7d32;
  --warn: #b26a00;
  --err: #c62828;
  --poly: #6a4c93;
  --lin: #0b6e99;
  --pt: #d1495b;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
header.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1.25rem; background: #14213d; color: #fff;
}
header.bar .brandline { display: flex; align-items: center; gap: .8rem; }
header.bar .brand a, header.bar .brand img { display: block; line-height: 0; }
header.bar .brand img { height: 32px; width: auto; background: #fff; border-radius: 5px; padding: 3px 6px; }
header.bar .brand a:focus-visible { outline: 2px solid #cfe8ff; outline-offset: 3px; }
header.bar h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
header.bar .who { font-size: .9rem; display: flex; gap: .75rem; align-items: center; }
header.bar a, header.bar button.link { color: #cfe8ff; }
main { max-width: 1100px; margin: 1.25rem auto; padding: 0 1rem 3rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1rem; margin: 0 0 .75rem; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
button, .btn {
  font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: .45rem .9rem; border-radius: 5px; cursor: pointer;
}
button.secondary { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--err); border-color: var(--err); }
button.link { background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
input[type=text], select, textarea {
  font: inherit; padding: .4rem .5rem; border: 1px solid #c4cad3; border-radius: 4px; background: #fff; width: 100%;
}
input.mono, .mono { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }
label.check { display: flex; gap: .45rem; align-items: flex-start; margin: .3rem 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }
.msg { padding: .6rem .8rem; border-radius: 5px; margin: .5rem 0; border: 1px solid; }
.msg.err { background: #fdecea; border-color: #f5c2c0; color: #7f1d1d; }
.msg.warn { background: #fff4e5; border-color: #ffd8a8; color: #6b3e00; }
.msg.ok { background: #edf7ed; border-color: #b7dfb9; color: #1b4d1e; }
.msg.info { background: #e8f4fb; border-color: #b6dcf0; color: #0b3c55; }
.target { border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; }
.target .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.target .t { font-weight: 600; word-break: break-word; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.dot.points { background: var(--pt); } .dot.lines { background: var(--lin); } .dot.polygons { background: var(--poly); }
.drop {
  border: 2px dashed #9fb3c8; border-radius: 8px; padding: 1.5rem; text-align: center; background: #fafcfe; cursor: pointer;
}
.drop.over { background: #e8f4fb; border-color: var(--accent); }
.stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat { flex: 1 1 140px; border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; }
.stat .n { font-size: 1.6rem; font-weight: 600; }
canvas#preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 6px; background: #fbfbfb; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.layers { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; }
progress { width: 100%; height: 1rem; }
.log { font-family: Consolas, monospace; font-size: .82rem; background: #0f1724; color: #dbe7f3; padding: .6rem .8rem; border-radius: 6px; max-height: 260px; overflow: auto; white-space: pre-wrap; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
td .row-actions { flex-wrap: nowrap; }
.checks { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.checks li.ok { color: var(--ok); } .checks li.warn { color: var(--warn); } .checks li.err { color: var(--err); }
.inline { display: flex; gap: .5rem; align-items: center; }
