:root {
  --staff-paper: #f6f0e4;
  --staff-paper-bright: #fffdf7;
  --staff-ink: #11131a;
  --staff-muted: #5d6068;
  --staff-rule: #c9c2b4;
  --staff-blue: #1542d4;
  --staff-blue-dark: #0d2c92;
  --staff-yellow: #ffd32a;
  --staff-orange: #f04a24;
  --staff-green: #087c5e;
  --staff-red: #bd2c2c;
  --staff-violet: #7452df;
  /* Keep staff and customer portals on the same typography system. */
  --staff-display: var(--display, 'Barlow Condensed', 'Arial Narrow', sans-serif);
  --staff-body: var(--body, 'Barlow', 'Segoe UI', sans-serif);
  --staff-data: var(--mono, 'Manrope', 'Segoe UI', sans-serif);
  --staff-topbar-height: 4.5rem;
  --staff-rail-width: 14rem;
}

.staff-site {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--staff-ink);
  background: var(--staff-paper);
  font-family: var(--staff-body);
  letter-spacing: 0;
}

.staff-site button,
.staff-site input,
.staff-site select,
.staff-site textarea {
  font: inherit;
  letter-spacing: 0;
}

.staff-site button { cursor: pointer; }
.staff-site button:disabled { cursor: not-allowed; opacity: 0.52; }
.staff-site [hidden] { display: none !important; }
.staff-site svg { width: 1.1rem; height: 1.1rem; stroke-width: 1.8; }
.staff-site :focus-visible { outline: 3px solid var(--staff-yellow); outline-offset: 2px; }

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

.staff-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(16rem, 0.72fr) minmax(20rem, 1.28fr);
  color: var(--staff-paper-bright);
  background: var(--staff-blue);
}

.staff-gate__brand {
  display: grid;
  align-content: end;
  padding: clamp(2rem, 6vw, 5rem);
  background: var(--staff-ink);
  border-inline-end: 2px solid var(--staff-ink);
}

.staff-gate__brand img { width: 6rem; height: 6rem; object-fit: contain; margin-block-end: 1.5rem; }
.staff-gate__brand strong { font-family: var(--staff-display); font-size: 3rem; line-height: 0.9; text-transform: uppercase; }
.staff-gate__brand span { margin-block-start: 0.7rem; color: var(--staff-yellow); font-family: var(--staff-data); font-size: 0.78rem; font-weight: 700; }

.staff-gate__panel {
  width: min(38rem, calc(100% - 3rem));
  align-self: center;
  justify-self: center;
  padding: clamp(1.5rem, 5vw, 3rem);
  color: var(--staff-ink);
  background: var(--staff-paper-bright);
  border: 2px solid var(--staff-ink);
  box-shadow: 0 18px 42px rgba(17, 19, 26, 0.28);
}

.staff-gate__panel h1 { margin: 1.2rem 0 0.65rem; font-family: var(--staff-display); font-size: 2.8rem; line-height: 0.92; text-transform: uppercase; }
.staff-gate__panel > p { max-width: 48ch; color: var(--staff-muted); }
.staff-gate__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-block-start: 1.5rem; }
.staff-loader { width: 3rem; height: 0.55rem; background: var(--staff-yellow); animation: staff-load 1.1s ease-in-out infinite alternate; transform-origin: left; }
@keyframes staff-load { to { width: 9rem; background: var(--staff-orange); } }

