:root {
  --rp-primary: #046169;
  --rp-primary-deep: #1d1d1d;
  --rp-secondary: #046169;
  --rp-accent: #ffc900;
  --rp-accent-soft: #fff6cc;
  --rp-header-2: #FFFFFF;
  --rp-bg: #F4F4F5;
  --rp-card: #FFFFFF;
  --rp-text: #3d3d3d;
  --rp-muted: #7b7b7b;
  --rp-border: #E0E0E0;
  --rp-success: #198754;
  --rp-danger: #DC3545;
  --rp-sidebar-width: 268px;
  --rp-radius: 0.85rem;
  --rp-shadow: 0 10px 28px rgba(29, 29, 29, 0.1);
  --rp-shadow-sm: 0 4px 14px rgba(29, 29, 29, 0.08);
  --rp-font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--rp-font);
  color: var(--rp-text);
  background: var(--rp-bg);
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--rp-secondary);
}

a:hover {
  color: var(--rp-primary);
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(36, 87, 167, 0.25);
}

.form-control:focus {
  border-color: var(--rp-secondary);
}

.validation-summary-valid {
  display: none;
}

.validation-summary-errors {
  color: #842029;
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.field-validation-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--rp-danger);
}

.text-muted,
.text-secondary {
  color: var(--rp-muted) !important;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(201, 162, 39, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 12%, rgba(36, 87, 167, 0.22), transparent 26rem),
    linear-gradient(155deg, #edf2f8 0%, #f7f9fc 45%, #e8eef7 100%);
  z-index: 0;
}

.login-page.admin-login-page::before {
  background:
    radial-gradient(circle at 85% 15%, rgba(201, 162, 39, 0.22), transparent 24rem),
    radial-gradient(circle at 10% 80%, rgba(36, 87, 167, 0.2), transparent 24rem),
    linear-gradient(160deg, #0e1f36 0%, #142b4a 48%, #1a3558 100%);
}

.login-stage {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 1.25rem;
  box-shadow: 0 28px 70px rgba(20, 43, 74, 0.18);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.admin-login-page .login-stage {
  background: #fff;
  border: 1px solid rgba(201, 162, 39, 0.25);
}

.reception-login-page::before {
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 201, 0, 0.22), transparent 24rem),
    radial-gradient(circle at 10% 80%, rgba(112, 128, 144, 0.22), transparent 24rem),
    linear-gradient(160deg, #5a6876 0%, #708090 48%, #5f6d7a 100%);
}

.reception-login-page .login-stage {
  background: #fff;
  border: 1px solid rgba(201, 162, 39, 0.25);
}

.reception-login-page .login-hero {
  background:
    linear-gradient(165deg, #5a6876, #708090 55%, #5f6d7a),
    radial-gradient(circle at top right, rgba(255, 201, 0, 0.28), transparent 16rem);
}

.reception-login-page .login-kicker {
  color: var(--rp-accent);
}

.login-hero {
  padding: 2.5rem 2.2rem;
  background:
    linear-gradient(160deg, rgba(20, 43, 74, 0.96), rgba(36, 87, 167, 0.9)),
    radial-gradient(circle at bottom left, rgba(201, 162, 39, 0.35), transparent 18rem);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 520px;
}

.admin-login-page .login-hero {
  background:
    linear-gradient(165deg, #0e1f36, #142b4a 55%, #1d3f6d),
    radial-gradient(circle at top right, rgba(201, 162, 39, 0.28), transparent 16rem);
}

.login-hero-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--rp-accent), #e6b400);
  color: var(--rp-primary-deep);
  font-size: 1.35rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.login-hero-brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.login-hero-brand span {
  display: block;
  font-size: 0.78rem;
  opacity: 0.82;
}

.login-hero h2 {
  margin: 2rem 0 0.75rem;
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.login-hero p {
  margin: 0;
  max-width: 28rem;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.55;
}

.login-portal-links {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 22rem;
}

.login-portal-links-label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.login-portal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.login-portal-link:hover,
.login-portal-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(201, 162, 39, 0.55);
  transform: translateY(-1px);
}

.login-portal-link:focus-visible {
  outline: 2px solid var(--rp-accent);
  outline-offset: 2px;
}

.login-portal-link i {
  color: var(--rp-accent);
  font-size: 1.05rem;
}

.login-hero-art {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.login-hero-tile {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.85rem;
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.login-hero-tile i {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
  color: var(--rp-accent);
}

.login-hero-tile span {
  font-size: 0.75rem;
  opacity: 0.9;
}

.login-panel {
  padding: 2.4rem 2rem;
  display: flex;
  align-items: center;
}

.login-card {
  width: 100%;
}

.login-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rp-secondary);
}

.admin-login-page .login-kicker {
  color: var(--rp-accent);
}

.login-card h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--rp-primary);
  letter-spacing: -0.02em;
}

.login-lead {
  margin: 0.55rem 0 1.5rem;
  color: var(--rp-muted);
}

.input-icon-group {
  position: relative;
}

.input-icon-group > i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rp-muted);
  pointer-events: none;
}

