/* West Broadway CSH Patrol Dashboard - Premium Design System */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #0b0f19;
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Screen Layouts */
.screen-view {
  display: none;
  min-height: 100vh;
  width: 100%;
}

.screen-view.active {
  display: flex;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Authentication Screen & Card */
#auth-screen, #blocked-screen, #loading-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top right, #1e1b4b 0%, #0b0f19 60%);
}

.auth-card {
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-logo {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: #94a3b8;
  font-size: 14px;
  font-weight: 400;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-google {
  background-color: white;
  color: #1f2937;
  gap: 12px;
  font-weight: 600;
}

.btn-google:hover {
  background-color: #f3f4f6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-secondary {
  background-color: #374151;
  color: #f9fafb;
}

.btn-secondary:hover {
  background-color: #4b5563;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #4b5563;
  font-size: 12px;
  margin: 24px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-divider span {
  padding: 0 10px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background-color: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: white;
  font-size: 15px;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  background-color: rgba(31, 41, 55, 0.8);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.error-text {
  color: #ef4444;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
  animation: fadeIn 0.2s ease;
}

.hidden {
  display: none !important;
}

/* Blocked / Error Screen */
.blocked-card {
  border-color: rgba(239, 68, 68, 0.2);
}

.error-logo {
  color: #ef4444;
  margin-bottom: 16px;
  animation: pulseGlow 2s infinite ease-in-out;
}

.blocked-message {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 30px;
}

.blocked-message strong {
  color: #f1f5f9;
}

/* App Shell Structure */
#app-shell {
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#shell-header {
  height: 64px;
  background-color: #0e1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shell-logo {
  color: #3b82f6;
  display: flex;
}

.app-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#header-user-name {
  font-size: 14px;
  font-weight: 500;
}

.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  font-weight: 600;
  text-transform: capitalize;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-icon {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
}

.btn-icon:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.05);
}

/* Shell Body layout */
#shell-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#shell-sidebar {
  width: 240px;
  background-color: #0b0f19;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 24px 12px;
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}

.nav-item:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: white;
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Main shell content */
#shell-content {
  flex: 1;
  background-color: #0b0f19;
  padding: 32px;
  overflow-y: auto;
}

.content-header {
  margin-bottom: 24px;
}

