/* Client list + profile + registration form */

/* Result-row name acts as a "focus on map" trigger */
.resident-row__focus {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px dashed transparent;
  transition: color var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard);
  cursor: pointer;
}
.resident-row__focus:hover,
.resident-row__focus:focus-visible {
  color: var(--mauve-700);
  border-bottom-color: var(--mauve-400);
  outline: 0;
}
.resident-row__focus strong { color: inherit; }
.table--clickable-focus tbody tr:hover {
  background: linear-gradient(90deg, rgba(247,111,21,0.04), rgba(245,74,125,0.03));
}
.table--clickable-focus .table__cell--actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  align-items: center;
}


.client-search {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  align-items: stretch;
}
.client-search .form-input { flex: 1 1 280px; }

.resident-search-bar .form-input { flex: 1 1 380px; }
.resident-search-bar .form-select { flex: 0 1 220px; }

.resident-directory {
  /* The Barangay Matches panel is a secondary navigation aid — most of
     the screen real estate should belong to the map. Halved the right
     column's fr-weight (.8 → .4) and min-width (260 → 180) so the panel
     takes ~17% instead of ~32% of the row. Map breathes. */
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(180px, .4fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.resident-map-card,
.resident-results-panel,
.client-access__panel {
  background:
    linear-gradient(145deg, rgba(255,255,255,.92), rgba(255,247,242,.84)),
    var(--surface-card);
  border: 1px solid rgba(224, 164, 126, .34);
  border-radius: var(--r-2xl);
  box-shadow: 0 18px 48px rgba(88, 45, 55, .10);
}

.resident-map-card { overflow: hidden; }

.resident-map-card__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid rgba(224, 164, 126, .26);
}
.resident-map-card__toolbar h2,
.resident-results-panel__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-22);
  color: var(--mauve-950);
}
.resident-map-card__toolbar p,
.resident-results-panel__head p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: var(--fs-13);
}
.resident-map-card__badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.resident-map {
  min-height: 440px;
  height: clamp(420px, 54vh, 620px);
  background: #f8efe7;
}
.resident-map-popup {
  display: grid;
  gap: 4px;
  min-width: 190px;
  font-family: var(--font-sans);
}
.resident-map-popup strong {
  color: #3f2a36;
  font-size: 14px;
}
.resident-map-popup span {
  color: #b5533f;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}
.resident-map-popup small {
  color: #6f5d64;
}
.resident-map-popup a {
  color: #9f3f48;
  font-weight: 800;
  text-decoration: none;
}

.resident-results-panel {
  padding: var(--sp-4);
}
.resident-results-panel__head h2 { font-size: var(--fs-18); }
.resident-results-panel__head p { font-size: var(--fs-12); }
.resident-barangay-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--sp-4);
}
.resident-barangay-list span {
  border: 1px solid rgba(219, 154, 110, .35);
  border-radius: var(--r-pill);
  background: rgba(255, 239, 229, .74);
  color: #6f3d4f;
  padding: 7px 10px;
  font-size: var(--fs-12);
  font-weight: 700;
}
.resident-barangay-list strong {
  color: #b5533f;
  margin-left: 4px;
}

.client-access {
  min-height: 64vh;
  display: grid;
  place-items: center;
  padding: var(--sp-6) 0;
}
.client-access__panel {
  width: min(100%, 520px);
  padding: var(--sp-7);
}
.client-access__seal {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-5);
}
.client-access__seal img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 22px rgba(77, 43, 54, .14);
}
.client-access__seal img + img { margin-left: -16px; }
.client-access__eyebrow {
  letter-spacing: .12em;
  margin: 0 0 var(--sp-2);
}
.client-access__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--mauve-950);
}
.client-access__body {
  color: var(--text-muted);
  margin: var(--sp-3) 0 var(--sp-5);
}
.client-access__form {
  display: grid;
  gap: var(--sp-3);
}
.client-access__footer {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-12);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

