:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #d8dee9;
  --text: #1a2332;
  --muted: #5c6778;
  --primary: #0b4f8a;
  --primary-hover: #093d6b;
  --accent: #c8922e;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(26, 35, 50, 0.08);
  --page-max: 1180px;
  --page-gutter: 0.5rem;
  --shell-padding: 0.5rem;
  --control-height: 40px;
  --control-radius: 8px;
  --control-border-color: #cfd8e3;
  --control-bg: #ffffff;
  --control-font-size: 0.9375rem;
  --control-shadow: 0 1px 2px rgba(26, 35, 50, 0.04);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.site-header {
  background: linear-gradient(135deg, #0b4f8a 0%, #1565a8 100%);
  color: #fff;
  padding: 0.65rem var(--page-gutter) 0.75rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  max-width: var(--page-max);
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.header-logo {
  display: block;
  height: 2.75rem;
  width: auto;
  max-width: 5.5rem;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
}

.header-note {
  margin: 0.75rem 0 0;
  max-width: 42rem;
  font-size: 0.9rem;
  opacity: 0.92;
}

.header-auth {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
  margin-left: auto;
  max-width: min(100%, 28rem);
  text-align: right;
}

#auth-signed-in:not([hidden]) {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
}

.header-mock-role {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  max-width: none;
  text-align: right;
}

.auth-user-block {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.5rem;
}

.auth-user-label {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-dev-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.header-tool-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.header-tool-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.55);
}

.header-tool-btn--active {
  color: #f0c14b;
  border-color: #f0c14b;
  background: rgba(240, 193, 75, 0.12);
}

.header-tool-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c8922e;
  color: #1a2332;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.header-impersonate-banner {
  margin: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(240, 193, 75, 0.2);
  border: 1px solid rgba(240, 193, 75, 0.45);
  color: #fff7e0;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.request-log-body {
  max-height: min(50vh, 420px);
  overflow: auto;
}

.request-log-text {
  margin: 0;
  padding: 0.75rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.request-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.request-log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 2fr);
  gap: 0.5rem 0.65rem;
  align-items: baseline;
  padding: 0.45rem 0.65rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.request-log-row--error {
  border-color: #e8b4b4;
  background: #fff8f8;
}

.request-log-meta {
  color: #5a6b7d;
  white-space: nowrap;
}

.request-log-url {
  color: var(--primary, #0b4f8a);
  text-decoration: underline;
  word-break: break-all;
  cursor: pointer;
}

.request-log-url:hover {
  text-decoration: none;
}

.request-log-note {
  grid-column: 1 / -1;
  color: #8a4a4a;
  font-size: 0.68rem;
}

.people-picker {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.people-picker-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border, #c5d3e0);
  background: #eef4fa;
}

.people-picker-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.people-picker-combobox {
  flex: 1;
  min-width: 0;
}

.people-picker-name-input {
  flex: 1;
  min-width: 0;
}

.people-picker--compact .people-picker-avatar {
  width: 36px;
  height: 36px;
}

.people-picker--compact {
  align-items: center;
}

.people-picker-list [role="option"] {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.people-picker-list .people-picker-option-photo {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef4fa;
  border: 1px solid #d8e2ec;
}

.people-picker-list .people-picker-option-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.people-picker-list .people-picker-option-name {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.people-picker-list .people-picker-option-meta {
  font-size: 0.75rem;
  color: #5a6b7d;
  line-height: 1.25;
}

.people-picker-list .combobox-empty {
  padding: 0.55rem 0.65rem;
}

.role-switch-dialog {
  max-width: 22rem;
}

.role-switch-lead {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.role-switch-options {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.role-switch-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.role-switch-option:hover {
  background: #eef3f9;
  border-color: #b8c4d4;
}

.role-switch-option.is-active {
  border-color: var(--primary);
  background: #eef4fb;
  box-shadow: 0 0 0 1px rgba(11, 79, 138, 0.12);
}

.role-switch-option-label {
  font-weight: 600;
}

.role-switch-unassigned {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: none;
}

.role-switch-current {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
}

.auth-sign-in-btn {
  white-space: nowrap;
}

.site-header .auth-sign-out-btn.btn {
  margin: 0;
  min-height: auto;
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  white-space: nowrap;
}

.site-header .auth-sign-out-btn.btn:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: #fff;
  color: #fff;
  text-decoration: none;
}

.site-header .auth-sign-out-btn.btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/**
 * When the "Not available" gate is showing it owns sign-out; the header copy would be a
 * duplicate control, so hide it (see js/user-profile.js applyAccessUnavailable).
 */
body.app-access-unavailable .site-header #btn-sign-out {
  display: none;
}

.auth-error {
  margin: 0;
  font-size: 0.8rem;
  color: #ffd4d4;
  max-width: 18rem;
  line-height: 1.35;
}

.auth-gate {
  margin-bottom: 1rem;
}

.auth-gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  max-width: 28rem;
  margin: 0 auto;
  text-align: center;
}

.auth-gate-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.auth-gate-card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.header-mock-role label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

.header-auth select,
.header-mock-role select {
  min-width: 12rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 0.9rem;
}

.header-mock-hint {
  margin: 0;
  font-size: 0.78rem;
  opacity: 0.8;
  max-width: 16rem;
  line-height: 1.35;
}

.layout {
  max-width: var(--page-max);
  margin: 0 auto 0.65rem;
  padding: 0.4rem var(--page-gutter) 0.65rem;
}

/* Hide main chrome until auth + initial view are ready (avoids tab/form flash). */
body.app-is-booting .app-shell {
  opacity: 0;
  pointer-events: none;
}

body.app-is-ready .app-shell {
  opacity: 1;
  transition: opacity 0.12s ease-out;
}

.app-shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-shell-body {
  flex: 1 1 auto;
  min-width: 0;
}

.view-nav:not([hidden]) {
  display: flex;
}

.view-nav {
  flex-direction: column;
  flex-shrink: 0;
  width: 3rem;
  background: #e3ebf5;
  border-right: 2px solid rgba(11, 79, 138, 0.22);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.65);
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 30;
  min-height: 100%;
  padding: 0.4rem 0.35rem;
  box-sizing: border-box;
}

.view-nav-icons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.view-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(11, 79, 138, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--primary);
  cursor: pointer;
  box-shadow: none;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.view-nav-item svg {
  display: block;
}

.view-nav-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.view-nav-item:not(.active):hover {
  background: #fff;
  border-color: rgba(11, 79, 138, 0.35);
}

.view-nav-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.view-nav-item[hidden] {
  display: none !important;
}

.view-panel {
  background: var(--surface);
  border: none;
  border-radius: 0;
  padding: var(--shell-padding);
  box-shadow: none;
}

.view-panel[hidden] {
  display: none !important;
}

.app-shell--applicant-landing .app-shell-body {
  min-height: min(420px, calc(100dvh - 12rem));
  display: flex;
  align-items: center;
  justify-content: center;
}

.applicant-landing {
  width: 100%;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  box-sizing: border-box;
}

.applicant-landing-card {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 55%);
  box-shadow: var(--shadow);
}

.applicant-landing-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  background: #e8f0fa;
  color: var(--primary);
}

.applicant-landing-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.25rem, 3vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.applicant-landing-lead {
  margin: 0 auto 1.35rem;
  max-width: 28rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.applicant-landing-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

@media (min-width: 480px) {
  .applicant-landing-actions {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }

  .applicant-landing-actions .btn {
    min-width: 11rem;
  }
}

#view-apply.view-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.35rem 0.45rem 0;
}

/* Apply view: keep header + actions in view; scroll fields only */
body.form-sticky-active {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

body.form-sticky-active .site-header {
  flex-shrink: 0;
}

body.form-sticky-active .layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* margin: 0 auto shrinks flex items to content width — match header column instead */
  margin: 0;
  align-self: center;
  width: min(100%, var(--page-max));
  box-sizing: border-box;
}

body.form-sticky-active .app-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  width: 100%;
}

body.form-sticky-active .view-nav {
  flex-shrink: 0;
  align-self: stretch;
}

body.form-sticky-active .app-shell-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.form-sticky-active #view-apply.view-panel:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

body.form-sticky-active .apply-form {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0;
}

body.form-sticky-active .apply-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-bottom: 0;
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
}

body.form-sticky-active .apply-form-fields {
  scrollbar-gutter: stable;
}

.wizard-form,
.apply-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  margin: 0;
  width: 100%;
}

.apply-form-intro {
  flex-shrink: 0;
  margin-bottom: 0.4rem;
  padding: 0;
}

.apply-intro-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.apply-intro-header--draft {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem 1rem;
  flex-wrap: nowrap;
}

.apply-intro-header--draft .apply-intro-header-leading {
  justify-self: start;
}

.apply-intro-header--draft .apply-draft-header-message {
  justify-self: center;
}