.content-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.text-secondary {
  color: #94a3b8;
  font-size: 14px;
  margin-top: 4px;
}

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.welcome-banner h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.welcome-banner p {
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.5;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: #0e1322;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}

.stat-trend {
  font-size: 12px;
}

.text-muted {
  color: #4b5563;
}

/* Module Status Card */
.module-status-card {
  background-color: #0e1322;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 24px;
}

.module-status-card h4 {
  font-size: 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.roadmap-list {
  list-style: none;
}

.roadmap-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.roadmap-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.roadmap-item.completed .status-indicator {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.roadmap-item.pending .status-indicator {
  background-color: #374151;
}

.roadmap-item strong {
  font-size: 14px;
  font-weight: 600;
  display: block;
}

.roadmap-item .desc {
  font-size: 13px;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

/* Panel Multi-View System */
.panel-view {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.panel-view.active {
  display: block;
}

/* Directory Toolbar & Search */
.directory-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 480px;
  min-width: 280px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  background-color: rgba(31, 41, 55, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #3b82f6;
  background-color: rgba(31, 41, 55, 0.7);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
}

/* Spinner Loader */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  color: #94a3b8;
  gap: 16px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-link {
  display: inline;
  padding: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.btn-link:hover {
  color: #3b82f6;
  text-decoration: underline;
}

.login-links-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.login-link-divider {
  color: #475569;
  font-size: 13px;
  user-select: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error States */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px dashed rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  color: #fca5a5;
  text-align: center;
  gap: 12px;
}

/* Directory Accordion List */
.directory-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.org-accordion-item {
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.org-accordion-item:hover {
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(17, 24, 39, 0.55);
}

.org-accordion-item.expanded {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(17, 24, 39, 0.6);
  box-shadow: 0 4px 20px -6px rgba(0, 0, 0, 0.3);
}

.org-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  gap: 16px;
}

.org-accordion-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.org-accordion-title {
  font-size: 15px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 260px;
}

.org-accordion-address {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.org-accordion-chevron {
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.org-accordion-item.expanded .org-accordion-chevron {
  transform: rotate(180deg);
  color: #3b82f6;
}

.org-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  background: rgba(10, 15, 26, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.02);
}

.org-accordion-content-inner {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.tier-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tier-badge.tier-1 {
  background-color: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.tier-badge.tier-2 {
  background-color: rgba(59, 130, 246, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.tier-badge.tier-3 {
  background-color: rgba(168, 85, 247, 0.08);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.tier-descriptor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tier-descriptor-text {
  font-size: 12px;
  color: #94a3b8;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.4;
}

.info-row svg {
  flex-shrink: 0;
  color: #64748b;
  margin-top: 2px;
}

.contact-section {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
  margin-top: 12px;
}

.contact-section:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.contact-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
}

.contact-name {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  color: #3b82f6;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.contact-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  transform: translateY(-1px);
}

.notes-box {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 12px 14px;
  background: rgba(99, 102, 241, 0.02);
  border-left: 3px solid #6366f1;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  line-height: 1.4;
}

.notes-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #a5b4fc;
}

.notes-content {
  color: #cbd5e1;
}

/* Coverage Map Layout */
.map-layout {
  display: flex;
  height: calc(100vh - 170px);
  min-height: 480px;
  gap: 20px;
  overflow: hidden;
}

.map-main {
  flex: 1;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

#google-map {
  width: 100%;
  height: 100%;
  background-color: #0c101d;
}

.map-sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar-block {
  background: rgba(17, 24, 39, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 20px;
  flex-shrink: 0;
}

.sidebar-block h4 {
  font-size: 12px;
  font-weight: 600;
  color: white;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.map-stat-row:last-child {
  margin-bottom: 0;
}

.map-stat-row strong {
  color: white;
}

.warning-block {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.02);
}

.warnings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.warning-item {
  font-size: 12px;
  color: #fca5a5;
  line-height: 1.4;
  border-left: 2px solid #ef4444;
  padding-left: 8px;
}

/* Custom Marker Tooltip Popup Style (Google Maps Overlay) */
.map-popup-bubble {
  background: #0e1322;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: white;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  max-width: 200px;
}
.contact-btn.nav-btn {
  color: #10b981;
}

.contact-btn.nav-btn:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

#locate-me-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

#locate-me-btn.active svg {
  animation: pulse-dot 1.5s infinite;
}

.map-popup-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: #10b981;
  text-decoration: none;
  font-weight: 500;
  font-size: 11px;
}

.map-popup-nav-btn:hover {
  color: #34d399;
}

@keyframes pulse-dot {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.5;
  }
}

/* Modal Dialog Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.modal-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: white;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  margin-bottom: 6px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  background: rgba(3, 7, 18, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.checkbox-group {
  margin-top: 4px;
}

.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}

.checkbox-label span {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
  margin-top: 8px;
}

/* Card Checkbox styling */
.polygon-toggle-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

@media (max-width: 768px) {
  .org-accordion-address {
    display: none;
  }
  .map-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .map-main {
    height: auto;
    flex: none;
  }
  /* Mobile: the map declares its own height directly in viewport units.
     No height: 100% inheritance, no flex sizing, no parent chain to resolve. */
  #google-map {
    height: 60dvh;
  }
  .map-sidebar {
    width: 100%;
  }
}

/* Autocomplete wrapper and suggestions dropdown styling */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}


/* Google Places Autocomplete dark mode styling overrides */
.pac-container {
  background-color: #111827 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
  font-family: 'Outfit', sans-serif !important;
  margin-top: 4px !important;
  z-index: 2000 !important; /* Must display on top of the modal overlay */
}

.pac-item {
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
  padding: 8px 12px !important;
  color: #e2e8f0 !important;
  cursor: pointer !important;
  font-size: 13px !important;
}

.pac-item:hover,
.pac-item-selected {
  background-color: #3b82f6 !important;
  color: white !important;
}

.pac-item:hover .pac-item-query,
.pac-item-selected .pac-item-query {
  color: #ffffff !important;
}

.pac-item:hover .pac-matched,
.pac-item-selected .pac-matched {
  color: #ffffff !important;
}

.pac-item-query {
  color: #ffffff !important;
  font-size: 13px !important;
}

.pac-matched {
  color: #3b82f6 !important;
  font-weight: 600 !important;
}

.pac-icon {
  filter: invert(1) !important; /* invert google places icon color for dark mode visibility */
}

/* Admin Panel permissions configuration groups */
.role-config-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.role-config-group:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(59, 130, 246, 0.2);
}

.role-config-title {
  color: #3b82f6;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 6px;
}

/* Role-level outer accordion */
.role-accordion {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}
.role-accordion-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  user-select: none;
  text-transform: capitalize;
}
.role-accordion-summary::-webkit-details-marker { display: none; }
.role-accordion-summary::after {
  content: '›';
  font-size: 16px;
  color: #475569;
  transition: transform 0.15s;
  display: inline-block;
}
.role-accordion[open] > .role-accordion-summary {
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(59,130,246,0.06);
  color: #93c5fd;
}
.role-accordion[open] > .role-accordion-summary::after {
  transform: rotate(90deg);
}
.role-config-group {
  padding: 12px 14px 8px;
}

/* Inner permission-group accordion */
.perm-group-accordion {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  margin-top: 6px;
  overflow: hidden;
}
.perm-group-accordion + .perm-group-accordion {
  margin-top: 4px;
}
.perm-group-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  user-select: none;
}
.perm-group-summary::-webkit-details-marker { display: none; }
.perm-group-summary::after {
  content: '›';
  font-size: 14px;
  color: #475569;
  transition: transform 0.15s;
  display: inline-block;
}
.perm-group-accordion[open] > .perm-group-summary::after {
  transform: rotate(90deg);
}
.perm-group-body {
  padding: 4px 0 6px;
}

/* Admin Panel Card */
.admin-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  width: 100%;
  transition: border-color 0.2s ease;
}

.admin-card:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

.admin-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: -0.2px;
}

.admin-card-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: -10px;
}

