:root {
  --ink: #1a1a2e;
  --ink-light: #3d3d5c;
  --ink-muted: #6b6b8d;
  --surface: #fafaf8;
  --surface-alt: #f2f1ed;
  --surface-warm: #eae8e0;
  --accent: #8B1A1A;
  --accent-deep: #6d1515;
  --accent-light: #c44040;
  --gold: #b8860b;
  --gold-light: #d4a843;
  --border: #d5d3cb;
  --border-light: #e8e6df;
  --white: #ffffff;
  --success: #2d6a4f;
  --warning: #e07c24;
  --danger: #c0392b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --radius: 6px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
.doc-header {
  background: var(--accent);
  color: var(--white);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.doc-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.header-top .university-name {
  font-family: 'Source Serif 4', serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-top .doc-ref {
  font-size: 0.75rem;
  opacity: 0.7;
  text-align: right;
  line-height: 1.5;
}

.header-body {
  padding: 32px 40px 36px;
}

.header-body h1 {
  font-family: 'Source Serif 4', serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.header-body .subtitle {
  font-size: 0.92rem;
  opacity: 0.85;
  max-width: 720px;
  line-height: 1.55;
}

.header-body .badge-row {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── INSTRUCTIONS BAR ── */
.instructions-bar {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 20px 40px;
}

.instructions-bar summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.instructions-bar .inst-content {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.7;
  max-width: 800px;
}

.instructions-bar .inst-content p { margin-bottom: 8px; }

.instructions-bar .inst-content strong { color: var(--ink-light); }

/* ── MAIN CONTAINER ── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.submission-notice {
  margin: 24px 0 0;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 600;
}

.submission-notice.success {
  color: var(--success);
  background: rgba(45,106,79,0.08);
  border: 1px solid rgba(45,106,79,0.22);
}

.submission-notice.error {
  color: var(--danger);
  background: rgba(192,57,43,0.08);
  border: 1px solid rgba(192,57,43,0.22);
}

/* ── SUBMITTER BLOCK ── */
.submitter-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin: 32px 0;
  box-shadow: var(--shadow-sm);
}

.submitter-block h3 {
  font-family: 'Source Serif 4', serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--ink);
}

.submitter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .submitter-grid { grid-template-columns: 1fr; }
}

/* ── PART DIVIDERS ── */
.part-divider {
  margin: 48px 0 8px;
  padding: 20px 0 12px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.part-divider .part-label {
  font-family: 'Source Serif 4', serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--white);
  background: var(--accent);
  padding: 4px 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.part-divider .part-title {
  font-family: 'Source Serif 4', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
}

.part-description {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 24px;
  line-height: 1.6;
  font-style: italic;
}

/* ── SECTIONS ── */
.section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section-header {
  padding: 16px 24px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.section-header:hover { background: var(--surface-warm); }

.section-header .section-code {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(139,26,26,0.08);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.section-header .section-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  flex: 1;
}

.section-header .chevron {
  width: 18px;
  height: 18px;
  transition: transform 0.25s ease;
  color: var(--ink-muted);
}

.section.collapsed .section-body { display: none; }
.section.collapsed .chevron { transform: rotate(-90deg); }

.section-body { padding: 24px; }

/* ── FORM FIELDS ── */
.field-group {
  margin-bottom: 20px;
}

.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 6px;
  line-height: 1.45;
}

.field-label .mandatory {
  color: var(--accent-light);
  font-weight: 700;
  margin-left: 2px;
}

.field-hint {
  display: block;
  font-size: 0.73rem;
  color: var(--ink-muted);
  margin-bottom: 6px;
  line-height: 1.45;
  font-style: italic;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,26,26,0.08);
}

textarea { resize: vertical; min-height: 80px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ── TABLES ── */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  background: var(--surface-alt);
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-light);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

table input, table textarea {
  border: 1px solid transparent;
  padding: 6px 8px;
  font-size: 0.82rem;
  border-radius: 3px;
  background: transparent;
}

table input:focus, table textarea:focus {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(139,26,26,0.06);
}

table textarea { min-height: 40px; }

.row-num {
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  width: 36px;
  min-width: 36px;
}

/* ── ADD ROW BUTTON ── */
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.add-row-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139,26,26,0.03);
}

.add-row-btn svg {
  width: 14px;
  height: 14px;
}

/* ── REMOVE ROW ── */
.remove-row-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-row-btn:hover {
  color: var(--danger);
  background: rgba(192,57,43,0.06);
}

/* ── ACTIONS ── */
.form-actions {
  margin-top: 40px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 28px;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
}

.btn-primary:hover { background: var(--accent-deep); }

.btn-secondary {
  background: var(--white);
  color: var(--ink-light);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--ink-muted);
}

/* ── PROGRESS ── */
.progress-strip {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.progress-strip .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 100px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 42px;
  text-align: right;
}

/* ── NAV TABS ── */
.part-nav {
  display: flex;
  gap: 6px;
  margin: 24px 0 8px;
  padding: 0;
  flex-wrap: wrap;
}

.part-nav button {
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.part-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.part-nav button.active {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

/* ── PRINT ── */
@media print {
  .progress-strip, .form-actions, .add-row-btn, .remove-row-btn, .part-nav, .instructions-bar { display: none !important; }
  .section.collapsed .section-body { display: block !important; }
  .doc-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { font-size: 11px; }
  .container { max-width: 100%; padding: 0 16px; }
}

@media (max-width: 768px) {
  .header-top, .header-body, .instructions-bar, .progress-strip { padding-left: 20px; padding-right: 20px; }
  .container { padding: 0 12px 60px; }
  .section-body { padding: 16px; }
}