.apply-intro-header--draft .apply-intro-header-actions {
  justify-self: end;
  margin-left: 0;
}

.apply-intro-header--draft .apply-view-status--header-end {
  display: none;
}

.apply-intro-header--review {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem 1rem;
  flex-wrap: nowrap;
}

.apply-intro-header--review .apply-intro-header-leading {
  justify-self: start;
}

.apply-intro-header--review .apply-review-header-message {
  justify-self: center;
}

.apply-intro-header--review .apply-view-status--header-end {
  margin-left: 0;
  justify-self: end;
}

.apply-intro-header--review .apply-intro-header-actions {
  display: none;
}

.apply-intro-header-leading {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.apply-draft-header-badge {
  flex-shrink: 0;
}

.apply-draft-header-badge .status-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
}

.apply-intro-banner-message {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.35;
  min-width: 0;
}

.apply-intro-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.apply-intro-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem 0.75rem;
  min-width: 0;
  flex: 0 1 auto;
}

.apply-intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(11, 79, 138, 0.08);
  border: 1px solid rgba(11, 79, 138, 0.18);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0;
}

.apply-form-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.apply-form-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.apply-view-status--inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  min-width: 0;
}

.apply-view-status--header-end {
  margin-left: auto;
  justify-content: flex-end;
  text-align: right;
}

.apply-view-status-meta {
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.35;
}

.apply-view-status--inline .status-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
}

.apply-approver-blocked {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #f0caca;
  border-radius: 8px;
  background: #fff5f5;
  color: #7f1d1d;
  font-size: 0.875rem;
  line-height: 1.45;
}

.apply-form-actions .btn-danger-outline {
  border-color: #dc2626;
  color: #b91c1c;
}

.apply-form-actions .btn-danger-outline:hover {
  background: #fef2f2;
}

.field-item .field-item--admin-approve-ack .field-label,
.field-item--admin-approve-ack .field-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.field-item .admin-approve-ack-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 35px;
  margin: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.3;
  color: #0f172a;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.field-item .admin-approve-ack-option:hover {
  border-color: #94a3b8;
}

.field-item .admin-approve-ack-option input {
  margin: 0;
  flex-shrink: 0;
}

.apply-required-notice {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  white-space: nowrap;
}

.apply-form-fields {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 0.3rem;
}

/* Compact Structured Form Section Cards */
.form-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 0.65rem 0.95rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px -1px rgba(15, 23, 42, 0.05);
}

.form-card .field-row:first-of-type {
  margin-top: 0;
}

.form-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #f1f5f9;
}

.form-card-icon-pill {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(11, 79, 138, 0.1) 0%, rgba(21, 101, 168, 0.05) 100%);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-card-header-text {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-card-title {
  margin: 0;
  font-size: 0.825rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.form-card-desc {
  margin: 0;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.3;
}

.apply-section-note {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

/* Compact Applicant Choice Selectable Cards */
.form-card.applicant-type-card-group {
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.5rem;
  background: #f8fafc;
}

/**
 * Three classification checkboxes on one horizontal row. Scoped with .field-row so it wins over
 * the later .field-row.two-col rule (the element carries both classes).
 */
.field-row.applicant-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0;
  align-items: stretch;
}

.field-row.applicant-type-grid .applicant-choice-card {
  height: 100%;
}

/** School/dept (personal) or department name (department application) — one full-width field. */
.field-row.workflow-dept-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem 1rem;
}

.applicant-choice-card {
  position: relative;
  display: flex;
  align-items: center;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  padding: 0.35rem 0.65rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.applicant-choice-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.choice-card-content {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
}

.choice-indicator {
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  transition: all 0.15s ease;
}

.choice-indicator .check-icon {
  width: 10px;
  height: 10px;
  transition: transform 0.15s ease;
  transform: scale(0.6);
}

.choice-text {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.choice-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.applicant-choice-card:hover {
  border-color: #94a3b8;
  background: #ffffff;
}

.applicant-choice-card:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.applicant-choice-card:has(input:checked) {
  border-color: var(--primary);
  background: #f0f6fc;
  box-shadow: 0 0 0 1px var(--primary);
}

.applicant-choice-card:has(input:checked) .choice-indicator {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.applicant-choice-card:has(input:checked) .choice-indicator .check-icon {
  transform: scale(1);
}

.applicant-choice-card:has(input:checked) .choice-title {
  color: var(--primary);
}

.field-row.step0-applicant-type.is-invalid-group .applicant-choice-card {
  border-color: #f04438;
  background-color: #fffbfa;
}

.field-row.step0-applicant-type.is-invalid-group .applicant-choice-card .choice-indicator {
  border-color: #f04438;
}

/* Field Items and Layout Grid */
.field-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.field-item label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.field-item label .req {
  color: #dc2626;
  font-weight: 700;
  margin-left: 0.15rem;
}

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
#application-form select,
#application-form textarea {
  min-height: 35px;
  height: 35px;
  padding: 0.35rem 0.65rem;
  font-size: 0.875rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
#application-form select:hover {
  border-color: #94a3b8;
}

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
#application-form select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 79, 138, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
}

#application-form select {
  padding-right: 1.85rem;
  background-position: right 0.65rem center;
}

#application-form input::placeholder {
  color: #94a3b8;
  font-size: 0.84rem;
}

.employee-ident-layout {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.65rem 0.85rem;
  align-items: stretch;
  margin-top: 0.85rem;
}

.employee-ident-fields {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.employee-ident-fields .field-row {
  margin-top: 0;
}

.field-row.name-row {
  grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
  gap: 0.45rem 0.65rem;
  align-items: end;
}

.applicant-avatar-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  align-self: stretch;
  border-radius: 14px;
  overflow: hidden;
  background: #eef4fa;
  border: 1px solid #c5d3e0;
  color: #93a7bd;
  flex-shrink: 0;
}

.applicant-avatar-box img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.applicant-avatar-box.has-photo img {
  display: block;
}

.applicant-avatar-box.has-photo svg {
  display: none;
}

.field-row.three-col.employee-district-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.85fr);
  gap: 0.45rem 0.65rem;
}

.field-row.three-col.address-three-col {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0.45rem 0.65rem;
}

/* Form Action Bar */
.apply-form--readonly input:disabled,
.apply-form--readonly select:disabled,
.apply-form--readonly textarea:disabled {
  opacity: 1;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  cursor: default;
  background: #f6f8fb;
  border-color: #e2e8f0;
}

#application-form input[name="adminPrintedName"][readonly],
#application-form input[name="adminTitle"][readonly],
#application-form input[name="firstName"][readonly],
#application-form input[name="lastName"][readonly],
#application-form input[name="employeeId"][readonly],
#application-form input[name="birthDate"][readonly],
#application-form input[name="schoolDept"][readonly],
#application-form input[name="principalSupervisor"][readonly] {
  cursor: default;
  background: #f6f8fb;
  border-color: #e2e8f0;
}

.apply-form--readonly .applicant-choice-card {
  pointer-events: none;
  cursor: default;
}

.apply-form--readonly .applicant-choice-card input:disabled {
  background: transparent;
}

.field-combobox-wrap {
  position: relative;
}

.rc-combobox,
.org-rc-combobox {
  position: relative;
}

.rc-combobox input.is-loading,
.org-rc-combobox input.is-loading {
  background-image: linear-gradient(90deg, transparent, rgba(11, 79, 138, 0.06), transparent);
  background-size: 200% 100%;
  animation: org-rc-shimmer 1.2s ease-in-out infinite;
}

@keyframes org-rc-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.combobox-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #c5d3e0;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15, 35, 55, 0.12);
}

.combobox-list.is-open {
  display: block;
}

.combobox-list [role="option"] {
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  cursor: pointer;
  line-height: 1.35;
}

.combobox-list [role="option"][aria-selected="true"],
.combobox-list [role="option"]:hover {
  background: #eef4fa;
}

.combobox-list .combobox-empty {
  padding: 0.55rem 0.65rem;
  color: #5a6b7d;
  font-size: 0.8125rem;
}

.apply-form--prefill-locked input.is-prefill-locked:read-only,
.apply-form--prefill-locked select.is-prefill-locked:disabled,
.apply-form--prefill-locked textarea.is-prefill-locked:read-only {
  opacity: 1;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  cursor: default;
  background: #f6f8fb;
  border-color: #e2e8f0;
}

.apply-form-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.45rem 0 0;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 0 0 9px 9px;
}

.apply-form-actions #btn-apply-view-back {
  margin-right: auto;
}

.apply-form-actions #btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  min-height: 33px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: all 0.15s ease;
}

.apply-form-actions #btn-reset:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.apply-form-actions #btn-save-draft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.95rem;
  min-height: 33px;
  font-size: 0.82rem;
  font-weight: 600;
}

