/* Mirrors the admin web app (Tailwind gray/blue palette) without a build step. */
* { box-sizing: border-box; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #f9fafb;            /* gray-50 */
  color: #111827;                 /* gray-900 */
  margin: 0;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; padding: 2rem; } /* min-width: 0 lets it shrink below its widest child */
/* Grows with the screen instead of a fixed 56rem column. */
.content-inner { width: 100%; max-width: 56rem; margin: 0 auto; }
@media (min-width: 1280px) { .content-inner { max-width: 64rem; } }
@media (min-width: 1536px) { .content-inner { max-width: 72rem; } }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  width: 14rem; flex-shrink: 0; background: #111827;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 0.625rem; padding: 1.25rem 1rem; border-bottom: 1px solid #1f2937; }
/* White tile (the logo has a white background), same size as admin's. */
.brand-logo { width: 2rem; height: 2rem; flex-shrink: 0; border-radius: 0.375rem; background: #fff; object-fit: contain; padding: 0.125rem; }
.login-logo { display: block; width: 4rem; height: 4rem; margin: 0 auto 0.75rem; object-fit: contain; }
.brand h1 { margin: 0; font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; letter-spacing: 0.025em; color: #fff; }
.brand p { margin: 0; font-size: 11px; line-height: 1.5; color: #9ca3af; }
/* Same metrics as ms-entra admin's sidebar (Tailwind text-sm / text-[11px]). */
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 0; } /* only the nav scrolls; the footer stays pinned */
.nav-title {
  padding: 0 1rem; margin: 0 0 0.375rem; font-size: 11px; line-height: 1.5; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280;
}
.nav-links { display: flex; flex-direction: column; gap: 0.125rem; padding: 0 0.5rem; }
.nav-links button {
  display: block; width: 100%; text-align: left; background: transparent; border: none;
  color: #9ca3af; font-size: 0.875rem; line-height: 1.25rem; font-weight: 400; padding: 0.375rem 0.625rem; border-radius: 0.375rem;
}
.nav-links + .nav-title, #roleTabs + .nav-title { margin-top: 1.25rem; }
.nav-links button:hover { background: rgba(31, 41, 55, 0.6); color: #fff; }
.nav-links button.active {
  background: #1f2937; color: #fff; font-weight: 500;
  border-left: 2px solid #3b82f6; margin-left: -1px; padding-left: 9px;
}
.sidebar-footer {
  flex-shrink: 0;
  padding: 0.75rem 1rem; border-top: 1px solid #1f2937;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.sidebar-footer .who { flex: 1; min-width: 0; font-size: 0.75rem; line-height: 1rem; color: #9ca3af; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The guide: a "?" in the middle of the footer. */
.tourHelpBtn {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; padding: 0;
  border-radius: 9999px; border: 1px solid #374151; background: transparent; color: #9ca3af; font-size: 0.75rem; font-weight: 700; line-height: 1;
}
.tourHelpBtn:hover { background: #1f2937; color: #fff; border-color: #4b5563; }
.sidebar-footer a { font-size: 0.75rem; font-weight: 500; color: #6b7280; text-decoration: none; flex-shrink: 0; }
.sidebar-footer a:hover { color: #fff; }

/* ── Page header ──────────────────────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-header h2 { margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.025em; color: #111827; }
.page-header p { margin: 0.375rem 0 0; font-size: 0.875rem; line-height: 1.6; color: #6b7280; }
.muted { color: #6b7280; font-size: 0.875rem; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }
.card-title { margin: 0; font-size: 1rem; font-weight: 600; color: #111827; }

/* ── Forms ────────────────────────────────────────────────────────────── */
label { display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.375rem;
  font: inherit; font-size: 0.875rem; color: #111827; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); margin-bottom: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 1px #3b82f6; }
input:disabled, select:disabled, textarea:disabled { background: #f9fafb; }
input[type=radio], input[type=checkbox] { width: auto; margin: 0; box-shadow: none; accent-color: #2563eb; }

fieldset { border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.75rem 1rem; margin: 0 0 1rem; }
legend { font-size: 0.875rem; font-weight: 500; color: #374151; padding: 0 0.25rem; }
label.radio { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; color: #374151; margin-bottom: 0.375rem; }
fieldset input:not([type=radio]):not([type=checkbox]) { margin: 0.5rem 0 0; }
.fieldHint { font-size: 0.75rem; font-weight: 400; color: #9ca3af; }
p.fieldHint { color: #dc2626; margin-top: -0.75rem; margin-bottom: 1rem; }

.section-title {
  font-size: 0.875rem; font-weight: 600; color: #111827;
  margin: 1.5rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid #e5e7eb;
}
.form-step > .section-title:first-child { margin-top: 0.5rem; }
#onboardingStepIndicator {
  display: inline-block; margin: 0.25rem 0 0; padding: 0.125rem 0.5rem; border-radius: 0.25rem;
  background: #eff6ff; color: #1d4ed8; font-size: 0.75rem; font-weight: 500;
}

/* Required fields, field grouping, per-kind visibility */
label.req::after, legend.req::after { content: ' *'; color: #dc2626; }
.req-mark { color: #dc2626; font-weight: 600; }
label.req { font-weight: 600; }
.req-legend { margin: -0.5rem 0 1rem; font-size: 0.75rem; color: #6b7280; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
[hidden] { display: none !important; }
.type-hint { margin: -0.5rem 0 1rem; font-size: 0.8125rem; color: #1d4ed8; background: #eff6ff; border-radius: 0.375rem; padding: 0.5rem 0.75rem; }
.type-hint:empty { display: none; }
.campaign-group { margin-bottom: 0.5rem; }
.campaign-group p { margin: 0 0 0.25rem; font-size: 0.75rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────────────────────────── */
button {
  font: inherit; font-size: 0.875rem; font-weight: 500;
  padding: 0.5rem 1rem; border-radius: 0.375rem; border: 1px solid transparent;
  background: #2563eb; color: #fff; cursor: pointer; transition: background-color 0.15s, color 0.15s;
}
button:hover { background: #1d4ed8; }
button:focus-visible { outline: none; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: #fff; color: #374151; border-color: #d1d5db; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
button.secondary:hover { background: #f9fafb; }
button.danger { background: #dc2626; }
button.small { padding: 0.25rem 0.625rem; font-size: 0.75rem; }

/* ── Documents (expanded request) ─────────────────────────────────────── */
.docs { margin-top: 1rem; }
.docs h4 { margin: 0 0 0.5rem; font-size: 0.875rem; }
.docList { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.docList li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.375rem 0; border-bottom: 1px solid #f3f4f6; }
.docList a { color: #2563eb; font-weight: 500; word-break: break-all; }
.docList .muted { font-size: 0.75rem; }
label.docUpload {
  display: inline-block; font-size: 0.875rem; font-weight: 500; padding: 0.5rem 1rem; border-radius: 0.375rem; cursor: pointer;
  background: #fff; color: #374151; border: 1px solid #d1d5db; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
label.docUpload:hover { background: #f9fafb; }
button.danger:hover { background: #b91c1c; }
td button { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
td button + button { margin-left: 0.25rem; }

#submitBtn { margin-top: 0.5rem; }
.stepNav { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }
.stepNav button:only-child { margin-left: auto; }
.viewHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.back-link { margin: 0 0 1rem; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -1.5rem -1.5rem; border-top: 1px solid #e5e7eb; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: #f9fafb; font-size: 0.75rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em; color: #6b7280;
}
th, td { text-align: left; padding: 0.75rem 1.5rem; border-bottom: 1px solid #e5e7eb; vertical-align: middle; }
tbody tr:last-child > td { border-bottom: none; }
tbody > tr:hover > td { background: #f9fafb; }
td { color: #374151; }
td:last-child { white-space: nowrap; text-align: right; }
/* Expanded request detail (nested key/value table) */
td table { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; }
td table th, td table td { padding: 0.375rem 0.75rem; text-align: left; white-space: normal; }
td table th { width: 35%; font-weight: 500; color: #6b7280; }
td table tr:hover > td { background: transparent; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; font-weight: 500; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.approved, .badge.completed { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.na { background: #f3f4f6; color: #6b7280; }

/* ── Login screen ─────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login .card { text-align: center; }
.login h1 { margin: 0 0 1rem; font-size: 1.125rem; font-weight: 600; }
.login p { margin: 0 0 1rem; }
.login .denied { color: #dc2626; font-size: 0.875rem; }

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar .nav { padding: 0.5rem 0; }
  .content { padding: 1rem; }
  .card { padding: 1rem; }
  .table-wrap { margin: 0 -1rem -1rem; }
  .viewHeader { flex-wrap: wrap; gap: 0.5rem; }
}

/* ── List filters ─────────────────────────────────────────────────────── */
.listFilter { display: flex; gap: 0.5rem; align-items: center; }
#mineFilter, #financeFilter { width: auto; margin: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; line-height: 1.25rem; }
.listFilter button { line-height: 1.25rem; }

/* ── Read-only request detail (same form, every section shown) ───────── */
#requestForm.readonly input:disabled, #requestForm.readonly select:disabled, #requestForm.readonly textarea:disabled {
  background: #f9fafb; color: #111827; opacity: 1; cursor: default; -webkit-text-fill-color: #111827;
}
#requestForm.readonly .form-step + .form-step { border-top: 1px solid #e5e7eb; margin-top: 1.25rem; padding-top: 1.25rem; }
#requestForm.readonly .stepNav, #requestForm.readonly #submitBtn, #requestForm.readonly #newRequestFiles,
#requestForm.readonly #onboardingStepIndicator, #requestForm.readonly .fieldHint { display: none !important; }
#requestForm.readonly label.req::after, #requestForm.readonly legend.req::after { content: none; }
.detailSummary { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.detailSummary dl { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 0; }
.detailSummary dt { font-size: 0.75rem; color: #6b7280; }
.detailSummary dd { margin: 0.125rem 0 0; font-size: 0.875rem; font-weight: 500; }
.detailSummary .actions { display: flex; gap: 0.5rem; }
.detailSummary .cancelled { flex-basis: 100%; color: #b91c1c; font-size: 0.875rem; }

/* ── Document slots (offer / termination letter) ──────────────────────── */
.templateLink { margin-left: 0.5rem; font-size: 0.8125rem; font-weight: 500; color: #2563eb; }
#requestForm.readonly .fileSlot { display: none !important; }
.docUploads { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.unavailable { display: none !important; }

/* ── Offices / campuses checklist, rate of pay ────────────────────────── */
.rateRow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.rateRow input, .rateRow select { width: auto; margin-bottom: 0; }
.rateRow #rateOfPay { width: 9rem; }
.rateRow #hoursPerWeek { width: 4.5rem; }
.ratePrefix { color: #6b7280; }
#rateEstimate { margin-top: 0.375rem; font-weight: 500; color: #374151; }

/* ── Documents block (end of the form, every step) ────────────────────── */
.docsBlock { margin-top: 1.75rem; }
.docsBlock .fieldHint { display: block; margin: 0 0 0.5rem; }
.docSlot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.625rem 0; border-top: 1px solid #f3f4f6; }
.docSlot:first-of-type { border-top: none; }
.docSlot > label { min-width: 11rem; margin: 0; font-weight: 500; color: #374151; }
.docSlot input[type=file] {
  width: auto; flex: 1; min-width: 14rem; margin: 0; padding: 0.375rem; font-size: 0.8125rem; color: #4b5563;
  border: 1px dashed #d1d5db; background: #f9fafb; box-shadow: none;
}
.docSlot input[type=file]::file-selector-button {
  font: inherit; font-weight: 500; margin-right: 0.75rem; padding: 0.375rem 0.75rem; border-radius: 0.375rem; cursor: pointer;
  background: #fff; color: #374151; border: 1px solid #d1d5db; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.docSlot input[type=file]::file-selector-button:hover { background: #f3f4f6; }
.docSlot .templateLink { margin-left: 0; }
.docError { margin: 0.5rem 0 0; color: #dc2626; font-size: 0.875rem; font-weight: 500; }
.docSlot.missing input[type=file] { border-color: #dc2626; background: #fef2f2; }

/* ── Request setup (country, type, company) and its summary ───────────── */
.setupSummary { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem 1.5rem;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.75rem 1rem; margin-bottom: 1.25rem; }
.setupSummary dl { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 0; }
.setupSummary dt { font-size: 0.75rem; color: #6b7280; }
.setupSummary dd { margin: 0.125rem 0 0; font-size: 0.875rem; font-weight: 600; color: #111827; }
.setupSummary .type-hint { flex-basis: 100%; margin: 0; }
#requestForm.readonly #setupChange { display: none; }

/* ── Guided tour ──────────────────────────────────────────────────────── */
.tour-overlay { position: fixed; inset: 0; z-index: 1000; display: none; }
.tour-ring { position: fixed; z-index: 1001; display: none; border-radius: 0.5rem; pointer-events: none;
  box-shadow: 0 0 0 3px #3b82f6, 0 0 0 9999px rgba(17, 24, 39, 0.55); transition: all 0.2s ease; }
.tour-pop { position: fixed; z-index: 1002; display: none; background: #fff; border-radius: 0.5rem; padding: 0.875rem 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); border: 1px solid #e5e7eb; }
.tour-overlay.on, .tour-ring.on, .tour-pop.on { display: block; }
.tour-count { margin: 0; font-size: 0.6875rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.tour-title { margin: 0.25rem 0 0.375rem; font-size: 0.9375rem; font-weight: 600; color: #111827; }
.tour-text { margin: 0 0 0.75rem; font-size: 0.875rem; line-height: 1.4; color: #374151; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.tour-actions > span { display: flex; gap: 0.375rem; }
.tour-skip { background: none; border: none; color: #6b7280; padding: 0.25rem 0; font-size: 0.8125rem; }
.tour-skip:hover { background: none; color: #111827; }

/* ── Field notes, spacing ─────────────────────────────────────────────── */
.fieldNote { margin: 0.375rem 0 0; padding: 0.5rem 0.75rem; font-size: 0.8125rem; line-height: 1.35; color: #92400e;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 0.375rem; }
.platformNotesField { margin-top: 1.5rem; }

/* Students module */
#studentsView .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
#studentsView .actions { display: flex; align-items: center; gap: 0.5rem; }
#studentsView td input { min-width: 8rem; }
#studentsView td input.invalid { border-color: #dc2626; }
@media (max-width: 640px) { #studentsView .grid2 { grid-template-columns: 1fr; } }
