:root {
  --yourhema-accent: #F04E53;
  --yourhema-accent-deep: #D93D43;
  --yourhema-cross: #FEF6EC;
  --yourhema-surface: var(--body-bg, #ffffff);
  --yourhema-text: var(--body-fg, #1f1f1f);
  --yourhema-muted: var(--body-quiet-color, #626262);
  --yourhema-border: var(--hairline-color, #e4e4e4);
  --primary: #F04E53;
  --secondary: #D93D43;
  --accent: #FEF6EC;
  /* The darker brand derivative is used behind white text because the primary
     coral is an accent color, not a sufficient normal-text contrast surface. */
  --header-bg: #A92A30;
  --header-color: #ffffff;
  --breadcrumbs-bg: #8E1F24;
  --link-fg: #A92A30;
  --link-hover-color: #7A181D;
  --button-bg: #A92A30;
  --button-hover-bg: #8E1F24;
  --default-button-bg: #A92A30;
  --default-button-hover-bg: #8E1F24;
}

#header {
  min-height: 64px;
  padding: 10px 24px;
  align-items: center;
  gap: 24px;
}

#yourhema-brand a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
}

.yourhema-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  background: var(--yourhema-accent);
  border: 2px solid var(--yourhema-cross);
  color: var(--yourhema-cross);
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
}

.yourhema-admin-label {
  font-size: 13px;
  font-weight: 600;
  opacity: .84;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.yourhema-admin-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.yourhema-admin-nav a,
.yourhema-admin-nav button {
  color: #fff;
  font: inherit;
  font-size: 14px;
  background: transparent;
  border: 0;
  padding: 6px 0;
  cursor: pointer;
  text-decoration: none;
}

.yourhema-admin-nav form {
  margin: 0;
}

.module h2,
.module caption,
.inline-group h2 {
  background: var(--yourhema-accent);
}

.button,
input[type=submit],
input[type=button],
.submit-row input,
a.button {
  border-radius: 8px;
}

input,
textarea,
select {
  font-size: 16px;
}

.login #container {
  width: min(440px, calc(100vw - 32px));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .14);
}

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

.yourhema-security-shell {
  width: 100%;
  display: grid;
  place-items: start center;
  padding: clamp(8px, 2vw, 24px) 0 36px;
  box-sizing: border-box;
}

.yourhema-security-card {
  width: min(100%, 640px);
  box-sizing: border-box;
  background: var(--yourhema-surface);
  border: 1px solid var(--yourhema-border);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .08);
}

.yourhema-mfa-card {
  width: min(100%, 520px);
}

.yourhema-security-card h1 {
  margin: 4px 0 12px;
  color: var(--yourhema-text);
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.2;
  letter-spacing: -.02em;
}

.yourhema-security-description {
  max-width: 48ch;
  margin-bottom: 0 !important;
}

.yourhema-security-card p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--yourhema-muted);
}

.yourhema-eyebrow {
  color: var(--yourhema-accent-deep) !important;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  font-size: 12px !important;
}

.yourhema-qr-wrap {
  width: 220px;
  max-width: 100%;
  padding: 14px;
  margin: 22px 0;
  background: #fff;
  border: 1px solid var(--yourhema-border);
  border-radius: 12px;
}

.yourhema-qr-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.yourhema-secret {
  margin: 18px 0;
}

.yourhema-secret code {
  display: block;
  margin-top: 10px;
  padding: 12px;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #f5f5f5;
  font-size: 15px;
}

.yourhema-security-form {
  margin-top: 28px;
}

.yourhema-security-form .form-row {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  background: transparent;
}

.yourhema-security-form label {
  display: block;
  color: var(--yourhema-text);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.yourhema-security-form input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}

.yourhema-otp-field input {
  max-width: 260px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .18em;
  text-align: center;
}

.yourhema-security-form .help {
  margin: 8px 0 0;
  color: var(--yourhema-muted);
  font-size: 14px;
  line-height: 1.5;
}

.yourhema-security-form .errorlist {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--error-fg, #ba2121);
  font-size: 14px;
}

.yourhema-primary-action {
  width: 100%;
  min-height: 48px;
  border: 0;
  padding: 11px 18px;
  font-size: 16px;
  font-weight: 700;
}

.yourhema-definition-list {
  margin: 24px 0;
}

