:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #52616d;
  --line: #d8e0e6;
  --teal: #007f78;
  --teal-dark: #00615d;
  --red: #b33535;
  --green-bg: #e5f5ec;
  --green: #257044;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.sign-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 28px;
}

.sign-panel {
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 55px rgba(27, 38, 49, 0.12);
}

.sign-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.status-badge {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-badge.is-signed {
  background: var(--green-bg);
  color: var(--green);
}

.notice {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.notice.error {
  border-color: rgba(179, 53, 53, 0.4);
  color: var(--red);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.summary-grid article,
.terms-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.summary-grid article {
  min-height: 94px;
  padding: 14px;
}

.summary-grid span,
.sign-form span,
dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.terms-block {
  padding: 16px;
  margin-bottom: 14px;
}

.terms-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}

.terms-heading h2,
.terms-heading p {
  margin-bottom: 12px;
}

.terms-body {
  color: var(--text);
  line-height: 1.6;
}

.terms-body p {
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.terms-body p:last-child {
  margin-bottom: 0;
}

.terms-body h1,
.terms-body h2,
.terms-body h3,
.terms-body h4 {
  margin: 18px 0 8px;
  line-height: 1.25;
}

.terms-body h1 {
  font-size: 1.35rem;
}

.terms-body h2 {
  font-size: 1.12rem;
}

.terms-body h3,
.terms-body h4 {
  font-size: 1rem;
}

.terms-body ul,
.terms-body ol {
  margin: 0 0 12px 22px;
  padding: 0;
}

.terms-body li {
  margin-bottom: 5px;
}

.terms-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.92rem;
}

.terms-body th,
.terms-body td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.terms-body blockquote {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

dt,
dd {
  margin: 0;
}

dd {
  margin-top: 3px;
}

.sign-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.sign-form label {
  display: grid;
  gap: 7px;
}

.notification-card,
.inspection-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.notification-card h2,
.notification-card p,
.inspection-card h2,
.inspection-card p {
  margin-bottom: 6px;
}

.notification-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
}

.sign-form input:not([type="checkbox"]):not([type="file"]),
.sign-form select,
.sign-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.sign-form input:not([type="checkbox"]):not([type="file"]),
.sign-form select {
  height: 46px;
  padding: 0 12px;
}

.sign-form textarea {
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
}

.photo-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.file-slot {
  min-height: 108px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-slot strong {
  display: block;
  margin-bottom: 4px;
}

.file-slot small {
  color: var(--muted);
}

.file-slot input {
  width: 100%;
  margin-top: 10px;
  font-size: 0.82rem;
}

.file-slot.is-uploaded {
  border-style: solid;
  background: var(--green-bg);
}

.check-line {
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.check-line input {
  width: 18px;
  height: 18px;
}

.sign-form button {
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.sign-form button:hover {
  background: var(--teal-dark);
}

.sign-form button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

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

@media (max-width: 760px) {
  .sign-shell {
    padding: 14px;
  }

  .sign-panel {
    padding: 18px;
  }

  .sign-header,
  .terms-heading,
  .notification-grid,
  .photo-slot-grid,
  .summary-grid,
  dl {
    grid-template-columns: 1fr;
    display: grid;
  }
}
