.account-button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #cbdce1;
  background: #ffffff;
  color: #064b5d;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-button {
  border-color: #064b5d;
  background: #064b5d;
  color: #ffffff;
}

.secure-login-box {
  width: min(94vw, 480px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 20px 0;
  border-bottom: 1px solid #d7e3e7;
}

.auth-tabs button {
  min-height: 46px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #637a83;
  font: inherit;
  font-weight: 700;
}

.auth-tabs button.active {
  border-color: #087b99;
  color: #102a33;
}

.secure-auth-form {
  display: grid;
  gap: 14px;
}

.secure-auth-form[hidden] {
  display: none;
}

.secure-auth-form label,
.profile-form label {
  display: grid;
  gap: 6px;
  color: #526b75;
  font-size: 13px;
  font-weight: 700;
}

.secure-auth-form input,
.secure-auth-form select,
.profile-form input,
.profile-form select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid #cbdce1;
  background: #ffffff;
  color: #102a33;
  font: inherit;
  font-size: 16px;
}

.secure-auth-form button[type="submit"],
.profile-form button[type="submit"] {
  min-height: 50px;
  border: 0;
  background: #064b5d;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
}

.auth-message {
  min-height: 22px;
  color: #526b75;
  font-size: 13px;
  line-height: 1.4;
}

.auth-message.error {
  color: #b32f2a;
}

.portal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  background: #f4f8f9;
  color: #102a33;
}

.portal-overlay[hidden] {
  display: none;
}

.portal-head {
  min-height: 72px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d7e3e7;
  background: #ffffff;
}

.portal-head div {
  min-width: 0;
}

.portal-head h2,
.portal-head p {
  margin: 0;
}

.portal-head h2 {
  font-size: 25px;
}

.portal-head p {
  margin-top: 3px;
  color: #637a83;
  font-size: 13px;
}

.portal-close {
  width: 46px;
  height: 46px;
  border: 1px solid #cbdce1;
  background: #ffffff;
  color: #064b5d;
  font-size: 24px;
}

.admin-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.admin-nav {
  padding: 18px 12px;
  display: grid;
  align-content: start;
  gap: 6px;
  background: #064b5d;
}

.admin-nav button {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  background: transparent;
  color: #d8edf2;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.admin-nav button.active {
  border-color: rgb(255 255 255 / 40%);
  background: rgb(255 255 255 / 14%);
  color: #ffffff;
}

.admin-content {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.admin-loading,
.admin-empty {
  padding: 30px;
  color: #637a83;
  text-align: center;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metric {
  min-width: 0;
  padding: 16px;
  border-left: 4px solid #087b99;
  background: #ffffff;
  box-shadow: 0 8px 22px rgb(6 75 93 / 8%);
}

.admin-metric.alert {
  border-left-color: #f1463f;
}

.admin-metric span,
.admin-metric small {
  display: block;
  color: #637a83;
}

.admin-metric b {
  display: block;
  margin: 7px 0;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}

.admin-section {
  margin-top: 22px;
}

.admin-section h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.admin-table-wrap {
  overflow-x: auto;
  background: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e2eaed;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: #526b75;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.admin-table td.error-text {
  max-width: 380px;
  color: #b32f2a;
  overflow-wrap: anywhere;
}

.filter-audit-table td:first-child {
  min-width: 300px;
  max-width: 520px;
}

.filter-audit-table code {
  color: #064b5d;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-filter-reasons {
  min-width: 280px;
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
}

.status-chip {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 4px;
  background: #e7f2f5;
  color: #064b5d;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.failed,
.status-chip.rejected {
  background: #fde9e7;
  color: #a72c27;
}

.status-chip.pending,
.status-chip.running {
  background: #fff1d8;
  color: #75510d;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-row-actions button,
.admin-row-actions select {
  min-height: 40px;
  padding: 0 9px;
  border: 1px solid #cbdce1;
  background: #ffffff;
  color: #102a33;
  font: inherit;
}

.admin-row-actions button.primary {
  border-color: #064b5d;
  background: #064b5d;
  color: #ffffff;
}

.admin-row-actions button.reject {
  border-color: #f1463f;
  color: #b32f2a;
}

.profile-panel {
  align-content: center;
  justify-content: center;
  padding: 18px;
  background: rgb(6 38 48 / 72%);
}

.profile-card {
  width: min(100%, 520px);
  max-height: calc(100dvh - 36px);
  padding: 20px;
  overflow: auto;
  background: #ffffff;
}

.profile-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.profile-card h2 {
  margin: 0;
}

.profile-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.profile-role {
  color: #087b99;
  font-weight: 700;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tabs.single {
  grid-template-columns: 1fr;
}

.admin-create-user {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.admin-create-user label {
  display: grid;
  gap: 6px;
  color: #5d7580;
  font-size: 12px;
  font-weight: 700;
}

.admin-create-user input,
.admin-create-user select,
.admin-create-user button {
  min-height: 44px;
  box-sizing: border-box;
}

.admin-create-user input,
.admin-create-user select {
  width: 100%;
  border: 1px solid #bfd2d9;
  background: #fff;
  padding: 9px 10px;
  color: #102730;
  font: inherit;
}

.admin-create-user .auth-message {
  align-self: center;
  margin: 0;
}

.logout-button {
  min-height: 48px;
  border: 1px solid #f1463f;
  background: #ffffff;
  color: #b32f2a;
  font: inherit;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-create-user {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar .admin-button {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
    min-width: 72px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .topbar:has(.admin-button) .language {
    display: none;
  }

  .admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .admin-nav {
    display: flex;
    padding: 8px;
    overflow-x: auto;
  }

  .admin-nav button {
    flex: 0 0 132px;
    text-align: center;
  }

  .admin-content {
    padding: 14px;
  }

  .admin-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .admin-metric {
    padding: 12px;
  }

  .admin-metric b {
    font-size: 24px;
  }

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .admin-create-user {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .admin-metrics {
    grid-template-columns: 1fr;
  }
}
