/* ============================================================
   Design tokens
   Subject: a community trust's merit-scholarship form.
   The physical form it replaces is a bordered ledger document
   with a maroon trust seal, ruled fields, and a marks grid.
   That vocabulary (rule lines, ledger grid, seal-red accent,
   warm paper ground) is carried into the digital version
   rather than reaching for a generic SaaS card look.
   ============================================================ */
:root {
  --paper: #FBF7F0;
  --paper-raised: #FFFFFF;
  --ink: #26201B;
  --ink-soft: #6B5F54;
  --rule: #DCD1C0;
  --maroon: #7A2A2E;
  --maroon-dark: #5C1F23;
  --gold: #B4862F;
  --success: #3F7A57;
  --success-bg: #EAF3ED;
  --error: #B23A3A;
  --error-bg: #FBEDED;
  --focus: #2F6FA8;

  --font-display: "Merriweather", "Noto Serif Gujarati", serif;
  --font-body: "Inter", "Noto Sans Gujarati", sans-serif;

  --radius: 6px;
  --shadow-doc: 0 1px 2px rgba(38, 32, 27, 0.06), 0 8px 24px -12px rgba(38, 32, 27, 0.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px);
  background-size: 100% 2.1rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: var(--maroon); }

/* ---------------- Masthead ---------------- */
.masthead {
  background: var(--paper-raised);
  border-bottom: 3px double var(--maroon);
}

.masthead-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.4rem;
  text-align: center;
}

.masthead-seal {
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin: 0 0 0.35rem;
}

.masthead-gu {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4.2vw, 1.85rem);
  color: var(--maroon-dark);
  margin: 0 0 0.25rem;
  line-height: 1.35;
}

.masthead-en {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
}

.masthead-address {
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: 46rem;
  margin: 0 auto;
}

/* ---------------- Page heading band ---------------- */
.page-heading {
  max-width: 800px;
  margin: 1.75rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-heading h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0;
  color: var(--ink);
}

.page-heading .year-pill {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--maroon-dark);
  background: #F3E6C8;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ---------------- Document card ---------------- */
.doc {
  max-width: 800px;
  margin: 1.25rem auto 3rem;
  padding: 0 1.5rem;
}

.doc-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-doc);
  padding: 1.75rem 1.5rem 2rem;
}

@media (min-width: 640px) {
  .doc-card { padding: 2.25rem 2.5rem 2.5rem; }
}

.section {
  margin-bottom: 1.9rem;
}

.section:last-child { margin-bottom: 0; }

.section-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--maroon-dark);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.section-title .gu {
  font-size: 0.92em;
  color: var(--ink-soft);
  font-weight: 400;
}

/* ---------------- Form elements ---------------- */
.field {
  margin-bottom: 1.15rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  color: var(--ink);
}

.field label .gu {
  font-weight: 400;
  color: var(--ink-soft);
  margin-left: 0.35rem;
  font-size: 0.9em;
}

.req { color: var(--maroon); }

.field input[type="text"],
.field input[type="tel"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.98rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea { resize: vertical; min-height: 4.2rem; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 111, 168, 0.15);
}

.field input:invalid:not(:placeholder-shown) { }

.field .hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}

.field .error-msg {
  font-size: 0.82rem;
  color: var(--error);
  margin-top: 0.35rem;
  display: none;
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select {
  border-color: var(--error);
  background: var(--error-bg);
}

.field.has-error .error-msg { display: block; }

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.25rem;
}

@media (min-width: 560px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

.radio-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-option:has(input:checked) {
  border-color: var(--maroon);
  background: #FBF1F0;
}

.radio-option input[type="radio"] {
  accent-color: var(--maroon);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}

.radio-option .gu { color: var(--ink-soft); font-size: 0.9em; }

.field.has-error .radio-option {
  border-color: var(--error);
}

/* ---------------- Subjects grid (echoes the ledger table) ---------------- */
.subjects-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

table.subjects {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.92rem;
}

table.subjects thead th {
  background: #F4EEE2;
  color: var(--maroon-dark);
  font-weight: 600;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

table.subjects tbody td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}

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

table.subjects input {
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  font-size: 0.92rem;
}

table.subjects input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(47, 111, 168, 0.15);
}

.subjects .col-remove { width: 2.4rem; text-align: center; }

.btn-remove-row {
  background: none;
  border: none;
  color: var(--error);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}

.btn-remove-row:hover { color: var(--maroon-dark); }