/* User Management Table */
.user-mgmt-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.user-mgmt-table thead th {
  text-align: left;
  padding: 8px 12px;
  color: #64748b;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.user-mgmt-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}

.user-mgmt-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.user-mgmt-cell {
  padding: 10px 12px;
  color: #cbd5e1;
  vertical-align: middle;
  overflow: hidden;
}

.user-mgmt-cell:first-child {
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 45%;
}

.user-mgmt-actions {
  text-align: right;
  white-space: nowrap;
  width: 30%;
}

.user-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
  text-transform: capitalize;
}

/* Add-user form row */
.add-user-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.add-user-row input[type="email"] {
  flex: 1;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-user-row input[type="email"]:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

.add-user-row select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

/* Add-role form row */
.add-role-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.add-role-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-role-row input[type="text"]:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

/* Danger/remove small button */
.btn-danger-sm {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger-sm:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}

.btn-danger-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-danger-sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Mobile Bottom Navigation & Responsiveness */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Force dynamic viewport height to prevent browser status/action bar shifting */
  html, body, #app-container, #auth-screen, #blocked-screen, #app-shell {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  /* Hide desktop sidebar */
  #shell-sidebar {
    display: none !important;
  }

  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #0b0f19;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
    height: 100%;
    padding: 6px 0;
  }

  .mobile-nav-btn svg {
    stroke-width: 2;
    transition: stroke 0.2s ease, transform 0.2s ease;
  }

  .mobile-nav-btn:hover {
    color: #cbd5e1;
  }

  .mobile-nav-btn.active {
    color: #3b82f6;
  }

  .mobile-nav-btn.active svg {
    transform: scale(1.1);
  }

  /* Layout adjustments */
  #shell-body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  #shell-content {
    padding: 16px;
  }

  /* Grid layouts */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
  }
  .form-grid .span-2 {
    grid-column: span 1 !important;
  }

  /* Admin panel tweaks */
  .admin-card {
    padding: 16px;
  }

  .add-user-row {
    flex-direction: column;
    align-items: stretch;
  }
  .add-user-row input[type="email"],
  .add-user-row select,
  .add-user-row button {
    width: 100%;
  }

  .add-role-row {
    flex-direction: column;
    align-items: stretch;
  }
  .add-role-row input[type="text"],
  .add-role-row button {
    width: 100%;
  }
  
  .user-mgmt-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* System preferences Light Mode adjustments */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-blue: #2563eb;
  }

  body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
  }

  #app-container {
    background-color: var(--bg-primary);
  }

  #auth-screen, #blocked-screen, #app-shell {
    background-color: var(--bg-primary);
  }

  .auth-card, .blocked-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  }

  .auth-header h1 {
    background: none !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
  }

  .auth-header h2 {
    color: var(--text-primary) !important;
  }

  .subtitle, .blocked-message p {
    color: var(--text-secondary);
  }

  .form-group input {
    background-color: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
  }

  .form-group input:focus {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent-blue) !important;
  }

  .form-group label {
    color: var(--text-secondary) !important;
  }

  .auth-divider {
    color: var(--text-secondary) !important;
  }

  .auth-divider::before, .auth-divider::after {
    border-bottom-color: var(--border-color) !important;
  }

  #shell-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
  }

  .app-title, #header-user-name {
    color: var(--text-primary);
  }

  #shell-body {
    background-color: var(--bg-primary);
  }

  #shell-sidebar {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
  }

  .nav-item {
    color: var(--text-secondary);
  }

  .nav-item:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
  }

  .nav-item.active {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--accent-blue);
  }

  #shell-content {
    background-color: var(--bg-primary);
  }

  #content-title {
    color: var(--text-primary);
  }

  .welcome-banner {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-color: rgba(37, 99, 235, 0.15);
  }

  #welcome-message {
    color: var(--text-primary);
  }

  .stat-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .stat-card h4 {
    color: var(--text-secondary);
  }

  .stat-card .stat-value {
    color: var(--text-primary);
  }

  .card-block {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .card-block h3 {
    color: var(--text-primary);
  }

  .notes-content, .card-block p, .roadmap-step p {
    color: var(--text-secondary);
  }

  .roadmap-step h4 {
    color: var(--text-primary);
  }

  .admin-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .admin-card-title {
    color: var(--text-primary);
  }

  .user-mgmt-table thead th {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
  }

  .user-mgmt-row {
    border-bottom: 1px solid var(--border-color);
  }

  .user-mgmt-row:hover {
    background: var(--bg-primary);
  }

  .user-mgmt-cell {
    color: var(--text-primary);
  }

  .add-user-row input[type="email"], .add-user-row select, .add-role-row input[type="text"] {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }

  .add-user-row input[type="email"]:focus, .add-role-row input[type="text"]:focus {
    border-color: var(--accent-blue);
  }

  .mobile-bottom-nav {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
  }

  .mobile-nav-btn {
    color: var(--text-secondary);
  }

  .mobile-nav-btn.active {
    color: var(--accent-blue);
  }

  .modal-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }

  .modal-header h3 {
    color: var(--text-primary);
  }

  .form-grid input, .form-grid select, .form-grid textarea {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }

  .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    border-color: var(--accent-blue);
  }

  .checkbox-label span {
    color: var(--text-primary);
  }

  /* Directory accordion */
  .org-accordion-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    backdrop-filter: none;
  }
  .org-accordion-item:hover {
    background: var(--bg-primary);
    border-color: rgba(99, 102, 241, 0.25);
  }
  .org-accordion-item.expanded {
    background: var(--bg-secondary);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.08);
  }
  .org-accordion-title {
    color: var(--text-primary);
  }
  .org-accordion-address {
    color: var(--text-secondary);
  }
  .org-accordion-chevron {
    color: var(--text-secondary);
  }
  .org-accordion-content {
    background: var(--bg-primary);
    border-top-color: var(--border-color);
  }
  .contact-section {
    border-top-color: var(--border-color);
  }
  .contact-header {
    color: var(--text-secondary);
  }
  .contact-name {
    color: var(--text-primary);
  }
  .contact-btn {
    border-color: var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
  }
  .contact-btn:hover {
    background: var(--bg-primary);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
  }
  .tier-badge.tier-1 {
    background: rgba(71, 85, 105, 0.08);
    color: #475569;
    border-color: rgba(71, 85, 105, 0.2);
  }
  .tier-badge.tier-2 {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.2);
  }
  .tier-badge.tier-3 {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.2);
  }
  .info-row {
    color: var(--text-secondary);
  }
  .tier-descriptor-text {
    color: var(--text-secondary);
  }
  .org-accordion-alias-original {
    color: var(--text-secondary);
  }

  /* Sort control */
  .sort-box .sort-label {
    color: var(--text-secondary);
  }
  .sort-box select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
  }

  /* Map panel */
  .map-main {
    border-color: var(--border-color);
  }
  .sidebar-block {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }
  .sidebar-block h4 {
    color: var(--text-secondary);
  }
  .map-stat-row {
    color: var(--text-secondary);
  }
  .map-stat-row strong {
    color: var(--text-primary);
  }

  /* Queue and call log panels */
  .queue-list-container {
    background: var(--bg-secondary);
    border-color: var(--border-color);
  }
  .queue-list-header {
    border-bottom-color: var(--border-color);
  }
  .queue-list-header h4 {
    color: var(--text-primary);
  }
  .queue-subtitle {
    color: var(--text-secondary);
  }
  .queue-item {
    border-bottom-color: var(--border-color);
  }
  .queue-item-type {
    color: var(--text-primary);
  }
  .queue-item-org {
    color: var(--text-secondary);
  }
  .queue-item-note {
    color: var(--text-secondary);
  }
  .queue-item-time {
    color: var(--text-secondary);
  }
  .sms-thread-summary {
    color: var(--text-secondary);
  }
  .sms-expand-btn {
    color: var(--text-secondary);
    border-color: var(--border-color);
  }
  .sms-msg-time {
    color: var(--text-secondary);
  }
  .sms-msg-body {
    color: var(--text-secondary);
  }
  .queue-empty-state {
    color: var(--text-secondary);
  }
  .queue-empty-state svg {
    color: var(--border-color);
  }
  .call-log-item {
    border-bottom-color: var(--border-color);
  }
  .call-log-org {
    color: var(--text-primary);
  }
  .call-log-number-sub {
    color: var(--text-secondary);
  }
  .queue-slack-link,
  .call-slack-link {
    color: #4f46e5;
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
  }
  .queue-note-input {
    background: #f8fafc;
    border-color: var(--border-color);
    color: var(--text-primary);
  }
  .queue-note-input::placeholder {
    color: var(--text-secondary);
  }
  .invite-divider {
    color: var(--text-secondary);
  }
  .invite-divider::before,
  .invite-divider::after {
    background: var(--border-color);
  }
  .invite-status-ok { color: #059669; }
  .invite-status-err { color: #dc2626; }
  .call-take-btn {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.25);
  }
  .call-take-btn:hover { background: rgba(37, 99, 235, 0.15); }
  .call-clear-btn {
    background: rgba(5, 150, 105, 0.08);
    color: #059669;
    border-color: rgba(5, 150, 105, 0.2);
  }
  .call-clear-btn:hover { background: rgba(5, 150, 105, 0.15); }
  .call-taken-badge {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.2);
  }
  .call-cleared-badge {
    background: rgba(5, 150, 105, 0.08);
    color: #059669;
    border-color: rgba(5, 150, 105, 0.15);
  }
}

