/* Resident self-service portal */
.resident-mode {
  --resident-green: #087f65;
  --resident-green-dark: #075f4d;
  --resident-ink: #17211f;
  --resident-muted: #65726e;
  --resident-line: #dde7e2;
  --resident-soft: #f3f8f5;
  background: #eef4f1 !important;
  color: var(--resident-ink);
}

.resident-mode::before {
  opacity: .14 !important;
}

.resident-mode .public-header {
  display: none;
}

.resident-mode main {
  min-height: 100dvh;
  padding: 0;
}

#resident-view.active {
  display: block;
  min-height: 100dvh;
}

.resident-portal-shell {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 48px) 48px;
}

.resident-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  margin-bottom: clamp(28px, 6vw, 72px);
}

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

.resident-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 12px;
  background: white;
}

.resident-brand span {
  display: grid;
  gap: 2px;
}

.resident-brand strong {
  font-size: 15px;
}

.resident-brand small {
  color: var(--resident-muted);
}

.resident-login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: center;
  gap: clamp(36px, 8vw, 100px);
  width: min(1020px, 100%);
  margin: 0 auto;
}

.resident-login-copy h1 {
  max-width: 700px;
  margin: 10px 0 18px;
  font-size: clamp(34px, 5.5vw, 64px);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.resident-login-copy > p:not(.eyebrow) {
  max-width: 620px;
  color: var(--resident-muted);
  font-size: 18px;
  line-height: 1.65;
}

.resident-login-copy ul {
  display: grid;
  gap: 12px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.resident-login-copy li {
  position: relative;
  padding-left: 30px;
  font-weight: 700;
}

.resident-login-copy li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--resident-green);
  font-size: 13px;
}

.resident-login-card {
  display: grid;
  gap: 17px;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid rgba(8, 127, 101, .18);
  border-radius: 24px;
  background: white;
  box-shadow: 0 24px 70px rgba(25, 58, 48, .12);
}

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

.resident-login-heading h2,
.resident-login-heading p {
  margin: 0;
}

.resident-login-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: var(--resident-green);
  font-weight: 900;
  letter-spacing: -.06em;
}

.resident-login-card > p {
  margin: 0;
  color: var(--resident-muted);
  line-height: 1.55;
}

.resident-login-card label {
  display: grid;
  gap: 7px;
  color: #33413d;
  font-size: 13px;
  font-weight: 800;
}

.resident-login-card input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #ccd9d3;
  border-radius: 12px;
  background: #fbfdfc;
}

.resident-login-card button {
  min-height: 52px;
  margin-top: 4px;
}

.resident-login-card > a {
  color: var(--resident-green-dark);
  font-weight: 800;
  text-align: center;
}

.resident-form-message {
  min-height: 22px;
  color: #b42318 !important;
  font-weight: 700;
  text-align: center;
}

.resident-security-note {
  padding-top: 14px;
  border-top: 1px solid var(--resident-line);
  color: var(--resident-muted);
  line-height: 1.5;
  text-align: center;
}

.resident-logout {
  min-height: 42px;
  padding: 0 18px;
  border-color: #cdd9d3;
  border-radius: 12px;
  background: white;
}

.resident-dashboard {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.resident-welcome {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.resident-welcome h1 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -.04em;
}

.resident-welcome p {
  margin: 0;
  color: var(--resident-muted);
}

.resident-profile-chip {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 13px 16px;
  border: 1px solid var(--resident-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  text-align: right;
}

.resident-profile-chip small {
  color: var(--resident-muted);
}

.resident-pass-overview {
  display: grid;
  grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr);
  gap: 20px;
  margin-bottom: 28px;
}

.resident-qr-card,
.resident-summary-card,
.resident-section {
  border: 1px solid var(--resident-line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 12px 38px rgba(25, 58, 48, .07);
}

.resident-qr-card {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.resident-qr-card canvas {
  width: min(210px, 70vw);
  height: auto;
  margin: 14px auto;
}

.resident-qr-card h2,
.resident-qr-card p {
  margin: 0;
}

.resident-qr-card p {
  color: var(--resident-muted);
  font-size: 13px;
}

.resident-summary-card {
  display: grid;
  align-content: center;
  padding: clamp(22px, 4vw, 36px);
  background: linear-gradient(140deg, #087f65, #075947);
  color: white;
}

.resident-summary-card .eyebrow {
  color: #c9f0e5;
}

.resident-summary-card h2 {
  max-width: 620px;
  margin: 8px 0 12px;
  font-size: clamp(25px, 3.5vw, 38px);
  line-height: 1.12;
  letter-spacing: -.035em;
}

.resident-summary-card > p {
  margin: 0;
  color: #d8eee8;
}

.resident-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 25px;
}

.resident-summary-stats div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .1);
}

.resident-summary-stats small {
  color: #d8eee8;
}

.resident-section {
  margin-top: 20px;
  padding: clamp(20px, 4vw, 30px);
}

.resident-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.resident-section-heading h2,
.resident-section-heading p {
  margin: 0;
}

.resident-section-heading p {
  margin-top: 5px;
  color: var(--resident-muted);
}

.resident-add-button {
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--resident-green);
  font-weight: 800;
}