/* Locked state on /dashboard/services-availed (no search yet) */
.services-availed-locked {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
  padding: var(--sp-6) var(--sp-5);
  background:
    linear-gradient(135deg, rgba(247, 111, 21, 0.06), rgba(245, 74, 125, 0.04));
  border: 1px solid rgba(168, 71, 10, 0.16);
  border-radius: var(--r-2xl);
  margin: var(--sp-5) 0;
  box-shadow: 0 6px 20px rgba(140, 50, 10, 0.06);
}
.services-availed-locked__icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mauve-500), var(--mauve-700));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(168, 71, 10, 0.30), inset 0 1px 0 rgba(255,255,255,0.30);
}
.services-availed-locked__eyebrow {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-12);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mauve-700);
}
.services-availed-locked__title {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 600;
  color: var(--mauve-900);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.services-availed-locked__body {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--fs-15, 0.94rem);
  line-height: 1.55;
  max-width: 70ch;
}
@media (max-width: 640px) {
  .services-availed-locked { flex-direction: column; padding: var(--sp-5) var(--sp-4); }
  .services-availed-locked__icon { width: 52px; height: 52px; }
}

/* Profile header */
.client-profile-header {
  display: flex;
  gap: var(--sp-5);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-2xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--elev-1);
  flex-wrap: wrap;
}
.client-profile-header__avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mauve-700), var(--mauve-950));
  color: var(--text-inverse);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-30);
  flex-shrink: 0;
}
.client-profile-header__info { flex: 1 1 280px; }
.client-profile-header__name { font-family: var(--font-display); font-size: var(--fs-24); margin: 0 0 4px; }
.client-profile-header__code { font-family: var(--font-mono); color: var(--text-muted); font-size: var(--fs-12); }
.client-profile-header__categories { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }

