/* ============================================================
   district_styles.css  v2
   DMO Connect — District Panel + Dashboard Styles
   Apple HIG inspired · Mobile-first · Light + Dark
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── Design tokens ── */
:root {
  --ds-radius-sm:   8px;
  --ds-radius-md:   14px;
  --ds-radius-lg:   20px;
  --ds-radius-xl:   28px;
  --ds-radius-full: 999px;

  --ds-gap:    16px;
  --ds-gap-sm: 10px;
  --ds-gap-lg: 24px;

  --ds-card-bg:       var(--bg-card, #fff);
  --ds-card-border:   var(--border-color, rgba(0,0,0,.08));
  --ds-card-shadow:   0 2px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --ds-card-shadow-h: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);

  --ds-accent:       var(--accent, #007AFF);
  --ds-accent-light: rgba(0,122,255,.10);
  --ds-accent-mid:   rgba(0,122,255,.20);

  --ds-full-bg:     rgba(239,68,68,.08);
  --ds-full-border: rgba(239,68,68,.22);
  --ds-full-dot:    #ef4444;

  --ds-open-bg:     rgba(34,197,94,.08);
  --ds-open-border: rgba(34,197,94,.22);
  --ds-open-dot:    #22c55e;

  --ds-bar-h:  4px;
  --ds-bar-bg: rgba(0,0,0,.06);

  /* Glass effect values */
  --glass-bg:     rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.55);
  --glass-shadow: 0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
}

.theme-dark {
  --ds-card-bg:       #1e293b;
  --ds-card-border:   rgba(255,255,255,.07);
  --ds-card-shadow:   0 2px 12px rgba(0,0,0,.3),  0 1px 3px rgba(0,0,0,.2);
  --ds-card-shadow-h: 0 8px 32px rgba(0,0,0,.4),  0 2px 8px rgba(0,0,0,.3);
  --ds-bar-bg:        rgba(255,255,255,.08);
  --ds-full-bg:       rgba(239,68,68,.12);
  --ds-open-bg:       rgba(34,197,94,.10);
  --glass-bg:         rgba(30,41,59,0.78);
  --glass-border:     rgba(255,255,255,0.10);
  --glass-shadow:     0 8px 32px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
}

/* ============================================================
   DASH PAGE SHELL
   ============================================================ */

.dash-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  /* Wide-screen sidebar tint — column itself stays white/dark */
  background: #f0f2f5;
}
.theme-dark .dash-page { background: #060608; }

.dash-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  /* No max-width cap — content fills available width on all screen sizes */
}

/* district-panel-topbar is now rendered inline by RegionWorker — see .ds-strip below */

/* ============================================================
   FOOTER NAV — Apple HIG floating buttons (no pill wrapper)
   Each button is an independent floating circle / squircle.
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   The nav floats over the content at the bottom-center of the
   screen on EVERY viewport size (mobile + desktop).
   Content scrolls freely behind it — the nav is fully transparent
   and only the grouped pill intercepts pointer events.
   ───────────────────────────────────────────────────────────── */

.dash-footer-nav {
  /* Float above everything, centered horizontally */
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;

  /* The nav itself is invisible — the pill inside holds the glass */
  background: transparent;
  pointer-events: none;

  /* Lay buttons out in a row — they'll be wrapped by the pill group */
  display: flex;
  align-items: center;
  gap: 0;

  /* Single glass pill container wrapping all buttons */
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--glass-shadow), 0 4px 24px rgba(0,0,0,.12);
  padding: 6px 8px;
  pointer-events: auto; /* the whole pill catches events */
}

/* Individual buttons — no individual glass, they share the pill */
.footer-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: none;
  background: transparent;
  border-radius: 20px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-tertiary, #8E8E93);
  transition: color .18s, background .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
  min-width: 48px;
  position: relative;
  pointer-events: auto;
}

.footer-nav-btn svg {
  transition: transform .2s cubic-bezier(0.34,1.56,0.64,1);
  flex-shrink: 0;
}

.footer-nav-btn:active { transform: scale(.88); }

.footer-nav-btn.active {
  color: var(--ds-accent);
  background: var(--ds-accent-light);
}

