:root {
  --navy-950: #0d1d3a;
  --navy-900: #132850;
  --navy-700: #25457e;
  --gold-500: #cda14d;
  --gold-300: #e8d2a5;
  --ink-900: #172544;
  --ink-700: #455571;
  --line: rgba(25, 49, 88, 0.12);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --bg: #f6f2ea;
  --shadow: 0 16px 40px rgba(15, 29, 58, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at top left, rgba(205, 161, 77, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(29, 46, 87, 0.08), transparent 22%),
    linear-gradient(180deg, #fcfaf5 0%, var(--bg) 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 320px;
  height: 320px;
  pointer-events: none;
  opacity: 0.35;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(29, 46, 87, 0.06) 0,
    rgba(29, 46, 87, 0.06) 1px,
    transparent 1px,
    transparent 7px
  );
}

body::before {
  top: 120px;
  right: 0;
  border-radius: 100% 0 0 100%;
}

body::after {
  bottom: 0;
  left: 0;
  border-radius: 0 100% 100% 0;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 40px;
  background: linear-gradient(135deg, #0d1d3a 0%, #152c56 100%);
  color: white;
}

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

.brand-monogram {
  font-family: "Cormorant Garamond", serif;
  font-size: 70px;
  line-height: 0.8;
  color: var(--gold-500);
}

.brand-copy {
  font-family: "Cormorant Garamond", serif;
  letter-spacing: 0.12em;
  font-size: 24px;
  line-height: 1;
}

.topbar-meta {
  display: grid;
  justify-items: end;
  gap: 10px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
}

.topbar-link {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

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

.hero {
  text-align: center;
  margin-bottom: 24px;
}

.hero-kicker {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--gold-500);
}

.hero h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(42px, 5vw, 58px);
  line-height: 1.08;
  color: var(--ink-900);
}

.hero-divider {
  width: 92px;
  height: 3px;
  margin: 18px auto 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, var(--gold-500) 22%, var(--gold-500) 78%, transparent 100%);
}

.hero-note {
  margin: 0;
  color: var(--ink-700);
}

.field-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(204, 78, 78, 0.14);
  color: var(--ink-700);
  font-size: 13px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #d56565, #b73f3f);
  box-shadow: 0 0 0 4px rgba(213, 101, 101, 0.14);
}

.role-switch {
  display: inline-flex;
  gap: 10px;
  margin-top: 22px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(205, 161, 77, 0.24);
  box-shadow: 0 14px 32px rgba(13, 29, 58, 0.06);
}

.role-switch a {
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--ink-700);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.role-switch a.active {
  color: white;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-700) 100%);
}

.admin-hero {
  margin-bottom: 28px;
}

.flash {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 15px;
}

.flash.error {
  background: rgba(191, 52, 52, 0.08);
  border-color: rgba(191, 52, 52, 0.18);
  color: #8f2424;
}

.flash.success {
  background: rgba(47, 122, 79, 0.08);
  border-color: rgba(47, 122, 79, 0.18);
  color: #1d6e40;
}

.register-form {
  display: grid;
  gap: 22px;
}

.section-card {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.section-index {
  min-width: 50px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-700) 100%);
}

.section-head h2 {
  margin: 0 0 4px;
  font-size: 28px;
  color: var(--ink-900);
}

.section-head p {
  margin: 0;
  color: var(--ink-700);
  font-size: 14px;
}

.field-grid {
  display: grid;
  gap: 18px;
}

.field-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.file-field {
  display: grid;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}

.field > span,
.file-field > span {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field input,
.static-value {
  width: 100%;
  min-height: 56px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font: inherit;
  color: var(--ink-900);
}

.field input:focus,
.file-input:focus + .file-card {
  outline: none;
  border-color: rgba(29, 46, 87, 0.45);
  box-shadow: 0 0 0 4px rgba(29, 46, 87, 0.08);
}

.required-field input {
  border-color: rgba(201, 90, 90, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 251, 251, 0.98), rgba(255, 255, 255, 1)),
    var(--surface-strong);
}

.optional-field input {
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(248, 250, 253, 0.9), rgba(255, 255, 255, 1)),
    var(--surface-strong);
}

.readonly .static-value {
  display: flex;
  align-items: center;
  color: var(--navy-900);
  background: linear-gradient(180deg, rgba(242, 246, 252, 0.9), rgba(255, 255, 255, 0.96));
}

.field-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.required-chip {
  color: #a23535;
  background: rgba(213, 101, 101, 0.12);
  border: 1px solid rgba(213, 101, 101, 0.22);
}