.apply-form-actions #btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 1.1rem;
  min-height: 33px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #0b4f8a 0%, #083c6c 100%);
  border: 1px solid #083c6c;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(11, 79, 138, 0.25);
  transition: all 0.15s ease;
}

.apply-form-actions #btn-submit:hover {
  background: linear-gradient(135deg, #0d5aa0 0%, #0a477d 100%);
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(11, 79, 138, 0.3);
}

.apply-form-actions #btn-submit:active {
  transform: translateY(0);
}

@media (max-width: 680px) {
  .apply-intro-header:not(.apply-intro-header--draft) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .apply-intro-header:not(.apply-intro-header--draft) .apply-intro-header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .apply-intro-header--draft,
  .apply-intro-header--review {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.45rem 0.5rem;
  }
  .apply-intro-header--draft .apply-intro-banner-message,
  .apply-intro-header--review .apply-intro-banner-message {
    font-size: 0.7rem;
  }
  .field-row.applicant-type-grid {
    grid-template-columns: 1fr;
  }
  .employee-ident-layout {
    grid-template-columns: 1fr;
  }
  .employee-ident-layout .applicant-avatar-box {
    width: 6.2rem;
    height: 6.2rem;
    min-height: 0;
    justify-self: start;
  }
  .field-row.name-row {
    grid-template-columns: 1fr;
  }
  .field-row.name-row .field-mi input {
    text-align: left;
  }
  .field-row.two-col {
    grid-template-columns: 1fr;
  }
  .field-row.three-col.employee-district-row,
  .field-row.three-col.address-three-col {
    grid-template-columns: 1fr;
  }
  .form-card {
    padding: 0.65rem 0.75rem;
  }
}

.config-panel {
  max-width: 36rem;
  padding: 0.25rem 0 1.5rem;
}

.config-panel-wide {
  max-width: 56rem;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(10.5rem, 12.5rem) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

.config-layout.config-layout--no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.config-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: sticky;
  top: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f6f8fb;
}

.config-nav-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.config-nav-item:hover {
  background: rgba(255, 255, 255, 0.75);
}

.config-nav-item.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.06);
}

.config-main {
  min-width: 0;
}

.config-section-panel[hidden] {
  display: none !important;
}

.config-section-panel {
  margin-bottom: 0.5rem;
}

.config-section-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e8edf3;
}

.purchasing-defaults-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0;
}

.purchasing-defaults-add-bar {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

#config-section-payment-import .purchasing-defaults-add-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

#config-section-payment-import .purchasing-defaults-add-label {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

#config-section-payment-import .purchasing-defaults-add-controls {
  flex: 0 1 auto;
  flex-wrap: nowrap;
}

#config-section-payment-import .purchasing-defaults-add-controls select {
  flex: 0 1 18rem;
  width: min(100%, 18rem);
}

.purchasing-defaults-add-label {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.purchasing-defaults-add-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
}

.purchasing-defaults-add-controls select {
  flex: 1 1 16rem;
  min-width: 0;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--control-shadow);
}

.purchasing-defaults-add-controls select:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.purchasing-defaults-add-controls .btn {
  flex: 0 0 auto;
  min-height: var(--control-height);
  padding-left: 1rem;
  padding-right: 1rem;
  white-space: nowrap;
}

.purchasing-defaults-table-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.purchasing-defaults-table-wrap:not(:has(.purchasing-default-row)) .purchasing-defaults-table-head {
  display: none;
}

.purchasing-defaults-table-head {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10rem) minmax(0, 1fr) 2.5rem;
  gap: 0.5rem 0.65rem;
  align-items: center;
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f9fafb 0%, #f1f4f8 100%);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.purchasing-defaults-head-actions {
  text-align: center;
}

.purchasing-defaults-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.purchasing-defaults-list:focus-visible {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: -2px;
}

/* Export Schema Mapping: fill viewport; scroll column/rule rows only */
#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 10.5rem);
  overflow: hidden;
}

#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) .config-panel-wide {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.35rem;
  max-width: min(72rem, 100%);
}

#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) .config-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) .config-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) .config-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#config-section-payment-import:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#config-section-payment-import .purchasing-defaults-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#config-section-payment-import .purchasing-defaults-add-bar,
#config-section-payment-import .config-section-heading,
#config-section-payment-import .purchasing-defaults-rules-lead {
  flex-shrink: 0;
}

#config-section-payment-import .config-section-heading {
  margin-bottom: 0.5rem;
}

#config-section-payment-import .purchasing-defaults-rules-lead {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
}

#config-section-payment-import .purchasing-defaults-list {
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
}

#config-section-payment-import .purchasing-defaults-table-wrap {
  flex: 1 1 auto;
  min-height: 4rem;
}

#config-section-payment-import .purchasing-defaults-list:has(.purchasing-default-row) {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 10.5rem);
  overflow: hidden;
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) .config-panel-wide {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0.35rem;
  max-width: min(72rem, 100%);
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) .config-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) .config-layout {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) .config-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#config-section-role-access:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

#config-section-role-access .config-section-title,
#config-section-role-access .config-section-lead,
#config-section-role-access .acl-add-card,
#config-section-role-access .acl-list-toolbar {
  flex-shrink: 0;
}

#view-config:not([hidden]):has(#config-section-role-access:not([hidden])) .config-form-actions {
  display: none;
}

#view-config:not([hidden]):has(#config-section-payment-import:not([hidden])) .config-form-actions {
  display: flex;
  flex-shrink: 0;
  margin-top: 0.5rem;
  padding: 0.65rem 0 0.25rem;
  border-top: 1px solid #e8edf3;
  background: var(--surface);
}

.purchasing-defaults-list.config-readonly .purchasing-default-rule-add,
.purchasing-defaults-list.config-readonly .purchasing-default-rule-chip-remove,
.purchasing-defaults-list.config-readonly .purchasing-default-rule-chip-editable {
  pointer-events: none;
}

.purchasing-defaults-list.config-readonly .purchasing-default-row-actions {
  display: none;
}

.purchasing-defaults-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}

.purchasing-defaults-empty p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.purchasing-defaults-empty-hint {
  margin-top: 0.35rem !important;
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
  color: var(--muted) !important;
  max-width: 26rem;
  margin-left: auto !important;
  margin-right: auto !important;
  line-height: 1.45;
}

.purchasing-default-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(7.5rem, 10rem) minmax(0, 1fr) 2.5rem;
  column-gap: 0.65rem;
  row-gap: 0;
  align-items: start;
  padding: 0.45rem 0.75rem 0.45rem 0.85rem;
  border-bottom: 1px solid #e8edf3;
  background: transparent;
}

.purchasing-default-row::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  pointer-events: none;
}

#config-section-payment-import .purchasing-defaults-list .purchasing-default-row::before {
  left: -0.85rem;
  right: calc(-0.75rem - 0.35rem);
}

.purchasing-default-row > * {
  position: relative;
  z-index: 1;
}

.purchasing-default-row:last-child {
  border-bottom: none;
}

.purchasing-default-row:hover::before {
  background: #fafbfc;
}

.purchasing-default-row--invalid::before,
.purchasing-default-row--invalid:hover::before {
  background: #fff8f7;
}

.purchasing-default-row--focused::before {
  outline: 2px solid rgba(11, 79, 138, 0.45);
  outline-offset: -2px;
}

.purchasing-config-validation-jump {
  font-size: inherit;
  font-weight: 600;
  padding: 0;
  vertical-align: baseline;
}

.purchasing-default-label {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  min-width: 0;
  padding-top: 0.15rem;
  padding-right: 0;
}

.purchasing-default-row-actions {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-left: 0.5rem;
  margin-left: 0;
  border-left: 1px solid #e8edf3;
  align-self: stretch;
  background: transparent;
}

.purchasing-default-row--invalid .purchasing-default-row-actions {
  border-left-color: #ecd4d0;
}

.purchasing-default-row-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  margin-top: 0;
  border-radius: 8px;
  font-size: 1rem;
  color: var(--muted);
  transition: color 0.12s ease, background-color 0.12s ease;
}

.purchasing-default-row-remove:hover,
.purchasing-default-row-remove:focus-visible {
  color: var(--danger);
  background: #fef3f2;
  outline: none;
}

.purchasing-default-row-remove-icon {
  display: block;
}

.purchasing-default-letter {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 2.125rem;
  height: 1.625rem;
  padding: 0 0.45rem;
  border-radius: 6px;
  background: #e7eef6;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.purchasing-default-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.purchasing-default-value-wrap {
  min-width: 0;
}

#config-section-payment-import .purchasing-default-value {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  font: inherit;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: var(--control-shadow);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

#config-section-payment-import .purchasing-default-value:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

#config-section-payment-import .purchasing-default-value.field-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(180, 35, 24, 0.12);
}

.purchasing-default-error {
  margin: 0 0 0.4rem;
  padding: 0;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
}

.purchasing-default-error[hidden] {
  display: none;
  margin: 0;
}