.subjects-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.7rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn-add-row {
  background: none;
  border: 1px dashed var(--gold);
  color: var(--maroon-dark);
  border-radius: 4px;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-add-row:hover { background: #FAF3E4; }

.btn-add-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.totals-strip {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.totals-strip strong { color: var(--ink); font-size: 1rem; }

/* ---------------- File upload ---------------- */
.upload-box {
  border: 1.5px dashed var(--rule);
  border-radius: 6px;
  padding: 1.5rem 1rem;
  text-align: center;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-box:hover,
.upload-box.dragover {
  border-color: var(--maroon);
  background: #FBF1F0;
}

.upload-box input[type="file"] { display: none; }

.upload-box .upload-icon {
  font-size: 1.6rem;
  color: var(--maroon);
  margin-bottom: 0.4rem;
}

.upload-box .upload-text {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 600;
}

.upload-box .upload-hint {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}

.file-list {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
}

.file-list .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list .file-remove {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ---------------- Rules & committee (collapsible) ---------------- */
.rules-box {
  margin-top: 2rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  padding: 0;
}

.rules-box summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--maroon-dark);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rules-box summary::-webkit-details-marker { display: none; }

.rules-box summary:hover { background: #F4EEE2; }

.rules-box[open] summary {
  border-bottom: 1px solid var(--rule);
}

.rules-box .rules-list,
.rules-box .rules-subhead,
.rules-box .subjects-wrap,
.rules-box .upload-hint,
.rules-box .committee-list {
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}

.rules-list {
  margin: 1rem 0;
  padding-top: 0;
  padding-bottom: 0;
  display: grid;
  gap: 0.9rem;
}

.rules-list li {
  padding-left: 0.3rem;
}

.rule-en {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.rule-gu {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.rules-subhead {
  font-family: var(--font-display);
  font-size: 0.96rem;
  color: var(--maroon-dark);
  margin: 1.4rem 0 0.7rem;
}

.committee-list {
  list-style: none;
  margin: 0 0 1.2rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.committee-list li::before {
  content: "•";
  color: var(--gold);
  margin-right: 0.5rem;
}

/* ---------------- Declaration + submit ---------------- */
/* ---------------- Submission-closed notice ---------------- */
.closed-notice {
  text-align: center;
  padding: 1.5rem 1rem 1rem;
}

.closed-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.closed-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--maroon-dark);
  margin: 0 0 0.5rem;
}

.closed-sub {
  font-size: 1rem;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

.closed-gu {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}

.declaration {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.checkbox-field {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.8rem;
}

.checkbox-field input { margin-top: 0.2rem; }

.checkbox-field label { font-size: 0.88rem; color: var(--ink); font-weight: 500; }

.submit-row {
  margin-top: 1.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--maroon);
  color: #fff;
  border: none;
  padding: 0.8rem 1.9rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover { background: var(--maroon-dark); }
.btn-primary:active { transform: translateY(1px); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 0.75rem 1.4rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-secondary:hover { border-color: var(--ink-soft); }

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.submitting .spinner { display: inline-block; }

/* ---------------- Banners ---------------- */
.banner {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.banner-box {
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  font-size: 0.92rem;
  border: 1px solid;
}

.banner-box.success {
  background: var(--success-bg);
  border-color: var(--success);
  color: #295C3F;
}

.banner-box.error {
  background: var(--error-bg);
  border-color: var(--error);
  color: #7A2828;
}

/* ---------------- Toast notifications ---------------- */
.toast-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 2rem);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--paper-raised);
  border-left: 4px solid var(--error);
  border-radius: 6px;
  box-shadow: 0 10px 30px -8px rgba(38, 32, 27, 0.35), 0 2px 8px rgba(38, 32, 27, 0.12);
  padding: 0.85rem 0.9rem 0.85rem 1rem;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  animation: toast-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.toast.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.toast-icon {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--error-bg);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.05rem;
}

.toast-body { flex: 1; min-width: 0; }

.toast-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.toast-list {
  margin: 0;
  padding-left: 1.05rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.15rem;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
}

.toast-close:hover { color: var(--ink); background: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ---------------- Footer ---------------- */
.site-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 0 1.5rem 2.5rem;
}

.site-footer a { color: var(--ink-soft); text-decoration: underline; }

/* ============================================================
   Success modal (post-submission popup)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 32, 27, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1100;
  animation: overlay-in 0.15s ease both;
}

.modal-overlay[hidden] { display: none; }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--paper-raised);
  border-radius: 8px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem 1.75rem 1.75rem;
  position: relative;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.35);
  animation: modal-in 0.22s cubic-bezier(0.2,0.8,0.3,1) both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.modal-close:hover { background: var(--paper); color: var(--ink); }

.modal-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  text-align: center;
  margin: 0 0 0.4rem;
}

.modal-sub {
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary { flex: 1; justify-content: center; min-width: 140px; }

.modal-whatsapp {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.modal-whatsapp-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin: 0 0 0.3rem;
}

.whatsapp-list {
  display: grid;
  gap: 0.5rem;
}

.whatsapp-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.6rem 0.8rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.whatsapp-link:hover { border-color: #25D366; background: #F1FBF5; }

.whatsapp-link .wa-icon {
  color: #25D366;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---------------- Off-screen PDF capture template ---------------- */
.proof-template {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 780px;
  z-index: -1;
}

.proof-page {
  background: #ffffff;
  color: #26201B;
  padding: 36px 40px;
  font-family: "Inter", "Noto Sans Gujarati", sans-serif;
}

.proof-seal { text-align: center; font-size: 12px; color: #B4862F; margin: 0 0 6px; }
.proof-org-gu { text-align: center; font-family: "Merriweather", "Noto Serif Gujarati", serif; font-size: 22px; color: #5C1F23; margin: 0 0 4px; }
.proof-org-en { text-align: center; font-style: italic; font-size: 14px; color: #6B5F54; margin: 0 0 6px; }
.proof-address { text-align: center; font-size: 11px; color: #6B5F54; margin: 0 0 14px; }
.proof-page hr { border: none; border-top: 2px double #7A2A2E; margin: 0 0 18px; }
.proof-title { font-family: "Merriweather", serif; font-size: 17px; color: #26201B; margin: 0 0 6px; }
.proof-meta { font-size: 12px; color: #6B5F54; margin: 0 0 16px; }

.proof-fields { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.proof-fields th { text-align: left; width: 34%; font-size: 12px; color: #6B5F54; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #DCD1C0; vertical-align: top; }
.proof-fields td { text-align: left; font-size: 13px; padding: 6px 8px; border-bottom: 1px solid #DCD1C0; }

.proof-subhead { font-family: "Merriweather", serif; font-size: 14px; color: #5C1F23; margin: 18px 0 8px; }

.proof-subjects { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.proof-subjects th, .proof-subjects td { border: 1px solid #DCD1C0; padding: 6px 8px; text-align: left; }
.proof-subjects thead th { background: #F4EEE2; color: #5C1F23; }
.proof-subjects tfoot th { background: #FAF7F0; }

.proof-percentage { font-size: 13px; margin: 0 0 4px; }

.proof-attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.proof-attachments img { width: 150px; height: 110px; object-fit: cover; border: 1px solid #DCD1C0; border-radius: 4px; }
.proof-attachments .proof-file-chip { width: 150px; height: 110px; display: flex; align-items: center; justify-content: center; text-align: center; border: 1px solid #DCD1C0; border-radius: 4px; font-size: 11px; padding: 6px; color: #6B5F54; background: #FAF7F0; }

.proof-footer { font-size: 10.5px; color: #6B5F54; margin-top: 20px; }

/* ============================================================
   Admin area
   ============================================================ */
.admin-shell {
  min-height: 100vh;
  background: var(--paper);
}

.admin-topbar {
  background: var(--maroon);
  color: #fff;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.admin-topbar .brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.admin-topbar .brand small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  opacity: 0.8;
  font-weight: 400;
}

.admin-topbar a.logout {
  color: #F3E6C8;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.35);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}

.admin-topbar a.logout:hover { background: rgba(255,255,255,0.1); }

.admin-body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-doc);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0 0 0.2rem;
  color: var(--maroon-dark);
  text-align: center;
}

.login-card p.sub {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1rem 1.1rem;
}

.stat-card .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--maroon-dark);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar input[type="search"] {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  min-width: 220px;
  font-size: 0.9rem;
}

.data-table-wrap {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  font-size: 0.88rem;
}

table.data-table th {
  text-align: left;
  padding: 0.7rem 0.85rem;
  background: #F4EEE2;
  color: var(--maroon-dark);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

table.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.data-table tbody tr:hover { background: #FBF7EF; }

.pct-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.82rem;
}

.pct-badge.high { background: var(--success-bg); color: #295C3F; }
.pct-badge.mid { background: #FBF1DA; color: #8A6415; }
.pct-badge.low { background: var(--error-bg); color: #7A2828; }

.detail-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.75rem;
  max-width: 760px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.5rem;
  margin-bottom: 1.5rem;
}

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

.detail-grid .k {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.detail-grid .v { font-size: 0.96rem; }

.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.attach-grid a {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.75rem;
  text-align: center;
}

.attach-grid img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  background: var(--paper);
}

.attach-grid .pdf-tile {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font-size: 1.6rem;
  color: var(--maroon);
}

.attach-grid .fname {
  display: block;
  padding: 0.3rem 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Admin detail: print / save-as-PDF ---------------- */
.print-only-header { display: none; }

@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    background-image: none;
  }

  .admin-shell, .admin-body { padding: 0; margin: 0; max-width: none; }

  .detail-card {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: none;
  }

  .print-only-header { display: block; }
  .print-only-header .proof-seal { text-align: center; font-size: 11px; color: #B4862F; margin: 0 0 4px; }
  .print-only-header .proof-org-gu { text-align: center; font-family: "Merriweather", "Noto Serif Gujarati", serif; font-size: 19px; color: #5C1F23; margin: 0 0 3px; }
  .print-only-header .proof-org-en { text-align: center; font-style: italic; font-size: 12px; color: #6B5F54; margin: 0 0 4px; }
  .print-only-header .proof-address { text-align: center; font-size: 10px; color: #6B5F54; margin: 0 0 10px; }
  .print-only-header hr { border: none; border-top: 2px double #7A2A2E; margin: 0 0 14px; }

  .attach-grid img { break-inside: avoid; }
}