/* B5: Invite section in admin panel */
.invite-section { margin-top: 16px; }
.invite-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
  color: #64748b;
  font-size: 0.82rem;
}
.invite-divider::before,
.invite-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.15);
}
.invite-status {
  font-size: 0.82rem;
  margin-top: 6px;
  min-height: 1.2em;
}
.invite-status-ok { color: #34d399; }
.invite-status-err { color: #f87171; }

/* Call log action buttons and status badges */
.call-log-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.call-take-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 6px;
  cursor: pointer;
}
.call-take-btn:hover { background: rgba(37, 99, 235, 0.25); }
.call-clear-btn {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 6px;
  cursor: pointer;
}
.call-clear-btn:hover { background: rgba(52, 211, 153, 0.22); }
.call-take-btn:disabled,
.call-clear-btn:disabled { opacity: 0.5; cursor: default; }
.call-taken-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(37, 99, 235, 0.25);
}
.call-cleared-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.call-log-item.call-log-cleared { opacity: 0.55; }

/* B30: Broadcast banner */
.app-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #854d0e;
  color: #fef3c7;
  font-size: 14px;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
}
.app-banner-text { flex: 1; }
.app-banner-dismiss {
  background: none;
  border: none;
  color: #fef3c7;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.7;
  flex-shrink: 0;
}
.app-banner-dismiss:hover { opacity: 1; }