.yourhema-definition-list > div {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--yourhema-border);
}

.yourhema-definition-list dt {
  font-weight: 700;
}

.yourhema-definition-list dd {
  margin: 0;
}

.yourhema-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.yourhema-account-boundary {
  margin: 24px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--yourhema-border);
  border-radius: 12px;
  background: var(--darkened-bg, #f7f7f7);
}

.yourhema-account-boundary strong {
  display: block;
  color: var(--yourhema-text);
  font-size: 14px;
  margin-bottom: 4px;
}

.yourhema-account-boundary p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.yourhema-mfa-alternative {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 24px 0 14px;
}

.yourhema-mfa-alternative span {
  height: 1px;
  background: var(--yourhema-border);
}

.yourhema-mfa-alternative p {
  margin: 0;
  font-size: 13px;
  color: var(--yourhema-muted);
}

.yourhema-secondary-action,
.yourhema-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
}

.yourhema-secondary-action {
  width: 100%;
  min-height: 46px;
  background: transparent;
  border: 1px solid var(--yourhema-border);
  color: var(--yourhema-text);
  font-weight: 700;
}

.yourhema-back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 600;
}

.yourhema-recovery-field input {
  max-width: 100%;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
}

.yourhema-recovery-status {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 24px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--yourhema-border);
  border-radius: 12px;
  background: var(--darkened-bg, #f7f7f7);
}

.yourhema-recovery-status strong {
  color: var(--yourhema-text);
  font-size: 22px;
}

.yourhema-recovery-status span {
  color: var(--yourhema-muted);
  font-size: 14px;
}

.yourhema-recovery-code-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 16px;
}

.yourhema-recovery-code-list code {
  display: block;
  padding: 12px 10px;
  border: 1px solid var(--yourhema-border);
  border-radius: 10px;
  background: var(--darkened-bg, #f7f7f7);
  color: var(--yourhema-text);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .04em;
}

.yourhema-confirm-list {
  display: grid;
  gap: 8px;
  margin: 22px 0;
}

.yourhema-confirm-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--yourhema-border);
  border-radius: 10px;
  background: var(--darkened-bg, #f7f7f7);
}

.yourhema-confirm-list span {
  color: var(--yourhema-muted);
  font-size: 14px;
}

.yourhema-ops-grid {
  margin: 0 0 28px;
}

.yourhema-ops-heading h1 {
  margin: 2px 0 14px;
}

.yourhema-ops-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.yourhema-ops-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  box-sizing: border-box;
  border: 1px solid var(--yourhema-border);
  border-radius: 14px;
  background: var(--yourhema-surface);
  color: var(--yourhema-text);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
}

.yourhema-ops-card:hover,
.yourhema-ops-card:focus-visible {
  border-color: var(--yourhema-accent);
  text-decoration: none;
}

.yourhema-ops-count {
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.yourhema-ops-label {
  color: var(--yourhema-muted);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 650;
}

.yourhema-ops-card--attention .yourhema-ops-count {
  color: #A92A30;
}

.yourhema-ops-card--security .yourhema-ops-count {
  color: #6D3E8E;
}

@media (max-width: 767px) {
  #header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .yourhema-admin-nav {
    width: 100%;
    margin-left: 0;
    gap: 18px;
  }

  #content {
    padding: 16px;
  }

  .yourhema-security-shell {
    padding-top: 0;
  }

  .yourhema-security-card {
    width: 100%;
    padding: 22px 18px;
    border-radius: 14px;
  }

  .yourhema-otp-field input {
    max-width: 100%;
  }

  .yourhema-primary-action {
    width: 100%;
  }

  .yourhema-recovery-code-list {
    grid-template-columns: 1fr;
  }

  .yourhema-ops-cards {
    grid-template-columns: 1fr;
  }

  .yourhema-confirm-list > div {
    flex-direction: column;
    gap: 3px;
  }

  .yourhema-definition-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

