/* Theme: the AVI FRIENDLY logo's blues with its leaf green as the accent, on Adire-pattern navy grounds.
   Saffron is kept only for pending and warning states. Tokens first, then Bootstrap 5.3 themed through
   its own CSS variables, then the shared header, footer, home page and staff screens. */

:root {
  --navy-900: #052A4F;
  --blue-800: #04549E;
  --blue-700: #0567BE;
  --blue-300: #8EC5F0;
  --blue-200: #C3DEF6;
  --blue-100: #E0EEFA;
  --blue-50: #F0F6FC;
  --sky-400: #05A3F4;
  --lime-400: #8CCC34;
  --lime-500: #7AB82A;
  --saffron-100: #FBE3B0;
  --saffron-800: #7A4E00;
  --leaf-700: #17704A;
  --leaf-100: #DDF1E6;
  --red-700: #B42318;
  --red-100: #FDE8E6;
  --ink: #0A1B30;
  --slate-600: #46566C;
  --line: #D3E1EF;
  --line-strong: #B3C7DD;
  --surface: #FFFFFF;

  --font-display: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-body: "Figtree", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-control: 14px;
  --radius-card: 22px;
  --focus-ring: 0 0 0 4px var(--blue-200);

  /* Absolute: a url() in a variable resolves against the stylesheet that uses it (apply.css too). */
  --pattern-adire: url("/_content/LoansApp.Shared/img/adire.svg");
  --pattern-steps: url("/_content/LoansApp.Shared/img/steps.svg");
  --pattern-weave: url("/_content/LoansApp.Shared/img/weave.svg");

  --bs-body-font-family: var(--font-body);
  --bs-font-monospace: var(--font-mono);
  --bs-body-color: var(--ink);
  --bs-body-color-rgb: 10, 27, 48;
  --bs-body-bg: var(--blue-50);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--slate-600);
  --bs-secondary-bg: #EAF0F6;
  --bs-tertiary-bg: var(--blue-100);
  --bs-border-color: var(--line);
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: var(--radius-control);
  --bs-primary: var(--blue-700);
  --bs-primary-rgb: 5, 103, 190;
  --bs-primary-text-emphasis: var(--blue-700);
  --bs-primary-bg-subtle: var(--blue-100);
  --bs-success: var(--leaf-700);
  --bs-success-rgb: 23, 112, 74;
  --bs-success-text-emphasis: var(--leaf-700);
  --bs-success-bg-subtle: var(--leaf-100);
  --bs-danger: var(--red-700);
  --bs-danger-rgb: 180, 35, 24;
  --bs-danger-text-emphasis: #8F1C13;
  --bs-danger-bg-subtle: var(--red-100);
  --bs-warning-rgb: 242, 179, 61;
  --bs-warning-text-emphasis: var(--saffron-800);
  --bs-warning-bg-subtle: var(--saffron-100);
  --bs-link-color: var(--blue-700);
  --bs-link-color-rgb: 5, 103, 190;
  --bs-link-hover-color: var(--navy-900);
  --bs-link-hover-color-rgb: 5, 42, 79;
  --bs-focus-ring-color: rgba(5, 103, 190, 0.25);
}

/* ---------- base ---------- */

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  text-underline-offset: 0.2em;
}

.text-accent {
  color: var(--lime-400);
}

/* ---------- buttons ---------- */

.btn {
  --bs-btn-font-weight: 700;
  --bs-btn-border-radius: 12px;
  --bs-btn-padding-x: 1.1rem;
}

.btn-lg {
  --bs-btn-border-radius: var(--radius-control);
  --bs-btn-padding-y: 0.8rem;
  --bs-btn-padding-x: 1.6rem;
  --bs-btn-font-size: 1.0625rem;
  min-height: 3.5rem;
}

.btn-sm {
  --bs-btn-border-radius: 8px;
  --bs-btn-padding-x: 0.75rem;
}

.btn:focus-visible,
.btn-check:focus-visible + .btn {
  box-shadow: var(--focus-ring);
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--blue-700);
  --bs-btn-border-color: var(--blue-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--blue-800);
  --bs-btn-hover-border-color: var(--blue-800);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--navy-900);
  --bs-btn-active-border-color: var(--navy-900);
  --bs-btn-disabled-color: var(--slate-600);
  --bs-btn-disabled-bg: var(--blue-100);
  --bs-btn-disabled-border-color: var(--blue-100);
}

.btn-outline-primary {
  --bs-btn-color: var(--blue-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--blue-700);
  --bs-btn-border-width: 2px;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--blue-700);
  --bs-btn-hover-border-color: var(--blue-700);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--blue-800);
  --bs-btn-active-border-color: var(--blue-800);
}