.footer-nav-btn.active svg {
  transform: scale(1.12);
}

.footer-nav-btn:hover:not(.active) {
  color: var(--text-primary, #1C1C1E);
  background: rgba(0,0,0,.05);
}
.theme-dark .footer-nav-btn:hover:not(.active) {
  background: rgba(255,255,255,.08);
}

/* Thin separator between buttons inside the pill */
.footer-nav-btn + .footer-nav-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: var(--glass-border);
  pointer-events: none;
}

/* Active indicator dot below icon */
.footer-nav-active-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ds-accent);
  opacity: 0;
  margin-top: 4px;
  transition: opacity .18s;
}
.footer-nav-btn.active .footer-nav-active-dot { opacity: 1; }

/* ============================================================
   PROFILE MODAL — centred, large, scrollable sheet
   ============================================================ */

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.45);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: pm-bg-in .2s ease both;
  overflow-y: auto;
}
@keyframes pm-bg-in { from { opacity: 0; } to { opacity: 1; } }
.profile-modal-overlay[hidden] { display: none; }

.profile-modal {
  background: var(--ds-card-bg);
  border-radius: var(--ds-radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.10);
  width: 100%;
  max-width: 420px;
  max-height: min(90dvh, 700px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pm-slide-in .25s cubic-bezier(0.34,1.3,0.64,1) both;
}
@keyframes pm-slide-in {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ── Header (fixed at top of modal) ── */
.pm-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--ds-card-border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  flex-shrink: 0;
}

.pm-close-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: var(--ds-radius-full);
  border: none;
  background: rgba(0,0,0,.07);
  color: var(--text-tertiary);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pm-close-btn:hover { background: rgba(0,0,0,.12); color: var(--text-primary); }
.theme-dark .pm-close-btn { background: rgba(255,255,255,.10); }

.pm-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 36px; /* don't overlap close btn */
}

.pm-avatar {
  width: 54px; height: 54px;
  border-radius: var(--ds-radius-full);
  object-fit: cover;
  border: 2.5px solid var(--ds-accent);
  box-shadow: 0 0 0 3px var(--ds-accent-light);
  flex-shrink: 0;
}
.pm-avatar--initials {
  width: 54px; height: 54px;
  border-radius: var(--ds-radius-full);
  background: var(--ds-accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--ds-accent-light);
}

.pm-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.pm-role {
  font-size: .76rem;
  color: var(--text-tertiary);
  text-transform: capitalize;
  margin-top: 2px;
}

/* ── Body (scrollable) ── */
.pm-body {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 20px;
}

/* Section wrapper */
.pm-section {
  padding: 4px 16px;
}

.pm-sep {
  height: 1px;
  background: var(--ds-card-border);
  margin: 6px 16px;
}

.pm-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 8px 0 6px;
}

/* Toggle row */
.pm-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 4px;
  cursor: pointer;
  border-radius: var(--ds-radius-sm);
  transition: background .12s;
}
.pm-toggle-row:hover { background: rgba(0,0,0,.03); }
.theme-dark .pm-toggle-row:hover { background: rgba(255,255,255,.05); }

.pm-toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .88rem;
  color: var(--text-secondary);
}

/* Toggle switch */
.toggle-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--ds-bar-bg);
  border-radius: var(--ds-radius-full);
  transition: background .2s;
  cursor: pointer;
}
.toggle-track::after {
  content: ''; position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.toggle-switch input:checked + .toggle-track { background: var(--ds-accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

/* Accordion rows (Theme / Language) */
.pm-accordion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: none;
  padding: 12px 4px;
  cursor: pointer;
  border-radius: var(--ds-radius-sm);
  transition: background .12s;
}
.pm-accordion-btn:hover { background: rgba(0,0,0,.03); }
.theme-dark .pm-accordion-btn:hover { background: rgba(255,255,255,.05); }

.pm-accordion-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .88rem;
  color: var(--text-secondary);
}
.pm-accordion-current {
  font-size: .78rem;
  color: var(--ds-accent);
  font-weight: 600;
  margin-left: 4px;
}
.pm-accordion-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform .22s cubic-bezier(0.34,1.56,0.64,1);
}

