:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #24211e;
  background: #f5f2ec;
  --accent: #a43223;
  --accent-hover: #88291c;
  --edge: #e4dbce;
  --secondary: #60584f;
  --surface: #fffdf9;
  --focus: #aa3f2d;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.page {
  width: min(100%, 470px);
  margin: 0 auto;
  padding: max(15px, env(safe-area-inset-top)) 15px calc(max(22px, env(safe-area-inset-bottom)) + var(--keyboard-inset, 0px));
}
.hero {
  background: #30231f;
  color: #fff8ea;
  border-radius: 11px;
  padding: 9px 13px;
  margin-bottom: 9px;
}
.hero h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -0.025em; }
.report-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.card {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: 15px;
  margin-bottom: 9px;
}
h2, .section-title {
  margin: 0 0 9px;
  display: block;
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.025em;
}
.location-card select { width: 100%; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  min-width: 0;
}
.field .optional { font-size: 11px; font-weight: 500; color: var(--secondary); }
.comment-field { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
.comment-field textarea { grid-column: 1 / -1; }
input:not([type="radio"]), select, textarea, .measure {
  min-height: 42px;
  border: 1px solid #ded5c8;
  border-radius: 9px;
  color: inherit;
  background: #faf7f2;
  font: inherit;
  font-size: 16px;
  width: 100%;
  min-width: 0;
}
input:not([type="radio"]), select, textarea { padding: 6px 9px; }
select { overflow: hidden; text-overflow: ellipsis; }
textarea { resize: vertical; }
textarea::placeholder { color: #72675d; font-size: 13px; }
.measure { display: flex; align-items: center; gap: 2px; padding: 0 8px; }
.measure input:not([type="radio"]) {
  border: 0;
  background: transparent;
  min-height: 40px;
  padding-left: 1px;
  padding-right: 1px;
}
.measure span { flex: none; color: var(--secondary); font-size: 12px; font-weight: 600; }
.compact-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(96px, 56%); align-items: center; margin-top: 9px; gap: 8px; }
.compact-field:has(select) { grid-template-columns: minmax(0, 1fr) minmax(150px, 65%); }
.choice-group { margin: 10px 0 0; padding: 0; border: 0; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: 5px; font-size: 12px; font-weight: 650; }
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
}
.segmented label { position: relative; }
.segmented input,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.segmented span {
  display: grid;
  place-items: center;
  height: 42px;
  padding: 2px 3px;
  border-radius: 8px;
  border: 1px solid #ded5c8;
  background: #faf7f2;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.segmented input:checked + span { background: #f4ded4; border-color: #bb7561; color: #782d20; }
:focus-visible, .segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { opacity: 0.72; }
fieldset:disabled .segmented span { cursor: default; }
.preview-card { background: #fdf6eb; }
.preview-card p { margin: 0; color: var(--secondary); font-size: 13px; }
.preview-card pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.52 "IBM Plex Mono", ui-monospace, monospace;
}
.actions { padding: 0; }
button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 6px 12px;
  min-height: 44px;
  color: #fff;
  background: var(--accent);
  font: 700 15px/1.28 system-ui, sans-serif;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button:disabled { background: #705e55; cursor: default; }
.session-state, .publish-state {
  background: #fffdf9;
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 10px 11px;
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.4;
}
[data-kind="success"] { color: #244c34; background: #ebf3e5; border-color: #b6c9b2; }
[data-kind="error"] { color: #7b3023; background: #fff1e9; border-color: #e8b5a6; }
#publish:not([hidden]) + #new-report {
  margin-top: 8px;
  border: 1px solid #bb7561;
  background: #fffaf3;
  color: #782d20;
}
#publish:not([hidden]) + #new-report:hover { background: #f4ded4; }