.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-border-width: 1.5px;
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--blue-100);
  --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--blue-100);
  --bs-btn-active-border-color: var(--blue-700);
}

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--leaf-700);
  --bs-btn-border-color: var(--leaf-700);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #115C3C;
  --bs-btn-hover-border-color: #115C3C;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #0D4A30;
  --bs-btn-active-border-color: #0D4A30;
}

.btn-danger {
  --bs-btn-bg: var(--red-700);
  --bs-btn-border-color: var(--red-700);
  --bs-btn-hover-bg: #961D14;
  --bs-btn-hover-border-color: #961D14;
  --bs-btn-active-bg: #7C1810;
  --bs-btn-active-border-color: #7C1810;
}

.btn-outline-danger {
  --bs-btn-color: var(--red-700);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: #E7B4AE;
  --bs-btn-border-width: 1.5px;
  --bs-btn-hover-color: var(--red-700);
  --bs-btn-hover-bg: var(--red-100);
  --bs-btn-hover-border-color: var(--red-700);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--red-700);
  --bs-btn-active-border-color: var(--red-700);
}

.btn-outline-light {
  --bs-btn-color: #fff;
  --bs-btn-border-color: var(--blue-300);
  --bs-btn-border-width: 2px;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: rgba(255, 255, 255, 0.1);
  --bs-btn-hover-border-color: #fff;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: rgba(255, 255, 255, 0.16);
  --bs-btn-active-border-color: #fff;
}

/* Leaf green leads on dark grounds. */
.btn-accent {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--lime-400);
  --bs-btn-border-color: var(--lime-400);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--lime-500);
  --bs-btn-hover-border-color: var(--lime-500);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--lime-500);
  --bs-btn-active-border-color: var(--lime-500);
}

/* On leaf-green grounds. */
.btn-ink {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--navy-900);
  --bs-btn-border-color: var(--navy-900);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--ink);
  --bs-btn-hover-border-color: var(--ink);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--ink);
  --bs-btn-active-border-color: var(--ink);
}

.btn-link {
  --bs-btn-color: var(--blue-700);
  --bs-btn-hover-color: var(--navy-900);
  --bs-btn-font-weight: 600;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* ---------- forms ---------- */

.form-label {
  font-weight: 600;
}

.form-control,
.form-select {
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background-color: var(--surface);
  color: var(--ink);
}

.form-control-lg,
.form-select-lg {
  border-radius: var(--radius-control);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--blue-700);
  box-shadow: var(--focus-ring);
}

.form-control::placeholder {
  color: #6E7F94;
}

.form-check-input {
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.15em;
  border: 1.5px solid var(--line-strong);
}

.form-check-input:checked {
  background-color: var(--blue-700);
  border-color: var(--blue-700);
}

.form-check-label {
  line-height: 1.5;
}

.form-range::-webkit-slider-thumb {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.5rem;
  background-color: var(--blue-700);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(5, 42, 79, 0.35);
}

.form-range::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--blue-700);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(5, 42, 79, 0.35);
}

/* Vendor pseudo-elements stay in separate rules: one unknown selector drops the whole list. */
.form-range::-webkit-slider-thumb:active {
  background-color: var(--navy-900);
}

.form-range::-moz-range-thumb:active {
  background-color: var(--navy-900);
}

.form-range::-webkit-slider-runnable-track {
  background-color: var(--line);
}

.form-range::-moz-range-track {
  background-color: var(--line);
}

.form-range:focus::-webkit-slider-thumb {
  box-shadow: var(--focus-ring);
}

.form-range:focus::-moz-range-thumb {
  box-shadow: var(--focus-ring);
}

/* ---------- tables, badges, alerts ---------- */

.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--blue-50);
  --bs-table-border-color: var(--line);
}

.table > thead th {
  color: var(--slate-600);
  font-size: 0.8125rem;
  font-weight: 700;
}

.table-danger {
  --bs-table-color: #8F1C13;
  --bs-table-bg: var(--red-100);
  --bs-table-border-color: #F3C4BF;
}

.badge {
  border-radius: 999px;
}

.alert {
  border-radius: var(--radius-control);
}

/* ---------- brand mark ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
}

/* The logo's two-tone wordmark, on dark grounds: AVI bold, FRIENDLY in the logo's sky blue. */
.brand-name {
  overflow: hidden;
  color: var(--sky-400);
  font-family: var(--font-body);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-name b {
  color: #fff;
  font-weight: 700;
}

/* ---------- public header and footer ---------- */

.site-header,
.site-footer,
.hero,
.staff-header {
  background: var(--navy-900) var(--pattern-adire);
  color: #fff;
}

/* One row at every width: the name truncates rather than pushing the links down. */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.75rem;
}

