:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, sans-serif;
  color: #172431;
  background: #f3f5f7;
  --accent: #174e7a;
  --muted: #506170;
  --border: #d5dee5;
  --light: #edf3f8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body { margin: 0; }
main, .header-inner { max-width: 1440px; margin-inline: auto; padding-inline: clamp(12px, 3vw, 42px); }
main { padding-block: 24px; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner, .account, .drawing-heading, .toolbar, .viewer-info, .ratings, .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.header-inner { justify-content: space-between; padding-block: 12px; }
.account { gap: 12px; }
.brand { font-weight: 700; }
.brand span { display: inline-block; background: var(--accent); color: white; border-radius: 4px; padding: 3px 7px; margin-right: 5px; font-size: .85rem; letter-spacing: .07em; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(1.45rem, 2.4vw, 2rem); line-height: 1.2; margin-bottom: 18px; }
h2 { font-size: 1.15rem; line-height: 1.25; overflow-wrap: anywhere; }
h3 { font-size: 1.04rem; }
h4 { font-size: .92rem; }
a { color: var(--accent); text-underline-offset: .15em; }
.card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: white; }
.start-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.instructions ol { margin: 10px 0 0; padding-left: 1.4em; }
.instructions li + li { margin-top: 5px; }
.instructions li::marker { font-weight: 650; color: var(--accent); }
.drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  border: 1px dashed #8097aa;
  border-radius: 6px;
  background: #f7fafc;
}
.drop.dragover { border-color: var(--accent); background: #ddebf5; }
button, .button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid #9caeba;
  border-radius: 5px;
  color: inherit;
  background: #fff;
  text-decoration: none;
  font-size: .89rem;
  font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover, button[aria-pressed="true"] { background: var(--light); color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #123d60; color: white; }
:focus-visible { outline: 3px solid #226dab; outline-offset: 3px; }
input:not([type="checkbox"], [type="radio"]), select, textarea {
  min-width: 0;
  width: 100%;
  padding: 6px 9px;
  border: 1px solid #9caeba;
  border-radius: 5px;
  background: white;
  color: inherit;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
textarea { resize: vertical; }
.field { display: grid; gap: 4px; font-size: .89rem; font-weight: 600; }
#upload-settings > .field { max-width: 244px; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); width: fit-content; font-size: .89rem; font-weight: 650; }
.number-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
#review-settings .number-settings { grid-template-columns: 1fr; }
.hint, .next, .privacy { color: var(--muted); font-size: .86rem; }
.notice { color: var(--accent); font-size: .89rem; font-weight: 600; }
.notice.error { color: #872e27; }
.notice:not(:empty), details .hint, #viewer-hint { margin-top: 8px; }
.saved, #drawing, .feedback, .next { margin-top: 16px; }
ul { padding-left: 19px; margin: 6px 0 0; }
.job-list { list-style: none; padding: 0; }
.job-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-block: 6px; }
.job-list li + li { border-top: 1px solid var(--border); }
.job-list a { font-weight: 650; overflow-wrap: anywhere; }
.job-list a[aria-current="true"] { color: #172431; }
.job-list button { margin-left: auto; }
.chip {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--light);
  color: #244763;
  font-size: .81rem;
  font-weight: 650;
}
.chip.blocked { color: #872e27; background: #fbf1ef; }
.drawing-heading { justify-content: space-between; margin-bottom: 8px; }
.drawing-heading h2 { font-size: 1.35rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(315px, 1fr); gap: 14px; margin-top: 10px; align-items: start; }
.viewer { padding: 10px; position: sticky; top: 10px; }
.toolbar { margin-bottom: 8px; }
.overlay, .ratings label, .layer-options label { display: flex; align-items: center; gap: 7px; font-size: .87rem; }
.overlay { margin-left: auto; min-height: 32px; }
#canvas {
  display: block;
  width: 100%;
  height: clamp(330px, 58vh, 650px);
  background: #f6f9fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
#canvas.measuring { cursor: crosshair; }
#canvas.dragging { cursor: grabbing; }
#canvas path, #canvas polyline, #canvas circle, #canvas line { vector-effect: non-scaling-stroke; }
.material { fill: #d3e4f1; fill-opacity: .73; fill-rule: evenodd; stroke: #174e7a; stroke-width: 1.25; }
.open-line, .original-line { fill: none; stroke: #374758; stroke-width: 1.3; stroke-dasharray: 4 3; }
.original-line { stroke: #596b7d; stroke-dasharray: 2 2; stroke-width: 1.7; }
.marker-leader { stroke: var(--accent); stroke-width: 1; }
.marker circle { fill: #fff; stroke: #174e7a; stroke-width: 1.5; }
.marker text { fill: #174e7a; text-anchor: middle; dominant-baseline: central; font-weight: 750; }
.marker.selected circle { fill: #174e7a; stroke: #fff; stroke-width: 2; }
.marker.selected text { fill: #fff; }
.measure-line { fill: none; stroke: #172431; stroke-width: 2; }
.measure-point { fill: white; stroke: #172431; stroke-width: 2; }
.viewer-info { margin-top: 7px; justify-content: space-between; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
#scale { display: flex; gap: 6px; align-items: center; }
#scale span { border: solid currentColor; border-width: 0 1px 2px; height: 5px; }
#scale b { font-weight: 500; }
.review { display: grid; gap: 10px; min-width: 0; }
.review-card { padding: 13px; font-size: .9rem; overflow-wrap: anywhere; }
.review-card h3 { margin-bottom: 6px; }
.size { font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.15; margin-block: 3px 6px; font-weight: 750; font-variant-numeric: tabular-nums; }
.review-card form, #layers, #ignored { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
#apply-settings, #reset-layers { margin-top: 7px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-size: .89rem; font-weight: 650; }
.layer-options { display: grid; gap: 3px; margin-block: 4px; }
.layer-options label { min-height: 26px; }
.layer-options input { flex: 0 0 auto; }
.finding-group { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.finding-group ul { list-style: none; padding-left: 0; }
.finding-group li { padding-block: 6px; }
.finding-group li + li { border-top: 1px solid var(--border); }
.finding-group .actions, #result .actions { margin-top: 6px; }
.finding-number { font-size: .77rem; padding: 0 4px; border-radius: 3px; background: var(--light); color: var(--accent); }
.feedback { max-width: 660px; }
.feedback fieldset, .feedback .field, .feedback button, .login-card form, .login-card button { margin-top: 10px; }
.ratings { margin-top: 5px; gap: 14px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(100%, 455px); padding: clamp(18px, 5vw, 32px); }
.login-card h1 { font-size: clamp(1.45rem, 4vw, 1.85rem); margin-bottom: 8px; }
.login-card .field + .field { margin-top: 9px; }
.privacy { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
@media (max-width: 760px) {
  .start-grid, .workspace { grid-template-columns: minmax(0, 1fr); }
  .viewer { position: static; }
  #canvas { height: clamp(260px, 48vh, 420px); }
  .overlay { margin-left: 0; }
}
@media (max-width: 440px) {
  .number-settings { grid-template-columns: 1fr; }
}