.client-ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.client-ledger-summary > div {
  background: linear-gradient(135deg, rgba(255,247,242,.94), rgba(255,255,255,.88));
  border: 1px solid rgba(224, 164, 126, .34);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  box-shadow: 0 12px 32px rgba(88, 45, 55, .08);
}
.client-ledger-summary p { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; }
.client-ledger-summary strong {
  font-family: var(--font-display);
  font-size: var(--fs-30);
  color: #7f3548;
}
.client-ledger-list {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.client-ledger-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-4);
  border: 1px solid rgba(224, 164, 126, .28);
  border-radius: var(--r-xl);
  padding: var(--sp-4);
  background: rgba(255,255,255,.7);
}
.client-ledger-entry h4 { margin: 2px 0 4px; font-size: var(--fs-18); }
.client-ledger-entry__program {
  margin: 0;
  color: #b5533f;
  font-size: var(--fs-12);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.client-ledger-entry__amount {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 3px;
  white-space: nowrap;
}
.client-ledger-entry__amount strong {
  color: #7f3548;
  font-size: var(--fs-20);
}
.client-ledger-entry__amount span {
  color: var(--text-muted);
  font-size: var(--fs-12);
}
.client-ledger-entry__actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.client-ledger-entry__actions form { margin: 0; }
.client-ledger-entry__actions .btn--danger {
  background: transparent;
  color: #b03a3a;
  border: 1px solid #f0c9c9;
  font-weight: 500;
}
.client-ledger-entry__actions .btn--danger:hover {
  background: #fde8e8;
  color: #7a2222;
}
.profile-map-card { margin-top: var(--sp-5); overflow: hidden; }
.resident-map--profile { min-height: 360px; height: 380px; margin-top: var(--sp-4); border-radius: var(--r-xl); overflow: hidden; }
.info-label { text-transform: uppercase; letter-spacing: var(--tracking-caps); margin-bottom: 4px; }

/* =================================================================
   Tabs — 3D colored pill bar with sliding active rail
   --------------------------------------------------------------------
   Each tab declares its own --tab-tint via the data-tone attribute.
   On hover the tab lifts 1px and fills with a 6%-tint of its tone.
   On active it lifts 2px, fills with a 14%-tint, and shows a thick
   gradient rail underneath that animates width/colour to the tone.
   Reasoning: a single grey underline reads as utility; per-tab tints
   give each context (Ledger, Info, Docs, Audit) instant identity.
   ================================================================= */
.tabs {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  padding: var(--sp-2);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  overflow-x: auto;
  scrollbar-width: thin;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 0 rgba(168, 71, 10, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.tabs__tab {
  --tab-tint:        var(--mauve-700);
  --tab-tint-soft:   var(--mauve-100);
  --tab-tint-hover:  var(--mauve-50);

  position: relative;
  padding: 0.6rem 1.05rem 0.7rem;
  font-weight: 600;
  font-size: var(--fs-14);
  color: var(--text-muted);
  border: 0;
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    color    var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    transform var(--motion-medium) var(--ease-emphasized),
    box-shadow var(--motion-medium) var(--ease-emphasized);
  isolation: isolate;
}
.tabs__tab::after {
  /* sliding active rail — animates from 0 to 70% width */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--tab-tint), var(--tab-tint-soft));
  transform: translateX(-50%);
  transition: width var(--motion-medium) var(--ease-emphasized);
  pointer-events: none;
}
.tabs__tab:hover {
  color: var(--tab-tint);
  background: var(--tab-tint-hover);
  transform: translateY(-1px);
}
.tabs__tab:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--ivory-50), 0 0 0 5px var(--tab-tint);
}
.tabs__tab.is-active {
  color: var(--text-inverse);
  background: linear-gradient(180deg, var(--tab-tint), color-mix(in srgb, var(--tab-tint) 80%, #000 20%));
  transform: translateY(-2px);
  box-shadow:
    0 6px 14px -4px color-mix(in srgb, var(--tab-tint) 50%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.tabs__tab.is-active::after {
  width: 70%;
  background: linear-gradient(90deg, rgba(255,255,255,0.0), rgba(255,255,255,0.85), rgba(255,255,255,0.0));
}

/* Per-tab tones — each tab gets its own personality */
.tabs__tab[data-tone="ledger"] {
  --tab-tint:       var(--mauve-700);   /* sunset orange */
  --tab-tint-soft:  var(--mauve-300);
  --tab-tint-hover: var(--mauve-50);
}
.tabs__tab[data-tone="info"] {
  --tab-tint:       var(--rose-700);    /* light pink */
  --tab-tint-soft:  var(--rose-300);
  --tab-tint-hover: var(--rose-50);
}
.tabs__tab[data-tone="docs"] {
  --tab-tint:       var(--champagne-600); /* warm gold */
  --tab-tint-soft:  var(--champagne-300);
  --tab-tint-hover: var(--champagne-50);
}
.tabs__tab[data-tone="audit"] {
  --tab-tint:       var(--berry-600);   /* raspberry */
  --tab-tint-soft:  #f5b3c4;
  --tab-tint-hover: #fff0f4;
}

@media (prefers-reduced-motion: reduce) {
  .tabs__tab,
  .tabs__tab::after { transition: none; }
  .tabs__tab:hover,
  .tabs__tab.is-active { transform: none; }
}

/* Duplicate-warning modal */
.dup-warning__candidates {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}
.dup-candidate {
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-3);
  align-items: center;
}
.dup-candidate__score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-14);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--warning-50);
  color: var(--warning-700);
}
.dup-candidate--block .dup-candidate__score { background: var(--danger-50); color: var(--danger-700); }

@media (max-width: 980px) {
  .resident-directory {
    grid-template-columns: 1fr;
  }
  .client-ledger-summary {
    grid-template-columns: 1fr;
  }
  .resident-map {
    height: 420px;
  }
}

@media (max-width: 640px) {
  .client-ledger-entry {
    grid-template-columns: 1fr;
  }
  .client-ledger-entry__amount {
    justify-items: start;
  }
}