.input-icon-group .form-control {
  padding-left: 2.45rem;
  min-height: 2.85rem;
  border-radius: 0.7rem;
  border-color: #d7dee8;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--rp-muted);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
}

.password-toggle:hover,
.password-toggle:focus {
  color: var(--rp-secondary);
  background: #eef3fb;
}

.input-icon-group.has-toggle .form-control {
  padding-right: 2.75rem;
}

.btn-portal {
  min-height: 2.15rem;
  padding: 0.35rem 0.9rem;
  border-radius: 0.55rem;
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-portal:hover {
  transform: translateY(-1px);
}

.btn-resident {
  background: linear-gradient(135deg, var(--rp-secondary), #1d4a8f);
  border: 0;
  color: #fff;
  box-shadow: 0 10px 22px rgba(36, 87, 167, 0.28);
}

.btn-resident:hover,
.btn-resident:focus {
  background: linear-gradient(135deg, #1f4d96, #163d78);
  color: #fff;
}

.btn-admin {
  background: linear-gradient(135deg, var(--rp-primary), #1c3d68);
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: #fff;
  box-shadow: 0 10px 22px rgba(14, 31, 54, 0.28);
}

.btn-admin:hover,
.btn-admin:focus {
  background: linear-gradient(135deg, #183456, #0e1f36);
  color: #fff;
}

.btn-reception {
  background: linear-gradient(135deg, #708090, #5f6d7a);
  border: 0;
  color: #fff;
  box-shadow: 0 10px 22px rgba(112, 128, 144, 0.28);
}

.btn-reception:hover,
.btn-reception:focus {
  background: linear-gradient(135deg, #5f6d7a, #5a6876);
  color: #fff;
}

.btn-outline-portal {
  border: 1px solid var(--rp-border);
  color: var(--rp-primary);
  background: #fff;
  border-radius: 0.7rem;
  font-weight: 600;
}

.btn-outline-portal:hover,
.btn-outline-portal:focus {
  background: #eef3fb;
  border-color: #c9d7ea;
  color: var(--rp-primary);
}

/* ---------- App shell ---------- */
.app-body {
  min-height: 100vh;
  background: var(--rp-bg);
}

.app-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header-primary {
  background: var(--rp-primary);
  color: #fff;
  padding: 0.45rem 1.15rem;
  box-shadow: 0 2px 10px rgba(29, 29, 29, 0.22);
  position: relative;
  z-index: 1030;
}

.app-header-primary .brand-mark {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.55rem;
  font-size: 1.05rem;
  box-shadow: none;
}

.app-header-primary::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.8), transparent);
}

.app-header-primary-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.app-brand:hover {
  color: inherit;
}

.app-brand-copy strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.app-brand-copy span {
  display: block;
  font-size: 0.68rem;
  opacity: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.app-user-menu .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.6rem 0.2rem 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 2rem;
  line-height: 1;
}

.app-user-menu .dropdown-toggle::after {
  margin-left: 0.15rem;
}

.app-user-menu .dropdown-toggle:hover,
.app-user-menu .dropdown-toggle:focus,
.app-user-menu .dropdown-toggle.show {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.app-avatar {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rp-accent);
  color: var(--rp-primary-deep);
  font-weight: 750;
  font-size: 0.72rem;
}

.app-user-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-menu .dropdown-menu {
  border: 1px solid var(--rp-border);
  border-radius: 0.85rem;
  box-shadow: var(--rp-shadow);
  padding: 0.4rem;
  min-width: 12.5rem;
}

.app-user-menu .dropdown-item {
  border-radius: 0.55rem;
  padding: 0.55rem 0.75rem;
  color: var(--rp-text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.app-user-menu .dropdown-item:hover,
.app-user-menu .dropdown-item:focus {
  background: #eef3fb;
  color: var(--rp-primary);
}

.app-user-menu .dropdown-item.danger {
  color: var(--rp-danger);
}

.app-header-secondary {
  background: #fff;
  border-bottom: 1px solid var(--rp-border);
  padding: 0.4rem 1.15rem;
}

.app-header-secondary-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 2.15rem;
}

.header-quick-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
}

.header-quick-nav a {
  color: var(--rp-primary);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.84rem;
  padding: 0.15rem 0.1rem;
  border-bottom: 2px solid transparent;
  line-height: 1.2;
}

.header-quick-nav a:hover,
.header-quick-nav a.active {
  color: var(--rp-secondary);
  border-bottom-color: var(--rp-accent);
}

.sidebar-toggle {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  border: 1px solid var(--rp-border);
  background: #fff;
  color: var(--rp-primary);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  padding: 0;
  line-height: 1;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
  background: #eef3fb;
  border-color: #c9d7ea;
}

.app-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--rp-muted);
  font-size: 0.82rem;
}

.app-breadcrumb a {
  color: var(--rp-primary);
  text-decoration: none;
  font-weight: 600;
}

.app-breadcrumb a:hover {
  color: var(--rp-secondary);
}

.app-breadcrumb .current {
  color: var(--rp-text);
  font-weight: 650;
}

.app-breadcrumb i {
  font-size: 0.75rem;
  opacity: 0.7;
}

.app-gold-rule {
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, #e6b400, var(--rp-accent), #ffe566, var(--rp-accent), #e6b400);
}

.app-shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-sidebar {
  width: var(--rp-sidebar-width);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--rp-border);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, transform 0.2s ease, margin 0.2s ease;
  z-index: 1020;
}

.portal-admin .app-sidebar {
  background: linear-gradient(180deg, #122741 0%, #142b4a 100%);
  border-right-color: rgba(255, 255, 255, 0.06);
  color: #d7e0ec;
}

.portal-reception .app-sidebar {
  background: linear-gradient(180deg, #5f6d7a 0%, #708090 100%);
  border-right-color: rgba(255, 255, 255, 0.06);
  color: #eef1f3;
}

.portal-resident .app-sidebar {
  background: linear-gradient(180deg, #035057 0%, #046169 100%);
  border-right-color: rgba(255, 255, 255, 0.06);
  color: #e6f4f4;
}

.portal-reception .app-header-primary {
  background: #708090;
  box-shadow: 0 2px 10px rgba(112, 128, 144, 0.28);
}

.portal-resident .app-header-primary {
  background: #046169;
  color: #fff;
  box-shadow: 0 2px 10px rgba(4, 97, 105, 0.28);
}

.portal-reception .app-header-primary::after {
  background: linear-gradient(90deg, transparent, rgba(255, 201, 0, 0.85), transparent);
}

.portal-resident .app-header-primary::after {
  background: linear-gradient(90deg, transparent, rgba(255, 201, 0, 0.85), transparent);
}

.portal-resident .app-user-menu .dropdown-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.portal-resident .app-user-menu .dropdown-toggle:hover,
.portal-resident .app-user-menu .dropdown-toggle:focus,
.portal-resident .app-user-menu .dropdown-toggle.show {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.portal-resident .app-avatar {
  background: #ffc900;
  color: #1d1d1d;
}

.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.85rem;
  overflow-y: auto;
}

.portal-resident .app-sidebar-nav,
.portal-reception .app-sidebar-nav {
  gap: 0;
  padding: 0.65rem 0.7rem;
  font-size: 0.88rem;
}

.portal-resident .app-sidebar-nav > a:first-child {
  margin-top: 0.35rem;
}

.portal-reception .app-sidebar-nav > a:first-child {
  margin-top: 0.65rem;
}

.portal-resident .app-sidebar-nav > a,
.portal-resident .app-sidebar-nav > .nav-group,
.portal-resident .app-sidebar-nav > form,
.portal-reception .app-sidebar-nav > a,
.portal-reception .app-sidebar-nav > .nav-group,
.portal-reception .app-sidebar-nav > form {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.portal-resident .app-sidebar-nav > :last-child,
.portal-reception .app-sidebar-nav > :last-child {
  border-bottom: 0;
}

.app-sidebar-nav a,
.app-sidebar-nav button.nav-link-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--rp-text);
  border-radius: 0.7rem;
  padding: 0.72rem 0.85rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.portal-resident .app-sidebar-nav a,
.portal-resident .app-sidebar-nav button.nav-link-btn,
.portal-reception .app-sidebar-nav a,
.portal-reception .app-sidebar-nav button.nav-link-btn {
  border-radius: 0.45rem;
  padding: 0.52rem 0.7rem;
  font-size: inherit;
}

.portal-resident .app-sidebar-nav a i,
.portal-resident .app-sidebar-nav button.nav-link-btn i,
.portal-reception .app-sidebar-nav a i,
.portal-reception .app-sidebar-nav button.nav-link-btn i {
  font-size: 0.95rem;
}

.portal-admin .app-sidebar-nav a,
.portal-admin .app-sidebar-nav button.nav-link-btn {
  color: #d7e0ec;
}

.portal-reception .app-sidebar-nav a,
.portal-reception .app-sidebar-nav button.nav-link-btn {
  color: #e6f4f4;
}

.portal-resident .app-sidebar-nav a,
.portal-resident .app-sidebar-nav button.nav-link-btn {
  color: #e6f4f4;
}

.app-sidebar-nav a i,
.app-sidebar-nav button.nav-link-btn i {
  width: 1.15rem;
  text-align: center;
  font-size: 1.05rem;
  color: var(--rp-secondary);
}

.portal-admin .app-sidebar-nav a i,
.portal-admin .app-sidebar-nav button.nav-link-btn i {
  color: var(--rp-accent);
}

.portal-reception .app-sidebar-nav a i,
.portal-reception .app-sidebar-nav button.nav-link-btn i {
  color: #ffc900;
}

.portal-resident .app-sidebar-nav a i,
.portal-resident .app-sidebar-nav button.nav-link-btn i {
  color: #ffc900;
}

.app-sidebar-nav a:hover,
.app-sidebar-nav button.nav-link-btn:hover {
  background: #eef3fb;
  color: var(--rp-primary);
}

.portal-admin .app-sidebar-nav a:hover,
.portal-admin .app-sidebar-nav button.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.portal-reception .app-sidebar-nav a:hover,
.portal-reception .app-sidebar-nav button.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.portal-resident .app-sidebar-nav a:hover,
.portal-resident .app-sidebar-nav button.nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.portal-resident .app-sidebar-nav a.nav-link-account,
.portal-resident .app-sidebar-nav a.nav-link-account:hover,
.portal-resident .app-sidebar-nav a.nav-link-account.active,
.portal-reception .app-sidebar-nav a.nav-link-account,
.portal-reception .app-sidebar-nav a.nav-link-account:hover,
.portal-reception .app-sidebar-nav a.nav-link-account.active {
  color: #ffc900;
}

.portal-resident .app-sidebar-nav a.nav-link-account i,
.portal-reception .app-sidebar-nav a.nav-link-account i {
  color: #ffc900;
}

.portal-resident .app-sidebar-nav button.nav-link-logout,
.portal-resident .app-sidebar-nav button.nav-link-logout:hover,
.portal-reception .app-sidebar-nav button.nav-link-logout,
.portal-reception .app-sidebar-nav button.nav-link-logout:hover {
  color: #ff8f8f;
}

.portal-resident .app-sidebar-nav button.nav-link-logout i,
.portal-reception .app-sidebar-nav button.nav-link-logout i {
  color: #ff8f8f;
}

.app-sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(4, 97, 105, 0.12), rgba(255, 201, 0, 0.14));
  color: var(--rp-primary);
  box-shadow: inset 3px 0 0 var(--rp-accent);
}

.portal-admin .app-sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--rp-accent);
}

