:root {
  --bg: #0e1116;
  --panel: #171c24;
  --line: #2a3340;
  --text: #e7edf5;
  --muted: #8b98a8;
  --accent: #3d9cf0;
  --rust: #e25b2a;
  --corr: #c9a227;
  --danger: #d4534a;
  --ok: #3cb37a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, sans-serif; }
.hidden { display: none !important; }
body.is-admin #admin-box,
body.is-admin #import-box,
body.is-admin #panel-team { display: block !important; }
body.is-admin #new-proj-row { display: block !important; }
body.is-admin #btn-export,
body.is-admin #btn-hub-team,
body.is-admin #btn-editor-team { display: inline-block !important; }
.screen { min-height: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; max-width: 420px; margin: 12vh auto; }
.card.wide { max-width: 640px; }
h1 { margin: 0 0 8px; font-size: 22px; }
label { display: block; margin: 12px 0; color: var(--muted); }
input, select { width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0f141b; color: var(--text); }
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  flex: none;
  border: none;
  background: none;
  accent-color: var(--accent);
}
button { background: #243040; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: #1e4d7a; border-color: #3d9cf0; }
button.danger { background: #4a2220; border-color: var(--danger); }
button.cls.rust { background: #4a2618; border-color: var(--rust); }
button.cls.corrosion { background: #3d3414; border-color: var(--corr); }
button.cls.heavy { filter: saturate(1.15) brightness(0.92); }
.cls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px; }
.cls-grid button.cls { width: 100%; padding: 5px 6px; font-size: 11px; text-align: left; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); min-height: 1.2em; }
header { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
#editor.screen { display: flex; flex-direction: column; height: 100%; min-height: 100%; }
.ed-head { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.ed-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; width: 100%; }
.ed-left, .ed-right { display: flex; gap: 10px; align-items: center; min-width: 0; }
.ed-right { justify-content: flex-end; }
.ed-center { display: flex; gap: 8px; align-items: center; }
#btn-prev, #btn-next { font-size: 22px; line-height: 1; min-width: 42px; padding: 6px 12px; }
#img-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.hub-body { padding: 20px; max-width: 960px; margin: 0 auto; }
.hub-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin: 0 0 16px; }
.hub-card h3 { margin: 0 0 8px; font-size: 16px; }
.hub-card .row input, .hub-card .row select { width: auto; flex: 1; min-width: 120px; margin-top: 0; }
.user-row select.user-role { width: auto; min-width: 160px; flex: 0 0 160px; margin-top: 0; }
.team-list-title { margin: 18px 0 8px; font-size: 15px; }
#panel-team { margin-bottom: 10px; }
#panel-team .primary { width: 100%; }
.proj-picks { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; max-width: 480px; }
label.proj-pick {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  width: 100%;
  max-width: 480px;
}
label.proj-pick span { flex: 1; }
#del-proj-modal label.proj-pick span { white-space: normal; }
.user-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0; background: #121820; }
#user-list .row span { min-width: 120px; }
.proj { display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: var(--panel); cursor: pointer; gap: 12px; }
.proj-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.proj-del { padding: 6px 10px; font-size: 12px; }
.ds-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.ds-stats span { white-space: nowrap; }
.ds-stats b { color: var(--text); font-weight: 600; }
.ds-stats .st-left b { color: #e2c36b; }
.ds-stats .st-done b { color: var(--ok); }
.ds-stats .st-rej b { color: var(--danger); }
.pill { background: #243040; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.ed-grid { display: grid; grid-template-columns: 148px 1fr 280px; flex: 1; min-height: 0; }
.tools, .panel { background: var(--panel); border-right: 1px solid var(--line); padding: 5px; overflow: auto; }
.tools { overflow: hidden; }
.panel { border-right: 0; border-left: 1px solid var(--line); }
.tools button { display: block; width: 100%; margin: 0; text-align: left; padding: 2px 5px; font-size: 10.5px; }
.tools button.active { background: #1e4d7a; border-color: var(--accent); }
.tools button:disabled { opacity: 0.45; cursor: not-allowed; }
button.cls.active { outline: 2px solid var(--accent); }
.tool-meta { margin-top: 8px; }
.tool-meta label { margin: 6px 0; }
.check { display: flex; gap: 8px; align-items: center; }
#stage-wrap { position: relative; overflow: hidden; background: #090b0e; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; outline: none; }
#hud { position: absolute; left: 10px; bottom: 10px; background: #0008; padding: 4px 8px; border-radius: 6px; font-size: 12px; pointer-events: none; }
#busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #0008; color: #fff; font-size: 16px; z-index: 5; text-align: center; padding: 24px; }
.inst { padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; cursor: pointer; display: flex; justify-content: space-between; user-select: none; }
.inst.sel { border-color: var(--accent); background: #1a2838; }
.inst.rust_light, .inst.rust_moderate, .inst.rust_heavy, .inst.rust { border-left: 4px solid var(--rust); }
.inst.corrosion_light, .inst.corrosion_moderate, .inst.corrosion_heavy, .inst.corrosion { border-left: 4px solid var(--corr); }
.inst.rust_heavy, .inst.corrosion_heavy { border-left-width: 6px; }
.inst.rust_light, .inst.corrosion_light { border-left-width: 3px; opacity: 0.96; }
.inst.layer-off { opacity: 0.48; }
.eye { margin-left: 8px; padding: 2px 8px; font-size: 12px; width: auto; }
#btn-vis.active { background: #1e4d7a; border-color: var(--accent); }
.filebtn { position: relative; overflow: hidden; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 20; }
.keys div { margin: 6px 0; }
kbd { background: #243040; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