.purchasing-default-rules {
  min-width: 0;
  padding: 0;
  background: transparent;
}

.purchasing-default-rule-chip--default-value {
  border-color: #c5d4e8;
  background: linear-gradient(180deg, #f4f8fc 0%, #e8f0fa 100%);
}

.purchasing-default-rule-chip--invalid {
  border-color: #e8a8a0;
  background: #fef3f2;
  color: #b42318;
  box-shadow: 0 0 0 1px rgba(180, 35, 24, 0.15);
}

.purchasing-default-rule-chip--invalid .purchasing-default-rule-chip-remove {
  color: #b42318;
}

.purchasing-default-rule-chip-editable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.purchasing-default-rule-chip-editable:hover,
.purchasing-default-rule-chip-editable:focus-visible {
  color: var(--primary, #1a5fb4);
}

.purchasing-default-rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
  min-height: 0;
}

.purchasing-default-rule-chips:empty::before {
  content: "None";
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.purchasing-default-rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  padding: 0.15rem 0.35rem 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef4fa;
  border: 1px solid #c5d8eb;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
}

.purchasing-default-rule-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchasing-default-rule-chip-remove {
  flex-shrink: 0;
  margin: 0;
  padding: 0 0.2rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.purchasing-default-rule-chip-remove:hover {
  color: var(--danger);
}

.purchasing-default-rule-add {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  box-sizing: border-box;
}

#config-section-payment-import .purchasing-default-rule-picker {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.purchasing-default-rule-picker {
  width: 100%;
  min-width: 0;
  height: 1.85rem;
  padding: 0 0.45rem;
  font-size: 0.72rem;
  border: 1px solid var(--control-border-color);
  border-radius: 6px;
  box-sizing: border-box;
}

#purchasing-rule-param-dialog .purchasing-rule-param-secondary:not([hidden]) {
  display: block;
  width: 100%;
  margin-bottom: 0.65rem;
  box-sizing: border-box;
}

.purchasing-format-preview-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.75rem 0 0.35rem;
}

.purchasing-format-preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.purchasing-format-preview {
  font-size: 1rem;
  letter-spacing: 0.06em;
  word-break: break-all;
  padding: 0.35rem 0.5rem;
  background: var(--surface-alt, #f4f6f8);
  border-radius: 6px;
  border: 1px solid var(--border, #dde3ea);
}

.purchasing-format-legend {
  margin-bottom: 0.85rem;
}

.purchasing-format-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.purchasing-format-slot-actions .btn.secondary {
  font-size: 0.72rem;
  padding: 0.35rem 0.55rem;
}

.purchasing-format-fixed-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.purchasing-format-fixed-char {
  width: 2.25rem;
  text-align: center;
  font-weight: 600;
}

.purchasing-format-slot-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.purchasing-format-slot-toolbar .btn.secondary {
  font-size: 0.68rem;
}

.purchasing-format-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 2rem;
  padding: 0.5rem;
  border: 1px dashed var(--border, #cdd5df);
  border-radius: 8px;
  background: #fafbfc;
}

.purchasing-format-slot-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: var(--primary, #1a4d8f);
  background: #e8f0fa;
  border-radius: 4px;
  border: 1px solid #c5d8ef;
}

#config-section-payment-import .purchasing-default-rule-add-btn.btn {
  flex: 0 0 auto;
  height: 1.85rem;
  min-height: 1.85rem;
  max-height: 1.85rem;
  padding: 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 6px;
  white-space: nowrap;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .purchasing-defaults-table-head {
    display: none;
  }

  #config-section-payment-import .purchasing-defaults-add-bar {
    flex-direction: column;
    align-items: stretch;
  }

  #config-section-payment-import .purchasing-defaults-add-controls select {
    width: 100%;
    flex: 1 1 auto;
  }

  #config-section-payment-import .purchasing-default-rule-picker {
    width: 100%;
    flex: 1 1 auto;
  }

  .purchasing-default-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label remove"
      "rules rules";
    column-gap: 0.65rem;
    row-gap: 0.5rem;
    padding: 0.85rem 1rem;
  }

  #config-section-payment-import .purchasing-defaults-list .purchasing-default-row::before {
    left: -1rem;
    right: calc(-1rem - 0.35rem);
  }

  .purchasing-default-label {
    grid-area: label;
  }

  .purchasing-default-rules {
    grid-area: rules;
  }

  .purchasing-default-row-actions {
    grid-area: remove;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    align-self: start;
  }
}

.config-section {
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #e8edf3;
}

.config-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 1rem;
}

.config-section-heading {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
}

.config-section-heading .config-section-title {
  margin: 0;
}

.config-section-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--primary);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.config-section-info-btn:hover,
.config-section-info-btn:focus-visible {
  background: #d4e3f4;
  color: var(--primary);
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
}

.config-section-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.config-section-lead {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 44rem;
}

.acl-list-toolbar {
  margin: 0.75rem 0 0.5rem;
}

.acl-list-search {
  width: 100%;
  max-width: 22rem;
  min-height: 36px;
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.acl-list-search:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

.acl-table-wrap--loading {
  position: relative;
  min-height: 4rem;
}

.acl-table-wrap--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

.acl-table-wrap--loading::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: submission-spin 0.75s linear infinite;
  pointer-events: none;
}

.acl-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.acl-table-wrap {
  flex: 1 1 auto;
  min-height: 8.75rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: #b9c7d6 transparent;
}

.acl-list-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  flex-shrink: 0;
  padding: 0.15rem 0 0;
}

.acl-list-page-info {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.acl-list-page-buttons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.acl-list-page-btn {
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.35rem 0.65rem;
  min-height: auto;
  border: 1px solid #c5d4e4;
  border-radius: 6px;
  background: #fff;
  line-height: 1.2;
}

.acl-list-page-btn:hover:not(:disabled) {
  background: #eef4fa;
  border-color: var(--primary);
}

.acl-list-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.acl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.acl-table th,
.acl-table td {
  padding: 0.55rem 0.75rem;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid #e8edf3;
}

.acl-table thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: linear-gradient(180deg, #f9fafb 0%, #f1f4f8 100%);
}

.acl-table tbody tr:last-child th,
.acl-table tbody tr:last-child td {
  border-bottom: none;
}

.acl-table tbody tr:hover td,
.acl-table tbody tr:hover th.acl-user-name {
  background: #fafbfc;
}

.acl-role-badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.625rem;
  padding: 0 0.35rem;
  border-radius: 6px;
  background: #e7eef6;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

.acl-role-text {
  padding-top: 0.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.acl-add-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  box-shadow: var(--shadow);
}

.acl-add-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 1.4fr) minmax(12rem, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

.acl-add-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.acl-add-grid .field-item {
  margin: 0;
}

.acl-add-card input[type="text"],
.acl-add-card select.acl-role-type-select {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-height);
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background-color: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--control-font-size);
  line-height: 1.35;
  box-shadow: var(--control-shadow);
}

.acl-add-card input[type="text"]:focus,
.acl-add-card select.acl-role-type-select:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.acl-add-card input[type="text"]::placeholder {
  color: #7a8797;
}

.acl-role-checks {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.acl-role-checks legend {
  padding: 0;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.acl-role-checks .checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 0;
  margin: 0 0 0.3rem;
  padding: 0.1rem 0;
  font-size: 0.85rem;
}

.acl-role-checks .checkbox-field input[type="checkbox"] {
  margin-top: 0;
}

.acl-role-checks .checkbox-field:last-child {
  margin-bottom: 0;
}

.acl-add-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-top: 0.85rem;
}

.acl-add-actions .btn {
  min-height: var(--control-height);
}

.acl-add-status {
  margin: 0;
  font-size: 0.78rem;
}

.acl-add-status--error {
  color: #b42318;
}

.acl-table th,
.acl-table td {
  vertical-align: middle;
}

.acl-table tbody th.acl-user-name {
  font-weight: 600;
  background: #fff;
}

.acl-user-name-label {
  display: block;
  font-size: 0.875rem;
  line-height: 1.35;
}

.acl-user-name-meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}

.acl-user-job-title {
  font-size: 0.8125rem;
  color: #334155;
  vertical-align: middle;
  max-width: 14rem;
}

.acl-user-role-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  vertical-align: middle;
}

.acl-role-toggle-cell,
.acl-role-toggle {
  text-align: center;
}

.acl-role-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.acl-role-toggle-cell {
  width: 8.5rem;
}

.acl-remove-cell {
  width: 2.5rem;
  text-align: right;
}

.acl-empty {
  margin: 0;
  padding: 1rem 0.9rem;
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--muted);
}

.acl-empty[hidden] {
  display: none;
}

