:root {
  --blue: #4a72c4; --blue-d: #3a5fae; --line: #dfe3ea; --bg: #f4f5f7; --ink: #222; --muted: #6b7280;
  --warn: #b45309; --bad: #b91c1c; --ok: #15803d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.5 "Segoe UI", "Malgun Gothic", sans-serif; color: var(--ink); background: var(--bg); }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--ink); text-decoration: none; }
.top nav { display: flex; gap: 14px; align-items: center; margin-left: auto; }
.top nav a { color: var(--blue-d); text-decoration: none; }
main { padding: 18px 20px 60px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 12px; } h1 small { color: var(--muted); font-weight: 400; }
h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 16px 0 8px; }
h4 { font-size: 13px; font-weight: 500; margin: 0 0 4px; }
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.card.narrow { max-width: 380px; margin: 40px auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
label { display: block; margin-bottom: 10px; }
.card.narrow input { display: block; width: 100%; margin-top: 4px; }
input, select { font: inherit; padding: 5px 7px; border: 1px solid #c9ced8; border-radius: 4px; background: #fff; }
input:disabled, select:disabled { background: #f1f2f4; color: var(--muted); }
input[type=number] { width: 96px; }
.btn { display: inline-block; font: inherit; padding: 6px 16px; border-radius: 4px; border: 1px solid var(--blue);
  background: var(--blue); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--blue-d); }
.btn.ghost { background: #fff; color: var(--blue-d); }
.btn.primary { background: var(--ok); border-color: var(--ok); }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; color: var(--blue-d); cursor: pointer; font: inherit; padding: 0; }
.inline { display: inline; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.muted { color: var(--muted); } .nowrap { white-space: nowrap; } .grow { flex: 1; } .w8 { width: 100px; }
.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; }
.flash.ok { background: #ecfdf3; color: var(--ok); } .flash.error { background: #fef2f2; color: var(--bad); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eef2ff; color: var(--blue-d); }
.tag.warn { background: #fff7ed; color: var(--warn); } .tag.bad { background: #fef2f2; color: var(--bad); }
.error { color: var(--bad); margin: 6px 0; }
table.grid { border-collapse: collapse; width: 100%; background: #fff; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
table.grid th { background: #fafbfc; font-weight: 500; }
.help ol { margin: 0; padding-left: 20px; } .help li { margin-bottom: 4px; }

/* editor */
.title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .title-row h1 { margin: 0; }
.form-grid.top { display: grid; grid-template-columns: 130px 260px auto auto; gap: 8px 12px; align-items: center; }
.form-grid.top label { margin: 0; } .span2 { grid-column: span 2; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.calib { display: flex; gap: 28px; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; } legend { font-weight: 500; margin-bottom: 6px; }
.calib label { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
label.check { display: flex; gap: 6px; align-items: center; }
.unit { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; margin: 2px 0; }
#graph { width: 100%; height: auto; max-height: 260px; display: block; }
#graph .band { opacity: .55; } #graph .p1 { fill: #eef4fd; } #graph .p2 { fill: #fdf6e7; } #graph .p3 { fill: #fdf0ee; }
#graph .p4 { fill: #eef4fd; } #graph .p5 { fill: #fdf6e7; } #graph .p6 { fill: #fdf0ee; } #graph .p7 { fill: #eef4fd; } #graph .p8 { fill: #eaf7ee; }
#graph .axis { stroke: #333; stroke-width: 1.5; } #graph .move { fill: none; stroke: #e5484d; stroke-width: 2.5; }
#graph .expose { stroke: #2bb594; stroke-width: 3; } #graph .phase { font-size: 11px; fill: #555; } #graph .tick { font-size: 11px; fill: #555; }
.sec-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.sec-head label { margin: 0; display: flex; gap: 8px; align-items: center; }
.sec-grid { display: grid; grid-template-columns: repeat(10, auto); gap: 10px 14px; align-items: start; justify-content: start; margin: 6px 0 10px; }
.sec-grid > div { display: flex; flex-direction: column; }
.sec-grid .lt { align-self: center; color: var(--muted); font-size: 16px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table.sections th, table.sections td { text-align: center; white-space: nowrap; }
table.sections tbody tr { cursor: pointer; } table.sections tbody tr:hover { background: #f7f8fc; }
table.sections tbody tr.sel { background: #eef0fb; }
#toast { position: fixed; right: 20px; bottom: 20px; background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 6px; max-width: 480px; }
#toast.bad { background: var(--bad); }
/* Jacobs */
textarea { font: inherit; width: 100%; padding: 6px 8px; border: 1px solid #c9ced8; border-radius: 4px; margin-top: 4px; }
ol.steps { padding-left: 20px; margin: 8px 0 0; } ol.steps li { margin-bottom: 8px; }
ol.steps li.warn { background: #fff7ed; border-left: 3px solid var(--warn); padding: 6px 10px; list-style-position: inside; margin-left: -20px; }
.row.wrap label { display: flex; gap: 6px; align-items: center; margin: 0 12px 0 0; }
.film { display: grid; grid-template-columns: 22px repeat(var(--cols, 8), minmax(78px, 1fr)); gap: 3px; max-width: 900px; margin: 8px 0; }
.film .frame { background: #cbd5e1; border-radius: 2px; min-height: 18px; }
.film .panel { background: #f1f5fb; border: 1px solid var(--line); border-radius: 4px; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.film .panel input { width: 100%; text-align: center; }
.film .pno { font-size: 11px; color: var(--muted); align-self: flex-start; }
.film .dose { font-size: 11px; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: max-content 1fr max-content 1fr max-content 1fr; gap: 4px 12px; margin: 6px 0 10px; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 600; }
#plot, #resplot { width: 100%; max-width: 900px; height: auto; display: block; }
#plot .gridline, #resplot .gridline { stroke: #e5e7eb; } #plot .axis, #resplot .axis { stroke: #333; stroke-width: 1.2; }
#plot .tick, #resplot .tick { font-size: 11px; fill: #555; } #plot .axislabel { font-size: 12px; fill: #333; }
#plot .fitline { fill: none; stroke: var(--blue); stroke-width: 2.2; } #plot .ecline { stroke: #e5484d; stroke-dasharray: 4 4; }
#plot .pt, #resplot .pt { fill: #e5484d; } #plot .pt.zero { fill: #fff; stroke: #e5484d; stroke-width: 1.5; }
#resplot .resbar { stroke: #e5484d; stroke-width: 1.2; }
#rec h3 { margin: 12px 0 6px; }
@media (max-width: 1100px) { .sec-grid { grid-template-columns: repeat(4, auto); } .sec-grid .lt { display: none; }
  .form-grid.top { grid-template-columns: 120px 1fr; } }
