:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #171717;
  --muted: #696f7a;
  --line: #e6e8ec;
  --soft: #f7f8fa;
  --accent: #19745f;
  --accent-strong: #105b4a;
  --danger: #b42318;
  --focus: #2f80ed;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    "Hiragino Sans",
    "Yu Gothic",
    "Meiryo",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.6rem, 2.6vw, 2.35rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.25;
}

.send-state {
  min-width: 82px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.send-state.success {
  border-color: #a6d9c9;
  background: #eefaf6;
  color: var(--accent-strong);
}

.send-state.error {
  border-color: #f1b8b2;
  background: #fff4f2;
  color: var(--danger);
}

.report-form {
  display: grid;
  gap: 30px;
}

.setup-box {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.setup-box summary {
  padding: 15px 18px;
  color: var(--ink);
  font-weight: 700;
}

.setup-box .settings-grid {
  padding: 0 18px 18px;
}

.form-section {
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin-bottom: 18px;
}

.section-title.with-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.field-grid,
.text-area-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
}

label span,
.compact-field span {
  color: #333942;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d5d9df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.member-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.compact-field {
  display: grid;
  width: 92px;
  gap: 7px;
}

.compact-field input {
  min-height: 40px;
}

.secondary-button,
.submit-button,
.remove-member-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 700;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.secondary-button:hover,
.remove-member-button:hover {
  border-color: #c8ccd4;
  background: var(--soft);
}

.secondary-button:active,
.submit-button:active,
.remove-member-button:active {
  transform: translateY(1px);
}

.member-header,
.member-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.1fr) minmax(110px, 1fr) minmax(130px, 1fr) minmax(110px, 0.8fr) minmax(180px, 1.6fr) 44px;
  gap: 10px;
  align-items: end;
}

.member-header {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.field-help {
  margin: -2px 12px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.member-rows {
  display: grid;
  gap: 10px;
}

.member-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(31, 41, 55, 0.04);
}

.member-row label span {
  display: none;
}

.remove-member-button {
  display: grid;
  width: 42px;
  padding: 0;
  place-items: center;
  color: var(--danger);
  font-size: 1.2rem;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.form-message.success {
  color: var(--accent-strong);
}

.submit-button {
  min-width: 210px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
}

.submit-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 900px) {
  .field-grid,
  .text-area-grid {
    grid-template-columns: 1fr;
  }

  .section-title.with-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .member-tools {
    justify-content: flex-start;
  }

  .member-header {
    display: none;
  }

  .member-row {
    grid-template-columns: 1fr 1fr;
  }

  .member-row label span {
    display: block;
  }

  .member-row label:last-of-type {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 20px;
  }

  .app-header,
  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .send-state {
    width: fit-content;
  }

  .member-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .compact-field {
    width: 100%;
  }

  .member-row {
    grid-template-columns: 1fr;
  }

  .remove-member-button {
    width: 100%;
  }

  .submit-button {
    width: 100%;
  }
}