.portal-reception .app-sidebar-nav a.active,
.portal-resident .app-sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 3px 0 0 #ffc900;
}

.portal-resident .app-sidebar-nav .nav-group-toggle.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 3px 0 0 #ffc900;
}

.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-toggle {
  position: relative;
}

.nav-group-toggle .nav-group-caret {
  margin-left: auto;
  width: auto;
  font-size: 0.78rem;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.nav-group.open .nav-group-toggle .nav-group-caret {
  transform: rotate(180deg);
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.15rem 0 0.35rem 0.55rem;
}

.portal-resident .nav-group-items > a {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
  padding-left: 0.85rem;
}

.portal-resident .nav-group-items > a:last-child {
  border-bottom: 0;
}

.app-sidebar-label {
  white-space: nowrap;
}

.app-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--rp-bg);
}

.app-content {
  flex: 1;
  padding: 1.5rem;
}

.app-footer {
  border-top: 1px solid var(--rp-border);
  background: #fff;
  color: var(--rp-muted);
  padding: 0.95rem 1.5rem;
  font-size: 0.88rem;
  text-align: center;
}

.app-body.sidebar-collapsed .app-sidebar {
  width: 4.5rem;
}

.app-body.sidebar-collapsed .app-sidebar-label {
  display: none;
}