.resident-facility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.resident-facility-card {
  display: grid;
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--resident-line);
  border-radius: 16px;
  background: #fbfdfc;
}

.resident-facility-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.resident-facility-card h3,
.resident-facility-card p {
  margin: 0;
}

.resident-facility-card p {
  color: var(--resident-muted);
}

.resident-facility-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.resident-facility-card dl div {
  display: grid;
  gap: 4px;
}

.resident-facility-card dt {
  color: var(--resident-muted);
  font-size: 12px;
}

.resident-facility-card dd {
  margin: 0;
  font-weight: 800;
}

.resident-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.resident-status.active,
.resident-status.verified {
  color: #087253;
  background: #dff6ed;
}

.resident-status.expiring,
.resident-status.pending {
  color: #9a5b00;
  background: #fff1d6;
}

.resident-status.expired,
.resident-status.rejected {
  color: #a1352b;
  background: #ffe5e1;
}

.resident-status.upcoming {
  color: #31599b;
  background: #e5edff;
}

.resident-renew-button {
  min-height: 42px;
  border-color: #b9d7ca;
  border-radius: 11px;
  color: var(--resident-green-dark);
  background: white;
  font-weight: 800;
}

.resident-payment-table {
  overflow-x: auto;
}

.resident-payment-table table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.resident-payment-table th,
.resident-payment-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--resident-line);
  text-align: left;
  vertical-align: middle;
}

.resident-payment-table th {
  color: var(--resident-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.resident-payment-table td strong {
  display: block;
}

.resident-payment-table td small {
  color: var(--resident-muted);
}

.resident-payment-lines {
  display: grid;
  gap: 8px;
  min-width: 250px;
}

.resident-payment-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.resident-payment-line > span {
  display: grid;
  gap: 2px;
}

.resident-payment-line + .resident-payment-line {
  padding-top: 8px;
  border-top: 1px dashed var(--resident-line);
}

.resident-payment-line em {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: #9a5b00;
  background: #fff1d6;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.resident-payment-status-detail {
  display: block;
  margin-top: 6px;
  line-height: 1.3;
}

.resident-empty {
  padding: 28px;
  border: 1px dashed #bfd0c8;
  border-radius: 14px;
  color: var(--resident-muted);
  background: var(--resident-soft);
  text-align: center;
}

.resident-entry-link {
  display: inline-flex;
  margin-top: 14px;
  color: #087f65;
  font-weight: 850;
}

body.resident-renewal-open {
  overflow: hidden;
}

.resident-renewal-layer {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.resident-renewal-layer[hidden] {
  display: none;
}

.resident-renewal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(10, 24, 20, .46);
  backdrop-filter: blur(3px);
}

.resident-renewal-drawer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(560px, 100vw);
  height: 100dvh;
  border-left: 1px solid var(--resident-line);
  background: white;
  box-shadow: -24px 0 70px rgba(10, 36, 28, .2);
}

.resident-renewal-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 18px;
}

.resident-renewal-drawer > header p,
.resident-renewal-drawer > header h2 {
  margin: 0;
}

.resident-renewal-close {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border-color: var(--resident-line);
  border-radius: 50%;
  background: white;
  font-size: 27px;
  line-height: 1;
}

