:root {
  --navy: #0b1f3a;
  --gold: #b88a2d;
  --gold-soft: #f5ead2;
  --ink: #111827;
  --muted: #667085;
  --line: #d6dae3;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --danger: #b42318;
  --success: #067647;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-size: 16px; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.topbar-inner { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand-mark {
  display: grid; width: 40px; height: 40px; place-items: center;
  border-radius: 8px; background: var(--navy); color: #fff; font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(184,138,45,.7);
}
.brand small { display: block; color: var(--muted); font-weight: 700; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.button, .nav button, .nav a {
  display: inline-flex; min-height: 46px; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line); padding: 0 18px;
  background: #fff; color: var(--navy); font-weight: 800; cursor: pointer;
}
.button.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.button.danger { color: var(--danger); border-color: #f3b7b0; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.main {
  min-height: calc(100vh - 72px);
  padding: 32px 0 56px;
  background: linear-gradient(180deg, rgba(11,31,58,.04), rgba(255,255,255,0) 220px), var(--bg);
}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: .88rem; font-weight: 900; }
h1, h2, h3 { margin: 0; color: var(--navy); }
h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.18; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.lead { margin: 10px 0 0; color: var(--muted); line-height: 1.8; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 22px; box-shadow: 0 18px 45px rgba(11,31,58,.06);
}
.stat-number { margin-top: 8px; color: var(--navy); font-size: 2.1rem; font-weight: 900; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { color: var(--navy); font-weight: 900; }
input, select, textarea {
  width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); padding: 12px 14px; outline: none;
}
textarea { min-height: 124px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(184,138,45,.15); }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 14px 12px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .9rem; }
.badge { display: inline-flex; border-radius: 999px; padding: 6px 10px; font-size: .84rem; font-weight: 900; }
.badge.pending, .badge.draft { background: var(--gold-soft); color: #8a5f12; }
.badge.signed { background: #dcfae6; color: var(--success); }
.info-list { display: grid; gap: 10px; }
.info-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.info-row span:first-child { color: var(--muted); font-weight: 800; }
.term-box { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; margin-top: 14px; }
.term-scroll {
  height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; line-height: 1.85; color: #253347; background: #fbfcfe;
}
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; line-height: 1.6; }
.check-row input { width: 22px; min-width: 22px; height: 22px; min-height: 22px; margin-top: 2px; }
.signature-pad {
  width: 100%; height: 220px; border: 2px solid var(--navy); border-radius: 8px;
  background: #fff; touch-action: none;
}
.notice { border-left: 4px solid var(--gold); padding: 14px 16px; background: #fffaf0; color: #5f410c; line-height: 1.7; }
.hidden { display: none !important; }
@media (max-width: 760px) {
  .container { width: min(100% - 24px, 1120px); }
  .topbar-inner, .page-head { align-items: stretch; flex-direction: column; }
  .nav { display: grid; grid-template-columns: 1fr 1fr; }
  .stats, .form-grid { grid-template-columns: 1fr; }
  .info-row { grid-template-columns: 1fr; gap: 2px; }
  .card { padding: 18px; }
}