.app-body.sidebar-collapsed .app-sidebar-nav a,
.app-body.sidebar-collapsed .app-sidebar-nav button.nav-link-btn,
.app-body.sidebar-collapsed .app-sidebar-nav .nav-item-disabled {
  justify-content: center;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.app-body.sidebar-collapsed .nav-group-items,
.app-body.sidebar-collapsed .nav-group-caret {
  display: none !important;
}

.app-body.sidebar-collapsed .nav-group-toggle .app-sidebar-label {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ---------- Content components ---------- */
.page-heading {
  margin: 0;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--rp-primary);
  font-size: clamp(1.4rem, 2vw, 1.75rem);
}

.page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--rp-muted);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.portal-card {
  border: 0;
  border-radius: var(--rp-radius);
  background: var(--rp-card);
  box-shadow: var(--rp-shadow-sm);
  height: 100%;
}

.portal-card .card-body {
  padding: 1.25rem 1.3rem;
}

.portal-card h2,
.portal-card .card-title {
  color: var(--rp-primary);
  font-weight: 700;
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -1rem;
  top: -1rem;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(36, 87, 167, 0.08);
}

.stat-card .stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  background: var(--rp-accent-soft);
  color: #8a6d12;
  margin-bottom: 0.85rem;
}

.stat-label {
  margin: 0;
  color: var(--rp-muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.stat-value {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  margin: 0.2rem 0 0;
  color: var(--rp-primary);
}

.sample-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a6d12;
  background: var(--rp-accent-soft);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.profile-list {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.55rem 0.85rem;
  margin: 0;
}

.profile-list dt {
  color: var(--rp-muted);
  font-weight: 650;
}

.profile-list dd {
  margin: 0;
  color: var(--rp-text);
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}

.shortcut-link {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-radius: var(--rp-radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--rp-shadow-sm);
  border-left: 4px solid var(--rp-accent);
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.shortcut-link:hover {
  color: inherit;
  transform: translateY(-2px);
  box-shadow: var(--rp-shadow);
}

.shortcut-link strong {
  display: block;
  color: var(--rp-primary);
}

.shortcut-link-disabled {
  position: relative;
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
  border-left-color: #adb5bd;
  background: #f5f6f8;
}

.shortcut-link-disabled strong {
  color: #6c757d;
}

.table {
  --bs-table-bg: transparent;
  color: var(--rp-text);
}

.table thead th {
  color: var(--rp-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  border-bottom-width: 1px;
}

.alert {
  border-radius: 0.75rem;
  border: 0;
}

.alert-success {
  background: #e8f6ee;
  color: #0f5132;
}

.alert-warning {
  background: #fff6df;
  color: #664d03;
}

.placeholder-panel {
  background: #fff;
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow-sm);
  padding: 1.5rem;
}

.module-placeholder-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  background: var(--rp-accent-soft);
  color: #8a6d12;
  font-size: 1.45rem;
  margin-bottom: 1rem;
}

.home-hero {
  background: #fff;
  border: 1px solid var(--rp-border);
  border-radius: 1rem;
  padding: 1.15rem 1.25rem;
  border-top: 3px solid var(--rp-accent);
}

.home-hero-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  min-width: 0;
}

.home-hero-copy .page-heading {
  flex-shrink: 0;
  margin: 0;
}

.home-hero-copy .page-subtitle {
  margin: 0;
  min-width: 0;
  flex: 1 1 12rem;
  line-height: 1.35;
}

@media (min-width: 768px) {
  .home-hero-copy {
    flex-wrap: nowrap;
    gap: 0.75rem 1rem;
  }

  .home-hero-copy .page-subtitle {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.module-grid-heading {
  margin: 0 0 0.85rem;
  color: var(--rp-primary);
  font-size: 1.05rem;
  font-weight: 700;
}

.project-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .project-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .project-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
  }
}

@media (min-width: 992px) {
  .project-card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .project-card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1400px) {
  .project-card-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-height: 7.5rem;
  height: 8.25rem;
  background: #fff;
  border-radius: 0.75rem;
  padding: 0.85rem 0.9rem;
  text-decoration: none;
  color: inherit;
  text-align: left;
  box-shadow: 0 1px 2px rgba(20, 43, 74, 0.06), 0 4px 12px rgba(20, 43, 74, 0.04);
  border: 1px solid var(--rp-border);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover,
.project-card:focus {
  color: inherit;
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(20, 43, 74, 0.1);
  border-color: rgba(36, 87, 167, 0.28);
  outline: none;
}

.project-card:focus-visible {
  box-shadow: 0 6px 18px rgba(20, 43, 74, 0.1), 0 0 0 0.2rem rgba(36, 87, 167, 0.22);
}

.project-card-primary {
  border-color: rgba(36, 87, 167, 0.35);
  box-shadow: 0 2px 4px rgba(36, 87, 167, 0.08), 0 6px 16px rgba(36, 87, 167, 0.08);
  background: linear-gradient(180deg, #fff 0%, #f7faff 100%);
}

.project-card-primary:hover,
.project-card-primary:focus {
  border-color: rgba(36, 87, 167, 0.5);
}

.portal-resident .project-card,
.portal-resident .project-card-primary,
.portal-resident .project-card-disabled {
  background: #57d9c9;
  color: #000;
  border-color: rgba(4, 97, 105, 0.16);
  box-shadow: 0 1px 2px rgba(87, 217, 201, 0.22), 0 4px 12px rgba(87, 217, 201, 0.18);
}

.portal-resident .project-card:hover,
.portal-resident .project-card:focus,
.portal-resident .project-card-primary:hover,
.portal-resident .project-card-primary:focus {
  color: #000;
  border-color: rgba(4, 97, 105, 0.28);
  box-shadow: 0 6px 18px rgba(87, 217, 201, 0.32);
}

.project-card-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.project-card-icon.electricity {
  background: #eef4ff;
  color: #2457a7;
}

.project-card-icon.utility {
  background: #eef8f1;
  color: #1f7a46;
}

.project-card-icon.visitors {
  background: #e8f0ff;
  color: #2457a7;
}

.project-card-icon.residents {
  background: #eef8f1;
  color: #1f7a46;
}

.project-card-icon.users {
  background: #f4eefc;
  color: #6b3fa0;
}

.project-card-icon.complaints {
  background: #fff3e8;
  color: #c05621;
}

.project-card-icon.notifications {
  background: #fbf5df;
  color: #8a6d12;
}

.project-card-icon.gatepass {
  background: #eef6f4;
  color: #2f6f62;
}

.project-card-icon.statement {
  background: #eef2f7;
  color: #4a5d73;
}

.project-card-icon.bills {
  background: #f7f0ea;
  color: #8a5a3a;
}

.portal-resident .project-card-icon.electricity,
.portal-resident .project-card-icon.utility,
.portal-resident .project-card-icon.visitors,
.portal-resident .project-card-icon.residents,
.portal-resident .project-card-icon.users,
.portal-resident .project-card-icon.complaints,
.portal-resident .project-card-icon.notifications,
.portal-resident .project-card-icon.gatepass,
.portal-resident .project-card-icon.statement,
.portal-resident .project-card-icon.bills {
  background: rgba(0, 0, 0, 0.08);
  color: #000;
}

.project-card-copy {
  min-width: 0;
  width: 100%;
}

.project-card-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--rp-primary);
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--rp-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-resident .project-card-title {
  color: #000;
}

.portal-resident .project-card-subtitle {
  color: rgba(0, 0, 0, 0.72);
}

.project-card-disabled {
  opacity: 0.62;
  pointer-events: none;
  cursor: not-allowed;
  box-shadow: none;
  background: #f6f7f9;
}

.project-card-disabled:hover,
.project-card-disabled:focus {
  transform: none;
  box-shadow: none;
  border-color: var(--rp-border);
}

.project-card-disabled .project-card-title {
  color: #6c757d;
}

.project-card-disabled .project-card-icon {
  filter: grayscale(0.4);
}

.portal-resident .project-card-disabled {
  opacity: 0.78;
  background: #57d9c9;
  box-shadow: none;
}

.portal-resident .project-card-disabled:hover,
.portal-resident .project-card-disabled:focus {
  border-color: rgba(4, 97, 105, 0.16);
}

.portal-resident .project-card-disabled .project-card-title {
  color: rgba(0, 0, 0, 0.7);
}

.portal-resident .project-card-disabled .project-card-icon {
  filter: grayscale(0.15);
  opacity: 0.85;
}

.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5c636a;
  background: #e9ecef;
  border: 1px solid #dee2e6;
  white-space: nowrap;
  line-height: 1.2;
}

.project-card-disabled .coming-soon-badge,
.shortcut-link-disabled .coming-soon-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 1;
}