.site-links {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Phones: a smaller mark and wordmark keep the whole name beside My loan and Apply at 360px. */
@media (max-width: 575.98px) {
  .site-nav .brand {
    gap: 0.5rem;
  }

  .site-nav .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  .site-nav .brand-name {
    font-size: 1.0625rem;
    letter-spacing: 0.01em;
  }

  .site-link {
    padding: 0 0.5rem;
  }
}

.site-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--blue-100);
  font-weight: 600;
  text-decoration: none;
}

.site-link:hover,
.site-link[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.site-links .btn {
  min-height: 44px;
  margin-left: 0.25rem;
}

.site-main {
  flex: 1 0 auto;
}

.site-body {
  padding-block: 1.75rem 3.5rem;
}

.site-footer {
  color: var(--blue-200);
  font-size: 0.9375rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-block: 2rem;
}

.site-footer .brand-name {
  font-size: 1.25rem;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.site-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.site-footer-links a:hover {
  text-decoration: underline;
}

.site-legal {
  flex: 1 1 100%;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid #12406E;
  font-size: 0.875rem;
}

/* The apply form pins its buttons to the bottom of a phone screen; keep the footer clear of them. */
@media (max-width: 575.98px) {
  body:has(.apply-nav:not([hidden])) .site-footer {
    padding-bottom: 5.5rem;
  }
}

/* ---------- home page ---------- */

.hero {
  position: relative;
  overflow: hidden;
}

.hero-steps {
  position: absolute;
  right: 0;
  bottom: -2.5rem;
  width: 40rem;
  max-width: 95%;
  height: auto;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2.5rem 3.5rem;
  padding-block: clamp(1.75rem, 6vw, 5rem) clamp(3rem, 8vw, 6.5rem);
}

.hero-copy {
  flex: 1 1 26rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  margin: 0;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: #0A3A66;
  color: var(--lime-400);
  font-size: 0.875rem;
  font-weight: 700;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.375rem, 5.4vw, 4.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero-lead {
  max-width: 34rem;
  margin: 0;
  color: var(--blue-200);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 575.98px) {
  .hero-actions,
  .hero-actions .btn {
    width: 100%;
  }
}

.hero-card {
  flex: 1 1 20rem;
  min-width: 0;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(2, 16, 32, 0.6);
}

.hero-card-label {
  margin: 0;
  color: var(--slate-600);
  font-size: 0.9375rem;
  font-weight: 600;
}

.hero-card-amount {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.hero-card-amount strong {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.hero-card-amount span {
  color: var(--slate-600);
}

.facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem 1rem;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--blue-100);
}

.facts dt {
  color: var(--slate-600);
  font-weight: 400;
}

.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.facts .facts-total {
  color: var(--ink);
  font-weight: 700;
}

.facts dd.facts-total {
  color: var(--blue-700);
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 800;
}

.hero-card-note {
  margin: 0;
  color: var(--slate-600);
  font-size: 0.875rem;
}

.home-section {
  padding-top: clamp(0.5rem, 3vw, 1.5rem);
}

.section-title {
  margin-bottom: 1.25rem;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.needs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.needs li {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.needs strong {
  display: block;
  font-weight: 600;
}

.needs small {
  display: block;
  color: var(--slate-600);
  font-size: 0.9375rem;
}

.icon-tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: var(--blue-100);
  color: var(--blue-700);
}

.icon-tile svg {
  width: 1.5rem;
  height: 1.5rem;
}

.band-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem 3rem;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border-radius: 28px;
  background: var(--lime-400) var(--pattern-steps);
  color: var(--ink);
}

.band-copy {
  flex: 1 1 22rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.band-copy h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.band-copy p {
  margin: 0;
  color: #1C2E08;
  font-size: 1.125rem;
  line-height: 1.55;
}

.band-rungs {
  flex: 1 1 18rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rung {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: min(100%, 20rem);
  padding: 1.1rem 1.4rem;
  border-radius: 20px;
  background: var(--surface);
}

.rung span {
  color: var(--slate-600);
  font-size: 0.875rem;
}

.rung strong {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.rung-top {
  align-self: flex-end;
  background: var(--navy-900);
  color: #fff;
}

.rung-top span {
  color: var(--blue-300);
}

.rung-top strong {
  color: var(--lime-400);
}

.lookup-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.lookup-card-copy {
  flex: 1 1 20rem;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lookup-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.lookup-card p {
  margin: 0;
  color: var(--slate-600);
}

@media (max-width: 575.98px) {
  .lookup-card .btn {
    width: 100%;
  }
}

/* ---------- privacy policy ---------- */

.policy {
  max-width: 46rem;
  line-height: 1.6;
}

.policy h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.policy-updated {
  color: var(--slate-600);
  font-size: 0.9375rem;
}

.policy h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.375rem;
}

.policy h3 {
  margin: 1.25rem 0 0.4rem;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0;
}

.policy li + li {
  margin-top: 0.35rem;
}

.policy-table {
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.policy-table td:last-child {
  width: 40%;
  font-weight: 600;
}

.policy-contact {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.policy-address {
  white-space: pre-line;
}

/* ---------- staff ---------- */

.staff-header {
  margin-bottom: 1.75rem;
}

.staff-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 0.6rem;
}

.staff-header .brand-mark {
  width: 2rem;
  height: 2rem;
}

.staff-header .brand-name {
  font-size: 1.125rem;
}

.staff-tag {
  flex: none;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--blue-700);
  color: var(--blue-100);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.staff-nav {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.staff-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.75rem;
  border-radius: 10px;
  color: var(--blue-200);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.staff-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.staff-link[aria-current="page"] {
  color: #fff;
  background: var(--blue-700);
}

.staff-main {
  max-width: 48rem;
  padding-bottom: 3rem;
}

.staff-main-wide {
  max-width: none;
}

.staff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.staff-head h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.staff-search {
  flex: 0 1 30rem;
  min-width: 0;
  display: flex;
  gap: 0.5rem;
}

.staff-search .form-control {
  min-height: 44px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.stat-label {
  color: var(--slate-600);
  font-size: 0.875rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.stat-alert {
  border-color: #F3C4BF;
  background: var(--red-100);
}

.stat-alert .stat-label {
  color: #8F1C13;
}

.stat-alert .stat-value {
  color: var(--red-700);
}

.queue-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.queue-tabs {
  display: flex;
  gap: 2px;
  padding: 0 0.75rem;
  overflow-x: auto;
  border-bottom: 1.5px solid var(--blue-100);
}

.queue-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  margin-bottom: -1.5px;
  padding: 0 0.75rem;
  border-bottom: 3px solid transparent;
  color: var(--slate-600);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.queue-tab:hover {
  color: var(--ink);
}

.queue-tab[aria-current="page"] {
  border-bottom-color: var(--blue-700);
  color: var(--ink);
  font-weight: 700;
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.375rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 0.75rem;
  font-weight: 700;
}

.queue-tab[aria-current="page"] .count {
  background: var(--blue-700);
  color: #fff;
}

.queue-tab .count-alert {
  background: var(--red-700);
  color: #fff;
}

.queue-note {
  margin: 0;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--blue-100);
  font-size: 0.9375rem;
}

.queue-empty {
  margin: 0;
  padding: 2.5rem 1.25rem;
  background: var(--pattern-weave);
  color: var(--slate-600);
  text-align: center;
}

.queue-table {
  min-width: 52rem;
  margin: 0;
  font-size: 0.9375rem;
}

.queue-table > thead th {
  padding: 0.75rem;
  background: #F5F9FD;
}

.queue-table > tbody td {
  padding: 0.85rem 0.75rem;
}

.queue-table th:first-child,
.queue-table td:first-child {
  padding-left: 1.25rem;
}

.queue-table th:last-child,
.queue-table td:last-child {
  padding-right: 1.25rem;
}

.queue-ref {
  font-family: var(--font-mono);
  font-weight: 600;
}

.flag-pill {
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: var(--saffron-100);
  color: var(--saffron-800);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 1.625rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  background: #EAF0F6;
  color: var(--slate-600);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
}

.status-submitted { background: var(--saffron-100); color: var(--saffron-800); }
.status-approved { background: var(--blue-100); color: var(--blue-700); }
.status-active { background: var(--leaf-100); color: var(--leaf-700); }
.status-overdue { background: var(--red-700); color: #fff; }
.status-repaid { background: var(--leaf-700); color: #fff; }

.staff-main dd {
  overflow-wrap: break-word;
}

/* ---------- staff on phones ---------- */

@media (max-width: 767.98px) {
  .staff-header {
    margin-bottom: 1.25rem;
  }

  /* Brand and Log out on the first row, the links on a second row that scrolls sideways if it must. */
  .staff-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.75rem;
    padding-bottom: 0.25rem;
  }

  .staff-bar .brand {
    min-width: 0;
  }

  .staff-logout {
    grid-row: 1;
    grid-column: 2;
  }

  .staff-logout .btn {
    min-height: 44px;
  }

  /* Runs to the screen edges, so all four Admin links fit at 360px. */
  .staff-nav {
    grid-row: 2;
    grid-column: 1 / -1;
    margin-inline: calc(var(--bs-gutter-x) * -0.5);
    padding-inline: 0.25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .staff-link {
    flex: none;
    min-height: 44px;
    padding: 0 0.55rem;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  /* Thumb-sized controls, and 16px text in fields so iPhones don't zoom in when one is tapped. */
  .staff-main .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }

  .staff-main .form-control,
  .staff-main .form-select {
    min-height: 44px;
  }

  .staff-main .form-control-sm,
  .staff-main .form-select-sm {
    font-size: 1rem;
  }

  /* The queue first, the totals under it. */
  .dashboard {
    display: flex;
    flex-direction: column;
  }

  .dashboard .stat-grid {
    order: 1;
    margin: 1.25rem 0 0;
  }

  .stat-grid {
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .stat {
    gap: 0.2rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
  }

  .stat-label {
    font-size: 0.8125rem;
  }

  /* Queues as wrapping chips, so the Flagged, Overdue and WhatsApp counts are all in view. */
  .queue-tabs {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.625rem;
    overflow: visible;
  }

  .queue-tab {
    gap: 0.4rem;
    min-height: 44px;
    margin: 0;
    padding: 0 0.7rem;
    border: 1.5px solid var(--blue-100);
    border-radius: 999px;
    font-size: 0.875rem;
  }

  .queue-tab[aria-current="page"] {
    border-color: var(--blue-700);
    background: var(--blue-700);
    color: #fff;
  }

  .queue-tab[aria-current="page"] .count {
    background: #fff;
    color: var(--blue-700);
  }

  /* Each queue row becomes a card; tapping anywhere on it opens the application. */
  .queue-panel .table-responsive {
    overflow: visible;
  }

  .queue-table,
  .queue-table > tbody {
    display: block;
    min-width: 0;
  }

  .queue-table > thead {
    display: none;
  }

  .queue-table > tbody > tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "ref status"
      "name amount"
      "outstanding due"
      "applied applied";
    gap: 0.15rem 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--line);
  }

  .queue-table > tbody > tr:last-child {
    border-bottom: 0;
  }

  .queue-table > tbody > tr > td,
  .queue-table > tbody > tr > td:first-child,
  .queue-table > tbody > tr > td:last-child {
    padding: 0;
    border: 0;
  }

  .queue-table .q-ref { grid-area: ref; }
  .queue-table .q-status { grid-area: status; justify-self: end; }
  .queue-table .q-name { grid-area: name; font-weight: 600; }
  .queue-table .q-amount { grid-area: amount; }
  .queue-table .q-outstanding { grid-area: outstanding; text-align: left !important; }
  .queue-table .q-due { grid-area: due; text-align: right; }
  .queue-table .q-applied { grid-area: applied; }

  .queue-table .q-outstanding,
  .queue-table .q-due,
  .queue-table .q-applied {
    color: var(--slate-600);
    font-size: 0.8125rem;
  }

  .queue-table .q-outstanding:empty,
  .queue-table .q-due:empty {
    display: none;
  }

  .queue-table td[data-label]::before {
    content: attr(data-label) " ";
    font-family: var(--font-body);
  }

  .queue-ref::after {
    content: "";
    position: absolute;
    inset: 0;
  }

  /* Tables marked table-stack: one block per row, labelled cells, no sideways scrolling. */
  .table-stack,
  .table-stack > tbody,
  .table-stack > tbody > tr,
  .table-stack > tbody > tr > td {
    display: block;
    width: 100%;
  }

  .table-stack > thead {
    display: none;
  }

  .table-stack > tbody > tr {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--line);
  }

  .table.table-stack > tbody > tr > td {
    padding: 0.1rem 0;
    border: 0;
    text-align: left !important;
  }

  .table-stack > tbody > tr > td:empty {
    display: none;
  }

  .table-stack > tbody > tr > td:has(form) {
    padding-top: 0.4rem;
  }

  .table-stack td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--slate-600);
  }

  .whatsapp-skip {
    flex: 1 1 15rem;
  }
}

/* ---------- install strip (both sites; install.js shows it) ---------- */

.install-bar {
  background: var(--blue-100);
  color: var(--ink);
}

.install-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.5rem;
}

.install-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.install-text {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.install-share {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
}

.install-button {
  flex: none;
  min-height: 44px;
  padding-inline: 1rem;
}

.install-close {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -0.5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--slate-600);
  font-size: 1.75rem;
  line-height: 1;
}

.install-close:hover {
  background: rgba(5, 42, 79, 0.08);
  color: var(--ink);
}
