:root {
  --navy: #1d3041;
  --navy-dark: #142432;
  --red: #a21f25;
  --red-dark: #86191e;
  --cream: #f4f1e8;
  --white: #ffffff;
  --text: #1d3041;
  --muted: #66737d;
  --border: #d9dee3;
  --background: #f5f6f7;
  --success: #2d6a42;
  --success-soft: #eaf5ed;
  --warning: #8a5a00;
  --warning-soft: #fff4d6;
  --danger-soft: #fbeaec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.siteBar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  border-bottom: 5px solid var(--red);
}

.siteBarInner {
  min-height: 68px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.siteName {
  color: var(--white);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  text-transform: uppercase;
}

.siteName span {
  color: #c9d3da;
  font-weight: 400;
}

.accountArea {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--white);
  font-size: 14px;
}

.textButton,
.dangerTextButton {
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 700;
}

.textButton {
  color: var(--white);
}

.dangerTextButton {
  color: var(--red);
}

.appShell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  padding: 28px 18px;
  background: var(--white);
  border-right: 1px solid var(--border);
}

.sidebarTitle {
  padding: 0 12px 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.navList {
  display: grid;
  gap: 5px;
}

.navButton {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.navButton:hover {
  background: #eef1f3;
}

.navButton.active {
  background: var(--navy);
  color: var(--white);
}

.portalLink {
  display: block;
  margin-top: 28px;
  padding: 12px;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.mainContent {
  padding: 36px;
}

.loadingScreen,
.errorScreen {
  max-width: 680px;
  margin: 80px auto;
  text-align: center;
}

.dashboard,
.view {
  width: 100%;
}

.pageHeading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 32px;
}

h2 {
  margin-bottom: 7px;
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

.pageHeading p,
.panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.primaryButton,
.secondaryButton {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 5px;
  font-weight: 700;
}

.primaryButton {
  border: 1px solid var(--red);
  background: var(--red);
  color: var(--white);
}

.primaryButton:hover {
  background: var(--red-dark);
}

.primaryButton:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.secondaryButton {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
}

.secondaryButton:hover {
  background: #f1f3f4;
}

.statGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.statCard,
.panel,
.tablePanel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.statCard {
  padding: 22px;
}

.statLabel {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.statValue {
  font-size: 30px;
}

.panelGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panelHeading,
.importHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.searchInput,
.selectInput,
.formField input,
.formField select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--white);
  color: var(--text);
}

.searchInput,
.formField input,
.formField select {
  padding: 9px 11px;
}

.searchInput {
  width: min(360px, 100%);
}

.selectInput {
  min-width: 170px;
  padding: 9px 32px 9px 11px;
}

.tablePanel {
  overflow: hidden;
}

.userTableHeader,
.userRow {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.5fr)
    140px
    minmax(190px, 1fr)
    130px
    90px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
}

.userTableHeader {
  background: #edf0f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.userRow {
  border-top: 1px solid var(--border);
}

.userName {
  font-weight: 700;
}

.userEmail,
.assignmentText {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.statusBadge {
  display: inline-flex;
  width: max-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.statusActive {
  background: var(--success-soft);
  color: var(--success);
}

.statusInactive {
  background: var(--danger-soft);
  color: var(--red);
}

.statusSetup {
  margin-top: 5px;
  background: var(--warning-soft);
  color: var(--warning);
}

.editButton {
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 700;
}

.emptyState {
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.importPanel {
  max-width: 820px;
}

.progressSection {
  margin-top: 28px;
}

.progressLabels {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 9px;
}

.progressTrack {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e8eb;
}

.progressBar {
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width .2s ease;
}

.importResult {
  margin-top: 20px;
  padding: 16px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  line-height: 1.6;
}

.importResult.error {
  background: var(--danger-soft);
  color: var(--red);
}

.modal {
  width: min(720px, calc(100% - 30px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .25);
}

.modal::backdrop {
  background: rgba(15, 25, 32, .58);
}

.modalCard {
  padding: 24px;
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.closeButton {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
  line-height: 1;
}

.formGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.formField {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.checkboxField {
  display: flex;
  align-items: center;
  padding-top: 27px;
}

.assignmentSection {
  margin-top: 22px;
}

.assignmentSearch {
  width: 100%;
  margin-bottom: 10px;
}

.assignmentList {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.assignmentOption {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.assignmentOption:last-child {
  border-bottom: 0;
}

.formMessage {
  margin-top: 18px;
  padding: 12px;
  border-radius: 5px;
  background: var(--danger-soft);
  color: var(--red);
}

.modalActions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.actionSpacer {
  flex: 1;
}

@media (max-width: 950px) {
  .statGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panelGrid {
    grid-template-columns: 1fr;
  }

  .userTableHeader {
    display: none;
  }

  .userRow {
    grid-template-columns: 1fr auto;
  }

  .userRow > :not(:first-child):not(:last-child) {
    display: none;
  }
}

@media (max-width: 720px) {
  .siteBarInner {
    padding: 0 16px;
  }

  .accountArea span,
  .siteName span {
    display: none;
  }

  .appShell {
    display: block;
  }

  .sidebar {
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebarTitle,
  .portalLink {
    display: none;
  }

  .navList {
    grid-template-columns: repeat(3, 1fr);
  }

  .navButton {
    text-align: center;
  }

  .mainContent {
    padding: 22px 15px;
  }

  .pageHeading,
  .importHeader {
    align-items: stretch;
    flex-direction: column;
  }

  .statGrid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    flex-direction: column;
  }

  .searchInput,
  .selectInput {
    width: 100%;
  }

  .formGrid {
    grid-template-columns: 1fr;
  }

  .checkboxField {
    padding-top: 0;
  }
}