.staff-mfa { display: grid; gap: 1rem; margin-block-start: 1.5rem; padding-block-start: 1.5rem; border-block-start: 2px solid var(--staff-ink); }
.staff-mfa img { width: min(15rem, 100%); aspect-ratio: 1; background: #fff; border: 1px solid var(--staff-ink); }
.staff-mfa__secret { overflow-wrap: anywhere; font-family: var(--staff-data); font-size: 0.74rem; }

.staff-topbar {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  height: var(--staff-topbar-height);
  display: grid;
  grid-template-columns: var(--staff-rail-width) minmax(0, 1fr) auto;
  align-items: center;
  color: var(--staff-paper-bright);
  background: var(--staff-ink);
  border-block-end: 2px solid var(--staff-ink);
}

.staff-brand {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-inline: 1rem;
  background: var(--staff-blue);
  border-inline-end: 2px solid var(--staff-ink);
}
.staff-brand img { width: 2.7rem; height: 2.7rem; object-fit: contain; }
.staff-brand span { display: grid; }
.staff-brand strong { font-family: var(--staff-display); font-size: 1.35rem; line-height: 0.9; text-transform: uppercase; }
.staff-brand small { color: var(--staff-yellow); font-family: var(--staff-data); font-size: 0.62rem; font-weight: 700; }

.staff-service { display: flex; align-items: center; gap: 0.55rem; padding-inline: 1.2rem; font-family: var(--staff-data); font-size: 0.72rem; }
.staff-service__dot { width: 0.6rem; height: 0.6rem; background: var(--staff-green); border: 1px solid var(--staff-paper-bright); border-radius: 50%; }
.staff-service__dot.is-error { background: var(--staff-red); }

.staff-account { display: flex; align-items: center; gap: 0.8rem; min-width: 13rem; justify-content: flex-end; padding-inline: 1rem; }
.staff-account > span { display: grid; text-align: end; }
.staff-account strong { font-size: 0.84rem; }
.staff-account small { color: #d5d2c9; font-family: var(--staff-data); font-size: 0.62rem; text-transform: capitalize; }

.staff-shell { min-height: 100vh; display: grid; grid-template-columns: var(--staff-rail-width) minmax(0, 1fr); padding-block-start: var(--staff-topbar-height); }

.staff-rail {
  position: fixed;
  z-index: 20;
  inset: var(--staff-topbar-height) auto 0 0;
  width: var(--staff-rail-width);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  color: var(--staff-paper-bright);
  background: var(--staff-blue);
  border-inline-end: 2px solid var(--staff-ink);
}
.staff-rail nav { overflow-y: auto; padding-block: 0.6rem; }
.staff-rail button,
.staff-rail__site {
  width: 100%;
  min-height: 3.15rem;
  display: grid;
  grid-template-columns: 1.45rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1rem;
  color: var(--staff-paper-bright);
  background: transparent;
  border: 0;
  border-block-end: 1px solid rgba(255, 255, 255, 0.24);
  text-align: start;
  font-size: 0.88rem;
  font-weight: 700;
}
.staff-rail button:hover,
.staff-rail button.is-current { color: var(--staff-ink); background: var(--staff-yellow); }
.staff-rail button b { min-width: 1.55rem; min-height: 1.55rem; display: grid; place-items: center; color: var(--staff-ink); background: var(--staff-paper-bright); border: 1px solid currentColor; border-radius: 50%; font-family: var(--staff-data); font-size: 0.63rem; }
.staff-rail button b:empty { display: none; }
.staff-rail__site { border-block-start: 2px solid var(--staff-ink); border-block-end: 0; }
.staff-rail__site:hover { color: var(--staff-ink); background: var(--staff-paper-bright); }

.staff-main { grid-column: 2; min-width: 0; }
.staff-commandbar {
  position: sticky;
  z-index: 15;
  inset-block-start: var(--staff-topbar-height);
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  min-height: 7.2rem;
  padding: 1.2rem clamp(1rem, 3vw, 2.2rem);
  background: #f6f0e4;
  border-block-end: 2px solid var(--staff-ink);
}
.staff-commandbar h1 { margin: 0; font-family: var(--staff-display); font-size: 3.1rem; line-height: 0.84; text-transform: uppercase; }
.staff-commandbar p { max-width: 58ch; margin: 0.45rem 0 0; color: var(--staff-muted); font-size: 0.88rem; }
.staff-commandbar__tools { display: flex; align-items: center; gap: 0.55rem; }

.staff-search {
  width: min(20rem, 28vw);
  height: 2.75rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  padding-inline: 0.75rem;
  background: var(--staff-paper-bright);
  border: 2px solid var(--staff-ink);
}
.staff-search input { min-width: 0; height: 100%; padding: 0; color: var(--staff-ink); background: transparent; border: 0; outline: 0; }
.staff-search input::placeholder { color: #74767c; }

.staff-icon-button,
.staff-button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 0.8rem;
  color: var(--staff-ink);
  background: var(--staff-paper-bright);
  border: 2px solid var(--staff-ink);
  border-radius: 0;
  font-weight: 700;
}
.staff-icon-button { width: 2.75rem; padding: 0; }
.staff-button:hover,
.staff-icon-button:hover { background: var(--staff-yellow); }
.staff-button--primary { color: var(--staff-paper-bright); background: var(--staff-blue); }
.staff-button--primary:hover { color: var(--staff-ink); background: var(--staff-yellow); }
.staff-button--danger { color: var(--staff-paper-bright); background: var(--staff-red); }

.staff-alert { margin: 1rem clamp(1rem, 3vw, 2.2rem) 0; padding: 0.85rem 1rem; color: var(--staff-ink); background: #fff1b8; border: 2px solid var(--staff-ink); }
.staff-alert[data-state="error"] { color: #fff; background: var(--staff-red); }

.staff-workspace { padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 4rem; }
.staff-loading { min-height: 18rem; display: grid; place-items: center; color: var(--staff-muted); border-block: 2px solid var(--staff-ink); }

.staff-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 2px solid var(--staff-ink);
  background: var(--staff-paper-bright);
}
.staff-summary div { min-width: 0; padding: 1rem; border-inline-end: 1px solid var(--staff-rule); }
.staff-summary div:last-child { border-inline-end: 0; }
.staff-summary dt { color: var(--staff-muted); font-family: var(--staff-data); font-size: 0.63rem; font-weight: 700; }
.staff-summary dd { margin: 0.35rem 0 0; font-family: var(--staff-display); font-size: 2.35rem; font-weight: 800; line-height: 0.9; }
.staff-summary div[data-tone="urgent"] dd { color: var(--staff-orange); }
.staff-summary div[data-tone="risk"] dd { color: var(--staff-red); }

.staff-section { margin-block-start: 2rem; }
.staff-section__head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-block-end: 0.75rem; }
.staff-section__head h2 { margin: 0; font-family: var(--staff-display); font-size: 2rem; line-height: 0.9; text-transform: uppercase; }
.staff-section__head p { max-width: 48ch; margin: 0; color: var(--staff-muted); font-size: 0.85rem; }

.staff-table-wrap { max-width: 100%; overflow: auto; background: var(--staff-paper-bright); border: 2px solid var(--staff-ink); }
.staff-table { width: 100%; min-width: 58rem; border-collapse: collapse; table-layout: fixed; }
.staff-table th,
.staff-table td { padding: 0.78rem 0.8rem; border-block-end: 1px solid var(--staff-rule); text-align: start; vertical-align: middle; overflow-wrap: anywhere; }
.staff-table th { position: sticky; z-index: 1; inset-block-start: 0; color: var(--staff-paper-bright); background: var(--staff-ink); font-family: var(--staff-data); font-size: 0.63rem; font-weight: 700; }
.staff-table td { color: var(--staff-muted); font-size: 0.86rem; }
.staff-table tr:last-child td { border-block-end: 0; }
.staff-table tbody tr:hover td { background: #fff5bf; }
.staff-table strong { color: var(--staff-ink); }
.staff-table code { color: var(--staff-blue-dark); background: transparent; font-family: var(--staff-data); font-size: 0.72rem; }
.staff-table__actions { width: 7rem; text-align: end !important; }
.staff-table__actions button { min-height: 2.25rem; padding: 0.42rem 0.65rem; }

.staff-status { display: inline-flex; align-items: center; min-height: 1.7rem; padding: 0.25rem 0.48rem; color: var(--staff-ink); background: #e9e7e0; border: 1px solid var(--staff-ink); border-radius: 999px; font-family: var(--staff-data); font-size: 0.61rem; font-weight: 700; white-space: nowrap; }
.staff-status[data-tone="good"] { color: #fff; background: var(--staff-green); }
.staff-status[data-tone="warn"] { background: var(--staff-yellow); }
.staff-status[data-tone="danger"] { color: #fff; background: var(--staff-red); }
.staff-status[data-tone="info"] { color: #fff; background: var(--staff-blue); }
.staff-status[data-tone="violet"] { color: #fff; background: var(--staff-violet); }

.staff-summary--clients { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-block-end: 0.8rem; }
.staff-client-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-end: 1.2rem; }
.staff-client-filters .is-current { color: var(--staff-paper-bright); background: var(--staff-blue); }
.staff-client-state { display: grid; gap: 0.45rem; padding: 0.9rem; background: var(--staff-paper-bright); border: 2px solid var(--staff-ink); }
.staff-client-state > span { color: var(--staff-muted); font-family: var(--staff-data); font-size: 0.72rem; }
.staff-client-state > strong { color: var(--staff-red); }
.staff-client-lifecycle { padding: 1rem; background: #fff1b8; border: 2px solid var(--staff-ink); }
.staff-client-lifecycle h3,
.staff-drawer__body section > h3 { margin: 0 0 0.45rem; font-family: var(--staff-display); font-size: 1.55rem; line-height: 0.95; text-transform: uppercase; }
.staff-client-lifecycle p { margin: 0; color: var(--staff-muted); }
.staff-client-create { padding-block-start: 1rem; border-block-start: 2px solid var(--staff-ink); }

.staff-empty { min-height: 15rem; display: grid; align-content: center; justify-items: start; gap: 0.35rem; padding: 2rem; background: var(--staff-paper-bright); border: 2px solid var(--staff-ink); }
.staff-empty i { color: var(--staff-blue); }
.staff-empty strong { font-family: var(--staff-display); font-size: 1.8rem; text-transform: uppercase; }
.staff-empty span { color: var(--staff-muted); }

.staff-field { display: grid; gap: 0.35rem; min-width: 0; }
.staff-field > span { color: var(--staff-muted); font-size: 0.78rem; font-weight: 700; }
.staff-field input,
.staff-field select,
.staff-field textarea { width: 100%; min-height: 2.8rem; padding: 0.65rem 0.72rem; color: var(--staff-ink); background: var(--staff-paper-bright); border: 2px solid var(--staff-ink); border-radius: 0; }
.staff-field textarea { min-height: 7rem; resize: vertical; }
.staff-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.staff-form-grid .is-wide { grid-column: 1 / -1; }
.staff-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
.staff-choice label { display: flex; align-items: center; gap: 0.55rem; min-height: 2.8rem; padding: 0.65rem; background: var(--staff-paper-bright); border: 2px solid var(--staff-ink); }
.staff-choice input { accent-color: var(--staff-blue); }

.staff-import-form {
  display: grid;
  grid-template-columns: minmax(10rem, 0.55fr) minmax(16rem, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
  padding: 1rem;
  background: var(--staff-paper-bright);
  border: 2px solid var(--staff-ink);
}

.staff-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-block-start: 0.7rem;
}

.staff-import-note {
  margin: 0.65rem 0 0;
  color: var(--staff-muted);
  font-size: 0.76rem;
}

.staff-import-summary {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  color: var(--staff-ink);
  background: var(--staff-yellow);
  border: 2px solid var(--staff-ink);
}

.staff-import-summary[data-tone="good"] { color: var(--staff-paper-bright); background: #1f6b45; }
.staff-import-summary[data-tone="danger"] { color: var(--staff-paper-bright); background: var(--staff-red); }
.staff-import-summary strong { font-family: var(--staff-display); font-size: 1.45rem; line-height: 1; text-transform: uppercase; }
.staff-import-summary span { font-size: 0.82rem; }

.staff-drawer { width: min(39rem, calc(100vw - 1rem)); max-width: none; height: 100vh; max-height: none; margin: 0 0 0 auto; padding: 0; color: var(--staff-ink); background: var(--staff-paper); border: 0; border-inline-start: 2px solid var(--staff-ink); box-shadow: -16px 0 38px rgba(17, 19, 26, 0.28); }
.staff-drawer::backdrop { background: rgba(17, 19, 26, 0.6); }
.staff-drawer__shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.staff-drawer header { display: flex; justify-content: space-between; gap: 1rem; align-items: start; padding: 1.2rem; color: var(--staff-paper-bright); background: var(--staff-blue); border-block-end: 2px solid var(--staff-ink); }
.staff-drawer h2 { margin: 0; font-family: var(--staff-display); font-size: 2.5rem; line-height: 0.9; text-transform: uppercase; }
.staff-drawer header p { max-width: 42ch; margin: 0.45rem 0 0; color: #e4e8ff; font-size: 0.85rem; }
.staff-drawer__body { overflow-y: auto; display: grid; align-content: start; gap: 1rem; padding: 1.2rem; }
.staff-drawer footer { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem 1.2rem; background: var(--staff-paper-bright); border-block-start: 2px solid var(--staff-ink); }
.staff-drawer footer > div { display: flex; gap: 0.6rem; }
.staff-drawer footer p { max-width: 28ch; margin: 0; color: var(--staff-muted); font-size: 0.78rem; }
.staff-drawer footer p[data-state="error"] { color: var(--staff-red); }

.staff-toast-region { position: fixed; z-index: 80; inset: auto 1rem 1rem auto; width: min(25rem, calc(100vw - 2rem)); display: grid; gap: 0.55rem; }
.staff-toast { padding: 0.8rem 1rem; color: var(--staff-paper-bright); background: var(--staff-ink); border: 2px solid var(--staff-paper-bright); box-shadow: 0 12px 28px rgba(17, 19, 26, 0.22); }
.staff-toast[data-state="error"] { background: var(--staff-red); }

@media (max-width: 1180px) {
  :root { --staff-rail-width: 4.4rem; }
  .staff-brand span,
  .staff-rail button span,
  .staff-rail__site span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .staff-brand { justify-content: center; padding-inline: 0; }
  .staff-rail button,
  .staff-rail__site { grid-template-columns: 1fr; justify-items: center; padding-inline: 0.45rem; }
  .staff-rail button b { position: absolute; margin: -1.6rem 0 0 1.7rem; min-width: 1.2rem; min-height: 1.2rem; }
  .staff-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .staff-summary div:nth-child(3) { border-inline-end: 0; }
  .staff-summary div:nth-child(-n + 3) { border-block-end: 1px solid var(--staff-rule); }
}

@media (max-width: 820px) {
  :root { --staff-rail-width: 0rem; --staff-topbar-height: 4rem; }
  .staff-topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .staff-brand { width: 4.2rem; border-inline-end: 0; }
  .staff-service { padding-inline: 0.5rem; }
  .staff-service span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .staff-account { min-width: 0; }
  .staff-account > span { display: none; }
  .staff-shell { display: block; padding-block-end: 4.2rem; }
  .staff-main { grid-column: auto; }
  .staff-rail { inset: auto 0 0 0; width: 100%; height: 4.2rem; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr); border: 0; border-block-start: 2px solid var(--staff-ink); }
  .staff-rail nav { display: flex; overflow-x: auto; padding: 0; }
  .staff-rail button { flex: 0 0 4.5rem; height: 4.1rem; border-block-end: 0; border-inline-end: 1px solid rgba(255, 255, 255, 0.24); }
  .staff-rail__site { display: none; }
  .staff-commandbar { inset-block-start: var(--staff-topbar-height); align-items: start; flex-direction: column; min-height: 0; }
  .staff-commandbar h1 { font-size: 2.55rem; }
  .staff-commandbar__tools { width: 100%; }
  .staff-search { width: auto; flex: 1; }
  .staff-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-summary div { border-block-end: 1px solid var(--staff-rule); }
  .staff-summary div:nth-child(even) { border-inline-end: 0; }
  .staff-summary div:nth-last-child(-n + 2) { border-block-end: 0; }
  .staff-gate { grid-template-columns: 1fr; }
  .staff-gate__brand { min-height: 12rem; align-content: center; border-inline-end: 0; border-block-end: 2px solid var(--staff-ink); }
  .staff-gate__brand img { width: 4rem; height: 4rem; margin-block-end: 0.8rem; }
  .staff-gate__brand strong { font-size: 2.25rem; }
  .staff-gate__panel { margin-block: 1.5rem; }
  .staff-import-form { grid-template-columns: 1fr; align-items: stretch; }
  .staff-summary--clients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .staff-summary--clients div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .staff-service { font-size: 0.64rem; }
  .staff-commandbar__tools { flex-wrap: wrap; }
  .staff-search { flex-basis: 100%; }
  .staff-button span { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .staff-summary dd { font-size: 1.85rem; }
  .staff-form-grid { grid-template-columns: 1fr; }
  .staff-form-grid .is-wide { grid-column: auto; }
  .staff-drawer footer { align-items: stretch; flex-direction: column; }
  .staff-drawer footer > div { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .staff-loader { animation: none; width: 7rem; }
  .staff-site * { scroll-behavior: auto !important; }
}