.pm-accordion-body {
  padding: 4px 0 8px 28px;
  animation: accordion-open .18s ease both;
}
@keyframes accordion-open { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.pm-accordion-body[hidden] { display: none; }

.pm-option-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pm-option-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--ds-radius-full);
  border: 1.5px solid var(--ds-card-border);
  background: none;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.pm-option-btn:hover { border-color: var(--ds-accent); color: var(--ds-accent); background: var(--ds-accent-light); }
.pm-option-btn.active { background: var(--ds-accent); color: #fff; border-color: var(--ds-accent); }

/* Fields */
.pm-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.pm-field-input {
  width: 100%;
  background: rgba(0,0,0,.04);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-md);
  padding: 10px 14px;
  font-size: .88rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.pm-field-input:focus {
  border-color: var(--ds-accent);
  box-shadow: 0 0 0 3px var(--ds-accent-light);
}
.theme-dark .pm-field-input { background: rgba(255,255,255,.06); }

/* Action buttons */
.pm-action-btn {
  padding: 10px 16px;
  border-radius: var(--ds-radius-md);
  border: none;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.pm-action-btn:active { transform: scale(.97); }
.pm-action-btn--accent {
  background: var(--ds-accent);
  color: #fff;
  margin-top: 4px;
}
.pm-action-btn--accent:hover { opacity: .88; }

/* Menu rows */
.pm-menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: none;
  padding: 11px 4px;
  border-radius: var(--ds-radius-sm);
  font-size: .88rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .12s, color .12s;
  text-align: left;
  font-family: inherit;
}
.pm-menu-row:hover { background: rgba(0,0,0,.04); color: var(--text-primary); }
.theme-dark .pm-menu-row:hover { background: rgba(255,255,255,.06); }
.pm-menu-row--danger { color: #ef4444; }
.pm-menu-row--danger:hover { background: rgba(239,68,68,.07); color: #ef4444; }


/* ============================================================
   DS-STRIP — inline meta bar inside RegionWorker
   Contains: district-meta-pill | days-left | profile avatar
   All on one white seamless line, no borders, no gray
   ============================================================ */

.ds-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 6px;
  background: #ffffff;
}
.theme-dark .ds-strip { background: #0a0a0f; }

.ds-strip-left   { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ds-strip-center { display: flex; align-items: center; flex-shrink: 0; }
.ds-strip-right  { display: flex; align-items: center; flex-shrink: 0; }

/* Deadline date pill — sits in ds-strip-center */
.ds-deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px 4px 9px;
  border-radius: var(--ds-radius-full);
  background: var(--deadline-bg, #FFF4E5);
  color: var(--deadline-fg, #B45309);
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  letter-spacing: .01em;
}
.ds-deadline-pill svg { opacity: .75; flex-shrink: 0; }
.theme-dark .ds-deadline-pill {
  background: rgba(255,159,10,.15);
  color: #FF9F0A;
}

/* Days-left — now a small inline pill, same line */
.ds-days-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--ds-radius-full);
  background: var(--ds-accent-light);
  color: var(--ds-accent);
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  font-family: 'DM Mono', monospace;
}
.ds-days-pill svg { opacity: .7; flex-shrink: 0; }
.ds-days-count { font-weight: 700; }

/* Profile button inside strip */
.ds-profile-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--ds-radius-full);
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s, transform .1s;
}
.ds-profile-btn:hover  { opacity: .8; }
.ds-profile-btn:active { transform: scale(.92); }

.ds-avatar {
  width: 34px; height: 34px;
  border-radius: var(--ds-radius-full);
  object-fit: cover;
  border: 2px solid var(--ds-accent);
  box-shadow: 0 0 0 2px var(--ds-accent-light);
}
.ds-avatar--initials {
  width: 34px; height: 34px;
  border-radius: var(--ds-radius-full);
  background: var(--ds-accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--ds-accent-light);
}

/* District meta pill — white bg pill */
.district-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 9px;
  border-radius: var(--ds-radius-full);
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(0,0,0,.07);
  font-size: .74rem;
  font-weight: 600;
  color: var(--ds-accent);
  white-space: nowrap;
  user-select: none;
}
.theme-dark .district-meta-pill { background: #1a1a2e; }

/* ============================================================
   DISTRICT PANEL
   ============================================================ */

.district-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  background: #ffffff;
  /* Thin side shadow so column reads as a card on wide screens */
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 2px 24px rgba(0,0,0,.07);
}
.theme-dark .district-panel {
  background: #0a0a0f;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 2px 24px rgba(0,0,0,.3);
}