.resident-renewal-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0 28px 20px;
  border-bottom: 1px solid var(--resident-line);
  list-style: none;
}

.resident-renewal-progress li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--resident-muted);
  font-size: 12px;
  font-weight: 800;
}

.resident-renewal-progress li:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 14px;
  left: 29px;
  right: 0;
  height: 2px;
  background: #e3ebe7;
}

.resident-renewal-progress li span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid #d8e3de;
  border-radius: 50%;
  background: white;
}

.resident-renewal-progress li.active,
.resident-renewal-progress li.complete {
  color: var(--resident-green-dark);
}

.resident-renewal-progress li.active span,
.resident-renewal-progress li.complete span {
  border-color: var(--resident-green);
  color: white;
  background: var(--resident-green);
}

.resident-renewal-progress li.complete::after {
  background: var(--resident-green);
}

.resident-renewal-body {
  min-height: 0;
  padding: 26px 28px;
  overflow-y: auto;
}

.resident-renewal-facility {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--resident-line);
  border-radius: 16px;
  background: var(--resident-soft);
}

.resident-renewal-facility h3,
.resident-renewal-facility small {
  display: block;
  margin: 0;
}

.resident-renewal-facility small,
.resident-renewal-current small,
.resident-renewal-calculation small {
  color: var(--resident-muted);
}

.resident-renewal-current,
.resident-renewal-calculation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.resident-renewal-current span,
.resident-renewal-calculation span {
  display: grid;
  gap: 5px;
  padding: 15px;
  border: 1px solid var(--resident-line);
  border-radius: 14px;
}

.resident-renewal-quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 17px;
  border-radius: 15px;
  background: #f7faf8;
}

.resident-renewal-quantity > div:first-child {
  display: grid;
  gap: 4px;
}

.resident-renewal-quantity small {
  color: var(--resident-muted);
}

.resident-renewal-quantity > div:last-child {
  display: grid;
  grid-template-columns: 40px minmax(90px, auto) 40px;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.resident-renewal-quantity button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-color: #bdd5ca;
  border-radius: 10px;
  color: var(--resident-green-dark);
  background: white;
  font-size: 20px;
}

.resident-renewal-calculation {
  border-radius: 16px;
  background: linear-gradient(140deg, #087f65, #075947);
}

.resident-renewal-calculation span {
  border: 0;
  color: white;
}

.resident-renewal-calculation small {
  color: #d5eee6;
}

.resident-renewal-calculation strong {
  font-size: 18px;
}

.resident-renewal-note {
  margin: 18px 0 0;
  padding: 13px 15px;
  border-radius: 12px;
  color: #456159;
  background: #edf7f3;
  line-height: 1.5;
}

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

.resident-renewal-payment-heading p,
.resident-renewal-payment-heading h3 {
  margin: 0;
}

.resident-renewal-payment-heading > strong {
  color: var(--resident-green-dark);
  font-size: 21px;
}

.resident-renewal-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.resident-renewal-methods label {
  position: relative;
  cursor: pointer;
}

.resident-renewal-methods input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.resident-renewal-methods label > span {
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 14px;
  border: 2px solid var(--resident-line);
  border-radius: 13px;
  background: white;
}

.resident-renewal-methods input:checked + span {
  border-color: var(--resident-green);
  background: #edf9f4;
}

.resident-renewal-methods small {
  color: var(--resident-muted);
  line-height: 1.4;
}

.resident-renewal-payment {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--resident-line);
  border-radius: 17px;
  background: #fbfdfc;
}

.resident-renewal-cash-panel {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border: 1px solid #bddbce;
  border-radius: 16px;
  background: #eef9f5;
}

.resident-renewal-cash-panel[hidden] {
  display: none;
}

.resident-renewal-cash-panel > span {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--resident-green);
  font-size: 13px;
  font-weight: 900;
}

.resident-renewal-cash-panel p {
  margin: 4px 0 0;
  color: var(--resident-muted);
  line-height: 1.5;
}

.resident-renewal-bank-qr {
  display: grid;
  min-height: 180px;
  place-items: center;
  border-radius: 13px;
  background: white;
}

.resident-renewal-bank-qr img {
  width: 100%;
  height: 100%;
  max-height: 190px;
  object-fit: contain;
}

