@font-face {
  font-family: Montserrat;
  src: url("./assets/Montserrat.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1c2d3a;
  --brand: #0f5e6f;
  --paper: #f5f8fa;
  --line: #d9e4e9;
  --muted: #53697b;
  --pale: #e9f3f6;
  font: 500 14px/1.5 Montserrat, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body, h1, h2, p, ol { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-header { background: white; border-bottom: 1px solid var(--line); }
.header-inner, main, .site-footer { width: min(100% - 72px, 1490px); margin-inline: auto; }
.header-inner, .identity, .back-link, .header-links { display: flex; align-items: center; }
.header-inner { min-height: 74px; justify-content: space-between; gap: 16px; }
.identity { gap: 24px; }
.brand { display: inline-flex; }
.brand img { width: 158px; height: auto; display: block; }
.header-caption { border-left: 1px solid var(--line); padding-left: 24px; color: var(--muted); }
.header-links { gap: 22px; color: var(--brand); font-weight: 700; }
.header-links a { white-space: nowrap; }
.header-links a:hover, .site-footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.back-link { gap: 10px; font-weight: 600; }
.back-link svg { width: 16px; height: 16px; transform: rotate(-35deg); }
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
main { padding: 20px 0 0; }
.small-screen-notice {
  display: none;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  margin: 0 0 16px;
  background: #fff5de;
  border: 1px solid #ddbd78;
  color: #543815;
  border-radius: 8px;
}
.small-screen-notice h2 { font-size: 17px; margin-bottom: 3px; }
.small-screen-notice p { font-size: 14px; line-height: 1.45; }
@media (max-width: 600px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  .small-screen-notice { display: flex; }
}
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px 23px;
  margin-bottom: 17px;
  border: 1px solid #d0e3e8;
  border-radius: 12px;
  background: linear-gradient(110deg, #fff 22%, #eaf5f7 100%);
}
.intro-kicker { display: flex; gap: 9px; align-items: center; color: var(--brand); }
.intro-kicker span { width: 16px; height: 2px; background: var(--brand); }
h1 { margin: 5px 0; font-size: clamp(29px, 3.4vw, 50px); font-weight: 700; letter-spacing: -.038em; line-height: 1.08; }
.intro p:last-child { color: var(--muted); }
.intro-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button, .tool, .icon-button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 600; line-height: 1.1; }
.button { min-height: 44px; padding: 9px 15px; white-space: nowrap; }
.primary { color: white; background: var(--brand); }
.primary:hover:not(:disabled) { background: #0a4c5a; }
.secondary { background: white; border-color: #c4d8df; }
.secondary:hover { background: #f1f8fa; }
.button.compact { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "editor actions" "editor summary";
  gap: 12px 18px;
  align-items: start;
}
.editor { grid-area: editor; }
.summary { grid-area: summary; }
.editor, .measurements { background: white; border: 1px solid var(--line); border-radius: 9px; min-width: 0; overflow: hidden; }
.filebar, .toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; gap: 8px; }
.filebar { min-height: 44px; border-bottom: 1px solid var(--line); font-weight: 600; }
.file-caption { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-caption span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-caption svg, .filebar label { color: var(--muted); }
.filebar label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; }
select { background: white; border: 1px solid var(--line); padding: 3px; max-width: 115px; }
.toolbar { min-height: 52px; padding-block: 5px; flex-wrap: wrap; }
.tool-group, .zoom-group, .draw-actions { display: flex; align-items: center; gap: 4px; }
.tool-group, .draw-actions { flex-wrap: wrap; }
.tool { min-height: 36px; padding: 5px 9px; white-space: nowrap; font-size: 13px; }
.tool svg { width: 18px; height: 18px; }
.tool:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--pale); }
.tool[aria-pressed="true"], .tool[aria-pressed="true"]:hover { color: white; background: var(--brand); }
.icon-button { width: 34px; height: 34px; padding: 0; }
.fit { border-left: 1px solid var(--line); margin-left: 3px; }
#zoom-level { min-width: 51px; text-align: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.viewport {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(340px, calc(100dvh - 390px), 900px);
  border-block: 1px solid var(--line);
  overflow: hidden;
  background: #edf4f7 radial-gradient(#acc6ce .8px, transparent .8px) center / 18px 18px;
}
.viewport.is-drop { box-shadow: inset 0 0 0 3px var(--brand); }
#drawing { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.viewport[data-mode="reference"], .viewport[data-mode="polygon"] { cursor: crosshair; }
.viewport[data-mode="outline-draw"] { cursor: crosshair; }
.viewport[data-mode="outline-edit"], .viewport[data-mode="area-edit"] { cursor: move; }
.viewport[data-mode="pan"] { cursor: grab; }
.viewport.is-panning { cursor: grabbing; }
.empty-state { padding: 14px; text-align: center; cursor: default; }
.empty-illustration { width: 140px; height: 104px; stroke: none; margin-bottom: 5px; }
.empty-state h2 { font-size: clamp(20px, 3vw, 27px); line-height: 1.2; font-weight: 700; letter-spacing: -.025em; }
.empty-state p { color: var(--muted); margin: 5px 0 16px; }
.file-types { display: block; color: var(--muted); font-size: 10px; margin-top: 12px; }
.loading { position: absolute; background: white; border: 1px solid var(--line); padding: 13px 21px; font-weight: 700; }
.work-panel { grid-area: actions; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.work-panel h2 { font-size: 15px; line-height: 1.2; }
.work-panel p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.work-panel .draw-actions { margin-top: 8px; }
.work-panel .error { color: #9b342b; font-weight: 700; }
.total-card { padding: 17px; border-radius: 9px; background: var(--brand); color: white; }
.total-card p { color: #e0f1f5; }
#total-caption { font-size: 12px; }
.total-card button { margin-top: 10px; color: var(--ink); }
.total-value { font-size: 37px; font-weight: 700; letter-spacing: -.042em; line-height: 1.13; margin: 6px 0 3px; overflow-wrap: anywhere; }
.total-value span { font-size: 16px; letter-spacing: 0; white-space: nowrap; }
.measurements { margin-top: 12px; }
.reference-row { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid var(--line); }
.reference-icon { display: grid; place-items: center; background: var(--pale); width: 36px; height: 36px; flex: none; }
.measurements h2 { font-size: 14px; font-weight: 700; line-height: 1.25; }
.measurements p { color: var(--muted); font-size: 12px; }
.area-section { padding: 14px; }
.area-section h2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.area-section h2 span { font-size: 14px; background: var(--pale); border-radius: 20px; min-width: 24px; text-align: center; padding: 3px 5px; }
#area-list { padding: 0; list-style: none; max-height: 280px; overflow: auto; }
.area-item { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.area-item > span:first-child { display: flex; align-items: center; gap: 6px; }
.area-item > span:nth-child(2) { margin-left: auto; text-align: right; }
.swatch { width: 9px; height: 9px; background: var(--swatch); flex: none; }
.area-item button { width: 29px; height: 30px; flex: none; }
.area-item svg { width: 16px; height: 16px; }
.area-subtotal { border-top: 1px solid var(--line); padding-top: 7px; font-weight: 700; }
.local-note { color: var(--muted); margin: 10px 2px 0; font-size: 11px; }
.service-card { display: flex; gap: 11px; margin-top: 15px; padding: 13px; border: 1px solid #cbdfe5; border-radius: 9px; background: #eaf4f7; }
.service-card:hover { border-color: var(--brand); }
.service-card strong, .service-tag, .service-copy, .service-link { display: block; }
.service-card strong { margin: 3px 0; font-size: 13px; }
.service-tag { color: var(--brand); font-size: 9px; }
.service-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 7px; background: var(--brand); color: #fff; }
.service-icon svg { width: 19px; height: 19px; }
.service-copy { color: var(--muted); font-size: 11px; }
.service-link { margin-top: 7px; color: var(--brand); font-size: 11px; font-weight: 700; }
.service-card:hover .service-link { text-decoration: underline; text-underline-offset: 3px; }
.service-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-top: 22px; padding: 19px 22px;
  border-radius: 10px; background: #eaf4f7; border: 1px solid #cbdfe5;
}
.service-banner .eyebrow { color: var(--brand); }
.service-banner h2 { margin: 4px 0; font-size: clamp(17px, 2vw, 23px); line-height: 1.2; }
.service-banner p:last-child { color: var(--muted); font-size: 12px; }
.service-banner .button { flex: none; color: var(--brand); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 17px 0; color: var(--muted); font-size: 11px; }
.site-footer a { color: var(--brand); font-weight: 700; }
dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 9px; padding: 23px; color: var(--ink); }
dialog::backdrop { background: #102f3399; }
dialog h2 { font-size: 31px; line-height: 1.2; margin: 3px 0 6px; }
dialog p { color: var(--muted); }
dialog label { display: block; font-weight: 700; margin: 15px 0 4px; }
.distance-field { display: flex; align-items: center; gap: 10px; }
.distance-field input { border: 1px solid #a9bfb5; padding: 8px; width: min(100%, 180px); }
.field-error { color: #9b342b; margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 19px; }

@media (max-width: 900px) {
  .header-inner, main, .site-footer { width: calc(100% - 34px); }
  .workspace { grid-template-columns: minmax(0, 1fr) 254px; gap: 12px; }
}
@media (max-width: 730px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "actions" "editor" "summary"; }
  .summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; }
  .measurements { margin-top: 0; }
  .local-note { grid-column: 1 / -1; margin-top: 0; }
  .total-card { padding: 12px; }
  .total-value { font-size: clamp(24px, 5vw, 37px); }
  .service-card { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 600px) {
  .header-inner, main, .site-footer { width: calc(100% - 24px); }
  .header-caption { display: none; }
  .header-inner { min-height: 61px; }
  .header-links { gap: 10px; font-size: 11px; }
  .brand img { width: 125px; }
  .intro, .service-banner { align-items: start; flex-direction: column; gap: 11px; padding: 14px; }
  main { padding-top: 16px; }
  .toolbar, .filebar { padding-inline: 7px; }
  .tool { padding-inline: 6px; }
}