.acl-role-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 0.85rem;
  /**
   * Each role column shows at least three members, then grows to fill whatever
   * vertical space the window has left. Members beyond that scroll inside the column.
   */
  --acl-role-member-height: 2.7rem;
  --acl-role-member-gap: 0.35rem;
  --acl-role-list-min: calc(
    3 * var(--acl-role-member-height) + 2 * var(--acl-role-member-gap)
  );
  --acl-role-list-max: max(var(--acl-role-list-min), calc(100vh - 34rem));
}

.acl-role-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.acl-role-column-title {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.55rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e8edf3;
  font-size: 0.8125rem;
}

.acl-role-member-list {
  list-style: none;
  flex: 0 1 auto;
  min-height: var(--acl-role-list-min);
  max-height: var(--acl-role-list-max);
  margin: 0;
  padding: 0 0.2rem 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b9c7d6 transparent;
  display: flex;
  flex-direction: column;
  gap: var(--acl-role-member-gap);
}

.acl-role-member-list::-webkit-scrollbar {
  width: 8px;
}

.acl-role-member-list::-webkit-scrollbar-track {
  background: transparent;
}

.acl-role-member-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #b9c7d6;
  background-clip: content-box;
}

.acl-role-member-list::-webkit-scrollbar-thumb:hover {
  background: #96a7b9;
  background-clip: content-box;
}

.acl-role-member {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-width: 0;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  background: #f4f8fc;
  border: 1px solid #dfe9f3;
}

.acl-role-member--empty {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--muted);
}

.acl-role-member-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acl-role-member-meta {
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.acl-remove-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.2rem;
  border-radius: 4px;
}

.acl-remove-btn:hover {
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
}

#config-section-role-access .config-section-lead {
  margin-bottom: 0.65rem;
  max-width: 44rem;
}

@media (max-width: 900px) {
  .acl-add-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .acl-role-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .acl-role-member-list {
    max-height: 16rem;
  }
}

@media (max-width: 720px) {
  .acl-table thead {
    display: none;
  }

  .acl-table,
  .acl-table tbody,
  .acl-table tr,
  .acl-table th,
  .acl-table td {
    display: block;
    width: 100%;
  }

  .acl-table tbody tr {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #e8edf3;
  }

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

  .acl-table tbody tr:hover td,
  .acl-table tbody tr:hover th.acl-user-name {
    background: transparent;
  }

  .acl-table tbody th.acl-user-name {
    padding: 0 0 0.45rem;
    border-bottom: none;
    background: transparent;
  }

  .acl-user-job-title,
  .acl-user-role-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    width: auto;
    padding: 0.2rem 0;
    border-bottom: none;
  }

  .acl-user-job-title::before,
  .acl-user-role-label::before {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
  }

  .acl-user-job-title::before {
    content: "Job title";
  }

  .acl-user-role-label::before {
    content: "Role";
  }

  .acl-role-toggle-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: auto;
    padding: 0.2rem 0;
    border-bottom: none;
  }

  .acl-role-toggle-cell::before {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
  }

  .acl-role-toggle-cell:nth-of-type(1)::before {
    content: "Approver";
  }

  .acl-role-toggle-cell:nth-of-type(2)::before {
    content: "Administrator";
  }

  .acl-role-toggle-cell:nth-of-type(3)::before {
    content: "Purchasing Department";
  }

  .acl-remove-cell {
    width: auto;
    padding: 0.35rem 0 0;
    text-align: left;
    border-bottom: none;
  }
}

.config-panel-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.config-form .field-row + .field-row {
  margin-top: 1rem;
}

.config-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e8edf3;
}

.config-purchasing-backup-actions {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-right: auto;
}

#view-config:has(#config-section-payment-import:not([hidden])) .config-purchasing-backup-actions {
  display: flex;
}

.config-form-save-btn {
  flex-shrink: 0;
}

.config-purchasing-backup-hint {
  display: none;
  flex: 1 1 100%;
  order: 10;
  margin: 0.25rem 0 0;
  padding-bottom: 0.15rem;
  font-size: 0.75rem;
  line-height: 1.4;
}

#view-config:has(#config-section-payment-import:not([hidden])) .config-purchasing-backup-hint {
  display: block;
}

.wizard-header {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.wizard-step-label {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.wizard-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  width: 12.5%;
  background: linear-gradient(90deg, var(--primary), #1565a8);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.wizard-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.wizard-step {
  margin: 0;
  padding: 0 0 0.5rem;
}

.wizard-field-group-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted, #4a5568);
}

.wizard-field-group-title:first-of-type {
  margin-top: 0.35rem;
}

.wizard-step[hidden] {
  display: none !important;
}

.step-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.step-lead {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.field-inline-error {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.45rem 0 0;
  padding: 0.5rem 0.6rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 500;
  color: #7a271a;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 6px;
}

.field-inline-error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-validation-banner {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #7a271a;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 6px;
}

.step-validation-banner p {
  margin: 0 0 0.4rem;
  font-weight: 600;
}

.step-validation-banner ul {
  margin: 0;
  padding-left: 1.15rem;
}

.step-validation-banner li {
  margin: 0.2rem 0;
}

.step-validation-banner[hidden],
.field-inline-error[hidden] {
  display: none !important;
}

#application-form input.is-invalid,
#application-form select.is-invalid,
#application-form textarea.is-invalid,
.mobile-search.is-invalid {
  border-color: #f04438;
  background-color: #fffbfa;
}

#application-form input.is-invalid:focus,
#application-form select.is-invalid:focus,
#application-form textarea.is-invalid:focus {
  outline-color: rgba(240, 68, 56, 0.35);
  border-color: #d92d20;
  box-shadow: var(--control-shadow), 0 0 0 3px rgba(240, 68, 56, 0.1);
}

.field-row.is-invalid-group .checkbox-field {
  color: #7a271a;
}

.field-item--admin-approve-ack.is-invalid-group .admin-approve-ack-option {
  border-color: #d92d20;
  box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.1);
}

.field-item--admin-approve-ack.is-invalid-group .field-label {
  color: #7a271a;
}

.review-summary {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: #fafbfc;
  font-size: 0.92rem;
}

.review-summary h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.review-summary h3:first-child {
  margin-top: 0;
}

.form-section.flat {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.wizard-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.85rem calc(-1 * var(--shell-padding)) 0;
  padding: 0.85rem var(--shell-padding);
  border-top: 1px solid #e8edf3;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f7fb 100%);
  border-radius: 0 0 var(--radius) var(--radius);
}

.wizard-nav-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wizard-nav-end {
  margin-left: auto;
}

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1.25rem;
  padding: 0 1rem 1rem;
}

.form-section legend {
  font-weight: 700;
  padding: 0 0.35rem;
}

.legend-note {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-only {
  background: #faf6ee;
  border-color: #e8dcc4;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.field-hint {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  font-weight: 400;
}

.statement-fields {
  margin-top: 0.5rem;
  padding: 0.75rem 0.85rem;
  border: 1px dashed #cfd8e3;
  border-radius: var(--radius);
  background: #fafbfc;
}

.statement-fields .step-lead {
  margin-top: 0;
}

.wizard-nav-end .btn-primary[hidden],
.wizard-nav-end #btn-submit[hidden],
.wizard-nav-end #btn-next[hidden] {
  display: none !important;
}

.field-row.two-col,
.field-row.three-col,
.field-row.name-row {
  display: grid;
  gap: 0.85rem 1rem;
}

.field-row.two-col {
  grid-template-columns: 1fr 1fr;
}

.field-row.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.field-row.name-row {
  grid-template-columns: minmax(0, 1fr) 4.25rem minmax(0, 1fr);
  align-items: end;
}

.wizard-step .step0-applicant-type {
  margin-top: 0.5rem;
}

.field-row.name-row > div {
  min-width: 0;
}

.field-row.name-row .field-mi label {
  text-align: center;
}

.field-row.name-row .field-mi input {
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
}

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

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
#application-form select,
#application-form textarea,
.mobile-search,
.applications-list-search-input,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-height);
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background-color: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--control-font-size);
  line-height: 1.35;
  box-shadow: var(--control-shadow);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    outline-color 0.15s ease;
}

#application-form select,
.dataTables_wrapper .dataTables_length select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6778' d='M1.4.4 6 5l4.6-4.6L12 2.8 6 8.8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
  cursor: pointer;
}

#application-form input[type="date"],
#application-form input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

/* Match autofill styling to normal controls (Chrome/Edge light blue fill) */
#application-form input:-webkit-autofill,
#application-form input:-webkit-autofill:hover,
#application-form input:-webkit-autofill:focus,
#application-form select:-webkit-autofill,
#application-form select:-webkit-autofill:hover,
#application-form select:-webkit-autofill:focus,
#application-form textarea:-webkit-autofill,
#application-form textarea:-webkit-autofill:hover,
#application-form textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  border: 1px solid var(--control-border-color);
  -webkit-box-shadow: 0 0 0 1000px var(--control-bg) inset !important;
  box-shadow: var(--control-shadow), 0 0 0 1000px var(--control-bg) inset !important;
  transition: background-color 99999s ease-out 0s;
}