.resident-renewal-bank-qr span {
  color: var(--resident-muted);
  text-align: center;
}

.resident-renewal-payment dl {
  display: grid;
  align-content: start;
  gap: 10px;
  margin: 0;
}

.resident-renewal-payment dl div {
  display: grid;
  gap: 3px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--resident-line);
}

.resident-renewal-payment dt {
  color: var(--resident-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.resident-renewal-payment dd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.resident-renewal-payment dd button {
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
}

.resident-renewal-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid #bfe2d4;
  border-radius: 15px;
  background: #edf9f4;
}

.resident-renewal-identity > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--resident-green);
  font-weight: 900;
}

.resident-renewal-identity div {
  display: grid;
  gap: 3px;
}

.resident-renewal-identity small {
  color: var(--resident-muted);
}

.resident-renewal-upload {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding: 22px;
  border: 2px dashed #b8cec4;
  border-radius: 16px;
  background: #fbfdfc;
  cursor: pointer;
  text-align: center;
}

.resident-renewal-upload small {
  color: var(--resident-muted);
}

.resident-renewal-upload input {
  width: 100%;
  margin-top: 8px;
}

.resident-renewal-upload > span {
  color: var(--resident-green-dark);
  font-weight: 800;
}

.resident-renewal-confirm {
  display: flex;
  align-items: start;
  gap: 10px;
  margin-top: 17px;
  color: #33413d;
  line-height: 1.45;
}

.resident-renewal-confirm input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.resident-renewal-success {
  display: grid;
  place-items: center;
  padding: 38px 12px;
  text-align: center;
}

.resident-renewal-success[hidden] {
  display: none;
}

.resident-renewal-success > span {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--resident-green);
  font-size: 30px;
  font-weight: 900;
}

.resident-renewal-success h3 {
  margin: 8px 0;
  font-size: 25px;
}

.resident-renewal-success > p:not(.eyebrow) {
  max-width: 430px;
  margin: 0;
  color: var(--resident-muted);
  line-height: 1.55;
}

.resident-renewal-success dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(360px, 100%);
  margin-top: 24px;
}

.resident-renewal-success dl div {
  display: grid;
  gap: 4px;
  padding: 13px;
  border-radius: 12px;
  background: var(--resident-soft);
}

.resident-renewal-success dt {
  color: var(--resident-muted);
  font-size: 12px;
}

.resident-renewal-success dd {
  margin: 0;
  font-weight: 900;
}

.resident-renewal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--resident-line);
  background: white;
}

.resident-renewal-actions button {
  min-height: 46px;
  padding-inline: 20px;
}

.resident-renewal-actions button.primary {
  min-width: 190px;
}

@media (max-width: 780px) {
  .resident-portal-shell {
    padding: 14px 12px 36px;
  }

  .resident-portal-header {
    margin-bottom: 24px;
  }

  .resident-login-layout,
  .resident-pass-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-login-copy {
    display: none;
  }

  .resident-login-card {
    width: min(460px, 100%);
    margin: 0 auto;
    padding: 22px 18px;
  }

  .resident-welcome {
    align-items: start;
    flex-direction: column;
  }

  .resident-profile-chip {
    width: 100%;
    text-align: left;
  }

  .resident-facility-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-renewal-drawer {
    width: 100vw;
  }
}

@media (max-width: 520px) {
  .resident-brand strong {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .resident-add-button {
    width: 100%;
  }

  .resident-summary-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-renewal-drawer > header,
  .resident-renewal-body,
  .resident-renewal-actions {
    padding-inline: 16px;
  }

  .resident-renewal-progress {
    padding-inline: 16px;
  }

  .resident-renewal-progress li {
    gap: 5px;
    font-size: 10px;
  }

  .resident-renewal-facility {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .resident-renewal-facility .resident-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .resident-renewal-current,
  .resident-renewal-calculation,
  .resident-renewal-payment,
  .resident-renewal-methods {
    grid-template-columns: minmax(0, 1fr);
  }

  .resident-renewal-quantity,
  .resident-renewal-payment-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .resident-renewal-bank-qr {
    min-height: 220px;
  }

  .resident-renewal-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .resident-renewal-actions button,
  .resident-renewal-actions button.primary {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
  }
}
