@font-face { font-family: "DM Sans"; src: url("/dm-sans.woff2") format("woff2"); font-display: swap; }
:root {
  --width: 70rem; color-scheme: light; --page: #f5f8fa; --surface: #fff; --ink: #172c3d;
  --subtle: #435c69; --edge: #afbec8; --blue: #174f74; --board: #e8f1f6; --chosen: #e4f0eb;
  --button: #164e73; --button-ink: #fff;
}
:root[data-theme="dark"] {
  color-scheme: dark; --page: #162028; --surface: #1a2933; --ink: #eef4f8;
  --subtle: #bbcfdb; --edge: #526d7e; --blue: #a9daf2; --board: #243844; --chosen: #243d37;
  --button: #a9daf2; --button-ink: #142b3c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--page); font: 1rem/1.55 "DM Sans", system-ui, sans-serif; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: 2.65rem; line-height: 1.12; }
h2 { font-size: 1.25rem; line-height: 1.3; }
a { color: var(--blue); text-underline-offset: .2em; }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
:is(button, select, input, textarea, a):focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
header, footer { background: var(--surface); }
header { border-bottom: 1px solid var(--edge); }
footer { border-top: 1px solid var(--edge); }
:is(header, footer) > div {
  max-width: var(--width); margin: auto; padding: .55rem clamp(1rem, 4vw, 2rem);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .35rem 1rem;
}
:is(header, footer) nav { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem; }
:is(header, footer) nav a { display: inline-flex; min-height: 44px; align-items: center; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 750; text-decoration: none; }
.brand img { width: 1.8rem; height: 1.8rem; border-radius: 4px; }
main { max-width: var(--width); margin: 0 auto; padding: clamp(1.3rem, 4vw, 2.7rem) clamp(1rem, 4vw, 2rem) 2.6rem; }
main > article { max-width: 48rem; }
article h2, article p, article form { margin-top: 1rem; }
.title { margin-bottom: 1.45rem; }
.title p { color: var(--subtle); margin-top: .5rem; }
#tool { display: grid; grid-template-columns: minmax(13rem, .8fr) minmax(24rem, 1.7fr); align-items: stretch; border-block: 1px solid var(--edge); }
#tool section { min-width: 0; min-height: 19.5rem; padding: 1.25rem; }
#tool section h2 { margin-bottom: 1rem; }
.drawing { background: var(--board); border-right: 1px solid var(--edge); }
.unit-board { background: var(--surface); }
.file-zone {
  position: relative; display: grid; place-items: center; align-content: center; gap: .25rem; padding: .8rem;
  min-height: 9.1rem; color: var(--blue); border: 1px dashed var(--edge); border-radius: 6px;
  background: var(--surface); text-align: center; cursor: pointer;
}
.file-zone span:not(.drawing-icon) { font-size: .85rem; color: var(--subtle); }
.file-zone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-zone:focus-within, .file-zone.dragging { outline: 2px solid var(--blue); outline-offset: 2px; }
.drawing-icon { width: 31px; height: 25px; border: 1px solid currentColor; background: linear-gradient(90deg, transparent 47%, currentColor 49% 51%, transparent 53%), linear-gradient(transparent 47%, currentColor 49% 51%, transparent 53%); }
.drawing-actions { display: flex; flex-wrap: wrap; gap: .15rem 1rem; }
.text-action { min-height: 44px; padding: .1rem 0; border: 0; background: transparent; color: var(--blue); font-weight: 650; }
.text-action:hover { text-decoration: underline; }
#drawing-status, #unit-empty, #download-status { color: var(--subtle); overflow-wrap: anywhere; }
#drawing-name { color: var(--blue); overflow-wrap: anywhere; font-weight: 750; }
.drawing-info { margin: .5rem 0 1rem; }
.drawing-info div { display: grid; grid-template-columns: minmax(8.5rem, 1fr) minmax(8rem, 1fr); gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--edge); }
dt { color: var(--subtle); }
dd { font-variant-numeric: tabular-nums; font-weight: 630; overflow-wrap: anywhere; }
.measure-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--edge); border-radius: 6px; }
.comparison { display: flex; flex-direction: column; align-items: start; justify-content: start; min-height: 8.65rem; gap: .48rem; padding: .7rem; }
.comparison span { color: var(--subtle); font-size: .87rem; }
.comparison strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.comparison.proposed { background: var(--chosen); border-left: 1px solid var(--edge); min-width: 0; }
select { min-height: 44px; width: 100%; min-width: 0; color: var(--ink); border: 1px solid var(--edge); border-radius: 5px; background: var(--surface); padding: .3rem .45rem; }
.unit-actions { margin-top: 1rem; }
#download-dxf { min-height: 44px; max-width: 100%; border: 1px solid transparent; border-radius: 6px; background: var(--button); color: var(--button-ink); font-weight: 730; padding: .5rem .8rem; }
#download-dxf:disabled { border-color: var(--edge); background: var(--surface); color: var(--subtle); cursor: default; }
.upgrade-note { color: var(--subtle); margin-top: .65rem; font-size: .88rem; }
nav.app-tabs span { font-size: 1.2rem; line-height: 1; }
@media(max-width:760px), (max-width:960px) and (max-height:500px) and (pointer:coarse) {
  h1 { font-size: 2.1rem; }
  #tool { display: block; }
  #tool section { min-height: 16rem; padding: 1rem 0; }
  .drawing { border-right: 0; background: transparent; }
  .unit-board { background: transparent; }
}
@media(max-width:420px) {
  .measure-board { display: block; }
  .comparison { min-height: 0; }
  .comparison.proposed { border-left: 0; border-top: 1px solid var(--edge); }
}