#application-form input:-webkit-autofill:focus,
#application-form select:-webkit-autofill:focus,
#application-form textarea:-webkit-autofill:focus {
  border-color: var(--primary);
  -webkit-box-shadow: var(--control-shadow), 0 0 0 1000px var(--control-bg) inset,
    0 0 0 3px rgba(11, 79, 138, 0.08) !important;
  box-shadow: var(--control-shadow), 0 0 0 1000px var(--control-bg) inset,
    0 0 0 3px rgba(11, 79, 138, 0.08) !important;
}

#application-form input[type="search"]::-webkit-search-cancel-button,
.mobile-search::-webkit-search-cancel-button,
.dataTables_wrapper .dataTables_filter input::-webkit-search-cancel-button {
  cursor: pointer;
}

.dataTables_wrapper .dataTables_length select {
  width: auto;
  min-width: 4.75rem;
}

.dataTables_wrapper .dataTables_filter input {
  width: auto;
  min-width: 12rem;
}

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
#application-form select:focus,
#application-form textarea:focus,
.mobile-search:focus,
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 0;
  border-color: var(--primary);
  box-shadow: var(--control-shadow), 0 0 0 3px rgba(11, 79, 138, 0.08);
}

#application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"])::placeholder,
.mobile-search::placeholder,
.dataTables_wrapper .dataTables_filter input::placeholder {
  color: #8b95a5;
  opacity: 1;
}

#application-form input:disabled,
#application-form select:disabled,
#application-form textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: #f3f5f8;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 500;
  min-height: 44px;
  padding: 0.35rem 0;
}

.checkbox-field input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.checkbox-field.block {
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.15rem;
  min-height: 42px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease,
    opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid rgba(11, 79, 138, 0.45);
  outline-offset: 2px;
}

.btn-icon {
  font-size: 0.95em;
  line-height: 1;
  opacity: 0.88;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid #cfd8e3;
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.05);
}

.btn-ghost:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #b8c4d4;
  box-shadow: 0 2px 6px rgba(26, 35, 50, 0.07);
}

.btn-ghost:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.05);
}

.btn-ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost.btn-subtle {
  color: var(--muted);
  border-color: #dce3ec;
  background: transparent;
  box-shadow: none;
}

.btn-ghost.btn-subtle:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
}

.btn-primary,
.btn.primary {
  background: linear-gradient(180deg, #1565a8 0%, var(--primary) 100%);
  color: #fff;
  border: 1px solid #093d6b;
  box-shadow:
    0 1px 2px rgba(9, 61, 107, 0.2),
    0 4px 14px rgba(11, 79, 138, 0.22);
}

.btn-primary:hover,
.btn.primary:hover {
  background: linear-gradient(180deg, #1870b8 0%, #0a4680 100%);
  box-shadow:
    0 2px 4px rgba(9, 61, 107, 0.22),
    0 6px 18px rgba(11, 79, 138, 0.28);
  transform: translateY(-1px);
}

.btn-primary:active,
.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(11, 79, 138, 0.2);
}

.btn-save {
  min-width: 9.5rem;
}

.btn.primary {
  background: linear-gradient(180deg, #1565a8 0%, var(--primary) 100%);
  color: #fff;
  border: 1px solid #093d6b;
  box-shadow:
    0 1px 2px rgba(9, 61, 107, 0.2),
    0 4px 14px rgba(11, 79, 138, 0.22);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #1870b8 0%, #0a4680 100%);
  box-shadow:
    0 2px 4px rgba(9, 61, 107, 0.22),
    0 6px 18px rgba(11, 79, 138, 0.28);
  transform: translateY(-1px);
}

.btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid #cfd8e3;
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.05);
}

.btn.secondary:hover {
  background: #f8fafc;
  border-color: #b8c4d4;
}

.btn.danger {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c2c0;
}

.btn.link {
  background: transparent;
  color: var(--primary);
  padding: 0.5rem 0.65rem;
  min-height: 44px;
  text-decoration: underline;
}

.export-panel {
  max-width: 56rem;
}