.optional-chip,
.readonly-chip {
  color: var(--navy-700);
  background: rgba(37, 69, 126, 0.08);
  border: 1px solid rgba(37, 69, 126, 0.12);
}

.textarea-card {
  margin: 18px 0;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(249, 250, 253, 0.88);
}

.textarea-card label {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.service-list {
  display: grid;
  gap: 10px;
  color: var(--ink-700);
  line-height: 1.75;
}

.service-list p {
  margin: 0;
}

.legal-box {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(251, 251, 252, 0.96), rgba(246, 248, 251, 0.94));
  line-height: 1.8;
  color: var(--ink-700);
}

.legal-box p {
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 22px;
}

.upload-stack {
  display: grid;
  gap: 14px;
}

.file-field {
  position: relative;
}

.file-input {
  position: absolute;
  inset: 34px 0 0;
  opacity: 0;
  cursor: pointer;
}

.file-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  align-items: center;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(37, 69, 126, 0.12);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 254, 0.96)),
    var(--surface-strong);
  box-shadow: 0 10px 24px rgba(17, 31, 60, 0.05);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.file-field:hover .file-card {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(17, 31, 60, 0.08);
  border-color: rgba(37, 69, 126, 0.24);
}

.file-card-copy {
  display: grid;
  gap: 4px;
}

.file-card-copy strong {
  font-size: 15px;
}

.file-card-copy small,
.file-card-name,
.signature-tip {
  color: var(--ink-700);
  font-size: 13px;
}

.file-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-700) 100%);
}

.file-card-name {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.hint {
  margin: 12px 0 0;
  color: var(--ink-700);
  font-size: 13px;
}

.signature-wrap {
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(37, 69, 126, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 252, 0.96)),
    repeating-linear-gradient(0deg, transparent 0, transparent 36px, rgba(19, 40, 80, 0.03) 36px, rgba(19, 40, 80, 0.03) 37px);
  overflow: hidden;
}

#signaturePad {
  display: block;
  width: 100%;
  height: 280px;
  cursor: crosshair;
}

.secondary-btn,
.primary-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.secondary-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  margin-top: 16px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  color: var(--navy-900);
  background: rgba(29, 46, 87, 0.08);
}

.signature-tip {
  margin: 12px 0 0;
}

.submit-panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.submit-panel p {
  margin: 14px 0 0;
  color: var(--ink-700);
  font-size: 14px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.admin-table th,
.admin-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(25, 49, 88, 0.1);
  text-align: left;
  font-size: 14px;
}

.admin-table th {
  color: var(--ink-700);
  font-weight: 700;
}

.table-link {
  color: var(--navy-700);
  font-weight: 700;
  text-decoration: none;
}

.empty-cell {
  color: var(--ink-700);
  text-align: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detail-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(25, 49, 88, 0.08);
  background: linear-gradient(180deg, rgba(249, 251, 254, 0.95), rgba(255, 255, 255, 0.98));
}

.detail-card span {
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 600;
}

.detail-card strong {
  font-size: 16px;
  word-break: break-word;
}

.admin-split {
  align-items: start;
}

.signature-preview {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 18px;
  border: 1px solid rgba(25, 49, 88, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.96));
}

.attachment-list {
  display: grid;
  gap: 14px;
}

.attachment-card,
.empty-panel {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(25, 49, 88, 0.08);
  background: linear-gradient(180deg, rgba(249, 251, 254, 0.95), rgba(255, 255, 255, 0.98));
}

.attachment-card {
  text-decoration: none;
  color: var(--ink-900);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.attachment-card:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 69, 126, 0.2);
  box-shadow: 0 12px 24px rgba(17, 31, 60, 0.06);
}

.attachment-card span,
.attachment-card small,
.empty-panel {
  color: var(--ink-700);
}

.primary-btn {
  min-width: min(100%, 420px);
  min-height: 62px;
  padding: 0 24px;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-700) 100%);
  box-shadow: 0 18px 30px rgba(14, 32, 65, 0.2);
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-meta {
    justify-items: start;
  }

  .field-grid.two-col,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content-wrap {
    width: min(100% - 20px, 1120px);
    padding: 22px 0 40px;
  }

  .topbar {
    padding: 18px 18px 20px;
  }

  .brand-monogram {
    font-size: 56px;
  }

  .brand-copy {
    font-size: 20px;
  }

  .section-card,
  .submit-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .section-head h2 {
    font-size: 24px;
  }

  .role-switch {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .role-switch a {
    display: block;
    width: 100%;
    text-align: center;
  }

  .file-card {
    grid-template-columns: 1fr;
  }

  .file-card-action {
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}
