/* ===== KIWAMI Design System ===== */
:root {
  --bg-deep: #060a14;
  --bg-dark: #0a0e1a;
  --bg-card: #0d1528;
  --bg-input: #111827;
  --border: #1e2d4a;
  --border-light: #2a3a5c;
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --text-primary: #e8e8e8;
  --text-secondary: #b0bcd4;
  --text-muted: #8a9bb8;
  --text-dim: #4a5a7a;
  --accent: #1e6fb0;
  --success: #2ecc71;
  --error: #e74c3c;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Helvetica Neue', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Layout ===== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, #1a2744 0%, #0d1a3a 100%);
  border-bottom: 1px solid var(--border-light);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--gold);
  text-decoration: none;
}

.logo-sub {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.header-badge {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(180deg, #0d1a3a 0%, var(--bg-deep) 100%);
  padding: 60px 0 48px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hero-title span { color: var(--gold); font-weight: 600; }

.hero-desc {
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.step-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 24px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  font-weight: 600;
  transition: all 0.3s;
}

.step.active .step-num {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
  box-shadow: 0 0 12px rgba(201,168,76,0.3);
}

.step.done .step-num {
  border-color: var(--success);
  color: var(--success);
  background: rgba(46,204,113,0.1);
}

.step-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.step.active .step-label { color: var(--text-muted); }

.step-line {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin-bottom: 20px;
}

/* ===== Main Content ===== */
.main-content {
  padding: 48px 0 80px;
  flex: 1;
}

/* ===== Card ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(201,168,76,0.05) 0%, transparent 100%);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  padding: 28px;
}

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-grid .full-width { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.required-mark {
  color: var(--gold);
  margin-left: 4px;
}

.form-input,
.form-textarea,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 12px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-dim);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select option { background: var(--bg-input); }

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== Signature Pad ===== */
.signature-container {
  position: relative;
}

.signature-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.signature-canvas {
  width: 100%;
  height: 160px;
  background: #080d1c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  display: block;
  touch-action: none;
}

.signature-canvas.signed {
  border-color: var(--gold);
}

.sig-empty-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  color: var(--text-dim);
  pointer-events: none;
  text-align: center;
  line-height: 1.5;
}

.btn-clear-sig {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-clear-sig:hover { border-color: var(--error); color: var(--error); }

/* ===== Agreement ===== */
.agreement-box {
  background: #080d1c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 32px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.9;
  margin-bottom: 16px;
}

.agreement-box strong { display: block; margin-top: 4px; }

/* ===== Agreement Clauses ===== */
.clause {
  display: flex;
  gap: 20px;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border);
}

.clause-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.clause-body { flex: 1; min-width: 0; }

.clause-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  margin-bottom: 12px;
}

.clause-body p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.85;
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--bg-input);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s;
  position: relative;
}

.checkbox-row input[type="checkbox"]:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 6px; height: 10px;
  border: 2px solid #0a0e1a;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #0a0e1a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 16px 40px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201,168,76,0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  padding: 12px 24px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.form-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== Notice ===== */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(201,168,76,0.06);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.notice p { font-size: 12px; color: var(--text-muted); line-height: 1.7; }

/* ===== Review Panel ===== */
.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.review-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child { border-bottom: none; }

.review-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.review-value {
  font-size: 14px;
  color: var(--text-primary);
}

.sig-preview {
  max-width: 100%;
  max-height: 80px;
  border-radius: 4px;
  background: #080d1c;
  border: 1px solid var(--border);
  padding: 4px;
}

/* ===== Status Badge ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

.status-pending {
  background: rgba(201,168,76,0.1);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold);
}

.status-completed {
  background: rgba(46,204,113,0.1);
  border: 1px solid rgba(46,204,113,0.3);
  color: var(--success);
}

/* ===== Success Page ===== */
.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(46,204,113,0.1);
  border: 2px solid rgba(46,204,113,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto 24px;
  animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46,204,113,0.2); }
  50% { box-shadow: 0 0 0 12px rgba(46,204,113,0); }
}

.success-title {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
}

.success-title span { color: var(--success); font-weight: 600; }

.success-desc {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.8;
  margin-bottom: 32px;
}

/* ===== Loading ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(10,14,26,0.3);
  border-top-color: #0a0e1a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s;
  max-width: 320px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: var(--error); }
.toast.success { border-color: var(--success); }

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
  margin: 32px 0;
}

/* ===== Footer ===== */
.site-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 20px; }
  .step-line { width: 30px; }
  .card-body { padding: 20px; }
}