html[data-theme="dark"] .yourhema-security-card,
html[data-theme="dark"] .yourhema-recovery-status,
html[data-theme="dark"] .yourhema-recovery-code-list code {
  background: var(--body-bg, #1c1c1e);
  color: var(--body-fg, #f5f5f7);
}

html[data-theme="dark"] .yourhema-security-card {
  box-shadow: 0 14px 38px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] .yourhema-security-form input {
  background: var(--darkened-bg, #242426);
  border-color: var(--hairline-color, #4a4a4f);
  color: var(--body-fg, #f5f5f7);
}

html[data-theme="dark"] .yourhema-security-form input:focus {
  border-color: #ff8d91;
  outline-color: #ff8d91;
}

html[data-theme="dark"] .yourhema-secret code {
  background: var(--darkened-bg, #2c2c2e);
  color: var(--body-fg, #f5f5f7);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .yourhema-security-card,
  html:not([data-theme]) .yourhema-security-card {
    box-shadow: 0 14px 38px rgba(0, 0, 0, .28);
  }

  html[data-theme="auto"] .yourhema-security-form input,
  html:not([data-theme]) .yourhema-security-form input {
    background: var(--darkened-bg, #242426);
    border-color: var(--hairline-color, #4a4a4f);
    color: var(--body-fg, #f5f5f7);
  }
}


/* Control-plane polish: keep Django's familiar information architecture while
   improving hierarchy, density, focus treatment, responsive overflow, and dark-mode
   consistency. These rules do not change model permissions or product behavior. */

#content {
  width: auto;
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 34px);
  box-sizing: border-box;
}

#content-main {
  min-width: 0;
}

.breadcrumbs {
  padding: 10px clamp(18px, 2.5vw, 34px);
  font-size: 13px;
  line-height: 1.4;
}

.yourhema-admin-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 28px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--yourhema-border);
  border-radius: 18px;
  background: var(--yourhema-surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .05);
}

.yourhema-admin-hero h1 {
  margin: 3px 0 8px;
  color: var(--yourhema-text);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.12;
  letter-spacing: -.025em;
}

.yourhema-admin-hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--yourhema-muted);
  font-size: 15px;
  line-height: 1.6;
}

.yourhema-dashboard-section,
.yourhema-admin-modules {
  margin: 0 0 30px;
}

.yourhema-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 12px;
}

.yourhema-section-heading h2 {
  margin: 2px 0 0;
  color: var(--yourhema-text);
  font-size: 20px;
  line-height: 1.25;
}

.yourhema-section-count {
  color: var(--yourhema-muted);
  font-size: 13px;
  white-space: nowrap;
}

.yourhema-all-clear {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 30px;
  padding: 16px 18px;
  border: 1px solid var(--yourhema-border);
  border-radius: 14px;
  background: var(--yourhema-surface);
}

.yourhema-all-clear strong {
  color: var(--yourhema-text);
  font-size: 15px;
}

.yourhema-all-clear p {
  margin: 3px 0 0;
  color: var(--yourhema-muted);
  font-size: 13px;
}

.yourhema-ops-cards {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.yourhema-ops-card {
  min-height: 142px;
  gap: 20px;
  padding: 19px;
  border-radius: 16px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.yourhema-ops-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 24px rgba(0, 0, 0, .08);
}

.yourhema-ops-card:focus-visible {
  outline: 3px solid rgba(240, 78, 83, .28);
  outline-offset: 2px;
}

.yourhema-ops-card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.yourhema-ops-label,
.yourhema-ops-description {
  display: block;
}

.yourhema-ops-label {
  color: var(--yourhema-text);
  font-size: 14px;
  font-weight: 750;
}

.yourhema-ops-description {
  margin-top: 5px;
  color: var(--yourhema-muted);
  font-size: 12px;
  line-height: 1.45;
}

.yourhema-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--yourhema-border);
  border-radius: 999px;
  color: var(--yourhema-muted);
  background: var(--darkened-bg, #f7f7f7);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
  white-space: nowrap;
}

.yourhema-status-pill--attention {
  border-color: rgba(169, 42, 48, .28);
  color: #8E1F24;
  background: rgba(240, 78, 83, .08);
}

.yourhema-status-pill--security {
  border-color: rgba(109, 62, 142, .28);
  color: #6D3E8E;
  background: rgba(109, 62, 142, .08);
}

.yourhema-status-pill--ok {
  border-color: rgba(46, 125, 50, .26);
  color: #256A2A;
  background: rgba(46, 125, 50, .08);
}

.yourhema-admin-modules > #content-main,
.yourhema-admin-modules .module {
  min-width: 0;
}

.dashboard .module,
#changelist .results,
#changelist-filter,
fieldset.module,
.inline-group {
  border: 1px solid var(--yourhema-border);
  border-radius: 12px;
  background: var(--yourhema-surface);
  overflow: hidden;
  box-shadow: none;
}

.module h2,
.module caption,
.inline-group h2 {
  padding: 11px 14px;
  border-bottom: 1px solid var(--yourhema-border);
  background: var(--darkened-bg, #f7f7f7);
  color: var(--yourhema-text);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .01em;
}

.dashboard .module table th,
.dashboard .module table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.dashboard .module a {
  font-weight: 600;
}

#changelist .changelist-form-container {
  min-width: 0;
}

#changelist .results {
  overflow-x: auto;
}

#changelist table {
  margin: 0;
  min-width: 720px;
}

