:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-dim: #a8a29e;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --success: #059669;
  --success-soft: #d1fae5;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -10px rgba(0, 0, 0, 0.1), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-8);
  border-bottom: 1px solid var(--border);
}
header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
#auth-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Section / Card ---------- */
section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6) var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}
section + section { margin-top: 0; }
h2, h3 {
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 var(--space-4);
}
h2 { font-size: 1rem; }
h3 {
  font-size: 0.92rem;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px dashed var(--border);
}
h3:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* ---------- Form controls ---------- */
form {
  display: grid;
  gap: var(--space-4);
}
label {
  display: grid;
  gap: var(--space-2);
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}
label.inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: normal;
  cursor: pointer;
  padding: var(--space-2) 0;
}
label.inline input[type=checkbox] { width: auto; margin: 0; }

input[type=email],
input[type=password],
input[type=text],
input[type=number] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus,
input[type=number]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
input[type=file] {
  font-size: 0.85rem;
  color: var(--text-muted);
}
input[type=file]::file-selector-button {
  margin-right: var(--space-3);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.15s ease;
}
input[type=file]::file-selector-button:hover {
  background: var(--surface-2);
}

/* ---------- Buttons ---------- */
button {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  justify-self: start;
  letter-spacing: 0.005em;
}
button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:active { transform: translateY(1px); }
button:disabled {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-dim);
  cursor: not-allowed;
}
button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
button.secondary:hover {
  background: var(--surface-2);
  border-color: var(--text-muted);
}
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}
button.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ---------- Fieldset (consent / documents) ---------- */
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin: 0;
  background: var(--surface-2);
}
fieldset legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 var(--space-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
fieldset.documents { background: var(--surface); }
fieldset.documents label.inline {
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
fieldset.documents label.inline:hover { background: var(--surface-2); }
fieldset.documents label.inline span strong { font-size: 0.95rem; }

/* ---------- List items (documents) ---------- */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul li {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
ul li:last-child { border-bottom: none; }
ul li > span:first-child {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
ul li button {
  padding: 5px 12px;
  font-size: 0.8rem;
}
ul li code {
  font-size: 0.75rem;
  color: var(--text-muted);
}

code {
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
  color: var(--text);
}

/* ---------- Hint / helper text ---------- */
.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
  line-height: 1.55;
}
.req {
  color: var(--danger);
  font-weight: 600;
  margin-left: 2px;
}

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.2);
}
.status-processing {
  background: var(--info-soft);
  color: var(--info);
  border-color: rgba(3, 105, 161, 0.2);
}
.status-ready {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(5, 150, 105, 0.2);
}

/* ---------- Visibility toggle ---------- */
.visibility-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0;
  margin-right: var(--space-3);
}
.visibility-toggle input { accent-color: var(--accent); }

/* ---------- Important pages editor ---------- */
.important-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px auto;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  align-items: center;
}
.important-row input { padding: 7px 10px; }

/* ---------- Landing card (wp/) ---------- */
.landing-card {
  max-width: 520px;
  margin: 4rem auto 0;
  text-align: center;
  padding: var(--space-12) var(--space-8);
}
.landing-card button {
  font-size: 1rem;
  padding: 12px 28px;
  margin-top: var(--space-4);
  justify-self: center;
}
.landing-card .hint { margin-top: var(--space-5); }

/* ---------- Thanks section ---------- */
#thanks-section h2 {
  font-size: 1.15rem;
  margin-bottom: var(--space-3);
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body { padding: var(--space-5) var(--space-4) var(--space-10); }
  section { padding: var(--space-5); }
  header { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  ul li {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  ul li > span:last-child {
    display: flex;
    gap: var(--space-3);
    align-items: center;
  }
  .important-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }
}
