:root {
  --maroon: #7a1224;
  --maroon-dark: #5a0d1a;
  --gold: #d4a418;
  --gold-light: #f4e4b0;
  --cream: #fdf8ee;
  --ink: #2b2320;
  --muted: #7a6f63;
  --border: #e6d9b8;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --success: #1e7a34;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* The form toggles visibility via the `hidden` attribute. Class rules that set
   `display` (.modal-overlay, .field, .badge) outrank the UA stylesheet's
   [hidden] rule, so state it explicitly here. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans Gujarati", Tahoma, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

.site-header {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff;
  padding: 18px 16px;
  border-bottom: 5px solid var(--gold);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 4px;
  flex-shrink: 0;
}
.titles h1 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.3;
}
.titles h1.en {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: 0.95;
}
.subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--gold-light);
}

.page {
  max-width: 960px;
  margin: 24px auto 60px;
  padding: 0 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  color: var(--maroon-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--gold-light);
  padding-bottom: 10px;
}
.card h2 .num {
  background: var(--maroon);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.card h2 .gu {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.field label .gu { font-weight: 400; color: var(--muted); }
.field label small { font-weight: 400; color: var(--muted); }
.req { color: var(--danger); }

input[type="text"], input[type="tel"], input[type="number"], select, input[type="file"] {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 3px rgba(122,18,36,0.12);
}
input.reveal { margin-top: 6px; }

/* An input with a button beside it, e.g. email + "Send code". */
.inline-row { display: flex; gap: 8px; align-items: stretch; }
.inline-row input { flex: 1 1 auto; min-width: 0; }
.inline-row button { flex: 0 0 auto; white-space: nowrap; }

/* Confirmation that the address has been verified. */
.verified-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 9px 13px;
  background: #e4f3e8;
  border: 1px solid var(--success);
  border-radius: 6px;
  font-size: 0.9rem;
}
.verified-badge .tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 0.78rem;
  flex: 0 0 auto;
}
.verified-badge strong { color: var(--success); }
.verified-badge .link-btn { margin-left: auto; }

/* An instruction that applies to a whole section, sitting under its heading. */
.section-note {
  margin: -4px 0 16px;
  padding: 9px 12px;
  background: var(--gold-light);
  border-left: 3px solid var(--gold);
  border-radius: 5px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink);
}
.section-note strong { color: var(--maroon); }
.section-note .gu { display: block; margin-top: 2px; color: var(--muted); }

/* Inline status under a field, e.g. the PIN code lookup result. */
.field-hint {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--muted);
}
.field-hint.ok { color: var(--success); }
.field-hint.warn { color: var(--danger); }

.badge {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  width: fit-content;
}
.badge.western { background: #e4f3e8; color: var(--success); }
.badge.other { background: #f1eee9; color: var(--muted); }

.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #fdfcf8;
}
.radio-pill input { margin: 0; }
.radio-pill:has(input:checked) {
  border-color: var(--maroon);
  background: var(--gold-light);
}

table#subjectsTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
table#subjectsTable th {
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
}
table#subjectsTable td {
  padding: 6px 6px;
  vertical-align: top;
}
.col-marks { width: 110px; }
.col-action { width: 40px; }
.remove-row-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 6px;
}

.btn-secondary, .btn-primary {
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  font-weight: 600;
}
.btn-secondary {
  background: #fff;
  border: 1px solid var(--maroon);
  color: var(--maroon);
}
.btn-secondary:hover { background: var(--gold-light); }
.btn-primary {
  background: var(--maroon);
  color: #fff;
}
.btn-primary:hover { background: var(--maroon-dark); }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.totals-row { margin: 10px 0 20px; }
.totals-box {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  background: var(--gold-light);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.file-hint { font-size: 0.78rem; color: var(--muted); }
.file-hint.error { color: var(--danger); }

.submit-row {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.form-error {
  align-self: stretch;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px 0 40px;
}
.footer-contact {
  margin: 0 auto 6px;
  padding: 9px 14px;
  max-width: 640px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.5;
}
.footer-contact a { color: var(--maroon); font-weight: 600; }
.footer-contact .gu { display: block; color: var(--muted); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43,35,32,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.modal h3 {
  margin: 0 0 8px;
  color: var(--maroon-dark);
}
.modal-note { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.confirm-summary dl {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 6px 10px;
  font-size: 0.88rem;
  margin: 0 0 16px;
}
.confirm-summary dt { color: var(--muted); }
.confirm-summary dd { margin: 0; font-weight: 600; }
.confirm-summary h4 {
  margin: 14px 0 6px;
  font-size: 0.85rem;
  color: var(--maroon-dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.loading-box { text-align: center; max-width: 280px; }
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--gold-light);
  border-top-color: var(--maroon);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-success h3 { color: var(--success); }
.result-error h3 { color: var(--danger); }
