:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --border: #d8dee8;
  --primary: #176b5b;
  --primary-hover: #0f5749;
  --success: #087443;
  --success-bg: #ecfdf3;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warning: #b54708;
  --shadow: 0 18px 45px rgba(24, 34, 48, 0.08);
}

* {
  letter-spacing: 0;
}

html {
  min-height: 100%;
  font-size: 15px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
}

.btn {
  border-radius: 7px;
  font-weight: 650;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-hover);
  --bs-btn-hover-border-color: var(--primary-hover);
  --bs-btn-active-bg: var(--primary-hover);
  --bs-btn-active-border-color: var(--primary-hover);
  border-color: var(--primary);
  background-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  border-color: var(--primary-hover);
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  border-color: #8abdb3;
  background-color: #8abdb3;
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: #9bc9be;
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
}

.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: #f0b8b3;
}

.btn-outline-success {
  --bs-btn-color: var(--success);
  --bs-btn-border-color: #a7d8bc;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #7cc0b2;
  box-shadow: 0 0 0 0.2rem rgba(23, 107, 91, 0.16);
}

.form-control,
.form-select {
  min-height: 46px;
  border-color: var(--border);
  border-radius: 7px;
  color: var(--text);
}

.form-control::placeholder {
  color: #98a2b3;
}

.form-label {
  margin-bottom: 0.4rem;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-body {
  background:
    linear-gradient(180deg, #eef6f3 0, rgba(238, 246, 243, 0) 270px),
    var(--bg);
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(216, 222, 232, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.admin-topbar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 68px;
}

.admin-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.admin-brand:hover {
  color: var(--text);
}

.admin-brand-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.admin-brand-mark-lg {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.admin-brand-text {
  font-weight: 800;
}

.admin-nav {
  display: flex;
  gap: 6px;
}

.admin-nav-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.admin-nav-link.active,
.admin-nav-link:hover {
  color: var(--primary);
  background: #eaf5f2;
}

.admin-account {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-account-name {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-main {
  padding: 32px 0 48px;
}

.page-heading {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.65rem, 2.8vw, 2.25rem);
  font-weight: 820;
}

.page-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app-btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  white-space: nowrap;
}

.btn-symbol {
  font-size: 1.25rem;
  line-height: 1;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.admin-panel,
.login-card {
  border: 1px solid rgba(216, 222, 232, 0.88);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card {
  display: flex;
  min-height: 92px;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.metric-card strong {
  margin-top: 6px;
  font-size: 2rem;
  line-height: 1;
}

.admin-panel {
  overflow: hidden;
}

.app-alert {
  border-radius: 8px;
  font-weight: 650;
}

.panel-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.search-control {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-control .form-control {
  padding-left: 42px;
}

.search-symbol {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 14px;
  height: 14px;
  border: 2px solid #98a2b3;
  border-radius: 50%;
  transform: translateY(-55%);
}

.search-symbol::after {
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: #98a2b3;
  content: "";
  transform: rotate(45deg);
}

.status-filter {
  width: 170px;
}

.admin-table {
  min-width: 920px;
}

.admin-table thead th {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: #475467;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table tbody td {
  padding-top: 15px;
  padding-bottom: 15px;
  border-color: #edf1f6;
  color: #344054;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #fbfdfc;
}

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.table-primary-text {
  color: var(--text);
  font-weight: 800;
}

.table-secondary-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.83rem;
}

.status-badge {
  display: inline-flex;
  min-width: 72px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-active {
  border-color: #abefc6;
  color: var(--success);
  background: var(--success-bg);
}

.status-passive {
  border-color: #fecdca;
  color: var(--danger);
  background: var(--danger-bg);
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.table-actions form {
  margin: 0;
}

.empty-row td {
  height: 120px;
  color: var(--muted);
  text-align: center;
}

.form-panel {
  padding: 24px;
}

.form-section {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.form-section-last {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.form-section-heading {
  margin-bottom: 14px;
}

.form-section h2,
.status-switch-row h2 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 820;
}

.form-muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.status-switch-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.form-check-input:checked {
  border-color: var(--primary);
  background-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, #0f3f36 0, #0f3f36 34%, transparent 34%),
    var(--bg);
}

.login-shell {
  display: grid;
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1fr);
  gap: 28px;
  align-items: center;
  margin: 0 auto;
  padding: 42px 0;
}

.login-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #ffffff;
  background: #0f3f36;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 850;
}

.login-brand p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-weight: 650;
}

.login-panel-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-panel-footer span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  font-weight: 700;
}

.login-card {
  width: min(100%, 460px);
  padding: 32px;
  justify-self: end;
}

.login-card-heading {
  margin-bottom: 24px;
}

.login-card h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 850;
}

.login-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-secondary-action {
  text-align: center;
}

.login-secondary-action a {
  color: var(--primary);
  font-weight: 750;
  text-decoration: none;
}

.login-secondary-action a:hover {
  text-decoration: underline;
}

.form-field {
  display: grid;
  gap: 4px;
}

@media (max-width: 860px) {
  .admin-topbar-inner {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 0;
  }

  .admin-nav,
  .admin-account {
    justify-content: space-between;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .search-control,
  .status-filter {
    width: 100%;
    min-width: 0;
  }

  .status-switch-row,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .login-body {
    background: var(--bg);
  }

  .login-shell {
    grid-template-columns: 1fr;
    padding: 20px 0;
  }

  .login-panel {
    min-height: 220px;
  }

  .login-card {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 520px) {
  .admin-shell,
  .login-shell {
    width: min(100% - 20px, 1180px);
  }

  .admin-account {
    align-items: stretch;
    flex-direction: column;
  }

  .table-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .form-panel,
  .login-card,
  .login-panel {
    padding: 20px;
  }
}
