.tenant-code-label {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.96);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
:root {
  --ins-primary: #1F3A5F;
  --ins-secondary: #2C5F8A;
  --ins-accent: #4A90E2;
  --ins-success: #2E7D32;
  --ins-warning: #ED6C02;
  --ins-danger: #C62828;
  --ins-bg: #F4F6F8;
  --ins-card: #FFFFFF;
  --ins-border: #D0D7DE;
  --ins-text: #1E293B;
  --ins-muted: #64748B;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--ins-bg);
  color: var(--ins-text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--ins-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.institution-container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 16px;
}

.institution-main-wrap {
  min-height: calc(100vh - 164px);
}

.institution-topbar {
  background: var(--ins-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  min-height: 56px;
}

.topbar-brand:hover {
  color: #fff;
}

.topbar-logo-wrap {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
}

.topbar-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar-username {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.96);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.btn-logout {
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #fff;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.btn-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.institution-subnav-wrap {
  background: #fff;
  border-bottom: 1px solid var(--ins-border);
}

.institution-subnav .nav-link {
  color: var(--ins-text);
  padding: 0.8rem 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
}

.institution-subnav .nav-link:hover,
.institution-subnav .nav-link.active {
  color: var(--ins-primary);
  border-bottom-color: var(--ins-primary);
}

.institution-footer {
  border-top: 1px solid var(--ins-border);
  background: #fff;
  color: var(--ins-muted);
  font-size: 0.8rem;
  padding: 10px 0;
}

.section-header {
  margin-bottom: 18px;
}

.section-header-title {
  margin-bottom: 4px;
}

.section-header-subtitle {
  margin: 0;
  color: var(--ins-muted);
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--ins-border);
  margin-top: 10px;
  margin-bottom: 0;
}

.card,
.content-card {
  background: var(--ins-card);
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--ins-border);
  color: var(--ins-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.card-body {
  padding: 24px;
}

.kpi-card {
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  background: #fff;
  padding: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  height: 100%;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: #eef3f8;
  color: var(--ins-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.kpi-label {
  color: var(--ins-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ins-primary);
  line-height: 1.2;
}

.btn {
  border-radius: 4px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--ins-primary);
  border-color: var(--ins-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #182f4d;
  border-color: #182f4d;
}

.btn-outline-primary {
  color: var(--ins-primary);
  border-color: var(--ins-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--ins-primary);
  border-color: var(--ins-primary);
}

.btn-outline-secondary {
  color: var(--ins-muted);
  border-color: var(--ins-border);
}

.btn-outline-danger {
  color: var(--ins-danger);
  border-color: #e4b3b3;
}

.btn-sm {
  padding: 0.22rem 0.52rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.table-actions .btn,
.page-header-actions .btn {
  padding: 0.22rem 0.52rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.modal-footer .btn {
  padding: 0.22rem 0.52rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.table {
  margin-bottom: 0;
  border: 1px solid var(--ins-border);
  color: var(--ins-text);
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--ins-border);
  padding: 0.58rem 0.62rem;
  font-size: 0.84rem;
  vertical-align: middle;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f6;
  color: var(--ins-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
}

.table tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.badge {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.32em 0.56em;
}
.member-status-active {
  background-color: #1f7a3a;
  color: #fff;
}
.member-status-inactive {
  background-color: #b73a3a;
  color: #fff;
}
.member-status-pending {
  background-color: #b66b0f;
  color: #fff;
}
.member-profile-sheet {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}
.member-profile-photo,
.member-edit-photo-panel {
  border: 1px solid var(--ins-border);
  background: #fff;
  border-radius: 6px;
  padding: 10px;
}
.member-profile-photo img,
.member-edit-photo {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border: 1px solid var(--ins-border);
  border-radius: 6px;
}
.member-no-photo {
  width: 100%;
  height: 170px;
  border: 1px dashed var(--ins-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ins-muted);
  font-size: 0.72rem;
  background: #f8fafc;
}
.member-profile-table-wrap {
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.member-profile-table th {
  width: 35%;
  background: #f2f5f9;
  color: var(--ins-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}
.member-profile-table td {
  color: var(--ins-text);
  font-weight: 600;
}

.gov-member-sheet {
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.gov-section-title {
  background: #1f3446;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.gov-section-title-inline {
  margin: 0;
  border-radius: 0;
}

.bg-success {
  background-color: var(--ins-success) !important;
}

.bg-danger {
  background-color: var(--ins-danger) !important;
}

.bg-warning {
  background-color: var(--ins-warning) !important;
}

.bg-secondary {
  background-color: var(--ins-muted) !important;
}

.form-label,
.form-check-label,
.modal .form-label,
.modal .form-check-label {
  color: var(--ins-text);
  font-weight: 600;
  margin-bottom: 0.32rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control,
.form-select,
.form-check-input,
textarea.form-control {
  border-color: var(--ins-border);
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--ins-text);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--ins-accent);
  box-shadow: 0 0 0 0.18rem rgba(74, 144, 226, 0.16);
}

.form-text,
.text-muted,
.small {
  color: var(--ins-muted) !important;
}

.table-actions {
  display: inline-flex;
  gap: 0.34rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.clear-member-button {
  display: none;
  line-height: 1;
}

.fieldset-block {
  border: 1px solid var(--ins-border);
  border-radius: 6px;
  padding: 14px;
  margin-bottom: 12px;
}

.fieldset-title {
  margin: 0 0 8px 0;
  font-size: 0.74rem;
  color: var(--ins-primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.required-indicator::after {
  content: " *";
  color: var(--ins-danger);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.login-brand-logo {
  width: 28px;
  height: 28px;
  display: block;
}

@media (max-width: 991.98px) {
  .institution-subnav .nav-link {
    border-bottom: 0;
    border-left: 2px solid transparent;
  }

  .institution-subnav .nav-link.active,
  .institution-subnav .nav-link:hover {
    border-left-color: var(--ins-primary);
    border-bottom-color: transparent;
  }
}

@media (max-width: 767.98px) {
  .topbar-user {
    gap: 6px;
  }

  .topbar-username {
    display: none;
  }

  .card-body {
    padding: 14px;
  }

  .kpi-value {
    font-size: 1.18rem;
  }

  .page-header-actions {
    width: 100%;
  }
}
@media (max-width: 768px) {
  .member-profile-sheet {
    grid-template-columns: 1fr;
  }

  .member-profile-photo {
    max-width: 220px;
  }
}

@media print {
  body {
    font-size: 11px;
    line-height: 1.3;
  }

  .section-header {
    margin-bottom: 6px;
  }

  .content-card {
    margin-bottom: 6px !important;
    break-inside: auto;
    page-break-inside: auto;
  }

  .card-body {
    padding: 8px !important;
  }

  .table > :not(caption) > * > * {
    padding: 0.32rem 0.4rem;
    font-size: 0.72rem;
  }

  .member-profile-sheet {
    display: grid !important;
    grid-template-columns: 168px minmax(0, 1fr) !important;
    gap: 8px;
    break-inside: auto;
    page-break-inside: auto;
  }

  .gov-member-sheet {
    break-inside: auto;
    page-break-inside: auto;
    padding: 6px;
  }

  .member-profile-photo,
  .member-profile-table-wrap {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .member-profile-photo img {
    height: 130px;
    object-fit: cover;
  }

  .gov-section-title {
    margin-bottom: 5px;
    padding: 6px 8px;
    font-size: 0.66rem;
    background: #1f3446 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .table-responsive {
    overflow: visible !important;
  }
}