/* ── Search + filter zone ── */
.district-search-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border-bottom: none;
}

.district-meta { display: flex; align-items: center; }

.district-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.district-search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-tertiary);
  pointer-events: none;
  flex-shrink: 0;
}
.district-search-input {
  width: 100%;
  background: rgba(0,0,0,.055);
  border: 1.5px solid transparent;
  border-radius: var(--ds-radius-full);
  padding: 9px 12px 9px 34px;
  font-size: .86rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
}
.district-search-input::placeholder { color: var(--text-tertiary); }
.district-search-input:focus {
  background: #ffffff;
  border-color: var(--ds-accent);
  box-shadow: 0 0 0 3px var(--ds-accent-light);
}
.theme-dark .district-search-input {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.theme-dark .district-search-input:focus {
  background: rgba(255,255,255,.12);
  border-color: var(--ds-accent);
}

.district-filter-wrap { position: relative; flex-shrink: 0; }

.district-filter-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: var(--ds-radius-full);
  border: 1.5px solid transparent;
  background: rgba(0,0,0,.055);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.district-filter-btn:hover {
  color: var(--ds-accent);
  border-color: var(--ds-accent);
  background: var(--ds-accent-light);
}
.district-filter-btn.active {
  background: var(--ds-accent);
  color: #fff;
  border-color: var(--ds-accent);
  box-shadow: 0 2px 10px rgba(0,122,255,.22);
}
.theme-dark .district-filter-btn {
  background: rgba(255,255,255,.08);
  color: var(--text-secondary);
}
.theme-dark .district-filter-btn.active {
  background: var(--ds-accent);
  color: #fff;
}

.district-filter-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-card-shadow-h);
  padding: 6px;
  z-index: 60;
  animation: pop-in .15s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes pop-in { from{opacity:0;transform:scale(0.93) translateY(-4px);} to{opacity:1;transform:none;} }
.district-filter-dropdown[hidden] { display: none; }

.district-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--ds-radius-sm);
  border: none;
  background: none;
  font-size: .84rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .12s, color .12s;
}
.district-filter-item:hover { background: rgba(0,0,0,.04); color: var(--text-primary); }
.district-filter-item.active {
  background: var(--ds-accent-light);
  color: var(--ds-accent);
  font-weight: 600;
}

/* ── Scrollable list ── */
.district-list-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 90px; /* bottom pad clears the floating nav pill */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── District row (collapsed) ── */
.district-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border: none;
  border-radius: var(--ds-radius-md);
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  transition: box-shadow .18s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.district-row:hover {
  box-shadow: 0 4px 18px rgba(0,122,255,.13);
}
.district-row:active { transform: scale(.99); }