/* PWA install prompt banner (B15) */
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.install-banner.hidden { display: none; }
.install-banner-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.install-banner-text strong { color: #f1f5f9; font-size: 0.95rem; }
.install-banner-text span { color: #94a3b8; font-size: 0.8rem; }
.install-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.install-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.install-btn.hidden { display: none; }
.install-btn:hover { background: #1d4ed8; }
.install-dismiss {
  background: transparent;
  color: #94a3b8;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.install-dismiss:hover { color: #f1f5f9; }

/* Directory sort control (B9) */
.sort-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.sort-box .sort-label {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
}
.sort-box select {
  background: #111827;
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}
.sort-box select:focus {
  outline: none;
  border-color: #2563eb;
}

/* Adaptive app name in the header: full name on wide screens, short on phones.
   Matches the app's 768px mobile breakpoint. */
.app-title-short { display: none; }
@media (max-width: 768px) {
  .app-title-full { display: none; }
  .app-title-short { display: inline; }
}

/* B17: org display-name (alias) - muted original-name chip + inline editor */
.org-accordion-alias-original {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  flex-shrink: 0;
}

.display-name-edit-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.display-name-edit-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.display-name-edit-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.display-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  font-size: 16px; /* 16px avoids mobile zoom-on-focus */
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  outline: none;
}

.display-name-input:focus {
  border-color: #3b82f6;
}

.display-name-save-btn {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
}

.display-name-edit-hint {
  font-size: 12px;
  color: #64748b;
}

/* Owner designation in the admin user table */
.owner-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  margin-right: 8px;
}

.owner-badge-prime {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.3);
}

.owner-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #94a3b8;
  margin-right: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.owner-toggle input {
  cursor: pointer;
}

/* B11/B12: anchor toggle + relationship notes editor on the org card */
.anchor-edit-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anchor-notes-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.anchor-notes-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 16px; /* 16px avoids mobile zoom-on-focus */
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  font-family: inherit;
}

