:root {
  --red: #d50000;
  --red-dark: #b60000;
  --blue: #367fb9;
  --blue-dark: #286a9f;
  --orange: #f1ac43;
  --green: #4c9e65;
  --text: #242424;
  --muted: #73777d;
  --border: #e1e3e6;
  --surface: #ffffff;
  --background: #f4f5f7;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.admin-header {
  height: 92px;
  background: #fff;
}

.admin-header-inner {
  width: min(calc(100% - 48px), 1436px);
  height: 100%;
  display: grid;
  grid-template-columns: 205px 1fr auto;
  align-items: center;
  margin: 0 auto;
}

.admin-brand {
  display: flex;
  width: fit-content;
  align-items: center;
}

.admin-brand img {
  width: 170px;
  height: 70px;
  object-fit: contain;
  object-position: left center;
}

.admin-header-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 26px;
  border-left: 1px solid #e2e2e2;
}

.admin-header-title strong {
  font-size: 17px;
  font-weight: 600;
}

.admin-header-title span,
.back-link {
  color: #7b7b7b;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.back-link {
  color: #555;
  text-decoration: none;
}

.back-link:hover {
  color: var(--red);
}

.admin-red-line {
  height: 8px;
  background: var(--red);
}

.admin-login-view {
  min-height: calc(100vh - 100px);
  display: grid;
  place-items: start center;
  padding: 70px 20px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)),
    repeating-linear-gradient(
      -45deg,
      #ececec,
      #ececec 1px,
      #f7f7f7 1px,
      #f7f7f7 8px
    );
}

.login-card {
  width: min(100%, 440px);
  padding: 34px 38px 30px;
  background: #fff;
  border-top: 4px solid var(--red);
  border-radius: 3px;
  box-shadow: 0 13px 42px rgba(0, 0, 0, 0.13);
}

.login-card-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.lock-icon {
  position: relative;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #454545;
  border-radius: 50%;
  font-size: 10px;
}

.lock-icon::before {
  content: "";
  position: absolute;
  top: 9px;
  width: 13px;
  height: 11px;
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.lock-icon::after {
  content: "";
  position: absolute;
  top: 20px;
  width: 18px;
  height: 14px;
  background: #fff;
  border-radius: 2px;
}

.login-card-heading p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

.login-card-heading h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 400;
}

.login-card form {
  display: flex;
  flex-direction: column;
}

.login-card label,
.form-grid label > span {
  margin-bottom: 7px;
  color: #555;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
}

.login-card input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.search-field {
  border: 1px solid #cfd3d7;
  border-radius: 4px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.login-card input {
  height: 48px;
  margin-bottom: 18px;
  padding: 0 14px;
}

.login-card input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(54, 127, 185, 0.12);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue-dark);
}

.primary-button:hover {
  background: #2f74aa;
}

.secondary-button {
  color: #555;
  background: #fff;
  border: 1px solid #cfd1d4;
}

.secondary-button:hover {
  color: var(--red);
  border-color: var(--red);
}

.full-button {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 4px;
  font-size: 15px;
}

.button-spinner {
  display: none;
  width: 19px;
  height: 19px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.login-card form.loading .button-text {
  display: none;
}

.login-card form.loading .button-spinner {
  display: block;
}

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

.login-help {
  margin: 19px 0 0;
  padding-top: 18px;
  color: #888;
  border-top: 1px solid #ededed;
  font-family: Arial, sans-serif;
  font-size: 11px;
  text-align: center;
}

.admin-app-view {
  padding: 32px 0 70px;
}

.admin-page {
  width: min(calc(100% - 48px), 1436px);
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.page-heading h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
}

.welcome-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 19px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.035);
}

.stat-icon {
  width: 45px;
  height: 45px;
  display: grid;
  flex: 0 0 45px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-weight: 700;
}

.stat-blue {
  background: var(--blue);
}

.stat-green {
  background: var(--green);
}

.stat-orange {
  background: var(--orange);
}

.stat-red {
  background: var(--red);
}

.stat-card > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card span:not(.stat-icon) {
  color: #7d8085;
  font-family: Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 25px;
  font-weight: 500;
}

