:root {
  --ink: #1c1c28;
  --ink-light: #3a3a52;
  --ink-muted: #6e6e88;
  --surface: #f8f7f4;
  --surface-alt: #efeee9;
  --surface-warm: #e6e4dc;
  --accent: #7B2D26;
  --accent-deep: #5e2019;
  --accent-light: #a94039;
  --gold: #9e7c1a;
  --gold-light: #c9a735;
  --border: #d2d0c8;
  --border-light: #e4e2db;
  --white: #ffffff;
  --success: #2d6a4f;
  --danger: #b83230;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.07);
  --radius: 5px;
  --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);
  position: relative;
}

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

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

.header-top .university-name {
  font-family: 'Literata', serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

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

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

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

.header-body .subtitle {
  font-size: 0.88rem;
  opacity: 0.82;
  max-width: 700px;
  line-height: 1.55;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── NOTICE BARS ── */
.notice-bar {
  border-bottom: 1px solid var(--border);
  padding: 18px 36px;
}

.notice-bar.instructions { background: var(--surface-alt); }

.notice-bar.visiting-notice {
  background: rgba(158,124,26,0.06);
  border-bottom-color: rgba(158,124,26,0.2);
}

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

.notice-content {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  line-height: 1.65;
  max-width: 780px;
}

.notice-content p { margin-bottom: 7px; }
.notice-content strong { color: var(--ink-light); }

.visiting-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  font-size: 0.82rem;
  color: var(--ink-light);
  line-height: 1.55;
}

.visiting-callout .icon-col {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--gold);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 1px;
}

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

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

.progress-bar {
  flex: 1;
  height: 5px;
  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.78rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

/* ── CONTAINER ── */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 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(184,50,48,0.08);
  border: 1px solid rgba(184,50,48,0.22);
}

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

.section-header {
  padding: 14px 22px;
  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.68rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(123,45,38,0.07);
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

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

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

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

.section-body { padding: 22px; }

/* ── FORM FIELDS ── */
.field-group { margin-bottom: 18px; }
.field-group:last-child { margin-bottom: 0; }

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

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

.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-bottom: 5px;
  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: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  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(123,45,38,0.07);
}

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

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

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

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

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

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

thead th {
  background: var(--surface-alt);
  padding: 9px 10px;
  font-weight: 600;
  font-size: 0.7rem;
  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: 5px 6px;
  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: 5px 7px;
  font-size: 0.8rem;
  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(123,45,38,0.05);
}

table textarea { min-height: 36px; }

table select {
  padding: 5px 7px;
  font-size: 0.78rem;
  border: 1px solid transparent;
  background: transparent;
}

table select:focus {
  border-color: var(--accent);
  background: var(--white);
}

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

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

.add-row-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(123,45,38,0.02);
}

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

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

.remove-row-btn:hover {
  color: var(--danger);
  background: rgba(184,50,48,0.05);
}

.form-actions {
  margin-top: 36px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.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);
}

/* ── INLINE NOTE ── */
.inline-note {
  background: rgba(158,124,26,0.06);
  border: 1px solid rgba(158,124,26,0.18);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--ink-light);
  line-height: 1.55;
  margin-bottom: 18px;
}

.inline-note strong { color: var(--gold); }

/* -- FACULTY TYPE SELECTOR -- */
.type-selector {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 28px 0 20px;
  box-shadow: var(--shadow-sm);
}

.type-selector h3 {
  font-family: 'Literata', serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.type-selector p {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.radio-group {
  display: flex;
  gap: 12px;
}

.radio-option {
  flex: 1;
  position: relative;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option label {
  display: block;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.radio-option label .radio-title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 3px;
}

.radio-option label .radio-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.radio-option input[type="radio"]:checked + label {
  border-color: var(--accent);
  background: rgba(123,45,38,0.03);
  box-shadow: 0 0 0 3px rgba(123,45,38,0.07);
}

.radio-option input[type="radio"]:checked + label .radio-title {
  color: var(--accent);
}

.radio-option label:hover {
  border-color: var(--ink-muted);
}

.pu-only { display: block; }
body.visiting-mode .pu-only { display: none; }
body.visiting-mode .visiting-only { display: block; }
.visiting-only { display: none; }

@media (max-width: 640px) {
  .radio-group { flex-direction: column; }
}

/* -- PRINT -- */
@media print {
  .progress-strip, .form-actions, .add-row-btn, .remove-row-btn, .notice-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: 10.5px; }
  .container { max-width: 100%; padding: 0 14px; }
}

@media (max-width: 768px) {
  .header-top, .header-body, .notice-bar, .progress-strip { padding-left: 18px; padding-right: 18px; }
  .container { padding: 0 10px 60px; }
  .section-body { padding: 14px; }
}