.district-row--selected {
  background: var(--ds-accent-light);
  box-shadow: 0 2px 12px rgba(0,122,255,.18);
}
.district-row--full {
  background: var(--ds-full-bg);
  opacity: .82;
}
.theme-dark .district-row { background: #1a1a2e; box-shadow: 0 1px 6px rgba(0,0,0,.25); }
.theme-dark .district-row:hover { box-shadow: 0 4px 18px rgba(10,132,255,.18); }
.theme-dark .district-row--selected { background: var(--ds-accent-light); }
.theme-dark .district-row--full { background: var(--ds-full-bg); }

/* Status dot */
.district-status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.district-status-dot--open   { background: var(--ds-open-dot); }
.district-status-dot--full   { background: var(--ds-full-dot); }
.district-status-dot--chosen { background: var(--ds-accent); box-shadow: 0 0 0 3px var(--ds-accent-light); }

.district-row-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.district-row-desc {
  font-size: .75rem;
  color: var(--text-tertiary);
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Capacity bar */
.district-bar-wrap { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; min-width: 52px; }
.district-bar {
  height: var(--ds-bar-h);
  border-radius: var(--ds-radius-full);
  background: var(--ds-bar-bg);
  overflow: hidden;
}
.district-bar-fill {
  height: 100%;
  border-radius: var(--ds-radius-full);
  background: var(--ds-open-dot);
  transition: width .4s ease;
}
.district-bar-fill--half { background: var(--warning, #FF9500); }
.district-bar-fill--full { background: var(--ds-full-dot); }
.district-bar-label { font-size: .68rem; color: var(--text-tertiary); text-align: right; font-family: 'DM Mono', monospace; }

/* Weather inline chip */
.district-wx {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
  white-space: nowrap;
}
.district-wx-icon { font-size: .9rem; line-height: 1; }
.district-wx-temp { font-family: 'DM Mono', monospace; font-weight: 500; color: var(--text-secondary); }

/* Avatar stack */
.avatar-stack { display: flex; flex-direction: row-reverse; flex-shrink: 0; }
.avatar-stack-item {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ds-card-bg);
  margin-left: -7px;
  object-fit: cover;
  background: var(--ds-accent);
  color: #fff;
  font-size: .55rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.avatar-stack-item:last-child { margin-left: 0; }

/* ── Detail card (expanded) ── */
.district-detail-card {
  background: var(--ds-card-bg);
  border: 1px solid var(--ds-accent);
  border-radius: var(--ds-radius-lg);
  overflow: hidden;
  box-shadow: var(--ds-card-shadow-h);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--ds-card-border);
}
.detail-back-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%; border: none;
  background: rgba(0,0,0,.06);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .12s;
  flex-shrink: 0;
}
.detail-back-btn:hover { background: rgba(0,0,0,.12); }
.theme-dark .detail-back-btn { background: rgba(255,255,255,.09); }

.detail-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.detail-subtitle { font-size: .76rem; color: var(--text-tertiary); margin-top: 1px; }
.detail-selected-badge {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  background: var(--ds-accent-light);
  color: var(--ds-accent);
  border-radius: var(--ds-radius-full);
  font-size: .72rem; font-weight: 700;
}

/* Stats row */
.detail-stats {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--ds-card-border);
}
.detail-stat {
  flex: 1;
  padding: 12px 14px;
  border-right: 1px solid var(--ds-card-border);
  min-width: 0;
}
.detail-stat:last-child { border-right: none; }
.detail-stat-label { font-size: .68rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.detail-stat-val   { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); font-family: 'DM Mono', monospace; }
.detail-stat-sub   { font-size: .7rem; color: var(--text-tertiary); }

/* Weather section in detail */
.detail-weather {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ds-card-border);
  font-size: .83rem;
  color: var(--text-secondary);
}
.detail-weather-icon { font-size: 1.6rem; line-height: 1; }
.detail-weather-temp { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); font-family: 'DM Mono', monospace; }
.detail-weather-desc { font-size: .78rem; color: var(--text-tertiary); }
.detail-weather-meta { font-size: .74rem; color: var(--text-tertiary); margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

/* Students grid */
.detail-students {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ds-card-border);
}
.detail-students-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 10px; }
.detail-students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.detail-student-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: rgba(0,0,0,.03);
  border-radius: var(--ds-radius-md);
  font-size: .78rem; color: var(--text-secondary);
  overflow: hidden;
}
.theme-dark .detail-student-chip { background: rgba(255,255,255,.05); }
.detail-student-chip img,
.detail-student-chip .chip-initials {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover;
}
.chip-initials {
  display: grid; place-items: center;
  background: var(--ds-accent); color: #fff;
  font-size: .6rem; font-weight: 700;
}
.detail-student-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 500; }