#changelist table thead th {
  background: var(--darkened-bg, #f7f7f7);
  border-bottom: 1px solid var(--yourhema-border);
}

#changelist table tbody tr:last-child td,
#changelist table tbody tr:last-child th {
  border-bottom: 0;
}

#changelist-filter {
  padding-bottom: 10px;
}

#changelist-filter h2 {
  border-bottom: 1px solid var(--yourhema-border);
}

#changelist-filter h3 {
  margin-top: 14px;
}

#changelist .actions {
  padding: 10px 12px;
  border: 1px solid var(--yourhema-border);
  border-radius: 10px;
  background: var(--yourhema-surface);
}

fieldset.module .form-row {
  padding: 14px 16px;
}

.aligned label {
  color: var(--yourhema-text);
  font-weight: 650;
}

.help,
p.help,
form p.help,
div.help {
  color: var(--yourhema-muted);
}

input,
textarea,
select {
  max-width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(240, 78, 83, .24);
  outline-offset: 2px;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--yourhema-border);
  border-radius: 12px;
  background: var(--yourhema-surface);
}

.submit-row p {
  margin: 0;
}

.object-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.object-tools a:link,
.object-tools a:visited {
  border-radius: 8px;
  background: var(--button-bg);
}

.messagelist {
  margin: 0 0 20px;
}

.messagelist li {
  border-radius: 10px;
  background-position: 14px center;
  padding-top: 12px;
  padding-bottom: 12px;
}

.paginator {
  margin-top: 12px;
  border-top: 0;
}

.yourhema-admin-nav .yourhema-staff-name {
  max-width: 180px;
  overflow: hidden;
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yourhema-admin-nav .yourhema-staff-name strong {
  color: #fff;
  font-weight: 700;
}

html[data-theme="dark"] .yourhema-admin-hero,
html[data-theme="dark"] .yourhema-all-clear,
html[data-theme="dark"] .yourhema-ops-card,
html[data-theme="dark"] .dashboard .module,
html[data-theme="dark"] #changelist .results,
html[data-theme="dark"] #changelist-filter,
html[data-theme="dark"] fieldset.module,
html[data-theme="dark"] .inline-group,
html[data-theme="dark"] #changelist .actions,
html[data-theme="dark"] .submit-row {
  background: var(--body-bg);
  border-color: var(--hairline-color);
}

html[data-theme="dark"] .yourhema-status-pill--attention {
  color: #ffb1b4;
  background: rgba(240, 78, 83, .14);
}

html[data-theme="dark"] .yourhema-status-pill--security {
  color: #d7b8ea;
  background: rgba(150, 95, 190, .15);
}

html[data-theme="dark"] .yourhema-status-pill--ok {
  color: #9cd7a2;
  background: rgba(64, 150, 72, .14);
}

@media (prefers-reduced-motion: reduce) {
  .yourhema-ops-card {
    transition: none;
  }

  .yourhema-ops-card:hover {
    transform: none;
  }
}

@media (max-width: 767px) {
  #content {
    padding: 16px;
  }

  .yourhema-admin-hero {
    padding: 20px 18px;
    border-radius: 14px;
  }

  .yourhema-section-heading,
  .yourhema-all-clear {
    align-items: flex-start;
  }

  .yourhema-section-heading,
  .yourhema-all-clear {
    flex-direction: column;
  }

  .yourhema-ops-cards {
    grid-template-columns: 1fr;
  }

  #changelist table {
    min-width: 640px;
  }

  #changelist-filter {
    width: auto;
  }

  .yourhema-admin-nav .yourhema-staff-name {
    max-width: 120px;
  }
}