.anchor-notes-input:focus {
  border-color: #3b82f6;
}

.anchor-save-btn {
  align-self: flex-start;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* Inline role selector in the admin user table (change role without re-adding) */
.user-role-select {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

.user-role-select:focus {
  outline: none;
  border-color: #3b82f6;
}

/* Stage 3: Queue and Call Log panels */
.queue-list-container {
  background: #0e1322;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

.queue-list-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.queue-list-header h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.queue-subtitle {
  font-size: 12px;
  color: #4b5563;
}

.queue-loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}

.queue-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  color: #4b5563;
  text-align: center;
}

.queue-empty-state svg {
  color: #1f2937;
}

.queue-empty-state p {
  font-size: 14px;
  margin: 0;
}

.queue-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.queue-item:last-child {
  border-bottom: none;
}

.queue-priority-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.queue-priority-badge.priority-1 {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.queue-priority-badge.priority-2 {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.queue-priority-badge.priority-3 {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.queue-item-body {
  flex: 1;
  min-width: 0;
}

.queue-item-type {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

.queue-item-org {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-note {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

/* SMS message thread accordion */
.sms-thread-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  flex-wrap: wrap;
}

.sms-expand-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #94a3b8;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.sms-expand-btn:hover {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.22);
}

.sms-expand-btn[aria-expanded="true"] {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
}

.sms-thread-body {
  display: none;
  margin-top: 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.06);
  padding-left: 10px;
}

.sms-thread-body.visible {
  display: block;
}

.sms-message {
  display: flex;
  gap: 10px;
  padding: 3px 0;
  font-size: 12px;
  line-height: 1.4;
}

.sms-msg-time {
  color: #4b5563;
  flex-shrink: 0;
  min-width: 58px;
}

.sms-msg-body {
  color: #94a3b8;
}

/* B22: Share Opt-In card */
.optin-share-body { display: flex; flex-direction: column; gap: 0; }
.optin-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.optin-url-code {
  font-family: monospace;
  font-size: 13px;
  color: #7dd3fc;
  flex: 1;
  word-break: break-all;
  user-select: all;
}
.optin-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  width: auto;
}
.optin-email-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.optin-email-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 14px;
}
.optin-email-input:focus {
  outline: none;
  border-color: rgba(96,165,250,0.5);
}
.optin-email-status {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  min-height: 16px;
}
.optin-email-status.error { color: #f87171; }
.optin-qr-img {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 6px;
  margin: 16px 0 8px;
  image-rendering: pixelated;
}

/* B26: link-to-org row in call log */
.call-link-org-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.call-link-disabled { opacity: 0.35; cursor: not-allowed; }
.call-link-org-select {
  flex: 1;
  padding: 5px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12px;
  min-width: 0;
}
.call-link-org-select:focus {
  outline: none;
  border-color: rgba(96,165,250,0.5);
}

.queue-item-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.queue-item-time {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
}

/* Call log */
.call-log-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.call-log-item:last-child {
  border-bottom: none;
}

.call-direction {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.call-direction.incoming {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.call-direction.outgoing {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.call-log-body {
  flex: 1;
  min-width: 0;
}

.call-log-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.call-log-number {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
}

.call-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  text-transform: lowercase;
}

.call-status-badge.status-missed {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.call-status-badge.status-noanswer {
  background: rgba(75, 85, 99, 0.3);
  color: #9ca3af;
}

.call-status-badge.status-abandoned {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.call-status-badge.status-answered {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.vm-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  letter-spacing: 0.05em;
}

.call-log-meta {
  font-size: 12px;
  color: #4b5563;
  margin-top: 3px;
}

.vm-transcript {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  margin-top: 5px;
  padding: 8px 10px;
  background: rgba(168, 85, 247, 0.05);
  border-left: 2px solid rgba(168, 85, 247, 0.3);
  border-radius: 0 4px 4px 0;
}

/* B7: org accordion item highlight when the org has an open queue item */
.org-accordion-item.queue-active {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.03);
}

/* Dark-theme overrides for Google Maps InfoWindow */
.gm-style .gm-style-iw-c {
  background: #0e1322 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 10px !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7) !important;
  padding: 0 !important;
}
.gm-style .gm-style-iw-d {
  overflow: hidden !important;
}
.gm-style .gm-style-iw-tc::after {
  background: #0e1322 !important;
}
.gm-style .gm-style-iw-chr {
  background: #0e1322 !important;
  border-radius: 10px 10px 0 0 !important;
}
.gm-style .gm-style-iw-c button.gm-ui-hover-effect {
  filter: invert(1) !important;
  opacity: 0.6 !important;
}
.gm-style .gm-style-iw-c button.gm-ui-hover-effect:hover {
  opacity: 1 !important;
}

/* Stage 4: org name in call log */
.call-log-org {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}
.call-log-number-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
}

/* Stage 5: Slack link in queue and call log */
.queue-slack-link,
.call-slack-link {
  font-size: 11px;
  font-weight: 600;
  color: #818cf8;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid rgba(129, 140, 248, 0.2);
  white-space: nowrap;
}
.queue-slack-link:hover,
.call-slack-link:hover {
  background: rgba(129, 140, 248, 0.18);
  color: #a5b4fc;
}

/* Stage 5: inline notes editor on queue items */
.queue-note-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 5px;
}
.queue-note-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12px;
  font-family: inherit;
  padding: 6px 8px;
  resize: vertical;
  min-height: 42px;
}
.queue-note-input::placeholder {
  color: #4b5563;
}
.queue-note-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(255, 255, 255, 0.06);
}
.queue-note-save {
  align-self: flex-end;
  font-size: 11px;
  padding: 3px 10px;
}

/* B27: CSH quick-links */
.csh-links-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.csh-link-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(96,165,250,0.12);
  color: #7dd3fc;
  border: 1px solid rgba(96,165,250,0.25);
  text-decoration: none;
  transition: background 0.15s;
}
.csh-link-btn:hover:not([disabled]) { background: rgba(96,165,250,0.22); }
.csh-link-btn[disabled], .csh-link-unconfigured {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.csh-url-row { display: flex; align-items: center; gap: 10px; }
.csh-url-label { font-size: 12px; color: #94a3b8; width: 110px; flex-shrink: 0; }
.csh-url-input { flex: 1; padding: 6px 10px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; color: #e2e8f0; font-size: 13px; }
.csh-url-input:focus { outline: none; border-color: rgba(96,165,250,0.5); }