/* Actions row */
.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.btn-apply-district {
  flex: 1;
  min-width: 120px;
  background: var(--ds-accent);
  color: #fff; border: none;
  border-radius: var(--ds-radius-full);
  padding: 11px 20px;
  font-size: .88rem; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  font-family: inherit;
}
.btn-apply-district:hover:not(:disabled) { opacity: .9; }
.btn-apply-district:active:not(:disabled) { transform: scale(.98); }
.btn-apply-district:disabled { opacity: .4; cursor: not-allowed; }

.btn-open-map {
  display: flex; align-items: center; gap: 6px;
  background: none;
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-full);
  padding: 11px 16px;
  font-size: .82rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s;
  font-family: inherit;
}
.btn-open-map:hover { border-color: var(--ds-accent); color: var(--ds-accent); }

/* Empty state */
.district-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 60px 24px; text-align: center;
  color: var(--text-tertiary);
}
.district-empty-icon { font-size: 2.5rem; }
.district-empty-text { font-size: .9rem; max-width: 260px; line-height: 1.5; }

/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.confirm-overlay[hidden] { display: none; }

.confirm-modal {
  background: var(--ds-card-bg);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-card-shadow-h);
  width: 100%; max-width: 380px;
  padding: 28px 24px 22px;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

.confirm-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 0 0 6px; }
.confirm-sub   { font-size: .83rem; color: var(--text-secondary); margin: 0 0 20px; line-height: 1.5; }
.confirm-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.confirm-field label { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.confirm-field input {
  background: rgba(0,0,0,.04);
  border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-sm);
  padding: 9px 12px; font-size: .875rem; color: var(--text-primary);
  outline: none; font-family: inherit; transition: border-color .15s;
}
.confirm-field input:focus { border-color: var(--ds-accent); }
.theme-dark .confirm-field input { background: rgba(255,255,255,.05); }