.export-panel-title {
  margin: 0 0 0.35rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.export-panel-lead {
  margin: 0 0 1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 44rem;
}

.export-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

.export-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.export-empty {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
}

.export-batch-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.export-batch-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.export-batch-option:hover {
  border-color: #b8c5d4;
  background: #fafbfc;
}

.export-batch-option.is-active {
  border-color: var(--primary);
  background: #eef4fa;
  color: var(--primary);
}

.export-batch-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-batch-option-count {
  flex-shrink: 0;
  min-width: 1.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.export-batch-option.is-active .export-batch-option-count {
  background: #fff;
}

.export-batch-detail {
  min-width: 0;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.export-detail-placeholder {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.export-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #e8edf3;
}

.export-summary-stat {
  font-size: 0.8125rem;
  color: var(--muted);
}

.export-summary-stat strong {
  color: var(--text);
}

.export-summary-ok {
  color: #0d6832;
  font-weight: 600;
}

.export-summary-warn {
  color: var(--danger);
  font-weight: 600;
}

.export-apps-wrap {
  overflow-x: auto;
  margin-bottom: 0.875rem;
  border: 1px solid #e8edf3;
  border-radius: 8px;
}

.export-apps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.export-apps-table th,
.export-apps-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid #eef2f6;
}

.export-apps-table th {
  background: #f6f8fb;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.export-validation-ok {
  color: #0d6832;
  font-weight: 600;
}

.export-validation-warn {
  color: var(--danger);
  font-weight: 600;
}

.export-validation-link {
  min-height: auto;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: var(--danger);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.export-validation-link:hover,
.export-validation-link:focus-visible {
  color: #8b1a12;
}

.export-summary-warn .export-validation-link strong {
  color: inherit;
}

.export-validation-body {
  max-height: min(60vh, 28rem);
  overflow: auto;
}

.export-issues-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

.export-issues-list li + li {
  margin-top: 0.35rem;
}

.export-issues-group + .export-issues-group {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e8edf3;
}

.export-issues-group-title {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.export-issues-group-count {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8125rem;
}

.export-issues-none {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.export-copy-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.export-copy-header-option {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.export-format-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 720px) {
  .export-layout {
    grid-template-columns: 1fr;
  }
}

.purchasing-batch-bar {
  margin-bottom: 0.875rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.purchasing-batch-bar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
}

.purchasing-batch-field {
  flex: 1 1 12rem;
  min-width: 0;
}

.purchasing-batch-field label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.purchasing-batch-field input {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  font: inherit;
  font-size: 0.875rem;
  box-shadow: var(--control-shadow);
}

.purchasing-batch-field input:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.purchasing-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.purchasing-batch-actions .btn {
  min-height: var(--control-height);
}

.purchasing-batch-selectors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.8125rem;
}

.purchasing-batch-sep {
  color: var(--muted);
}

.purchasing-batch-lead {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.batch-cell {
  display: inline-block;
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}

.batch-cell-empty {
  font-weight: 400;
  color: var(--muted);
}

.purchasing-row-select-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 2rem;
  cursor: pointer;
}

.purchasing-row-select {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.application-card .purchasing-row-select-wrap {
  margin: 0.35rem 0 0.15rem;
}

.applications-data td.col-purchasing-select,
.applications-data th.col-purchasing-select {
  text-align: center;
}

.applications-cards {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.application-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: #fafbfc;
}

.application-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.application-card-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.application-card-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.application-card-details {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.88rem;
  display: grid;
  gap: 0.2rem;
}

.application-card-details span {
  display: block;
}

.mobile-search-wrap {
  display: none;
}

.mobile-search {
  display: none;
  margin-bottom: 0.85rem;
}

.applications-list-toolbar[hidden] {
  display: none !important;
}

.applications-list-toolbar:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
}

.app-shell--applicant-records .applications-list-toolbar:not([hidden]) {
  flex-wrap: nowrap;
}

.applications-list-search {
  flex: 1 1 12rem;
  min-width: 0;
}

.applications-list-search-combo {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 28rem;
}

.applications-list-search-combo .applications-list-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.applications-list-search-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  margin: 0;
  border: 1px solid var(--control-border-color);
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--control-shadow);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.applications-list-search-btn:hover {
  background: #094a85;
  border-color: #094a85;
}

.applications-list-search-btn:focus-visible {
  outline: 2px solid rgba(11, 79, 138, 0.45);
  outline-offset: 2px;
}

.applications-list-search-combo:focus-within .applications-list-search-input {
  border-color: var(--primary);
}

#applications-list-toolbar:not([hidden]) ~ .datatable-shell .dataTables_filter,
#applications-list-toolbar:not([hidden]) ~ .datatable-shell .dt-toolbar {
  display: none !important;
}

.applications-list-toolbar:not([hidden]) .applications-list-search-input {
  display: block;
  width: 100%;
  margin-bottom: 0;
  box-sizing: border-box;
}

.applications-list-toolbar:not([hidden]) .applications-page-length .dataTables_length label {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  font-size: var(--control-font-size);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  box-sizing: border-box;
  min-height: var(--control-height);
  padding: 0 0 0 0.75rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background-color: var(--control-bg);
  box-shadow: var(--control-shadow);
}

.applications-list-toolbar:not([hidden]) .applications-page-length .dataTables_length select,
.applications-list-toolbar:not([hidden]) .applications-page-length .dt-length-select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: auto;
  min-width: 3.25rem;
  min-height: calc(var(--control-height) - 2px);
  margin: 0;
  padding: 0.625rem 2.25rem 0.625rem 0.35rem;
  border: none;
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6778' d='M1.4.4 6 5l4.6-4.6L12 2.8 6 8.8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 10px;
  color: var(--text);
  font: inherit;
  font-size: var(--control-font-size);
  line-height: 1.35;
  cursor: pointer;
}

.applications-page-length {
  flex: 0 0 auto;
}

.applications-start-page {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.15rem 0.4rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.applications-start-page[hidden] {
  display: none !important;
}

.applications-start-page:hover {
  color: var(--text);
  background: rgba(11, 79, 138, 0.06);
}

.applications-start-page:focus-visible {
  outline: 2px solid rgba(11, 79, 138, 0.45);
  outline-offset: 2px;
}

.applications-start-page[aria-pressed="true"] {
  color: var(--primary);
}

.applications-start-page[aria-pressed="true"] svg {
  fill: currentColor;
}

.app-shell--applicant-records .applications-page-length .dataTables_length {
  margin: 0;
}

.app-shell--applicant-records .applications-page-length .dataTables_length label {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  font-size: var(--control-font-size);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  box-sizing: border-box;
  min-height: var(--control-height);
  padding: 0 0 0 0.75rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background-color: var(--control-bg);
  box-shadow: var(--control-shadow);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    outline-color 0.15s ease;
}

.app-shell--applicant-records .applications-page-length .dataTables_length label:focus-within {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 0;
  border-color: var(--primary);
  box-shadow: var(--control-shadow), 0 0 0 3px rgba(11, 79, 138, 0.08);
}

.app-shell--applicant-records .applications-page-length .dataTables_length select,
.app-shell--applicant-records .applications-page-length .dt-length-select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: auto;
  min-width: 3.25rem;
  min-height: calc(var(--control-height) - 2px);
  margin: 0;
  padding: 0.625rem 2.25rem 0.625rem 0.35rem;
  border: none;
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6778' d='M1.4.4 6 5l4.6-4.6L12 2.8 6 8.8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 10px;
  color: var(--text);
  font: inherit;
  font-size: var(--control-font-size);
  line-height: 1.35;
  box-shadow: none;
  cursor: pointer;
}

.app-shell--applicant-records .applications-page-length .dataTables_length select:focus,
.app-shell--applicant-records .applications-page-length .dt-length-select:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.app-shell--applicant-records .applications-list-search-input {
  display: block;
  width: 100%;
  margin-bottom: 0;
  box-sizing: border-box;
}

.app-shell--applicant-records .datatable-shell .dataTables_filter {
  display: none !important;
}

.app-shell--applicant-records .datatable-shell .dt-toolbar {
  display: none;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.card-actions .btn {
  width: 100%;
  font-size: 0.88rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.card-actions .btn.link {
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
}

.card-actions .btn-danger-link {
  color: var(--danger);
  border-color: #f5c2c0;
  background: #fff;
}

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

.table-toolbar p {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
  font-size: 0.78rem;
  line-height: 1.35;
}

.table-toolbar .btn {
  min-height: 36px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.datatable-shell {
  margin-top: 0.15rem;
}

.datatable-shell .dataTables_wrapper {
  position: relative;
  font-size: 0.8125rem;
}

.datatable-shell .dataTables_wrapper .dataTables_processing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: auto;
  height: auto;
  background: rgba(255, 255, 255, 0.72);
  z-index: 5;
  border: none;
  box-shadow: none;
}

.datatable-shell .datatable-processing-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.datatable-shell .dt-toolbar,
.datatable-shell .dt-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.65rem;
  margin-bottom: 0.35rem;
}

.datatable-shell .dt-footer {
  margin-bottom: 0;
  margin-top: 0.35rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.datatable-shell .dataTables_length,
.datatable-shell .dataTables_filter,
.datatable-shell .dataTables_info,
.datatable-shell .dataTables_paginate {
  margin: 0;
  float: none;
}

.datatable-shell .dataTables_length label,
.datatable-shell .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.datatable-shell .dt-search-input {
  min-width: 12rem;
}

.datatable-shell .dataTables_info {
  color: var(--muted);
  font-size: 0.8125rem;
}

.datatable-shell .dataTables_paginate .paginate_button {
  min-height: 32px;
  padding: 0.25rem 0.65rem !important;
  margin-left: 0.2rem !important;
  border-radius: 6px !important;
  border: 1px solid var(--border) !important;
  background: #fff !important;
  color: var(--text) !important;
  font-size: 0.8125rem !important;
  font-weight: 600;
}

.datatable-shell .dataTables_paginate .paginate_button.current,
.datatable-shell .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.datatable-shell .dataTables_paginate .paginate_button:hover {
  background: #eef2f7 !important;
  border-color: #c5ced9 !important;
  color: var(--text) !important;
}

.datatable-shell .dataTables_paginate .paginate_button.disabled,
.datatable-shell .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.45;
  background: #fff !important;
}

table.applications-data {
  border-collapse: separate;
  border-spacing: 0;
}

table.applications-data thead th {
  padding: 0.35rem 0.5rem !important;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f6f8fb !important;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}

table.applications-data tbody td {
  padding: 0.3rem 0.5rem !important;
  vertical-align: middle;
  border-bottom: 1px solid #edf1f6 !important;
  font-size: 0.78rem;
  line-height: 1.3;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

table.applications-data tbody td.col-actions,
table.applications-data tbody td:last-child {
  max-width: none;
  overflow: visible;
  white-space: normal;
}

table.applications-data tbody tr:hover td {
  background: #fafbfc;
}

table.applications-data tbody tr:last-child td {
  border-bottom: none !important;
}

table.applications-data .status-pill {
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
}

.applications-row-actions-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.row-actions {
  position: relative;
  display: inline-block;
}

.row-actions-trigger {
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.28rem 0.55rem;
  min-height: auto;
  border: 1px solid #c5d4e4;
  border-radius: 6px;
  background: #fff;
  line-height: 1.2;
  user-select: none;
}

.row-actions.is-open .row-actions-trigger {
  background: #eef4fa;
  border-color: var(--primary);
}

.row-actions-menu {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 10.5rem;
  margin-top: 0.25rem;
  padding: 0.3rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 35, 50, 0.12);
}

.row-actions-menu.is-fixed {
  position: fixed;
  margin-top: 0;
  z-index: 100;
}

.row-actions-menu[hidden] {
  display: none !important;
}

.row-actions-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.45rem 0.55rem;
  min-height: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}

.row-actions-item:hover {
  background: #f3f6fa;
}

.row-actions-item.danger {
  color: var(--danger);
}

.row-actions-item--approve {
  color: #0d6832;
  font-weight: 600;
}

.row-actions-item--approve:hover {
  background: #eef8f1;
}

table.dataTable tbody tr {
  cursor: default;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.detail-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 640px;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.detail-dialog.wide {
  max-width: 900px;
}

#import-preview-dialog.detail-dialog.wide {
  max-width: min(1120px, calc(100vw - 2rem));
}

#import-preview-dialog .dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 920px);
}

#import-preview-dialog .dialog-lead {
  padding-top: 0.75rem;
  padding-bottom: 0.35rem;
  flex-shrink: 0;
}

#import-preview-dialog .import-preview-save-status {
  flex-shrink: 0;
  margin-top: 0;
}

/* API error dialog (DAT2-style) */
.error-modal {
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.18);
}

.error-modal::backdrop {
  background: rgba(26, 35, 50, 0.4);
}

.error-modal-content {
  padding: 1.5rem 1.75rem 1.25rem;
}

.error-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.error-modal-summary {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  font-size: 0.95rem;
}

.error-modal-details-toggle {
  text-align: center;
  margin-top: 0.85rem;
}

.error-modal-details-link {
  color: var(--primary);
  font-size: 0.875rem;
  text-decoration: none;
  font-weight: 600;
}

.error-modal-details-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.error-modal-details-panel {
  margin-top: 0.85rem;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: #f8fafc;
}