.management-panel {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.panel-tabs {
  display: flex;
  height: 59px;
  padding: 0 22px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}

.panel-tab {
  position: relative;
  min-width: 135px;
  padding: 0 20px;
  color: #777;
  background: transparent;
  border: 0;
  font-size: 15px;
}

.panel-tab.active {
  color: #202020;
  font-weight: 600;
}

.panel-tab.active::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  background: var(--red);
}

.panel-toolbar {
  min-height: 73px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid #ededed;
}

.search-field {
  width: min(100%, 390px);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #999;
}

.search-field input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 17px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #eceef0;
}

th {
  color: #777b80;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: #454545;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

tbody tr:hover {
  background: #fafbfc;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.primary-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.primary-cell strong {
  color: #252525;
  font-size: 13px;
}

.primary-cell span {
  color: #979797;
  font-size: 11px;
}

.status-badge {
  display: inline-flex;
  min-width: 57px;
  justify-content: center;
  padding: 5px 9px;
  color: #377b4a;
  background: #eaf6ed;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-badge.inactive {
  color: #a33a3a;
  background: #fbe9e9;
}

.actions-column {
  width: 125px;
  text-align: right;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.icon-button {
  height: 31px;
  padding: 0 10px;
  color: #5b6269;
  background: #fff;
  border: 1px solid #d8dadd;
  border-radius: 3px;
  font-size: 11px;
}

.icon-button:hover {
  color: var(--blue);
  border-color: var(--blue);
}

.icon-button.delete:hover {
  color: var(--red);
  border-color: var(--red);
}

.empty-state {
  padding: 55px 20px;
  color: #8a8d91;
  font-family: Arial, sans-serif;
  font-size: 13px;
  text-align: center;
}

.record-dialog {
  width: min(calc(100% - 32px), 680px);
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-top: 4px solid var(--red);
  border-radius: 4px;
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.3);
}

.record-dialog::backdrop {
  background: rgba(15, 18, 20, 0.58);
  backdrop-filter: blur(2px);
}

.record-dialog form {
  padding: 27px 30px 25px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 25px;
  padding-bottom: 18px;
  border-bottom: 1px solid #ececec;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 400;
}

.dialog-close {
  width: 35px;
  height: 35px;
  color: #777;
  background: #f5f5f5;
  border: 0;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
}

.form-grid label > span {
  margin: 0 0 7px;
}

.form-grid .wide-field {
  grid-column: 1 / -1;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 0 12px;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.form-grid input,
.form-grid select {
  height: 43px;
}

.form-grid textarea {
  min-height: 82px;
  padding-top: 11px;
  resize: vertical;
}

#passport-number {
  text-transform: uppercase;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #ececec;
}

.dialog-actions button {
  min-width: 105px;
}

.admin-toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  max-width: min(390px, calc(100vw - 48px));
  padding: 14px 18px;
  color: #fff;
  background: #343434;
  border-left: 4px solid var(--blue);
  border-radius: 4px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast.error {
  border-left-color: var(--red);
}

.admin-toast.success {
  border-left-color: var(--green);
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-header-inner {
    grid-template-columns: 180px 1fr auto;
  }

  .admin-header-title {
    padding-left: 15px;
  }
}

@media (max-width: 680px) {
  .admin-header {
    height: 82px;
  }

  .admin-header-inner,
  .admin-page {
    width: min(calc(100% - 28px), 1436px);
  }

  .admin-header-inner {
    grid-template-columns: 1fr auto;
  }

  .admin-brand img {
    width: 145px;
    height: 60px;
  }

  .admin-header-title {
    display: none;
  }

  .back-link {
    font-size: 11px;
  }

  .admin-login-view {
    min-height: calc(100vh - 90px);
    padding: 35px 14px;
  }

  .login-card {
    padding: 29px 24px 25px;
  }

  .admin-app-view {
    padding-top: 24px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-tabs {
    padding: 0 8px;
  }

  .panel-tab {
    min-width: 120px;
  }

  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide-field {
    grid-column: auto;
  }

  .record-dialog form {
    padding: 23px 20px 20px;
  }
}