.confirm-warn {
  font-size: .75rem; color: #f59e0b;
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--ds-radius-sm);
  padding: 8px 12px; margin-bottom: 14px; line-height: 1.4;
}
.confirm-err { font-size: .78rem; color: #ef4444; margin-bottom: 10px; min-height: 1em; }

.confirm-btns { display: flex; gap: 8px; margin-top: 4px; }
.confirm-btns button { flex: 1; }

.btn-confirm-cancel {
  background: none; border: 1px solid var(--ds-card-border);
  border-radius: var(--ds-radius-full); padding: 10px;
  font-size: .85rem; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; font-family: inherit; transition: background .15s;
}
.btn-confirm-cancel:hover { background: rgba(0,0,0,.04); }

.btn-confirm-submit {
  background: var(--ds-accent); border: none;
  border-radius: var(--ds-radius-full); padding: 10px;
  font-size: .85rem; font-weight: 600; color: #fff;
  cursor: pointer; font-family: inherit; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-confirm-submit:hover:not(:disabled) { opacity: .88; }
.btn-confirm-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 90px; /* clears the footer pill */
  left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 300; pointer-events: none;
  width: min(90vw, 360px);
}
.toast {
  background: #1e293b; color: #f8fafc;
  padding: 10px 20px; border-radius: var(--ds-radius-full);
  font-size: .83rem; font-weight: 500; font-family: 'DM Sans', sans-serif;
  box-shadow: 0 4px 20px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
  text-align: center;
  width: 100%;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: #166534; }
.toast--error   { background: #991b1b; }
.toast--info    { background: #1e3a5f; }
.theme-light .toast { background: #0f172a; }

/* ============================================================
   UTILITY
   ============================================================ */

.spinner-sm {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ============================================================
   PANEL HEADER (Files / Chat panels)
   ============================================================ */
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; gap: 12px; flex-wrap: wrap;
}
.panel-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.panel-sub   { font-size: .78rem; color: var(--text-tertiary); margin-top: 1px; }
.panel-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 24px; text-align: center; color: var(--text-tertiary);
}
.panel-empty-icon { font-size: 2.5rem; }
.panel-empty-text { font-size: .9rem; max-width: 260px; line-height: 1.5; }

/* ============================================================
   RESPONSIVE — Mobile first
   ============================================================ */

/* Extra small: tighten horizontal spacing */
@media (max-width: 390px) {
  .district-panel-topbar  { padding: 8px 12px; }
  .district-list-scroll   { padding: 10px 10px 90px; }
  .district-search-zone   { padding: 8px 10px; }
  .footer-nav-btn         { padding: 9px 11px; min-width: 40px; }
  .dash-footer-nav        { padding: 5px 6px; border-radius: 22px; }
  .detail-stats           { flex-wrap: wrap; }
  .detail-stat            { min-width: 50%; border-right: none; border-bottom: 1px solid var(--ds-card-border); }
  .detail-students-grid   { grid-template-columns: 1fr 1fr; }
  .pm-avatar, .pm-avatar--initials { width: 46px; height: 46px; }
}

/* ≤ 600 px */
@media (max-width: 600px) {
  .profile-modal { max-height: min(95dvh, 680px); border-radius: var(--ds-radius-xl) var(--ds-radius-xl) 0 0; }
  .profile-modal-overlay { align-items: flex-end; padding: 0; }
  @keyframes pm-slide-in {
    from { opacity:0; transform:translateY(40px); }
    to   { opacity:1; transform:none; }
  }

  .detail-students-grid { grid-template-columns: 1fr 1fr; }
  .district-bar-wrap { min-width: 44px; }
  .district-wx { display: none; } /* hide wx on very small rows; still shown in detail */
}

/* ============================================================
   PEOPLE PANEL  (PeopleWorker — Students + Supervisors tabs)
   ============================================================ */

.people-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: 'DM Sans', sans-serif;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 2px 24px rgba(0,0,0,.07);
}
.theme-dark .people-panel {
  background: #0a0a0f;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 2px 24px rgba(0,0,0,.3);
}

/* ── Header bar ── */
.people-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 8px;
  flex-shrink: 0;
  color: var(--text-primary);
}
.people-title {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}
.people-count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: rgba(0,0,0,.05);
  border-radius: var(--ds-radius-full);
  padding: 2px 9px;
}
.theme-dark .people-count { background: rgba(255,255,255,.08); }

/* ── Scrollable list ── */
.people-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.people-loading {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

/* ── Card ── */
.people-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border-radius: var(--ds-radius-md);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .15s;
}
.people-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.10); }
.theme-dark .people-card {
  background: #1a1a2e;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.theme-dark .people-card:hover { box-shadow: 0 3px 14px rgba(0,0,0,.4); }

/* Avatar circle */
.people-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Body */
.people-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.people-card-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-card-sub {
  font-size: .75rem;
  color: var(--text-tertiary);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.people-card-meta svg { flex-shrink: 0; opacity: .6; }

/* Right slot */
.people-card-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* ── Badges ── */
.people-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--ds-radius-full);
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}
.people-badge--done {
  background: rgba(34,197,94,.12);
  color: #16a34a;
}
.theme-dark .people-badge--done {
  background: rgba(34,197,94,.18);
  color: #4ade80;
}
.people-badge--pending {
  background: rgba(0,0,0,.05);
  color: var(--text-tertiary);
}
.theme-dark .people-badge--pending { background: rgba(255,255,255,.07); }
.people-badge--warn {
  background: rgba(245,158,11,.12);
  color: #b45309;
}
.theme-dark .people-badge--warn {
  background: rgba(245,158,11,.18);
  color: #fbbf24;
}

/* ── Supervisor progress bar ── */
.people-card-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.people-progress-bar {
  width: 60px;
  height: 3px;
  background: rgba(0,0,0,.08);
  border-radius: var(--ds-radius-full);
  overflow: hidden;
  flex-shrink: 0;
}
.theme-dark .people-progress-bar { background: rgba(255,255,255,.10); }
.people-progress-fill {
  height: 100%;
  background: var(--ds-accent);
  border-radius: var(--ds-radius-full);
  transition: width .35s ease;
}
.people-progress-label {
  font-size: .68rem;
  color: var(--text-tertiary);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

/* Avatar color classes (shared with RegionWorker) */
.av-color-blue   { background: #3b82f6; }
.av-color-green  { background: #22c55e; }
.av-color-purple { background: #a855f7; }
.av-color-orange { background: #f97316; }
.av-color-pink   { background: #ec4899; }
.av-color-teal   { background: #14b8a6; }