.error-modal-details-text {
  margin: 0;
  padding: 0.75rem;
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-modal-footer {
  text-align: center;
  margin-top: 1.25rem;
}

.error-modal-close-btn {
  color: #ffffff;
  background-color: #64748b;
  border: 1px solid #64748b;
  border-radius: 6px;
  padding: 0.45rem 1.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.error-modal-close-btn:hover {
  background-color: #475569;
  border-color: #475569;
}

.detail-dialog::backdrop {
  background: rgba(26, 35, 50, 0.45);
}

.submission-loading-dialog {
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  max-width: none;
  width: max-content;
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
}

.submission-loading-dialog::backdrop {
  background: rgba(26, 35, 50, 0.38);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.submission-success-dialog {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.submission-success-dialog::backdrop {
  background: rgba(26, 35, 50, 0.38);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.submission-loading-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: auto;
  max-width: min(22rem, calc(100vw - 2.5rem));
  padding: 1.75rem 2rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.submission-loading-inner p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.submission-spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: submission-spin 0.75s linear infinite;
}

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

.submission-success-dialog {
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  max-width: 420px;
  width: calc(100% - 2rem);
}

.submission-success-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

.submission-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: #ecfdf5;
  border: 2px solid #34d399;
  color: #059669;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
}

.dialog-inner {
  margin: 0;
}

.detail-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.detail-dialog header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.detail-body {
  padding: 1rem 1.25rem;
  max-height: 60vh;
  overflow: auto;
}

.dialog-lead {
  margin: 0;
  padding: 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.import-validation {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
}

.import-preview-validation-banner .import-validation {
  margin: 0;
}

.import-validation--ok {
  background: #ecfdf3;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.import-validation--warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.review-paymentnet-heading {
  margin-top: 1.75rem;
}

.review-paymentnet-lead {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.92rem;
  color: var(--text-muted, #4a5568);
}

.import-validation ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.import-preview-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.import-preview-validation-banner {
  flex-shrink: 0;
}

.import-preview-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem 0.65rem;
  align-content: start;
}

.import-field {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  background: #fafbfc;
  min-width: 0;
}

.import-field--issue {
  border-color: #f59e0b;
  background: #fffbeb;
}

.import-field .label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.import-field .value {
  font-size: 0.88rem;
  word-break: break-word;
}

.import-field-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--control-border-color);
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
}

.import-field--issue .import-field-input {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
}

.import-field-issue {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: #b45309;
  line-height: 1.35;
}

.import-field-rules {
  margin: 0.2rem 0 0.4rem;
}

.import-field-rules-heading {
  margin: 0 0 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.import-field-rule-chips {
  margin-bottom: 0;
  gap: 0.25rem;
}

.import-field-rule-chips .purchasing-default-rule-chip {
  max-width: 100%;
}

.import-preview-save-status {
  margin: 0 1.25rem 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.import-preview-save-status--error {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.import-preview-save-status--success {
  background: #ecfdf5;
  border: 1px solid #34d399;
  color: #065f46;
}

.detail-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
}

.confirm-dialog-body p {
  margin: 0;
  line-height: 1.5;
}

.confirm-dialog-body label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.confirm-dialog-body textarea {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  resize: vertical;
}

.confirm-dialog-body textarea:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.confirm-dialog-body input[type="text"] {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 0.875rem;
}

.confirm-dialog-body input[type="text"]:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.confirm-dialog-body select {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 0.875rem;
  background: #fff;
}

.confirm-dialog-body select:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.impersonate-recent-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.impersonate-recent-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.impersonate-recent-remove-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-height);
  height: var(--control-height);
  margin: 0;
  padding: 0;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  background: #fff;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.impersonate-recent-remove-btn:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(217, 45, 32, 0.45);
  background: #fff5f5;
}

.impersonate-recent-remove-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Impersonate people picker: list is position:absolute; avoid footer/body clipping. */
#impersonate-dialog {
  overflow: visible;
}

#impersonate-dialog .confirm-dialog-body {
  overflow: visible;
  max-height: none;
  position: relative;
  z-index: 2;
}

#impersonate-dialog footer {
  position: relative;
  z-index: 1;
  background: #fff;
}

#impersonate-dialog .people-picker-combobox {
  position: relative;
}

#impersonate-dialog .combobox-list {
  z-index: 1000;
}

#impersonate-dialog .people-picker-combobox input[type="text"] {
  width: 100%;
  height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--control-border-color);
  border-radius: var(--control-radius);
  font: inherit;
  font-size: 0.875rem;
  box-sizing: border-box;
}

#impersonate-dialog .people-picker-combobox input[type="text"]:focus {
  outline: 2px solid rgba(11, 79, 138, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}

.confirm-dialog-body .field-hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.confirm-dialog .btn.danger {
  background: linear-gradient(180deg, #d92d20 0%, var(--danger) 100%);
  color: #fff;
  border: 1px solid #912018;
  box-shadow: 0 1px 2px rgba(145, 32, 24, 0.2);
}

.confirm-dialog .btn.danger:hover {
  background: linear-gradient(180deg, #e03124 0%, #912018 100%);
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: capitalize;
  background: #e8eef5;
  color: var(--primary);
}

.status-pill.activated {
  background: #e6f4ea;
  color: #1e6b3a;
}

.status-pill.approved {
  background: #e8f2fb;
  color: #0b4f8a;
}

.status-pill.denied {
  background: #fdecea;
  color: var(--danger);
}

.status-pill.draft {
  background: #f1f5f9;
  color: #475569;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10050;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  :root {
    --page-gutter: 0.75rem;
    --shell-padding: 0.85rem;
  }

  .site-header {
    padding: 1rem var(--page-gutter) 1.25rem;
  }

  .header-logo {
    height: 2.75rem;
    max-width: 4.5rem;
  }

  .header-note {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .layout {
    padding: 0.35rem var(--page-gutter) 0.75rem;
  }

  #view-apply.view-panel {
    padding: 0.3rem 0.35rem 0;
  }

  .wizard-form {
    max-height: calc(100dvh - 9.5rem);
  }

  .wizard-nav {
    position: fixed;
    left: var(--page-gutter);
    right: var(--page-gutter);
    bottom: 0;
    z-index: 50;
    margin: 0 auto;
    max-width: calc(var(--page-max) - 2 * var(--page-gutter));
    padding: 0.65rem 0.75rem;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom));
    background: rgba(250, 251, 253, 0.94);
    border: 1px solid #dfe6ef;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    box-shadow:
      0 -1px 0 rgba(255, 255, 255, 0.8) inset,
      0 -8px 28px rgba(26, 35, 50, 0.12);
    backdrop-filter: blur(12px);
    gap: 0.5rem;
  }

  .wizard-nav-start {
    flex: 1;
    min-width: 0;
  }

  .wizard-nav-start .btn-ghost {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .wizard-nav-end {
    flex-shrink: 0;
  }

  .wizard-nav-end .btn-primary {
    min-width: 6.75rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  .wizard-form {
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }

  body.form-sticky-active .apply-form {
    padding-bottom: 0;
  }

  .field-row.two-col,
  .field-row.three-col {
    grid-template-columns: 1fr;
  }

  .field-row.name-row {
    grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
    gap: 0.65rem 0.5rem;
  }

  .field-row.checkboxes {
    gap: 0.25rem;
  }

  .form-section {
    padding: 0 0.75rem 0.85rem;
  }

  .form-section legend {
    font-size: 0.95rem;
  }

  .legend-note {
    display: block;
    margin-top: 0.15rem;
  }

  #application-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  #application-form select,
  #application-form textarea,
  .mobile-search,
  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select {
    font-size: 16px;
  }

  .tab-label-short {
    display: inline;
  }

  .tab-label-long {
    display: none;
  }

  .toolbar-copy {
    font-size: 0.85rem;
  }

  .table-toolbar .btn {
    width: 100%;
  }

  .mobile-search-wrap {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
  }

  .mobile-search {
    display: block;
  }

  .app-shell--applicant-records .applications-page-length {
    display: none !important;
  }

  .applications-start-page-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .applications-cards {
    display: flex;
  }

  .table-desktop {
    display: none !important;
  }

  .detail-dialog {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .detail-dialog .dialog-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
  }

  .detail-body,
  .import-preview-body {
    max-height: none;
    flex: 1;
  }

  .import-preview-fields {
    grid-template-columns: 1fr;
  }

  .detail-dialog footer {
    flex-wrap: wrap;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .detail-dialog footer .btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
  }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    text-align: center;
  }

  body.form-sticky-active .toast {
    bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 720px) {
  .config-layout {
    grid-template-columns: 1fr;
  }

  .config-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .config-nav-item {
    flex: 1 1 auto;
    text-align: center;
    font-size: 0.78rem;
  }
}

@media (min-width: 721px) {
  .applications-cards,
  .mobile-search,
  .mobile-search-wrap {
    display: none !important;
  }

  .applications-list-toolbar:not([hidden]) .applications-list-search-input {
    display: block !important;
  }
}