.app-sidebar-nav .nav-item-disabled {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.7rem;
  padding: 0.72rem 0.85rem;
  font-weight: 600;
  color: #8a93a0;
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
  user-select: none;
}

.app-sidebar-nav .nav-item-disabled i {
  width: 1.15rem;
  text-align: center;
  font-size: 1.05rem;
  color: #9aa3af;
  flex-shrink: 0;
}

.portal-admin .app-sidebar-nav .nav-item-disabled {
  color: rgba(215, 224, 236, 0.45);
}

.portal-admin .app-sidebar-nav .nav-item-disabled i {
  color: rgba(201, 162, 39, 0.4);
}

.portal-reception .app-sidebar-nav .nav-item-disabled {
  color: rgba(215, 240, 224, 0.45);
}

.portal-reception .app-sidebar-nav .nav-item-disabled i {
  color: rgba(201, 162, 39, 0.4);
}

.portal-resident .app-sidebar-nav .nav-item-disabled {
  color: rgba(230, 244, 244, 0.45);
}

.portal-resident .app-sidebar-nav .nav-item-disabled i {
  color: rgba(255, 201, 0, 0.4);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.public-shell {
  min-height: 100vh;
  background: var(--rp-bg);
}

.public-shell main {
  padding: 2rem 1rem 3rem;
}

@media (max-width: 991.98px) {
  .login-page {
    padding: 1rem;
  }

  .login-stage {
    grid-template-columns: 1fr;
    width: min(100%, 460px);
  }

  .login-hero {
    min-height: auto;
    padding: 1.6rem 1.4rem;
  }

  .login-hero-art {
    display: none;
  }

  .login-portal-links {
    max-width: none;
  }

  .login-panel {
    padding: 1.6rem 1.35rem 1.8rem;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    transform: translateX(-105%);
    box-shadow: 12px 0 30px rgba(20, 43, 74, 0.18);
  }

  .app-body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-body.sidebar-collapsed .app-sidebar {
    width: var(--rp-sidebar-width);
  }

  .app-body.sidebar-collapsed .app-sidebar-label {
    display: inline;
  }

  .app-body.sidebar-collapsed .app-sidebar-nav a,
  .app-body.sidebar-collapsed .app-sidebar-nav button.nav-link-btn,
  .app-body.sidebar-collapsed .app-sidebar-nav .nav-item-disabled {
    justify-content: flex-start;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(14, 31, 54, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1015;
  }

  .app-body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-brand-copy strong {
    font-size: 0.92rem;
    max-width: min(52vw, 16rem);
  }

  .app-user-name {
    display: none;
  }

  .app-content {
    padding: 1.15rem;
  }

  .app-header-primary,
  .app-header-secondary {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .app-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 575.98px) {
  .profile-list {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .profile-list dt {
    margin-top: 0.45rem;
  }

  .page-heading {
    font-size: 1.35rem;
  }

  .home-hero {
    padding: 0.95rem 1rem;
  }

  .home-hero-copy .page-subtitle {
    font-size: 0.9rem;
  }

  .project-card {
    height: auto;
    min-height: 6.5rem;
    padding: 0.8rem 0.85rem;
    border-radius: 0.7rem;
  }

  .project-card-icon {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.95rem;
    border-radius: 0.55rem;
  }

  .project-card-title {
    font-size: 0.9rem;
    white-space: normal;
  }

  .project-card-subtitle {
    font-size: 0.74rem;
    white-space: normal;
  }

  .coming-soon-badge {
    font-size: 0.52rem;
    padding: 0.1rem 0.32rem;
  }

  .app-content {
    padding: 1rem 0.85rem 1.25rem;
  }

  .coming-soon-badge {
    font-size: 0.55rem;
    padding: 0.1rem 0.35rem;
  }

  .app-header-secondary-inner {
    gap: 0.65rem;
  }

  .login-card h1 {
    font-size: 1.45rem;
  }
}

.visitor-name-cell {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visitor-purpose-cell {
  max-width: 18rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
