:root {
  color-scheme: light;
  --accent: #176b52;
  --accent-dark: #10523e;
  --accent-soft: #e8f3ee;
  --text: #17231f;
  --muted: #64736c;
  --border: #d8e0dc;
  --surface: #ffffff;
  --background: #f3f6f4;
  --danger: #b42318;
  --warning: #8a5300;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body {
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.page-shell { width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 14px 40px; }
.page-header { padding: 10px 4px 16px; }
.page-header h1 { margin: 0; font-size: 27px; line-height: 1.25; color: var(--accent-dark); }
.page-header p { margin: 7px 0 0; color: var(--muted); font-size: 15px; }
.form-section {
  margin: 0 0 14px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid #e4eae7;
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(20, 54, 42, 0.045);
}
.form-section h2 { margin: 0 0 15px; font-size: 18px; line-height: 1.35; }
label { display: block; margin: 12px 0 7px; font-size: 14px; font-weight: 600; }
input, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 47px;
  margin-top: 6px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 16px;
  outline: none;
}
textarea { min-height: 74px; line-height: 1.55; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.13); }
input:disabled { color: var(--muted); background: #eef1ef; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.field-grid > * { min-width: 0; max-width: 100%; }
.field-grid label { margin-top: 0; }
.date-field { min-width: 0; }
.date-control { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; max-width: 100%; min-height: 47px; margin-top: 6px; padding: 11px 40px; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 11px; }
.date-control::after { content: '▾'; position: absolute; top: 50%; right: 14px; color: var(--muted); font-size: 14px; pointer-events: none; transform: translateY(-50%); }
.date-display { display: block; width: 100%; min-width: 0; color: var(--text); text-align: center; white-space: nowrap; font-size: 16px; line-height: 1.55; }
#report-date { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; max-width: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; border: 0; border-radius: 11px; cursor: pointer; -webkit-appearance: none; appearance: none; }
#report-date:focus { box-shadow: none; }
.date-control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 107, 82, 0.13); }
.check-row { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-weight: 500; }
.check-row input { width: 23px; height: 23px; min-height: 23px; margin: 0; padding: 0; accent-color: var(--accent); }
.section-hint { margin: -7px 0 10px; color: var(--muted); font-size: 13px; }
.input-with-button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.input-with-button input { margin-top: 0; }
.combobox { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-width: 0; margin-top: 6px; }
.combobox input { min-width: 0; margin-top: 0; }
.input-with-button .combobox { margin-top: 0; }
.combo-toggle { min-width: 76px; min-height: 47px; padding: 10px 12px; color: var(--accent-dark); background: var(--accent-soft); border: 1px solid #9fc7b5; border-radius: 11px; font-size: 15px; font-weight: 700; }
.combo-toggle:disabled { color: var(--muted); background: #eef1ef; border-color: var(--border); }
.combo-options { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 50; max-height: min(300px, 42vh); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid #aac4b7; border-radius: 12px; box-shadow: 0 10px 28px rgba(20, 54, 42, 0.18); }
.combo-option { display: block; width: 100%; min-height: 48px; padding: 11px 13px; color: var(--text); text-align: left; background: #fff; border: 0; border-bottom: 1px solid #e8eeea; font-size: 15px; }
.combo-option:last-child { border-bottom: 0; }
.combo-option:hover, .combo-option:focus { background: var(--accent-soft); }
.option-title { display: block; font-weight: 650; }
.option-subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.combo-empty { padding: 14px; color: var(--muted); text-align: center; font-size: 14px; }
.primary, .secondary {
  min-height: 47px;
  padding: 11px 17px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 650;
}
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:active { background: var(--accent-dark); }
.primary:disabled { cursor: wait; opacity: 0.65; }
.secondary { color: var(--accent-dark); background: var(--accent-soft); border-color: #c8dfd4; }
.secondary:active { background: #d5e9df; }
.add-item { width: 100%; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.chips:empty { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px 6px 11px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; font-size: 14px; }
.chip button { width: 28px; height: 28px; padding: 0; color: var(--accent-dark); background: transparent; border: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
.item-row { position: relative; margin: 10px 0; padding: 12px; background: #f8faf9; border: 1px solid var(--border); border-radius: 12px; }
.item-row input { margin-top: 0; background: #fff; }
.item-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; margin-top: 9px; }
.quantity-control { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; align-items: center; min-width: 0; }
.quantity-control button { width: 44px; height: 47px; padding: 0; color: var(--accent-dark); background: var(--accent-soft); border: 1px solid #9fc7b5; border-radius: 10px; font-size: 25px; font-weight: 700; line-height: 1; }
.quantity-control .item-quantity { min-width: 0; padding-inline: 6px; text-align: center; }
.quantity-control .item-quantity::-webkit-inner-spin-button, .quantity-control .item-quantity::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.quantity-control .item-quantity { -moz-appearance: textfield; appearance: textfield; }
.item-note { grid-column: 1 / -1; }
.item-note-toggle { display: inline-flex; align-items: center; justify-content: center; width: auto; min-height: 34px; margin-top: 8px; padding: 4px 11px; color: var(--accent-dark); background: var(--accent-soft); border: 1px solid #c8dfd4; border-radius: 9px; font-size: 13px; font-weight: 650; }
.item-note-editor { margin-top: 8px; }
.item-remove { position: absolute; top: 5px; right: 5px; width: 36px; height: 36px; color: var(--muted); background: transparent; border: 0; border-radius: 50%; font-size: 23px; }
.item-name { padding-right: 38px; }
.item-invalid { border-color: #d92d20; }
.item-row input[aria-invalid="true"] { border-color: #d92d20; box-shadow: 0 0 0 2px rgba(217, 45, 32, 0.1); }
.item-error { margin: 9px 0 0; color: var(--danger); font-size: 13px; font-weight: 650; line-height: 1.45; }
#construction-content { margin-top: 0; }
.form-actions { display: grid; gap: 8px; margin-top: 18px; }
#submit-report, #copy-report { width: 100%; min-height: 52px; font-size: 17px; }
.text-button { min-height: 42px; color: var(--muted); background: transparent; border: 0; }
.draft-status, .copy-status { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.error-message { margin: 12px 0; padding: 12px; color: var(--danger); background: #fff1f0; border: 1px solid #f1c4c0; border-radius: 10px; }
.warning-message { padding: 11px; color: var(--warning); background: #fff7e6; border-radius: 10px; font-size: 14px; }
.result-section h2 { color: var(--accent-dark); }
.record-id { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
#copy-text { max-height: 430px; margin: 14px 0; padding: 14px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #22332c; background: #f5f7f6; border: 1px solid var(--border); border-radius: 12px; font-family: inherit; font-size: 15px; line-height: 1.65; }
#new-report, #edit-report { width: 100%; margin-top: 6px; }
.history-button { width: 100%; margin-bottom: 14px; }
.history-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; margin-left: 5px; padding: 0 6px; color: #fff; background: var(--accent); border-radius: 999px; font-size: 12px; }
.history-count:empty { display: none; }
.history-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.history-header h2 { margin: 0; }
.history-card { margin: 12px 0; padding: 13px; background: #f8faf9; border: 1px solid var(--border); border-radius: 12px; }
.history-card h3 { margin: 0 0 7px; font-size: 16px; line-height: 1.45; }
.history-meta { margin: 4px 0; color: var(--muted); font-size: 13px; }
.history-card details { margin-top: 10px; }
.history-card summary { min-height: 38px; color: var(--accent-dark); font-weight: 600; }
.history-card pre { padding: 11px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--border); border-radius: 9px; font-family: inherit; font-size: 14px; }
.history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.history-actions button { min-height: 44px; }
.edit-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 12px; color: var(--warning); background: #fff7e6; border: 1px solid #ead2a4; border-radius: 10px; font-size: 14px; }
.edit-notice button { flex: none; min-height: 38px; padding: 6px 10px; color: var(--warning); background: #fff; border: 1px solid #d9bd87; border-radius: 8px; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
footer { padding: 16px 4px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 360px) {
  .page-shell { padding-inline: 10px; }
  .form-section { padding: 14px; }
  .field-grid { grid-template-columns: 1fr; }
}
@media (min-width: 600px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 700px) {
  .page-shell { padding-top: 30px; }
  .form-section { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
