/* ================================================================
   Nairobi Objection Tracker — Stylesheet
   Clean, professional government application design
   ================================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a5632;
  --primary-light: #2a7a4a;
  --primary-dark: #0e3a20;
  --accent: #c8a415;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --green: #16a34a;
  --green-light: #dcfce7;
  --yellow: #ca8a04;
  --yellow-light: #fef9c3;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --red: #dc2626;
  --red-light: #fef2f2;
  --purple: #7c3aed;
  --purple-light: #f3e8ff;
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --font:
    'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial,
    sans-serif;
}

html {
  font-size: 14px;
}
body {
  font-family: var(--font);
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-100);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ── Login Page ───────────────────────────────────────────── */
@keyframes bgZoom {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

.login-body {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-y: auto;
  background: #111;
}

.login-body::before {
  content: '';
  position: fixed;
  inset: -5%;
  width: 110%;
  height: 110%;
  background: url('../img/assembly.jpg') center / cover no-repeat;
  animation: bgZoom 20s ease-in-out infinite;
  z-index: 0;
}

.login-body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 80, 40, 0.7) 0%,
    rgba(0, 60, 30, 0.6) 50%,
    rgba(0, 40, 20, 0.7) 100%
  );
  z-index: 1;
}

.login-container {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  margin: auto 1rem;
  backdrop-filter: blur(4px);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo {
  margin-bottom: 1rem;
}
.login-header h1 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.login-subtitle {
  color: var(--gray-500);
  font-size: 0.85rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}
.login-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--gray-700);
  font-size: 0.9rem;
}
.login-form input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}
.input-toggle-wrap {
  position: relative;
}
.input-toggle-wrap input {
  padding-right: 2.6rem;
}
.toggle-vis {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400, #9ca3af);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.toggle-vis:hover {
  color: var(--gray-600, #4b5563);
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--gray-500);
}
.login-footer p {
  margin-bottom: 0.25rem;
}

/* ── Top Bar ──────────────────────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 100;
  box-shadow: var(--shadow);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-600);
  padding: 0.25rem;
  display: none;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
}
.top-bar-brand:hover {
  text-decoration: none;
  color: var(--primary-dark);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Global Plot Search ───────────────────────────────────── */
.top-bar-center {
  flex: 1;
  max-width: 500px;
  margin: 0 1rem;
}
.global-search {
  position: relative;
  display: flex;
  align-items: center;
}
.global-search-input {
  width: 100%;
  padding: 0.45rem 2.5rem 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--gray-50);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.global-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.12);
  background: #fff;
}
.global-search-input::placeholder {
  color: var(--gray-400);
  font-size: 0.8rem;
}
.global-search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  padding: 0.3rem;
  border-radius: 4px;
}
.global-search-btn:hover {
  color: var(--primary);
}
.global-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 480px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}
.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}
.search-result-item:hover {
  background: var(--gray-50);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-plot {
  font-weight: 700;
  color: var(--gray-800);
  font-size: 0.95rem;
}
.search-result-app {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.15rem;
}
.search-result-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
}
.search-result-objs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.search-result-objs .badge {
  font-size: 0.7rem;
}
.search-no-results {
  padding: 1.5rem;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.85rem;
}
.search-section-header {
  padding: 0.45rem 1rem;
  background: var(--gray-50);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 1;
}
.search-section-header:first-child { border-top: none; }
.search-result-parcel .search-result-plot { color: #0077b6; }
[data-theme="dark"] .search-section-header {
  background: var(--gray-100);
  color: var(--gray-300);
}
.modal-dialog.modal-lg { max-width: 900px; width: 92vw; }

/* ── Deadline / PLUPA Window Badges ───────────────────────── */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.user-name {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.9rem;
}

/* ── Layout ───────────────────────────────────────────────── */
.app-layout {
  display: flex;
  padding-top: var(--topbar-height);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary-dark);
  border-right: none;
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 90;
}

.sidebar-nav {
  padding: 0.5rem 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
}
.nav-link.active {
  background: #217a45;
  color: #ffffff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-link .nav-icon {
  color: rgba(255, 255, 255, 0.7);
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  color: #ffffff;
}
.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.5);
}
.sidebar-footer p {
  color: rgba(255, 255, 255, 0.5);
}
.sidebar-footer span {
  color: var(--accent) !important;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 1rem 1.5rem;
  max-width: 1280px;
  overflow-y: auto;
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  position: relative;
}

/* ── Main Body SVG Decorations ────────────────────────────── */
.main-decor {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}
.main-decor img {
  display: block;
  transform: scaleY(-1);
}
.main-decor-left {
  bottom: 0;
  left: calc(var(--sidebar-width) + 20px);
}
.main-decor-left img {
  height: 220px;
  width: auto;
}
.main-decor-right {
  bottom: 0;
  right: 0;
  z-index: 101;
}
.main-decor-right img {
  height: 80px;
  width: auto;
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.25rem;
  color: var(--gray-900);
  margin-bottom: 0;
}
.page-header .text-muted {
  margin-top: 0.1rem;
  font-size: 0.8rem;
}
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
  margin-bottom: 0.5rem;
}
.search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 600px;
}
.search-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg {
  width: 18px;
  height: 18px;
}
.stat-icon-blue {
  background: var(--blue-light);
  color: var(--blue);
}
.stat-icon-green {
  background: var(--green-light);
  color: var(--green);
}
.stat-icon-orange {
  background: var(--orange-light);
  color: var(--orange);
}
.stat-icon-red {
  background: var(--red-light);
  color: var(--red);
}
.stat-icon-purple {
  background: var(--purple-light);
  color: var(--purple);
}
.stat-icon-teal {
  background: var(--teal-light);
  color: var(--teal);
}

.stat-details {
  display: flex;
  flex-direction: column;
}
.stat-number {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--gray-500);
}

/* ── Charts Grid (Dashboard Analytics) ─────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 1300px) {
  .charts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(26, 86, 50, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.chart-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.1),
    0 4px 10px rgba(26, 86, 50, 0.08);
}

.chart-card-header {
  padding: 0.85rem 1rem 0.55rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--gray-900);
  border-bottom: 1px solid var(--gray-200);
  border-left: 3px solid var(--primary, #1e3a5f);
  transition: color 0.2s ease;
}

.chart-card:hover .chart-card-header {
  color: var(--primary);
}

.chart-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chart-card-body canvas {
  display: block;
  max-width: 100%;
}

/* Donut legends */
.chart-legend {
  width: 100%;
  margin-top: 0.7rem;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.82rem;
  color: var(--gray-700);
  border-radius: var(--radius);
  transition: background 0.15s ease;
  cursor: default;
}

.chart-legend-item:hover {
  background: var(--gray-100);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.chart-legend-item:hover .chart-legend-dot {
  transform: scale(1.4);
}

.chart-legend-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-legend-val {
  font-weight: 600;
  color: var(--gray-900);
  white-space: nowrap;
}

/* Resolution ring & metrics */
.resolution-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.resolution-ring-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  line-height: 1.15;
  pointer-events: none;
}

.resolution-ring-label .ring-pct {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  display: block;
}

.resolution-ring-label .ring-sub {
  font-size: 0.72rem;
  color: var(--gray-500);
}

.resolution-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.8rem;
}

.res-metric {
  text-align: center;
  padding: 0.35rem 0.25rem;
  background: var(--gray-100);
  border-radius: var(--radius);
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  cursor: default;
}

.res-metric:hover {
  background: #e0f2e9;
  transform: scale(1.05);
}

.res-metric .res-val {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-900);
  display: block;
}

.res-metric .res-label {
  font-size: 0.68rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.chart-card-body-stats {
  gap: 0.5rem;
}

/* ── Dashboard Grid ───────────────────────────────────────── */

/* Responsive dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Objections Map Card */
#objectionMapCard {
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(26, 86, 50, 0.08);
}
#objectionMapCard .card-header {
  background: linear-gradient(
    90deg,
    var(--gray-50) 0%,
    var(--green-light, #e5fbee) 100%
  );
}
#dashboardMap {
  background: var(--gray-50);
}
.obj-map-marker {
  background: transparent !important;
  border: none !important;
}
.obj-map-legend {
  z-index: 1000;
}

/* ── Basemap Layer Control ────────────────────────────── */
.leaflet-control-layers {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.leaflet-control-layers-expanded {
  padding: 8px 12px;
  font-size: 13px;
}

/* ── Subcounty Labels ─────────────────────────────────── */
.subcounty-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  pointer-events: none;
}
.obj-map-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
  background: var(--white);
  color: var(--gray-500);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  max-width: 320px;
  box-shadow: var(--shadow);
}
.subcounty-label::before {
  display: none;
}

/* ── Marker Cluster Styling ───────────────────────────── */
.obj-cluster-wrapper {
  background: transparent !important;
  border: none !important;
}
.obj-cluster-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid #e74c3c;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.35),
    inset 0 0 8px rgba(255, 255, 255, 0.15);
  transition: transform 0.2s ease;
}
.obj-cluster-icon:hover {
  transform: scale(1.12);
}
.obj-cluster-icon.marker-cluster-small {
  background: radial-gradient(
    circle,
    rgba(231, 76, 60, 0.85) 0%,
    rgba(192, 57, 43, 0.95) 100%
  );
}
.obj-cluster-icon.marker-cluster-medium {
  background: radial-gradient(
    circle,
    rgba(230, 126, 34, 0.85) 0%,
    rgba(211, 84, 0, 0.95) 100%
  );
}
.obj-cluster-icon.marker-cluster-large {
  background: radial-gradient(
    circle,
    rgba(142, 68, 173, 0.85) 0%,
    rgba(113, 50, 143, 0.95) 100%
  );
}
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Highlight the detailed objection card */
.dashboard-grid > .card:first-child {
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(26, 86, 50, 0.08);
  background: linear-gradient(
    90deg,
    var(--gray-50) 0%,
    var(--green-light, #e5fbee) 100%
  );
}

/* Add more space between dashboard cards */
.dashboard-grid .card {
  min-height: 220px;
}

/* Style navigation buttons in the objection detail card */
#btnPrevObjCard,
#btnNextObjCard {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--primary);
  transition:
    background 0.15s,
    border 0.15s;
}
#btnPrevObjCard:hover,
#btnNextObjCard:hover {
  background: var(--primary-light);
  color: var(--white);
  border-color: var(--primary-light);
}

/* Make the objection detail grid more readable */
#dashboardObjDetail .detail-grid {
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem 2.5rem;
}
@media (max-width: 700px) {
  #dashboardObjDetail .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Add a subtle shadow to all dashboard cards */
.dashboard-grid .card {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.04),
    0 1.5px 4px rgba(26, 86, 50, 0.04);
}

/* ── Quick Actions ─────────────────────────────────────── */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
@media (max-width: 600px) {
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.35rem;
  border-radius: var(--radius);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
  cursor: pointer;
}
.quick-action-btn:hover {
  background: var(--primary-light);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
}
.qa-icon {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}
.qa-label {
  text-align: center;
  word-break: break-word;
  line-height: 1.25;
}

/* ── Document Stats ───────────────────────────────────── */
.doc-stats-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.doc-stat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
}
.doc-stat-bar {
  flex: 1 1 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--gray-100);
  overflow: hidden;
}
.doc-stat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.doc-stat-fill-blue {
  background: #3b82f6;
}
.doc-stat-fill-teal {
  background: #0d9488;
}
.doc-stat-fill-green {
  background: #16a34a;
}
.doc-stat-fill-orange {
  background: #d97706;
}
.doc-stat-label {
  font-size: 0.75rem;
  color: var(--gray-600);
  font-weight: 500;
}
.doc-stat-val {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-left: auto;
}

/* ── Staff Workload ───────────────────────────────────── */
.text-danger {
  color: #dc2626;
}
.text-success {
  color: #16a34a;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.card-header h2 {
  font-size: 0.9rem;
  color: var(--gray-800);
}

.card-body {
  padding: 0.75rem 1rem;
}

.mb-4 {
  margin-bottom: 0.75rem;
}
.mt-3 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 0.75rem;
}
.ml-2 {
  margin-left: 0.5rem;
}
.mb-0 {
  margin-bottom: 0;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-responsive {
  overflow: auto;
  max-height: calc(100vh - 280px);
  max-height: calc(100dvh - 280px);
  flex: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 0.4rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: top;
}
.table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-600);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.sortable-th:hover {
  color: var(--primary);
}
.sortable-th.sorted {
  color: var(--primary);
}
.sort-arrow {
  font-size: 0.65rem;
  opacity: 0.7;
}
.table td {
  font-size: 0.85rem;
}
.table tbody tr:hover {
  background: var(--gray-50);
}
.table-compact th,
.table-compact td {
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
}

.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-sm {
  font-size: 0.85rem;
}
.text-xs {
  font-size: 0.75rem;
}
.text-muted {
  color: var(--gray-500);
}

.row-urgent {
  background: var(--red-light) !important;
}
.row-inactive {
  opacity: 0.6;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-green {
  background: var(--green-light);
  color: #166534;
}
.badge-blue {
  background: var(--blue-light);
  color: #1e40af;
}
.badge-yellow {
  background: var(--yellow-light);
  color: #854d0e;
}
.badge-orange {
  background: var(--orange-light);
  color: #9a3412;
}
.badge-red {
  background: var(--red-light);
  color: #991b1b;
}
.badge-purple {
  background: var(--purple-light);
  color: #5b21b6;
}
.badge-teal {
  background: var(--teal-light);
  color: var(--teal);
}
.badge-gray {
  background: var(--gray-100);
  color: var(--gray-600);
}
.badge-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

/* ── Urgency & Deadline Indicators ─────────────────────────── */
.urgency-overdue {
  color: #dc2626;
  font-weight: 600;
}
.urgency-critical {
  color: #dc2626;
  font-weight: 700;
  animation: urgency-pulse 1.5s ease-in-out infinite;
}
.urgency-warning {
  color: #d97706;
  font-weight: 600;
}
@keyframes urgency-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}
.urgency-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}
.urgency-dot-red {
  background: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}
.urgency-dot-orange {
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.25);
}

/* Deadline Alerts Panel (dashboard) */
.deadline-alerts-panel {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid #dc2626;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.deadline-alerts-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
}
.deadline-alerts-header h2 {
  font-size: 0.95rem;
  margin: 0;
  flex: 1;
}
.deadline-alerts-header svg {
  flex-shrink: 0;
}
.deadline-alert-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  background: #dc2626;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 6px;
}
.deadline-alerts-body {
  padding: 0.75rem 1rem;
  max-height: 360px;
  overflow-y: auto;
}
/* SLA Alert Tabs */
.sla-tabs {
  display: flex;
  gap: 0;
  padding: 0 1rem;
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  overflow-x: auto;
}
.sla-tab {
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #991b1b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.sla-tab:hover {
  background: rgba(220, 38, 38, 0.06);
}
.sla-tab.sla-tab-active {
  border-bottom-color: #dc2626;
  color: #dc2626;
}
.sla-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 4px;
}
.sla-tab-badge-red {
  background: #fee2e2;
  color: #dc2626;
}
.sla-tab-badge-orange {
  background: #ffedd5;
  color: #c2410c;
}
.deadline-section {
  margin-bottom: 0.75rem;
}
.deadline-section:last-child {
  margin-bottom: 0;
}
.deadline-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.deadline-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #888);
  margin: 0 0 0.4rem 0;
  font-style: italic;
}
/* SLA Timeline Bar */
.sla-timeline-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-600, #666);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  flex-wrap: wrap;
}
.sla-timeline-step {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.sla-timeline-step small {
  font-weight: 400;
  color: var(--gray-500, #999);
}
.sla-timeline-arrow {
  color: var(--gray-400, #bbb);
  font-size: 0.85rem;
}
.sla-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.sla-dot-blue {
  background: #3b82f6;
}
.sla-dot-orange {
  background: #f59e0b;
}
.sla-dot-red {
  background: #dc2626;
}
.sla-dot-green {
  background: #10b981;
}
.deadline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.deadline-item {
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}
.deadline-item a {
  color: inherit;
}
.deadline-item-red {
  background: #fef2f2;
  border-left: 3px solid #dc2626;
}
.deadline-item-orange {
  background: #fffbeb;
  border-left: 3px solid #d97706;
}
.deadline-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

/* ── LR / Block Tags ──────────────────────────────────────── */
/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font);
}
.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--white);
}

.btn-outline {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-700);
}

.btn-danger-outline {
  background: var(--white);
  color: var(--red);
  border-color: var(--red);
}
.btn-danger-outline:hover {
  background: var(--red-light);
}

.btn-success-outline {
  background: var(--white);
  color: var(--green);
  border-color: var(--green);
}
.btn-success-outline:hover {
  background: var(--green-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}
.btn-block {
  width: 100%;
  justify-content: center;
}

/* ── Filters Bar ──────────────────────────────────────────── */
.filters-bar {
  margin-bottom: 0.5rem;
}
.filter-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  min-width: 250px;
}
.filter-input:focus {
  outline: none;
  border-color: var(--primary);
}
.filter-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--white);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form fieldset {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.form fieldset legend {
  font-weight: 600;
  color: var(--primary);
  padding: 0 0.5rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 0.6rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--gray-700);
  font-size: 0.82rem;
}
.required {
  color: var(--red);
}

.form-group input[type='text'],
.form-group input[type='email'],
.form-group input[type='tel'],
.form-group input[type='password'],
.form-group input[type='date'],
.form-group input[type='number'],
.form-group input[type='file'],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}

.form-group textarea {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: normal;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.checkbox-label input[type='checkbox'] {
  width: auto;
}

/* ── Detail Grid ──────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.detail-item {
  display: flex;
  flex-direction: column;
}
.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.detail-value {
  font-size: 0.95rem;
  color: var(--gray-800);
}
.detail-full {
  border-top: 1px solid var(--gray-100);
  padding-top: 0.75rem;
}

/* ── Summary Grid ─────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.summary-section h3 {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}
.summary-bars {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.summary-bar-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.summary-count {
  font-weight: 700;
  min-width: 2rem;
  text-align: right;
}

/* ── Objection Text Box ───────────────────────────────────── */
.objection-text-box,
.staff-notes-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--gray-700);
}
.staff-notes-box {
  background: #fefce8;
  border-color: #fde68a;
}

/* ── Map Placeholder ──────────────────────────────────────── */
.map-frame {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--gray-50);
}

/* ── Bar Chart (CSS-only) ─────────────────────────────────── */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bar-label {
  min-width: 180px;
  font-size: 0.82rem;
  color: var(--gray-700);
  text-align: right;
}
.bar-track {
  flex: 1;
  background: var(--gray-100);
  border-radius: 4px;
  height: 22px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.3s;
}
.bar-fill-blue {
  background: var(--blue);
}
.bar-value {
  min-width: 2rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-700);
}

/* ── Bulk Actions ─────────────────────────────────────────── */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  font-size: 0.85rem;
}
.bulk-actions label {
  font-weight: 600;
  color: var(--gray-600);
}
.bulk-actions select {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  flex-wrap: wrap;
}
.pagination .btn {
  min-width: 2rem;
  text-align: center;
}
.page-info {
  font-size: 0.85rem;
  color: var(--gray-500);
}
.page-dots {
  font-size: 0.85rem;
  color: var(--gray-500);
  user-select: none;
  padding: 0 0.1rem;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert ul {
  margin-left: 1.25rem;
}
.alert-danger {
  background: var(--red-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-success {
  background: var(--green-light);
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
}
.toast-success {
  background: var(--green);
  color: var(--white);
}
.toast-danger {
  background: var(--red);
  color: var(--white);
}
.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
}
.toast-close:hover {
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
}
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  max-height: 80dvh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 {
  font-size: 1.1rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  line-height: 1;
}
.modal-close:hover {
  color: var(--gray-700);
}
.modal-body {
  padding: 1.25rem;
}
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-dialog {
  background: var(--white, #fff);
  border-radius: var(--radius-lg, 10px);
  box-shadow: var(--shadow-lg, 0 4px 24px rgba(0, 0, 0, 0.18));
  width: 90%;
  max-width: 450px;
  max-height: 80vh;
  max-height: 80dvh;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-200, #e5e7eb);
}

/* ── Resources Page ───────────────────────────────────────── */
.resources-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.ref-card-wide {
  grid-column: 1 / -1;
}
.ref-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .ref-split {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
.ref-col .ref-group-label {
  padding: 0.3rem 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500, #64748b);
}
.ref-col .link-list {
  margin: 0;
}
.ref-col .link-list li {
  padding: 0.45rem 0;
}

.reference-list dt {
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.75rem;
  font-size: 0.95rem;
}
.reference-list dd {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--gray-200);
  margin-bottom: 0.5rem;
  color: var(--gray-600);
  font-size: 0.9rem;
}

.checklist {
  padding-left: 1.5rem;
}
.checklist li {
  margin-bottom: 0.75rem;
}
.checklist li strong {
  color: var(--primary);
}
.checklist li p {
  margin-top: 0.2rem;
  color: var(--gray-600);
  font-size: 0.9rem;
}

.resource-callout {
  background: #f0fdf4;
  border-left: 3px solid var(--primary);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
}
.resource-action {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 0.75rem;
}
.resource-action a {
  color: var(--primary);
  font-weight: 600;
}
.checklist-status {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #3b82f6;
  background: #eff6ff;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
}

.link-list {
  list-style: none;
  padding: 0;
}
.link-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.link-list a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}
.link-list a:hover {
  text-decoration: underline;
}
.link-list .ref-group-label {
  padding: 0.3rem 0 0.15rem;
  border-bottom: none;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500, #64748b);
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  .top-bar,
  .sidebar,
  .filters-bar,
  .bulk-actions,
  .form-actions,
  .page-actions,
  .btn,
  .toast,
  .search-bar,
  .pagination {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .app-layout {
    display: block;
    padding-top: 0;
    height: auto;
    overflow: visible;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  body {
    background: white;
    font-size: 11pt;
    height: auto;
    overflow: visible;
  }
  .main-content {
    height: auto;
    overflow: visible;
  }
  .table-responsive {
    max-height: none;
    overflow: visible;
  }
}

/* ── Responsive ───────────────────────────────────────────── */

/* Sidebar overlay backdrop for mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 85;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 768px) {
  /* Top bar */
  .sidebar-toggle {
    display: block;
  }
  .top-bar {
    padding: 0 0.75rem;
  }
  .top-bar-center {
    display: none;
  }
  .main-decor {
    display: none;
  }
  .top-bar-brand span {
    font-size: 0.8rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .top-bar-right {
    gap: 0.4rem;
    flex-shrink: 0;
  }
  .user-menu {
    gap: 0.35rem;
  }
  .user-menu .badge {
    display: none;
  }
  #btnChangePassword {
    display: none;
  }

  /* Sidebar: off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open + .sidebar-backdrop,
  .sidebar.open ~ .sidebar-backdrop {
    display: block;
  }

  /* Main content: full width */
  .main-content {
    margin-left: 0;
    padding: 0.5rem 0.5rem;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    gap: 0.75rem;
  }
  .page-header h1 {
    font-size: 1.2rem;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-actions .btn {
    flex: 0 1 auto;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0.45rem 0.6rem;
    white-space: nowrap;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .stat-card {
    padding: 0.85rem;
    gap: 0.6rem;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
  }
  .stat-icon svg {
    width: 18px;
    height: 18px;
  }
  .stat-number {
    font-size: 1.25rem;
  }
  .stat-label {
    font-size: 0.72rem;
  }

  /* Forms */
  .form-row {
    grid-template-columns: 1fr;
  }
  .form fieldset {
    padding: 1rem 0.75rem;
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  /* Filters */
  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-input {
    min-width: 0;
    width: 100%;
  }
  .filter-select {
    width: 100%;
  }
  .search-form {
    max-width: none;
    flex-direction: column;
  }
  .search-form .btn {
    width: 100%;
    justify-content: center;
  }

  /* Tables: horizontal scroll with hints */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
  }
  .table th,
  .table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Detail grids */
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Bar chart */
  .bar-label {
    min-width: 100px;
    font-size: 0.72rem;
  }
  .bar-row {
    gap: 0.5rem;
  }

  /* Bulk actions */
  .bulk-actions {
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
  }
  .pagination .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
  }

  /* Cards */
  .card-header {
    padding: 0.75rem 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .card-body {
    padding: 0.85rem;
  }

  /* Tabs: scrollable */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .tab {
    padding: 0.6rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Toast */
  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: none;
  }

  /* Map */
  #parcelMap {
    min-height: 250px !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
  .user-name {
    display: none;
  }
  .top-bar-brand span {
    display: none;
  }
  .top-bar-brand img {
    width: 28px;
    height: 28px;
  }
  .top-bar-right {
    gap: 0.25rem;
  }
  .user-menu {
    gap: 0.25rem;
  }
  .user-menu .btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.4rem;
  }

  /* Compact buttons */
  .btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
  }
  .btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
  }

  /* Table: narrower cells */
  .table th,
  .table td {
    padding: 0.4rem 0.45rem;
    font-size: 0.75rem;
  }

  /* Page header */
  .page-header h1 {
    font-size: 1.05rem;
  }
  .page-subtitle {
    font-size: 0.78rem;
  }

  /* Summary grid */
  .summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Bar chart labels */
  .bar-label {
    min-width: 80px;
    font-size: 0.68rem;
  }

  /* Detail items */
  .detail-label {
    font-size: 0.7rem;
  }
  .detail-value {
    font-size: 0.85rem;
  }
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 0.75rem;
}
.tab {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.tab:hover {
  color: var(--gray-700);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--gray-400);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ── Loading Indicator ──────────────────────────────────── */
.loading-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ── Utilities ──────────────────────────────────────────── */
.mb-3 {
  margin-bottom: 1rem;
}
.text-xs {
  font-size: 0.75rem;
}
.row-urgent {
  background-color: #fff5f5;
}
.row-inactive {
  opacity: 0.6;
}
.btn-danger-outline {
  color: #dc3545;
  border-color: #dc3545;
}
.btn-danger-outline:hover {
  background: #dc3545;
  color: #fff;
}
.btn-success-outline {
  color: #28a745;
  border-color: #28a745;
}
.btn-success-outline:hover {
  background: #28a745;
  color: #fff;
}
.btn-xs {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}
.staff-notes-box {
  background: var(--gray-50);
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 3px solid var(--primary);
}
.summary-section {
  margin-bottom: 1.5rem;
}
.summary-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}
.summary-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.summary-bar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.summary-count {
  font-weight: 600;
  min-width: 2rem;
  text-align: right;
}
.bar-fill-blue {
  background: var(--info, #3b82f6);
}

/* ── Admin-only hidden by default ─────────────────────── */
.admin-only {
  display: none;
}
.edit-only {
  display: none;
}

/* ── Bulk Actions ─────────────────────────────────────── */
.bulk-actions {
  display: none;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}
.bulk-actions select,
.bulk-actions button {
  margin-right: 0.5rem;
}

/* ── Page info ────────────────────────────────────────── */
.page-info {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-right: 0.75rem;
}

/* ── Public Portal ────────────────────────────────────── */
.public-portal-container {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 700px;
  margin: auto 1rem;
}

.portal-tagline {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.portal-info-box {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.portal-notice-box {
  background: #fef9e7;
  border: 1px solid #f5c518;
  border-left: 4px solid #d4a017;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: #5a4b1c;
  margin-bottom: 1.5rem;
  line-height: 1.55;
}
.portal-notice-box h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: #7a5d00;
}
.portal-notice-box ul {
  margin: 0;
  padding-left: 1.25rem;
}
.portal-notice-box li {
  margin-bottom: 0.35rem;
}
.portal-notice-box li:last-child {
  margin-bottom: 0;
}

.portal-fieldset {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1rem 1rem;
  margin-bottom: 1.25rem;
}
.portal-fieldset legend {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  padding: 0 0.5rem;
}

.portal-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
}
.portal-categories .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.portal-categories input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.required {
  color: var(--red);
}

.portal-submit-area {
  margin-top: 1.25rem;
}
.portal-disclaimer {
  font-size: 0.75rem;
  color: var(--gray-400);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.4;
}

.portal-success {
  text-align: center;
  padding: 2rem 1rem;
}
.portal-success-icon {
  width: 64px;
  height: 64px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}
.portal-success h2 {
  color: var(--green);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}
.portal-success p {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.public-portal-container .form-group {
  margin-bottom: 1rem;
}
.public-portal-container label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--gray-700);
  font-size: 0.88rem;
}
.public-portal-container input[type='text'],
.public-portal-container input[type='tel'],
.public-portal-container input[type='number'],
.public-portal-container input[type='email'],
.public-portal-container select,
.public-portal-container textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.public-portal-container input:focus,
.public-portal-container select:focus,
.public-portal-container textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}
.public-portal-container textarea {
  resize: vertical;
}

.public-portal-container .login-footer {
  margin-top: 1.5rem;
}

.public-portal-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--blue);
  font-weight: 600;
  font-size: 0.88rem;
}
.public-portal-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .public-portal-container {
    padding: 1.5rem 1rem;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .portal-categories {
    grid-template-columns: 1fr;
  }
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* ── Public Register ──────────────────────────────────── */
.public-register-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
}

.public-register-body::before {
  display: none;
}

.public-register-body::after {
  display: none;
}

.public-register-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  box-shadow: var(--shadow);
}
.public-register-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.public-register-topbar-left strong {
  font-size: 1rem;
  color: var(--primary);
  display: block;
  line-height: 1.2;
}
.public-register-subtitle {
  font-size: 0.78rem;
  color: var(--gray-500);
  display: block;
}
.public-register-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.public-register-banner {
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white);
  padding: 1rem 1.5rem;
}
.public-register-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  font-size: 0.88rem;
  line-height: 1.5;
}
.public-register-banner a {
  color: var(--yellow-light);
  font-weight: 600;
  text-decoration: underline;
}
.public-register-banner a:hover {
  color: var(--white);
}

.public-register-controls {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.5rem;
}
.public-register-controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.public-register-search {
  flex: 1;
  min-width: 200px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: var(--font);
}
.public-register-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}
.public-register-filter {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: var(--font);
  background: var(--white);
}

.public-register-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0.75rem auto;
  padding: 0 1.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}
.public-register-summary {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.75rem;
}

.public-register-table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.public-register-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.public-register-table th {
  background: var(--gray-50);
  color: var(--gray-700);
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.public-register-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.public-register-table tr:hover {
  background: var(--gray-50);
}
.public-register-table .text-center {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem;
}

.public-ref {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.82rem;
}

/* ================================================================
   Dark Theme
   ================================================================ */
[data-theme='dark'] {
  --primary: #2ecc71;
  --primary-light: #3ddf80;
  --primary-dark: #1fa855;
  --gray-50: #1a1a2e;
  --gray-100: #16162a;
  --gray-200: #2a2a45;
  --gray-300: #3a3a58;
  --gray-400: #7a7a96;
  --gray-500: #9a9ab0;
  --gray-600: #b0b0c4;
  --gray-700: #d0d0df;
  --gray-800: #e8e8f0;
  --gray-900: #f5f5fa;
  --white: #1e1e36;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.35), 0 4px 6px rgba(0, 0, 0, 0.2);
  --blue-light: #1a2744;
  --green-light: #122e1a;
  --yellow-light: #2e2a10;
  --orange-light: #2e1a10;
  --red-light: #2e1212;
  --purple-light: #1e1430;
  --teal-light: #0d2626;
  color-scheme: dark;
}

[data-theme='dark'] body {
  color: var(--gray-800);
  background: var(--gray-100);
}

[data-theme='dark'] a {
  color: var(--primary);
}

[data-theme='dark'] .top-bar {
  background: var(--white);
  border-bottom-color: var(--gray-200);
}

[data-theme='dark'] .top-bar-brand {
  color: var(--primary);
}

[data-theme='dark'] .global-search-input {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme='dark'] .sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
}

[data-theme='dark'] .nav-link {
  color: rgba(255, 255, 255, 0.78);
}
[data-theme='dark'] .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
[data-theme='dark'] .nav-link.active {
  background: #217a45;
  color: #ffffff;
}

[data-theme='dark'] .card {
  background: var(--white);
}
[data-theme='dark'] .card-header {
  background: var(--gray-50);
  border-bottom-color: var(--gray-200);
}

[data-theme='dark'] .stat-card {
  background: var(--white);
}

[data-theme='dark'] .deadline-alerts-panel {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-left-color: #f87171;
}
[data-theme='dark'] .deadline-alerts-header {
  background: var(--red-light);
  border-bottom-color: var(--gray-300);
  color: #fca5a5;
}
[data-theme='dark'] .sla-tabs {
  background: var(--red-light);
  border-bottom-color: var(--gray-300);
}
[data-theme='dark'] .sla-tab {
  color: #fca5a5;
}
[data-theme='dark'] .sla-tab:hover {
  background: rgba(248, 113, 113, 0.1);
}
[data-theme='dark'] .sla-tab.sla-tab-active {
  border-bottom-color: #f87171;
  color: #f87171;
}
[data-theme='dark'] .sla-tab-badge {
  background: var(--gray-200);
  color: var(--gray-700);
}
[data-theme='dark'] .sla-tab-badge-red {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}
[data-theme='dark'] .sla-tab-badge-orange {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}
[data-theme='dark'] .deadline-item-red {
  background: var(--red-light);
  border-left-color: #f87171;
  color: var(--gray-800);
}
[data-theme='dark'] .deadline-item-orange {
  background: var(--yellow-light);
  border-left-color: #fbbf24;
  color: var(--gray-800);
}

[data-theme='dark'] .table th {
  background: var(--gray-50);
  color: var(--gray-600);
}
[data-theme='dark'] .table th,
[data-theme='dark'] .table td {
  border-bottom-color: var(--gray-200);
}
[data-theme='dark'] .table tbody tr:hover {
  background: var(--gray-50);
}

[data-theme='dark'] .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}
[data-theme='dark'] .modal-dialog {
  background: var(--white);
}
[data-theme='dark'] .modal-header {
  border-bottom-color: var(--gray-200);
}
[data-theme='dark'] .modal-footer {
  border-top-color: var(--gray-200);
}

[data-theme='dark'] .form-control {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme='dark'] .btn-primary {
  background: #f1c40f;
  color: #1a1a2e;
  border-color: #f1c40f;
}
[data-theme='dark'] .btn-primary:hover {
  background: #f4d03f;
  border-color: #f4d03f;
  color: #1a1a2e;
}

[data-theme='dark'] .btn-outline {
  border-color: var(--gray-300);
  color: var(--gray-700);
}
[data-theme='dark'] .btn-outline:hover {
  background: var(--gray-200);
}

[data-theme='dark'] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.12);
}

[data-theme='dark'] .audit-trail-item {
  border-bottom-color: var(--gray-200);
}

[data-theme='dark'] .subcounty-label {
  color: var(--gray-500);
  text-shadow:
    0 0 3px rgba(0, 0, 0, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.6);
}

[data-theme='dark'] .obj-map-legend div {
  background: var(--white) !important;
  color: var(--gray-800) !important;
}
[data-theme='dark'] .obj-map-legend-toggle {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-700);
}
[data-theme='dark'] .obj-map-legend-toggle:hover {
  background: var(--gray-200);
}

/* Dark mode: Parcel map popup */
[data-theme='dark'] .parcel-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--white);
  color: var(--gray-800);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}
[data-theme='dark'] .parcel-leaflet-popup .leaflet-popup-tip {
  background: var(--white);
}
[data-theme='dark'] .parcel-leaflet-popup .leaflet-popup-close-button {
  color: var(--gray-500);
}
[data-theme='dark'] .parcel-leaflet-popup .leaflet-popup-close-button:hover {
  color: var(--gray-800);
}
[data-theme='dark'] .parcel-info-card {
  background: var(--green-light);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

/* Dark mode: Objection map popups */
[data-theme='dark'] .obj-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--white);
  color: var(--gray-800);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}
[data-theme='dark'] .obj-leaflet-popup .leaflet-popup-tip {
  background: var(--white);
}
[data-theme='dark'] .obj-leaflet-popup .leaflet-popup-close-button {
  color: var(--gray-500);
}
[data-theme='dark'] .obj-leaflet-popup .leaflet-popup-close-button:hover {
  color: var(--gray-800);
}
[data-theme='dark'] .obj-map-popup-sub {
  color: var(--gray-500);
}
[data-theme='dark'] .obj-map-popup-link {
  color: #60a5fa;
}

[data-theme='dark'] .leaflet-control-layers {
  background: var(--white);
  color: var(--gray-800);
}

[data-theme='dark'] .leaflet-bar a {
  background: var(--white);
  color: var(--gray-700);
  border-bottom-color: var(--gray-300);
}
[data-theme='dark'] .leaflet-bar a:hover {
  background: var(--gray-100);
}
[data-theme='dark'] .leaflet-control-attribution {
  background: rgba(30, 30, 54, 0.8) !important;
  color: var(--gray-500);
}
[data-theme='dark'] .leaflet-control-attribution a {
  color: var(--gray-500);
}

[data-theme='dark'] select,
[data-theme='dark'] input[type='text'],
[data-theme='dark'] input[type='email'],
[data-theme='dark'] input[type='password'],
[data-theme='dark'] input[type='number'],
[data-theme='dark'] input[type='date'],
[data-theme='dark'] input[type='search'],
[data-theme='dark'] textarea {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme='dark'] .resource-callout {
  background: #0d2818;
  color: var(--gray-600);
}
[data-theme='dark'] .resource-action {
  background: #0c1a2e;
  border-left-color: #60a5fa;
  color: var(--gray-600);
}
[data-theme='dark'] .checklist-status {
  background: #0c1a2e;
  color: #60a5fa;
}
[data-theme='dark'] .link-list li {
  border-bottom-color: var(--gray-200);
}
[data-theme='dark'] .reference-list dd {
  border-left-color: var(--gray-300);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--gray-600);
  padding: 0.3rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.public-app {
  color: var(--gray-500);
  font-size: 0.82rem;
}
.public-cats {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.public-register-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--white);
  border-radius: var(--radius);
}
.public-register-pagination .btn {
  min-width: 2rem;
  text-align: center;
}

.public-register-footer {
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.public-register-footer p {
  margin-bottom: 0.25rem;
}
.public-register-footer a {
  color: var(--primary);
}

@media (max-width: 768px) {
  .public-register-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .public-register-topbar-right {
    width: 100%;
    justify-content: flex-end;
  }
  .public-register-controls-inner {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .public-register-search {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  .public-register-filter {
    flex: 1 1 auto;
    min-width: 0;
  }
  .public-register-controls-inner .btn {
    flex: 0 0 auto;
  }
  .public-register-content {
    padding: 0 0.75rem;
  }
}

/* ── Parcel Map ───────────────────────────────────────── */
.parcel-map-wrap {
  position: relative;
}
#parcelMap {
  z-index: 1;
  background: var(--gray-50);
}
.parcel-map-info {
  margin-top: 0.75rem;
}
.parcel-info-card {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.parcel-popup {
  font-size: 0.85rem;
  line-height: 1.7;
  min-width: 180px;
}
.parcel-popup strong {
  display: block;
  color: var(--primary, #1a5632);
  font-size: 0.92rem;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  padding-bottom: 4px;
}
.pp-label {
  color: var(--gray-500, #6b7280);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-right: 4px;
}
.btn-map-link {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--primary, #1a5632);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 0.25rem;
}
.btn-map-link:hover {
  background: #145228;
}

/* ── Objection Map Popup ──────────────────────────────── */
.obj-map-popup {
  min-width: 200px;
  font-size: 13px;
}
.obj-map-popup-title {
  font-size: 14px;
}
.obj-map-popup-sub {
  color: var(--gray-500);
}
.obj-map-popup-hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--gray-200);
}
.obj-map-pending {
  color: #e74c3c;
}
.obj-map-decided {
  color: #27ae60;
}
.obj-map-popup-approx {
  color: var(--gray-400);
  font-size: 11px;
}
.obj-map-popup-link {
  display: inline-block;
  margin-top: 6px;
  color: #2980b9;
}

/* ── Objection Map Legend ─────────────────────────────── */
.obj-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 4px;
}
.obj-map-legend-inner {
  background: var(--white, #fff);
  color: var(--gray-800, #1e293b);
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  font-size: 12px;
  line-height: 1.8;
}
.obj-map-legend-inner.obj-map-legend-collapsed {
  display: none;
}
.obj-map-legend-toggle {
  display: block;
  margin-left: auto;
  background: var(--white, #fff);
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  color: var(--gray-600, #475569);
  margin-bottom: 4px;
}
.obj-map-legend-toggle:hover {
  background: var(--gray-100, #f1f5f9);
}
.obj-map-legend-hr {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--gray-200);
}

/* ── Comments & Staff Notes ───────────────────────────── */
.comments-list {
  max-height: 500px;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.comment-item {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--gray-50, #f8f9fa);
  border: 1px solid var(--gray-200, #e9ecef);
  border-radius: var(--radius, 6px);
  border-left: 3px solid var(--primary, #1a5632);
}
.comment-meta {
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.comment-text {
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-actions {
  display: flex;
  gap: 0.35rem;
}
.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--gray-300, #dee2e6);
  border-radius: var(--radius, 6px);
  font-size: 0.92rem;
  font-family: var(--font);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary, #1a5632);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}

/* ── Audit Trail List ──────────────────────────────────── */
.audit-trail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.audit-trail-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.audit-trail-item:last-child {
  border-bottom: none;
}
.audit-action {
  font-weight: 600;
  font-size: 0.82rem;
}
.audit-details {
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
}

/* ── Zoning Map (SPA page) ─────────────────────────────── */
.zoning-page {
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  margin: -1.5rem;
  overflow: hidden;
}
.zoning-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}
#zoningMap {
  flex: 1;
  height: 100%;
  z-index: 1;
}
/* Remove default browser focus rectangles on Leaflet map layers */
.leaflet-interactive:focus {
  outline: none !important;
}
.leaflet-container:focus {
  outline: none !important;
}
.leaflet-container svg:focus,
.leaflet-container path:focus,
.leaflet-container canvas:focus {
  outline: none !important;
}
.zoning-sidebar {
  width: 370px;
  max-width: 90vw;
  background: #fff;
  border-left: 1px solid var(--gray-200, #e2e5e9);
  overflow-y: auto;
  padding: 1.2rem;
  flex-shrink: 0;
  z-index: 2;
  transition: margin-right 0.25s ease;
}
.zoning-sidebar.collapsed {
  margin-right: -370px;
}
.zoning-sidebar h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem 0;
  color: var(--gray-800, #1e293b);
}
.zoning-sidebar h3 {
  font-size: 0.92rem;
  margin: 1rem 0 0.35rem 0;
  color: var(--primary, #1a5632);
}
.zoning-sidebar p,
.zoning-sidebar li {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--gray-600, #475569);
}
.zoning-sidebar ul {
  padding-left: 1.1rem;
  margin: 0.3rem 0;
}
.zoning-sidebar ul li {
  margin-bottom: 0.2rem;
}
.zoning-panel-toggle {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 800;
  background: #fff;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: none;
}
.zoning-panel-toggle:hover {
  background: var(--gray-100, #f1f5f9);
}
.zoning-pdf-section {
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}
.zoning-pdf-section .pdf-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.zoning-pdf-section .pdf-actions .btn {
  font-size: 0.82rem;
}
.zoning-pdf-viewer {
  margin-top: 0.6rem;
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 6px;
  overflow: hidden;
  display: none;
}
.zoning-pdf-viewer object,
.zoning-pdf-viewer iframe {
  width: 100%;
  height: 500px;
  border: none;
}
.zoning-pdf-viewer.open {
  display: block;
}
.zoning-search-control {
  background: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  min-width: 260px;
}
.zoning-search-select {
  padding: 6px 4px;
  font-size: 0.82rem;
  border: 1px solid var(--gray-300, #d1d5db);
  border-right: none;
  border-radius: 4px 0 0 4px;
  background: var(--gray-50, #f9fafb);
  color: var(--gray-800, #1f2937);
  cursor: pointer;
  outline: none;
}
.zoning-search-select:focus {
  border-color: var(--primary, #1a5632);
}
.zoning-search-control input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 5px;
  font-size: 0.85rem;
  outline: none;
  background: var(--white, #fff);
  color: var(--gray-800, #1f2937);
}
.zoning-search-control input::placeholder {
  color: var(--gray-400, #9ca3af);
}
.zoning-search-control input:focus {
  border-color: var(--primary, #1a5632);
  box-shadow: 0 0 0 2px rgba(26, 86, 50, 0.12);
}
.zoning-search-results {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--gray-200, #e5e7eb);
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.13);
}
.zoning-search-results:empty {
  display: none;
}
.zsr-header {
  padding: 5px 10px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gray-400, #9ca3af);
  background: var(--gray-50, #f9fafb);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  user-select: none;
}
.zoning-search-results .zsr-item {
  display: flex;
  align-items: stretch;
  cursor: pointer;
  font-size: 0.83rem;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  transition: background 0.1s;
  overflow: hidden;
}
.zoning-search-results .zsr-item:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}
.zoning-search-results .zsr-item:first-child {
  border-radius: 8px 8px 0 0;
}
.zoning-search-results .zsr-item:only-child {
  border-radius: 8px;
}
.zoning-search-results .zsr-item:hover {
  background: var(--gray-50, #f8fafc);
}
/* Left colour accent bar */
.zsr-bar {
  width: 4px;
  flex-shrink: 0;
}
/* Text content column */
.zsr-body {
  display: flex;
  flex-direction: column;
  padding: 7px 10px;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.zsr-area {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--gray-800, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zsr-zname {
  font-size: 0.74rem;
  color: var(--gray-500, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Pill badge on far right */
.zsr-pill {
  align-self: center;
  flex-shrink: 0;
  margin: 0 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.63rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
  opacity: 0.88;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Empty / loading state message inside dropdown */
.zsr-msg {
  padding: 8px 12px;
  font-size: 0.81rem;
  color: var(--gray-400, #9ca3af);
}
/* ── Plot Density Calculator (Dashboard) ─────────────────────── */
.density-card {
  --dc-green: #1a5632;
  --dc-green-soft: rgba(26, 86, 50, 0.08);
  --dc-green-line: rgba(26, 86, 50, 0.22);
  --dc-surface: #ffffff;
  --dc-surface-tint: #f5faf6;
  --dc-text: #111827;
  --dc-muted: #6b7280;
  --dc-border: #e5e7eb;
}
[data-theme='dark'] .density-card {
  --dc-green: #4ade80;
  --dc-green-soft: rgba(74, 222, 128, 0.10);
  --dc-green-line: rgba(74, 222, 128, 0.30);
  --dc-surface: #1f2937;
  --dc-surface-tint: #1a2e25;
  --dc-text: #e5e7eb;
  --dc-muted: #9ca3af;
  --dc-border: #374151;
}

.density-card-header h2 { color: var(--dc-green) !important; }
.density-card-header h2::after {
  content: '';
  display: block;
  width: 38px;
  height: 3px;
  background: var(--dc-green);
  border-radius: 2px;
  margin-top: 4px;
}

.density-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: stretch;
}
@media (max-width: 720px) {
  .density-split { grid-template-columns: 1fr; }
}

.density-subcard {
  background: var(--dc-surface);
  border: 1px solid var(--dc-border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.density-subcard:hover {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10), 0 8px 22px rgba(15, 23, 42, 0.06);
}
[data-theme='dark'] .density-subcard {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.density-subcard-input,
.density-subcard-output {
  border-top: 4px solid var(--dc-green);
}
.density-subcard-output {
  background: linear-gradient(180deg, var(--dc-surface-tint) 0%, var(--dc-surface) 110%);
}

.density-subcard-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--dc-border);
  background: var(--dc-green-soft);
}
.density-subcard-header h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--dc-green);
  letter-spacing: 0.01em;
}
.density-subcard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dc-green);
  box-shadow: 0 0 0 3px var(--dc-green-soft);
}
.density-subcard-sub {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--dc-muted);
  font-weight: 500;
}
.density-subcard-body {
  padding: 1rem 1rem 1.1rem;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.density-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem 0.85rem;
}
.density-input {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.density-input label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dc-muted);
}
.density-input input,
.density-input select {
  width: 100%;
  background: var(--dc-surface);
  color: var(--dc-text);
  border: 1px solid var(--dc-border);
  border-radius: 5px;
  padding: 0.45rem 0.55rem;
  font-size: 0.84rem;
  font-family: inherit;
  box-sizing: border-box;
}
.density-input input:focus,
.density-input select:focus {
  outline: none;
  border-color: var(--dc-green);
  box-shadow: 0 0 0 2px var(--dc-green-line);
}
.density-zone-hint {
  margin-top: 0.85rem;
  padding: 0.55rem 0.85rem;
  background: var(--dc-green-soft);
  border-left: 3px solid var(--dc-green);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--dc-text);
}

.density-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}
.density-metric {
  background: var(--dc-surface);
  border: 1px solid var(--dc-border);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: border-color 120ms ease, transform 120ms ease;
}
.density-metric:hover { transform: translateY(-1px); }
.density-metric-accent {
  background: var(--dc-green-soft);
  border-color: var(--dc-green);
}
.dm-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dc-muted);
  font-weight: 600;
}
.dm-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dc-text);
  line-height: 1.15;
}
.density-metric-accent .dm-val { color: var(--dc-green); }
.dm-hint {
  font-size: 0.7rem;
  color: var(--dc-muted);
}
.density-note {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 0.84rem;
  color: var(--dc-text);
}
[data-theme='dark'] .density-note { background: rgba(245, 158, 11, 0.16); }
.density-outputs .empty-state { color: var(--dc-muted); font-style: italic; }

/* Full-width input row */
.density-input-full { margin-bottom: 0.9rem; }

/* Parcel typeahead */
.density-parcel-search-wrap { position: relative; }
.density-parcel-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 50;
  margin-top: 2px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--dc-surface);
  border: 1px solid var(--dc-green);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.density-parcel-result {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-bottom: 1px solid var(--dc-border);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.density-parcel-result:last-child { border-bottom: none; }
.density-parcel-result:hover,
.density-parcel-result:focus { background: var(--dc-green-soft); }
.dpr-num { font-size: 0.88rem; color: var(--dc-text); }
.dpr-meta { font-size: 0.72rem; }
.density-parcel-result-msg {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--dc-muted);
}

/* Selected-parcel badge */
.density-parcel-detail {
  margin-top: 0.55rem;
  padding: 0.55rem 0.75rem;
  background: var(--dc-green-soft);
  border: 1px solid var(--dc-green-line);
  border-left: 3px solid var(--dc-green);
  border-radius: 4px;
  font-size: 0.84rem;
  color: var(--dc-text);
  line-height: 1.5;
}
.density-parcel-detail-badge {
  display: inline-block;
  background: var(--dc-green);
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.4rem;
  vertical-align: 1px;
}

/* ── Parcel preview map inside the Results sub-card ── */
.density-parcel-map {
  width: 100%;
  height: 220px;
  min-height: 180px;
  border-radius: 6px;
  border: 1px solid var(--dc-green-line);
  overflow: hidden;
  margin-top: 0.75rem;
}
.density-parcel-map-results {
  flex: 1 1 auto;         /* fills leftover space in the Results column */
  min-height: 200px;
  max-height: 320px;
}
.density-parcel-map .leaflet-container {
  background: var(--dc-card-bg, #f5f7f5);
}
[data-theme='dark'] .density-parcel-map {
  border-color: rgba(255,255,255,0.08);
}
[data-theme='dark'] .density-parcel-map .leaflet-container {
  background: #1e1e1e;
}

/* ── Objection form — Parcel Number autocomplete ──────────────── */
.obj-parcel-search-wrap { position: relative; }
.obj-parcel-results {
  position: absolute;
  top: 100%; left: 0; right: 0;
  z-index: 100;
  margin-top: 2px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.obj-parcel-result {
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.obj-parcel-result:last-child { border-bottom: none; }
.obj-parcel-result:hover,
.obj-parcel-result.is-active { background: var(--green-light); }
.obj-parcel-result .opr-num { font-size: 0.88rem; color: var(--gray-800); font-weight: 500; }
.obj-parcel-result .opr-meta { font-size: 0.72rem; color: var(--gray-500); }
.obj-parcel-result-msg {
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.obj-parcel-detail {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--green-light);
  border: 1px solid #bbf7d0;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.83rem;
  color: var(--gray-800);
  line-height: 1.6;
}
.obj-parcel-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-right: 0.4rem;
  vertical-align: 1px;
}
[data-theme='dark'] .obj-parcel-results {
  background: var(--gray-800);
  border-color: var(--primary-light);
}
[data-theme='dark'] .obj-parcel-result { border-bottom-color: rgba(255,255,255,0.07); }
[data-theme='dark'] .obj-parcel-result:hover,
[data-theme='dark'] .obj-parcel-result.is-active { background: rgba(26,86,50,0.25); }
[data-theme='dark'] .obj-parcel-result .opr-num { color: var(--gray-100); }
[data-theme='dark'] .obj-parcel-detail {
  background: rgba(26,86,50,0.15);
  border-color: rgba(26,86,50,0.4);
  color: var(--gray-100);
}

/* ── Public portal — parcel autocomplete positional fix ─────────────
   The .obj-parcel-search-wrap / .obj-parcel-results classes are reused
   on the public portal pages (public-portal.php, public-inquiry.php).
   The portal uses a centred card layout (.public-portal-container) so
   the dropdown needs z-index above the card shadow.
   ──────────────────────────────────────────────────────────────────── */
.login-body .obj-parcel-search-wrap {
  display: block;
}
.login-body .obj-parcel-results {
  z-index: 200;
  /* Ensure border colour falls back gracefully when --primary is unavailable */
  border-color: var(--primary, #1a5632);
}
.login-body .obj-parcel-result:hover,
.login-body .obj-parcel-result.is-active {
  background: var(--green-light, #f0fdf4);
}
.login-body .obj-parcel-detail {
  background: var(--green-light, #f0fdf4);
  border-color: #bbf7d0;
  border-left-color: var(--primary, #1a5632);
}
.login-body .obj-parcel-badge {
  background: var(--primary, #1a5632);
}

/* ── Density Calculator: Card body, buttons, terminologies ──────── */
.density-card-body {
  padding: 1rem;
}

/* Reset button (inside Inputs header) */
.density-reset-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--dc-border);
  color: var(--dc-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.density-reset-btn:hover {
  background: var(--dc-green-soft);
  color: var(--dc-green);
  border-color: var(--dc-green-line);
}

/* PDF export button */
.density-pdf-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: var(--dc-green);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  transition: background 140ms, box-shadow 140ms;
  box-shadow: 0 1px 3px rgba(26, 86, 50, 0.25);
}
.density-pdf-btn:hover {
  background: #145228;
  box-shadow: 0 3px 10px rgba(26, 86, 50, 0.35);
}
.density-pdf-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.density-pdf-sub {
  font-size: 0.68rem;
  font-weight: 400;
  opacity: 0.75;
  margin-left: 0.15rem;
}
[data-theme='dark'] .density-pdf-btn {
  background: #22c55e;
  color: #111;
  box-shadow: 0 1px 3px rgba(34, 197, 94, 0.3);
}
[data-theme='dark'] .density-pdf-btn:hover {
  background: #16a34a;
}

/* ── Terminologies sub-card ──────────────────────────────────────── */
.density-subcard-terms {
  margin-top: 1.1rem;
  border-top: 4px solid var(--dc-green);
}

/* Definitions grid — 2 columns on wide, 1 on narrow */
.density-defs-list {
  margin: 0;
  padding: 0;
}
.density-defs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.85rem;
}

/* Each definition card */
.density-def {
  background: var(--dc-surface-tint);
  border: 1px solid var(--dc-border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 140ms, box-shadow 140ms;
}
.density-def:hover {
  border-color: var(--dc-green-line);
  box-shadow: 0 2px 8px rgba(26, 86, 50, 0.06);
}
.density-def dt {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--dc-text);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.density-def dd {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--dc-muted);
}
.density-def dd strong {
  color: var(--dc-text);
}

/* Relationship / interaction definition (spans full width) */
.density-def-rel {
  grid-column: 1 / -1;
  background: var(--dc-green-soft);
  border-color: var(--dc-green-line);
}

/* Worked-example card */
.density-def-example {
  background: #fffbeb;
  border-color: #fbbf24;
}
[data-theme='dark'] .density-def-example {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
}

/* Pill badges inside dt */
.density-def-pill {
  display: inline-flex;
  align-items: center;
  background: var(--dc-green);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.density-def-pill-alt {
  background: #6366f1;
}
.density-def-pill-example {
  background: #f59e0b;
  color: #111;
}

/* Alternate name label */
.density-def-alt {
  font-weight: 400;
  font-size: 0.74rem;
  color: var(--dc-muted);
}

/* Inline equation / formula highlight */
.density-def-eq {
  display: inline-block;
  background: rgba(26, 86, 50, 0.06);
  border: 1px solid var(--dc-green-line);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.76rem;
  color: var(--dc-green);
  margin: 0.15rem 0;
  white-space: nowrap;
}
[data-theme='dark'] .density-def-eq {
  background: rgba(74, 222, 128, 0.08);
}

/* Mini example paragraph inside a definition */
.density-def-mini-eg {
  margin-top: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: rgba(26, 86, 50, 0.04);
  border-left: 3px solid var(--dc-green-line);
  border-radius: 3px;
  font-size: 0.78rem;
  color: var(--dc-text);
  line-height: 1.5;
}
[data-theme='dark'] .density-def-mini-eg {
  background: rgba(74, 222, 128, 0.06);
}

/* Worked-example input list */
.density-example-inputs {
  margin: 0 0 0.4rem 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--dc-text);
}
.density-example-inputs li {
  padding: 0.12rem 0;
}
.density-example-inputs li strong {
  color: var(--dc-green);
}

/* Worked-example step list */
.density-example-steps {
  margin: 0 0 0.45rem 0;
  padding: 0 0 0 1.25rem;
  font-size: 0.8rem;
  color: var(--dc-text);
}
.density-example-steps li {
  padding: 0.15rem 0;
  list-style: decimal;
}
.density-example-steps li::marker {
  color: var(--dc-green);
  font-weight: 700;
}

/* Step label inside example steps */
.dx-step {
  display: inline-block;
  background: var(--dc-green-soft);
  color: var(--dc-green);
  font-weight: 700;
  font-size: 0.74rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 0.2rem;
  min-width: 5rem;
}

/* Example note / caveat at bottom */
.density-example-note {
  margin-top: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--dc-text);
}
[data-theme='dark'] .density-example-note {
  background: rgba(245, 158, 11, 0.12);
}

/* ── Estimated Build Charges Card ───────────────────────── */
.density-charges-card {
  margin-top: 0.75rem;
  background: var(--dc-surface);
  border: 1px solid var(--dc-border);
  border-radius: 10px;
  overflow: hidden;
}
.density-charges-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--dc-green-soft);
  border-bottom: 1px solid var(--dc-border);
}
.density-charges-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.density-charges-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--dc-green);
  letter-spacing: 0.01em;
}
.density-charges-body {
  padding: 0.65rem 0.85rem;
  display: grid;
  gap: 0.55rem;
}
.density-charges-body .density-input label {
  font-size: 0.78rem;
}
[data-theme='dark'] .density-charges-card {
  background: var(--dc-surface);
  border-color: var(--dc-border);
}
[data-theme='dark'] .density-charges-header {
  background: rgba(74, 222, 128, 0.08);
}

/* Legend removed from the Zoning Map — kill rule hides any stale legend
   injected by a cached/older app.js bundle. The polygon palette is
   preserved separately via ZONE_COLORS in app.js. */
.zoning-legend,
.zoning-legend.visible {
  display: none !important;
}
.zoning-legend--unused-keep-rules-for-css-validity-only {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 0.78rem;
  max-height: 320px;
  overflow-y: auto;
  min-width: 170px;
}
.zoning-legend h4 {
  margin: 0 0 6px 0;
  font-size: 0.82rem;
}
.zoning-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.zoning-legend-swatch {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
/* ── Zoning Layer Control — Collapsible ────────────────── */
.zoning-layer-wrapper {
  position: relative;
}
.zoning-layer-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-size: 1.1rem;
  cursor: pointer;
  margin-bottom: 4px;
  margin-left: auto;
  color: #374151;
  transition: background 0.15s;
}
.zoning-layer-toggle:hover {
  background: #f1f5f9;
}
.zoning-layer-control {
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 0.8rem;
  max-height: 70vh;
  overflow-y: auto;
  transition: opacity 0.2s, transform 0.2s;
}
.zoning-layer-control.zoning-layer-collapsed {
  display: none;
}
.zoning-layer-control label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}
.zoning-layer-control input[type="checkbox"],
.zoning-layer-control input[type="radio"] {
  width: 13px;
  height: 13px;
  margin: 0;
  flex-shrink: 0;
}
.lyr-section-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500, #64748b);
  margin: 2px 0 4px 0;
}
/* OLS airport groups */
.ols-airport-group {
  margin-bottom: 2px;
}
.ols-airport-header {
  font-weight: 600 !important;
}
.ols-sub-layers {
  display: none;
  padding-left: 18px;
  margin: 2px 0 4px 0;
  border-left: 2px solid var(--gray-200, #e2e5e9);
}
.ols-sub-layers.ols-subs-visible {
  display: block;
}
.ols-sub-label {
  font-size: 0.72rem !important;
  font-weight: 400 !important;
  margin-bottom: 1px !important;
}
.ols-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Compact on small screens */
@media (max-width: 768px) {
  .zoning-layer-control {
    font-size: 0.72rem;
    padding: 8px 9px;
    max-height: 55vh;
    max-width: 200px;
  }
  .zoning-layer-control label {
    gap: 4px;
    margin-bottom: 2px;
  }
  .ols-sub-label {
    font-size: 0.66rem !important;
  }
  .lyr-section-label {
    font-size: 0.6rem;
  }
}
.ols-tooltip {
  background: rgba(17, 24, 39, 0.88);
  border: none;
  color: #f9fafb;
  font-size: 0.78rem;
  border-radius: 6px;
  padding: 5px 9px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.ols-tooltip::before {
  border-top-color: rgba(17, 24, 39, 0.88);
}
.zone-info-section {
  background: var(--gray-50, #f8fafc);
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}
.zone-info-section strong {
  color: var(--gray-800, #1e293b);
}
.zone-color-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.zoning-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 600;
  background: rgba(255, 255, 255, 0.92);
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* ── Zoning sidebar — pinned selected-zone panel ─────────── */
.zone-selected-panel {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  margin: 0 0 0.9rem 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.zone-selected-empty {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  color: var(--gray-600, #475569);
}
.zone-selected-empty-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.zone-selected-empty p {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.5;
}
.zone-selected-head {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}
.zone-selected-head .zone-color-badge {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.zone-selected-titles {
  flex: 1;
  min-width: 0;
}
.zone-selected-area {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray-800, #1e293b);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.zone-selected-name {
  font-size: 0.8rem;
  color: var(--gray-600, #475569);
  margin-top: 1px;
  word-break: break-word;
}
.zone-selected-desc {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--gray-700, #334155);
  margin: 0.4rem 0 0.25rem;
}
.zone-selected-notes {
  font-size: 0.76rem;
  color: var(--gray-500, #64748b);
  margin: 0 0 0.5rem;
  line-height: 1.45;
}
.zone-selected-fallback {
  font-size: 0.76rem;
  color: var(--gray-500, #64748b);
  font-style: italic;
  margin: 0.5rem 0 0;
}
.zone-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.5rem;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 6px;
}
.zone-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.zone-metric .zm-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500, #64748b);
  font-weight: 600;
}
.zone-metric .zm-val {
  font-size: 0.82rem;
  color: var(--gray-800, #1e293b);
  font-weight: 600;
  word-break: break-word;
}
.zone-selected-det {
  margin-top: 0.5rem;
  border: 1px solid var(--gray-200, #e2e5e9);
  border-radius: 6px;
  background: #fff;
}
.zone-selected-det > summary {
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary, #1a5632);
  user-select: none;
  list-style: none;
}
.zone-selected-det > summary::-webkit-details-marker { display: none; }
.zone-selected-det > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s;
}
.zone-selected-det[open] > summary::before { transform: rotate(90deg); }
.zone-selected-det-body {
  padding: 0.4rem 0.7rem 0.55rem;
  font-size: 0.78rem;
  color: var(--gray-700, #334155);
  line-height: 1.5;
  white-space: pre-wrap;
  border-top: 1px solid var(--gray-100, #f1f5f9);
  max-height: 220px;
  overflow-y: auto;
}

/* Collapsible reference sections in sidebar */
.zoning-details {
  margin: 0 0 0.5rem 0;
  border-bottom: 1px solid var(--gray-100, #f1f5f9);
  padding-bottom: 0.4rem;
}
.zoning-details > summary {
  cursor: pointer;
  padding: 0.45rem 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary, #1a5632);
  user-select: none;
  list-style: none;
}
.zoning-details > summary::-webkit-details-marker { display: none; }
.zoning-details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.78rem;
  transition: transform 0.15s;
}
.zoning-details[open] > summary::before { transform: rotate(90deg); }

/* Dark theme overrides for the new panel */
[data-theme='dark'] .zone-selected-panel {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border-color: #374151;
}
[data-theme='dark'] .zone-selected-area { color: #f1f5f9; }
[data-theme='dark'] .zone-selected-name,
[data-theme='dark'] .zone-selected-empty,
[data-theme='dark'] .zone-selected-desc { color: #cbd5e1; }
[data-theme='dark'] .zone-metrics {
  background: #0f172a;
  border-color: #374151;
}
[data-theme='dark'] .zone-metric .zm-val { color: #f1f5f9; }
[data-theme='dark'] .zone-selected-det,
[data-theme='dark'] .zone-selected-det-body {
  background: #1f2937;
  border-color: #374151;
  color: #cbd5e1;
}
/* Zoning map controls toggle for small screens */
.zoning-map-controls-toggle {
  display: none;
}
@media (max-width: 768px) {
  .zoning-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 310px;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
  }
  .zoning-sidebar.collapsed {
    margin-right: -310px;
  }
  /* Reposition info/close button to top-right on small screens */
  .zoning-panel-toggle {
    left: auto;
    transform: none;
    right: 16px;
    top: 16px;
  }
  /* Hide legend by default on small screens; layer toggle button stays visible */
  .zoning-legend {
    display: none;
  }
  .zoning-legend.visible {
    display: block;
  }
  /* Layer control already collapses via toggle btn; ensure panel fits */
  .zoning-layer-control {
    max-width: 190px;
  }
  /* Show the map controls toggle button */
  .zoning-map-controls-toggle {
    display: block;
    position: absolute;
    bottom: 20px;
    left: 10px;
    z-index: 800;
    background: #fff;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  }
  .zoning-map-controls-toggle:hover {
    background: var(--gray-100, #f1f5f9);
  }
}
@media (max-width: 480px) {
  .zoning-sidebar {
    width: 100vw;
    max-width: 100vw;
  }
  .zoning-sidebar.collapsed {
    margin-right: -100vw;
  }
}

/* ── Zoning Map — Dark Mode ────────────────────────────── */
[data-theme='dark'] .zoning-sidebar {
  background: var(--white);
  border-left-color: var(--gray-200);
}
[data-theme='dark'] .zoning-sidebar h2 {
  color: var(--gray-800);
}
[data-theme='dark'] .zoning-sidebar h3 {
  color: var(--primary);
}
[data-theme='dark'] .zoning-sidebar p,
[data-theme='dark'] .zoning-sidebar li {
  color: var(--gray-600);
}
[data-theme='dark'] .zone-info-section {
  background: var(--gray-50);
  border-color: var(--gray-200);
}
[data-theme='dark'] .zone-info-section strong {
  color: var(--gray-800);
}
[data-theme='dark'] .zoning-panel-toggle {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-700);
}
[data-theme='dark'] .zoning-panel-toggle:hover {
  background: var(--gray-200);
}
[data-theme='dark'] .zoning-map-controls-toggle {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-700);
}
[data-theme='dark'] .zoning-map-controls-toggle:hover {
  background: var(--gray-200);
}
[data-theme='dark'] .zoning-pdf-section {
  background: var(--gray-50);
  border-color: var(--gray-200);
}
[data-theme='dark'] .zoning-search-control {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme='dark'] .zoning-search-select {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}
[data-theme='dark'] .zoning-search-control input {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-800);
}
[data-theme='dark'] .zoning-search-control input::placeholder {
  color: var(--gray-500);
}
[data-theme='dark'] .zoning-search-results {
  background: var(--white);
  border-color: var(--gray-300);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
[data-theme='dark'] .zsr-header {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-500);
}
[data-theme='dark'] .zoning-search-results .zsr-item {
  border-color: var(--gray-200);
}
[data-theme='dark'] .zoning-search-results .zsr-item:hover {
  background: var(--gray-100);
}
[data-theme='dark'] .zsr-area {
  color: var(--gray-800);
}
[data-theme='dark'] .zsr-zname {
  color: var(--gray-500);
}
[data-theme='dark'] .zoning-legend {
  background: rgba(30, 30, 54, 0.95);
  color: var(--gray-700);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme='dark'] .zoning-layer-toggle {
  background: rgba(30, 30, 54, 0.95);
  color: var(--gray-300);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
[data-theme='dark'] .zoning-layer-toggle:hover {
  background: rgba(45, 45, 70, 1);
}
[data-theme='dark'] .zoning-layer-control {
  background: rgba(30, 30, 54, 0.96);
  color: var(--gray-700);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
[data-theme='dark'] .ols-sub-layers {
  border-left-color: var(--gray-600, #475569);
}
[data-theme='dark'] .zoning-loading {
  background: rgba(30, 30, 54, 0.92);
  color: var(--gray-700);
}
[data-theme='dark'] .zoning-pdf-viewer {
  border-color: var(--gray-200);
}

/* ── Zoning Popup (Leaflet) ────────────────────────────── */
.zp-popup {
  min-width: 240px;
  max-width: 420px;
}
.zp-popup-zone {
  font-size: 1rem;
}
.zp-popup-name {
  color: var(--gray-800, #1e293b);
}
.zp-popup-hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--gray-200, #e2e5e9);
}
.zp-popup-desc {
  font-size: 0.82rem;
  color: var(--gray-600, #475569);
}
.zp-popup-table {
  width: 100%;
  font-size: 0.78rem;
  margin-top: 6px;
  border-collapse: collapse;
}
.zp-popup-label {
  color: var(--gray-500, #64748b);
  padding: 2px 6px 2px 0;
  white-space: nowrap;
}
.zp-popup-val {
  font-weight: 600;
  color: var(--gray-800, #1e293b);
}
.zp-popup-hint {
  font-size: 0.75rem;
  color: var(--gray-500, #64748b);
  margin-top: 4px;
}
.zp-popup-det {
  margin-top: 6px;
  font-size: 0.78rem;
}
.zp-popup-det > summary {
  cursor: pointer;
  color: var(--gray-500, #64748b);
  font-weight: 600;
  list-style: none;
  padding: 2px 0;
}
.zp-popup-det > summary::before {
  content: '\25b6\00a0';
  font-size: 0.65rem;
  vertical-align: 1px;
}
.zp-popup-det[open] > summary::before {
  content: '\25bc\00a0';
}
.zp-popup-det-body {
  margin-top: 4px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-line;
  font-size: 0.75rem;
  color: var(--gray-600, #475569);
  line-height: 1.45;
  padding: 4px 6px;
  background: var(--gray-50, #f8fafc);
  border-left: 2px solid var(--gray-200, #e2e5e9);
  border-radius: 0 3px 3px 0;
}

/* Dark mode: Leaflet popup container + tooltip */
[data-theme='dark'] .zp-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--white);
  color: var(--gray-800);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5);
}
[data-theme='dark'] .zp-leaflet-popup .leaflet-popup-tip {
  background: var(--white);
}
[data-theme='dark'] .zp-leaflet-popup .leaflet-popup-close-button {
  color: var(--gray-500);
}
[data-theme='dark'] .zp-leaflet-popup .leaflet-popup-close-button:hover {
  color: var(--gray-800);
}
[data-theme='dark'] .leaflet-tooltip {
  background: var(--white);
  color: var(--gray-800);
  border-color: var(--gray-300);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
[data-theme='dark'] .leaflet-tooltip::before {
  border-top-color: var(--white);
}

/* ── Inquiry View Layout ──────────────────────────────────── */
.inq-view-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}
.inq-view-grid .detail-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.inq-view-grid .detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Inquiry cards — refined */
.inq-view-grid .card {
  border: 1px solid var(--gray-200);
  transition: box-shadow 0.2s ease;
}
.inq-view-grid .card:hover {
  box-shadow: var(--shadow-md);
}
.inq-view-grid .card-header {
  padding: 0.75rem 1.25rem;
  background: linear-gradient(to right, var(--gray-50), var(--white));
  border-bottom: 1px solid var(--gray-200);
}
.inq-view-grid .card-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.inq-view-grid .card-header h3::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}
.inq-view-grid .card-body {
  padding: 1rem 1.25rem;
}

/* Detail rows inside inquiry view */
.inq-view-grid .detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 1rem;
}
.inq-view-grid .detail-row:last-child {
  border-bottom: none;
}
.inq-view-grid .detail-row .detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 120px;
}
.inq-view-grid .detail-row .detail-value {
  font-size: 0.9rem;
  color: var(--gray-800);
  text-align: right;
  word-break: break-word;
}

/* Pre-wrap blocks (dev description, inquiry text) */
.inq-view-grid .pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--gray-700);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 1rem;
}

/* Map inside inquiry */
.inq-view-grid #inqDetailMapWrap {
  margin-top: 0.75rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.inq-view-grid #inqDetailMap {
  border-radius: var(--radius-lg) !important;
  border: none !important;
}

/* Response card styling */
.inq-view-grid #inqResponseCard .pre-wrap {
  background: var(--green-light);
  border-color: #bbf7d0;
}
.inq-view-grid #inqNoResponse {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray-400);
  font-style: italic;
}

/* Response form */
.inq-view-grid #inqResponseForm textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  resize: vertical;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.inq-view-grid #inqResponseForm textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}

/* ── Inquiries Analytics (D3) ─────────────────────────── */
.inquiry-analytics-card .card-header,
#dashInqAssignCard > .card-header,
#dashInqRegisterCard > .card-header {
  border-left: 4px solid #f59e0b;
}
.inq-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.inq-kpi {
  background: linear-gradient(135deg, #fffbeb 0%, #fffef5 100%);
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  text-align: center;
}
.inq-kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #b45309;
  line-height: 1.1;
}
.inq-kpi-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-600, #4b5563);
  margin-top: 0.3rem;
}
[data-theme="dark"] .inq-kpi {
  background: linear-gradient(135deg, #2d2008 0%, #3a2a13 100%);
  border-color: #b45309;
}
[data-theme="dark"] .inq-kpi-value {
  color: #fbbf24;
}
[data-theme="dark"] .inq-kpi-label {
  color: #cbd5e1;
}
.inq-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}
.inq-chart-cell {
  background: var(--white, #fff);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 0.85rem;
}
[data-theme="dark"] .inq-chart-cell {
  background: #1f2335;
  border-color: #374151;
}
.inq-chart-cell h4 {
  margin: 0 0 0.6rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700, #374151);
  letter-spacing: 0.01em;
}
[data-theme="dark"] .inq-chart-cell h4 {
  color: #e5e7eb;
}
.inq-chart {
  width: 100%;
  min-height: 220px;
  position: relative;
}
.inq-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.inq-chart .d3-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  font-size: 0.72rem;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 5;
}
.inq-chart .axis text {
  font-size: 11px;
  fill: var(--gray-600, #4b5563);
}
[data-theme="dark"] .inq-chart .axis text {
  fill: #cbd5e1;
}
.inq-chart .axis path,
.inq-chart .axis line {
  stroke: var(--gray-300, #d1d5db);
}
[data-theme="dark"] .inq-chart .axis path,
[data-theme="dark"] .inq-chart .axis line {
  stroke: #4b5563;
}
.inq-chart .grid line {
  stroke: var(--gray-200, #e5e7eb);
  stroke-dasharray: 2 3;
}
[data-theme="dark"] .inq-chart .grid line {
  stroke: #374151;
}
.inq-chart .bar-label {
  font-size: 10.5px;
  fill: var(--gray-700, #374151);
}
[data-theme="dark"] .inq-chart .bar-label {
  fill: #e5e7eb;
}

/* Locked card — visible but disabled for non-admin/technical users */
.card.card-locked {
  position: relative;
  opacity: 0.55;
  filter: grayscale(0.6);
}
.card.card-locked .card-body,
.card.card-locked .card-header {
  pointer-events: none;
  user-select: none;
}
.card.card-locked::after {
  content: "\1F512  Admin / Developer access only";
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--gray-600, #555);
  background: rgba(255, 255, 255, 0.85);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--gray-300, #ccc);
  pointer-events: none;
}

/* Manage Inquiry card — sidebar accent */
.inq-view-grid .inq-manage-only .card-header {
  background: linear-gradient(to right, #fef9c3, var(--white));
}
.inq-view-grid .inq-manage-only .card-header h3::before {
  background: var(--yellow);
}
.inq-view-grid .inq-manage-only .form-group {
  margin-bottom: 0.85rem;
}
.inq-view-grid .inq-manage-only label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 0.3rem;
}
.inq-view-grid .inq-manage-only select,
.inq-view-grid .inq-manage-only textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--white);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.inq-view-grid .inq-manage-only select:focus,
.inq-view-grid .inq-manage-only textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 50, 0.1);
}
.inq-view-grid .btn-block {
  width: 100%;
  text-align: center;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius);
}

/* Inquirer card — subtle icon accent */
.inq-view-grid .detail-sidebar > .card:first-child .card-header {
  background: linear-gradient(to right, var(--blue-light), var(--white));
}

/* Email Reply card in sidebar — compact sizing */
.inq-view-grid .detail-sidebar #inqEmailReplyCard .card-header {
  background: linear-gradient(to right, #e0f2fe, var(--white));
}
.inq-view-grid .detail-sidebar .email-compose {
  box-shadow: none;
  border: 1px solid var(--gray-200);
}
.inq-view-grid .detail-sidebar .email-meta-row {
  padding: 0.4rem 0.65rem;
  gap: 0.4rem;
}
.inq-view-grid .detail-sidebar .email-meta-label {
  min-width: 46px;
  font-size: 0.72rem;
}
.inq-view-grid .detail-sidebar .email-input {
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
}
.inq-view-grid .detail-sidebar .email-compose-body textarea {
  min-height: 120px;
  font-size: 0.82rem;
  padding: 0.65rem;
}
.inq-view-grid .detail-sidebar .email-compose-footer {
  padding: 0.5rem 0.65rem;
}
.inq-view-grid .detail-sidebar .email-preview {
  font-size: 0.82rem;
}
.inq-view-grid .detail-sidebar .email-preview-body {
  font-size: 0.82rem;
  max-height: 200px;
  overflow-y: auto;
}
.inq-view-grid .detail-sidebar > .card:first-child .card-header h3::before {
  background: var(--blue);
}

/* Mini Inquiry Register in sidebar */
.mini-register-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.35;
}
.mini-register-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.mini-register-table th {
  background: var(--gray-50);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-500);
  padding: 0.45rem 0.5rem;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
  font-size: 0.65rem;
}
.mini-register-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
  word-break: break-word;
}
.mini-register-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.mini-register-table tbody tr:hover {
  background: var(--blue-light);
}
.mini-register-table tbody tr.active-row {
  background: #e0f2fe;
  font-weight: 600;
}
.mini-register-table .text-center {
  text-align: center;
}

/* Page header refinement for inquiry view */
.inq-view-grid ~ .page-header,
.page-header:has(+ .inq-view-grid) {
  margin-bottom: 1.25rem;
}

/* Responsive — stack on narrow screens */
@media (max-width: 900px) {
  .inq-view-grid {
    grid-template-columns: 1fr;
  }
  .inq-view-grid .detail-sidebar {
    position: static;
  }
}
@media (max-width: 600px) {
  .inq-view-grid .detail-row {
    flex-direction: column;
    gap: 0.15rem;
  }
  .inq-view-grid .detail-row .detail-value {
    text-align: left;
  }
}

/* ── Email Reply Compose (Objection Form) ─────────────────── */
.email-reply-fieldset {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-top: 0.5rem;
}
.email-reply-fieldset legend {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
  padding: 0 0.75rem;
  margin-left: 0.5rem;
}
.email-compose {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}
.email-compose-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 0;
}
.email-meta-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  gap: 0.75rem;
}
.email-meta-row:last-child {
  border-bottom: none;
}
.email-meta-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  min-width: 60px;
  flex-shrink: 0;
}
.email-meta-value {
  font-size: 0.85rem;
  color: var(--gray-700);
}
.email-input {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.88rem;
  font-family: var(--font);
  color: var(--gray-800);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  transition:
    border-color 0.2s,
    background 0.2s;
}
.email-input:hover {
  background: var(--white);
  border-color: var(--gray-200);
}
.email-input:focus {
  outline: none;
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 86, 50, 0.1);
}
.email-input::placeholder {
  color: var(--gray-400);
}
.email-compose-body {
  padding: 0;
}
.email-compose-body textarea {
  display: block;
  width: 100%;
  border: none;
  padding: 1rem;
  font-size: 0.9rem;
  font-family: var(--font);
  line-height: 1.7;
  color: var(--gray-800);
  resize: vertical;
  min-height: 220px;
}
.email-compose-body textarea:focus {
  outline: none;
  background: #fafbfd;
}
.email-compose-body textarea::placeholder {
  color: var(--gray-400);
}
.email-compose-footer {
  padding: 0.6rem 1rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

/* ── Email Reply Preview (Objection View) ─────────────────── */
.email-preview {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}
.email-preview-row {
  display: flex;
  align-items: baseline;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  gap: 0.75rem;
}
.email-preview-row:last-child {
  border-bottom: none;
}
.email-preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-500);
  min-width: 60px;
  flex-shrink: 0;
}
.email-preview-value {
  font-size: 0.88rem;
  color: var(--gray-800);
}
.email-preview-subject {
  font-weight: 600;
}
.email-preview-body {
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--gray-700);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  min-height: 80px;
}

/* ── Email Outbox ─────────────────────────────────────────── */
.outbox-row-sent {
  opacity: 0.7;
}
.outbox-row-sent td {
  color: var(--gray-500);
}
.outbox-row-draft td:first-child a {
  font-weight: 600;
}

/* ── Notification Bell ────────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
  margin-right: 0.5rem;
}
.notif-bell {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 0.35rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.notif-bell:hover {
  background: var(--bg-secondary);
}
.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-height: 480px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10);
  z-index: 1000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #f3f4f6;
  border-bottom: 1px solid #d1d5db;
  font-weight: 600;
  font-size: 0.875rem;
  color: #111827;
}
.notif-dropdown-body {
  overflow-y: auto;
  max-height: 400px;
  padding: 0.25rem 0;
  background: #ffffff;
}
.notif-empty {
  text-align: center;
  color: #9ca3af;
  padding: 2rem 1rem;
  font-size: 0.85rem;
}
.notif-item {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background 0.12s;
  background: #ffffff;
}
.notif-item:hover {
  background: #f3f4f6;
}
.notif-item.unread {
  background: #eff6ff;
  border-left: 3px solid #1a5632;
}
.notif-item.read {
  opacity: 0.72;
}
.notif-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
  color: #111827;
}
.notif-msg {
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.45;
}
.notif-time {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 3px;
}

/* Dark theme overrides */
[data-theme='dark'] .notif-dropdown {
  background: #1e1e36;
  border-color: #3a3a58;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
}
[data-theme='dark'] .notif-dropdown-header {
  background: #16162a;
  border-bottom-color: #3a3a58;
  color: #f5f5fa;
}
[data-theme='dark'] .notif-dropdown-body {
  background: #1e1e36;
}
[data-theme='dark'] .notif-item {
  background: #1e1e36;
  border-bottom-color: #2a2a45;
  color: #e8e8f0;
}
[data-theme='dark'] .notif-item:hover {
  background: #2a2a45;
}
[data-theme='dark'] .notif-item.unread {
  background: #12272e;
  border-left-color: #2ecc71;
}
[data-theme='dark'] .notif-title {
  color: #f5f5fa;
}
[data-theme='dark'] .notif-msg {
  color: #b0b0c4;
}
[data-theme='dark'] .notif-time {
  color: #7a7a96;
}

/* ── Settings ─────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}
.settings-card .card-header h3 {
  margin: 0;
  font-size: 1rem;
}
.settings-card .form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ── Bulk Import ──────────────────────────────────────────── */
.import-instructions h4 {
  margin: 0 0 0.5rem;
}
.csv-cols-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.75rem 1rem;
  border-radius: 6px;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 0.75rem 1rem;
  border-radius: 6px;
}

/* ── Activity Dashboard ───────────────────────────────────── */
.activity-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* Bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 200px;
  padding: 0.5rem 0;
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}
.bar {
  width: 100%;
  max-width: 24px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s;
}
.bar-value {
  font-size: 0.6rem;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.bar-label {
  font-size: 0.55rem;
  color: var(--gray-400);
  margin-top: 3px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-height: 40px;
  overflow: hidden;
}

/* Heatmap */
.heatmap-container {
  overflow-x: auto;
}
.heatmap-table {
  border-collapse: collapse;
  width: 100%;
}
.heatmap-table th,
.heatmap-table td {
  padding: 3px;
  text-align: center;
  font-size: 0.65rem;
  min-width: 28px;
}
.heatmap-table th {
  color: var(--gray-400);
  font-weight: 500;
}
.heatmap-cell {
  border-radius: 3px;
  color: var(--text);
  font-weight: 500;
}
.heatmap-day {
  text-align: right;
  padding-right: 6px;
  color: var(--gray-500);
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .notif-dropdown {
    width: calc(100vw - 2rem);
    right: -1rem;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .activity-grid {
    grid-template-columns: 1fr;
  }
}

  font-weight: 500;
  margin: 0;
  word-break: break-all;
}
.error-log-pre {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  background: #0f172a;
  color: #94a3b8;
  padding: 1rem;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
.backup-restore-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 768px) {
  .health-info-grid {
    grid-template-columns: 1fr;
  }
  .backup-restore-grid {
    grid-template-columns: 1fr;
  }
}

/* ── ROLE PERMISSIONS MATRIX ────────────────────────────── */
.permissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.permissions-table th,
.permissions-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.permissions-table thead th {
  background: var(--bg-secondary, #f8fafc);
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}
.perm-group-row {
  background: var(--bg-secondary, #f8fafc);
}
.perm-group-header {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--primary, #1a5632);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem !important;
}
.perm-cap-label {
  padding-left: 1.5rem !important;
  color: var(--text, #111827);
}
.permissions-table input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary, #1a5632);
  cursor: pointer;
}
.permissions-table input[type='checkbox']:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.role-desc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
.role-desc-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
@media (max-width: 900px) {
  .role-desc-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .role-desc-grid {
    grid-template-columns: 1fr;
  }
  .permissions-table {
    font-size: 0.75rem;
  }
}

/* ================================================================
   QUICK-VIEW SLIDE PANEL
   ================================================================ */
.quick-view-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 1200;
}
.quick-view-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 95vw);
  height: 100vh;
  background: var(--bg-card, #fff);
  z-index: 1201;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.28s ease;
}
.quick-view-panel.quick-view-open {
  transform: translateX(0);
}
.quick-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  gap: 0.75rem;
  flex-shrink: 0;
}
.quick-view-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-view-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-500, #6b7280);
  padding: 0 0.2rem;
  flex-shrink: 0;
}
.quick-view-close:hover {
  color: var(--primary, #1a5632);
}
.quick-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}
.quick-view-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.qv-dl {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.3rem 0.75rem;
  margin: 0 0 1rem;
}
.qv-dl dt {
  font-size: 0.76rem;
  color: var(--gray-500, #6b7280);
  align-self: start;
  padding-top: 0.1rem;
  font-weight: 500;
}
.qv-dl dd {
  font-size: 0.87rem;
  margin: 0;
}
.qv-section {
  margin-top: 1rem;
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 0.75rem;
}
.qv-section strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500, #6b7280);
  margin-bottom: 0.4rem;
}
.qv-text {
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.qv-text-muted {
  color: var(--gray-500, #6b7280);
}
.obj-row {
  cursor: pointer;
}
.obj-row:hover {
  background: var(--bg-hover, #f3f4f6) !important;
}

/* ================================================================
   DEADLINE CALENDAR WIDGET
   ================================================================ */
.cal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  table-layout: fixed;
}
.cal-table th {
  text-align: center;
  padding: 0.35rem 0.2rem;
  color: var(--gray-500, #6b7280);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}
.cal-table td {
  text-align: center;
  padding: 0.3rem 0.15rem;
  position: relative;
  border-radius: 4px;
  vertical-align: top;
  min-width: 0;
}
.cal-day {
  cursor: default;
}
.cal-today {
  background: var(--primary-light, #2a7a4a);
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
}
.cal-has-event {
  background: #fff8e1;
}
.cal-has-breach {
  background: #fde8e8;
}
.cal-today.cal-has-event {
  background: #2a7a4a;
}
.cal-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin: 0 1px;
  vertical-align: middle;
}
.cal-dot-deadline {
  background: #f59e0b;
}
.cal-dot-overdue {
  background: #ef4444;
}
.cal-dot-resolved {
  background: #22c55e;
}
.cal-dot-breach {
  background: #dc2626;
}
.cal-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--gray-500, #6b7280);
  align-items: center;
}
.cal-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border, #d1d5db);
  background: transparent;
  color: inherit;
}
.btn-xs:hover {
  background: var(--bg-hover, #f3f4f6);
}

/* ================================================================
   MOBILE FILTER TOGGLE
   ================================================================ */
.filter-toggle-btn {
  display: none;
}
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
  }
  .filter-form {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    flex-direction: column;
    align-items: stretch;
  }
  .filter-form.filters-expanded {
    display: flex;
  }
  .filter-input,
  .filter-select {
    width: 100%;
  }
}

/* SMS status message (inline below SLA panel header) */
#smsNotifyStatus {
  font-size: 0.8rem;
  padding: 0.2rem 1rem 0.4rem;
  display: none;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */
.print-only {
  display: none;
}
@media print {
  .sidebar,
  .top-bar,
  .page-header .page-actions,
  .filters-bar,
  .tabs,
  .tab-panel:not(.active),
  #deadlineCalendarCard,
  .chart-card,
  .charts-grid,
  .quick-view-backdrop,
  .quick-view-panel {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
  .print-only {
    display: block !important;
  }
  table {
    font-size: 10pt;
  }
  a[href]::after {
    content: none !important;
  }
}

/* ================================================================
   ADDITIONAL RESPONSIVE IMPROVEMENTS
   ================================================================ */

/* ── Touch-friendly minimum tap target ──────────────────────── */
@media (max-width: 768px) {
  .btn,
  .nav-link,
  .tab,
  .pagination .btn,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 38px;
  }
  .btn-xs {
    min-height: 32px;
  }

  /* Sidebar: smooth iOS scroll */
  .sidebar {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Calendar: scrollable on narrow screens */
  #deadlineCalendarWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cal-table {
    min-width: 280px;
  }

  /* Deadline alerts header: wrap SMS button on tiny screens */
  .deadline-alerts-header {
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
  }

  /* Quick-view: full width on small phones */
  .quick-view-panel {
    width: 100vw;
  }

  /* Modal: full-width on mobile */
  .modal {
    width: 96vw;
    max-width: none;
    margin: 2vh auto;
    border-radius: var(--radius);
  }

  /* Application view tabs: always scrollable */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    scroll-snap-align: start;
  }

  /* Objections table: hide less critical columns */
  .table .col-hide-mobile {
    display: none;
  }

  /* Page actions: stack buttons */
  .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }

  /* Charts grid collapsed */
  .charts-grid {
    grid-template-columns: 1fr;
  }

  /* Map height: shorter on mobile */
  #objectionMap,
  .objection-map-wrap {
    min-height: 200px !important;
    max-height: 300px !important;
  }
}

@media (max-width: 480px) {
  /* Full-width action buttons */
  .page-actions .btn {
    flex: 1 1 calc(50% - 0.4rem);
    text-align: center;
    justify-content: center;
  }

  /* SLA panel header: stack count + SMS button */
  .deadline-alerts-header {
    flex-direction: row;
    flex-wrap: wrap;
  }
  #btnSendSmsAlerts {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  /* Calendar nav header: compact */
  #calMonthLabel {
    min-width: 80px;
    font-size: 0.8rem;
  }

  /* Filter toggle full width */
  .filter-toggle-btn {
    width: 100%;
    justify-content: center;
  }

  /* Quick-view footer: stack buttons */
  .quick-view-footer {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .quick-view-footer .btn {
    flex: 1;
    justify-content: center;
  }

  /* Stats: larger text scales down */
  .stat-number {
    font-size: 1.1rem;
  }

  /* Card header action buttons */
  .card-header .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}

/* ── Landscape phone (thin height) ─────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar {
    padding-bottom: 0.5rem;
  }
  .nav-link {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }
  .top-bar {
    height: 44px;
  }
}

/* ── Large screens: center content ─────────────────────────── */
@media (min-width: 1440px) {
  .main-content {
    max-width: 1400px;
  }
}


/* ============================================================
   Reports module — analytics workbench (added v20260502j)
   ============================================================ */
.reports-filter-card .reports-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:.75rem;align-items:end}
.rf-group label{display:block;font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted,#6b7280);margin-bottom:.25rem;font-weight:600}
.rf-group input[type=date],.rf-group select{width:100%;padding:.4rem .55rem;border:1px solid var(--border,#d1d5db);border-radius:6px;background:var(--bg-input,#fff);color:var(--text,#111);font-size:.85rem}
.rf-group select[multiple]{height:2.25rem}
.rf-group select[multiple]:focus{height:9rem}
.rf-chips{display:flex;gap:.25rem;flex-wrap:wrap}
.rf-chips .chip{padding:.3rem .65rem;border:1px solid var(--border,#d1d5db);background:transparent;border-radius:99px;font-size:.78rem;cursor:pointer;color:var(--text,#111)}
.rf-chips .chip:hover{background:rgba(59,130,246,.08)}
.rf-chips .chip.active{background:#1e3a5f;color:#fff;border-color:#1e3a5f}
.rf-actions{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center}
.rf-compare{display:flex;align-items:center;gap:.3rem;font-size:.78rem;color:var(--text-muted,#6b7280)}
.reports-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:.75rem;margin-bottom:1rem}
.kpi-tile{background:var(--bg-card,#fff);border:1px solid var(--border,#e5e7eb);border-radius:8px;padding:.85rem 1rem;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.kpi-label{font-size:.72rem;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted,#6b7280);margin-bottom:.4rem}
.kpi-value{font-size:1.5rem;font-weight:700;color:var(--text,#111);line-height:1.1}
.kpi-delta{font-size:.78rem;margin-top:.25rem;font-weight:600}
.kpi-up{color:#dc2626}.kpi-down{color:#10b981}.kpi-flat{color:#6b7280}
.reports-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:1rem;margin-bottom:1rem}
.reports-grid .span-2{grid-column:span 2}
@media (max-width:900px){.reports-grid{grid-template-columns:1fr}.reports-grid .span-2{grid-column:auto}}
.report-chart{min-height:240px;width:100%;display:flex;align-items:center;justify-content:center}
.report-chart .empty-state{padding:2rem;text-align:center;color:var(--text-muted,#6b7280);width:100%}
.empty-pill{display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .7rem;border-radius:999px;background:#f3f4f6;color:#6b7280;font-size:.78rem;font-weight:600;border:1px solid #e5e7eb;letter-spacing:.01em}
.empty-pill::before{content:'\25CB';color:#9ca3af;font-size:.7rem}
.empty-pill-row{margin:.25rem auto}
.empty-sub{margin-top:.4rem;font-size:.78rem;color:#9ca3af}
[data-theme="dark"] .empty-pill{background:#1f2937;color:#9ca3af;border-color:#374151}
.dq-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:.6rem}
.dq-item{display:flex;align-items:center;gap:.65rem;padding:.55rem .8rem;border:1px solid var(--border,#e5e7eb);border-radius:6px;background:var(--bg-card,#fff)}
.dq-count{font-size:1.15rem;font-weight:700;min-width:2.5rem;text-align:center;border-radius:4px;padding:.1rem .35rem}
.dq-name{font-size:.85rem;color:var(--text,#111)}
.dq-ok .dq-count{background:#d1fae5;color:#065f46}
.dq-warn .dq-count{background:#fef3c7;color:#92400e}
.dq-bad .dq-count{background:#fee2e2;color:#991b1b}
.table-sm td,.table-sm th{padding:.4rem .6rem;font-size:.82rem}
[data-theme=dark] .kpi-tile,[data-theme=dark] .dq-item{background:#1e1e36;border-color:#374151}
[data-theme=dark] .reports-grid .card{background:#1e1e36;border-color:#374151}
[data-theme=dark] .rf-group input[type=date],[data-theme=dark] .rf-group select{background:#1e1e36;color:#e2e5e9;border-color:#374151}
[data-theme=dark] .rf-chips .chip{color:#e2e5e9;border-color:#374151}

/* -- Dashboard pending sign-ups alert tile ----------------- */
.pending-signups-tile{display:flex;align-items:center;gap:1rem;padding:.85rem 1.1rem;margin:0 0 1rem;background:linear-gradient(90deg,#fff7ed,#fffbeb);border:1px solid #fcd34d;border-left:4px solid #f59e0b;border-radius:8px;color:#92400e;text-decoration:none;transition:transform .12s ease,box-shadow .12s ease}
.pending-signups-tile:hover{transform:translateY(-1px);box-shadow:0 4px 14px rgba(245,158,11,.18);text-decoration:none;color:#92400e}
.pending-signups-tile .psu-icon{width:38px;height:38px;flex:0 0 38px;border-radius:50%;background:#fde68a;color:#92400e;display:flex;align-items:center;justify-content:center}
.pending-signups-tile .psu-body{flex:1;display:flex;flex-direction:column;line-height:1.25}
.pending-signups-tile .psu-body strong{font-size:1rem}
.pending-signups-tile .psu-sub{font-size:.78rem;color:#b45309;opacity:.9}
.pending-signups-tile .psu-arrow{font-size:1.25rem;font-weight:700;color:#b45309}
[data-theme="dark"] .pending-signups-tile{background:linear-gradient(90deg,#3a2a13,#2d2008);border-color:#b45309;color:#fcd34d}
[data-theme="dark"] .pending-signups-tile:hover{color:#fcd34d}
[data-theme="dark"] .pending-signups-tile .psu-icon{background:#78350f;color:#fde68a}
[data-theme="dark"] .pending-signups-tile .psu-sub,[data-theme="dark"] .pending-signups-tile .psu-arrow{color:#fbbf24}

/* ── Inquiries Register Enhancements ───────────────────── */

/* Filter form layout */
.inq-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.filter-date {
  max-width: 145px;
  font-size: 0.8rem;
}

/* Bulk actions bar */
.inq-bulk-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  color: #1e40af;
}
[data-theme='dark'] .inq-bulk-bar {
  background: #1e3a5f;
  border-color: #2563eb;
  color: #93c5fd;
}
.filter-select-sm {
  max-width: 160px;
  font-size: 0.78rem;
  padding: 0.25rem 0.4rem;
}

/* Checkbox column */
.th-check,
.td-check {
  width: 32px;
  text-align: center;
}
.th-check input,
.td-check input {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Internal comments thread */
.inq-comments-list {
  max-height: 350px;
  overflow-y: auto;
}
.inq-comment {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.inq-comment:last-child {
  border-bottom: none;
}
.inq-comment-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.inq-comment-body {
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--gray-700);
}
[data-theme='dark'] .inq-comment {
  border-color: var(--gray-700);
}
[data-theme='dark'] .inq-comment-body {
  color: var(--gray-300);
}
.inq-comment-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 50px;
  font-size: 0.82rem;
}

/* Status history timeline */
.inq-history-list {
  max-height: 300px;
  overflow-y: auto;
}
.inq-history-item {
  padding: 0.4rem 0 0.4rem 0.75rem;
  border-left: 2px solid var(--gray-200);
  margin-bottom: 0.35rem;
}
.inq-history-item:last-child {
  margin-bottom: 0;
}
.inq-history-meta {
  font-size: 0.75rem;
  margin-bottom: 0.15rem;
}
.inq-history-desc {
  font-size: 0.8rem;
}
.inq-history-desc .badge {
  font-size: 0.68rem;
  vertical-align: middle;
}
[data-theme='dark'] .inq-history-item {
  border-color: var(--gray-600);
}

/* Page header actions row */
.page-header-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Responsive filters */
@media (max-width: 768px) {
  .inq-filter-form {
    gap: 0.35rem;
  }
  .inq-filter-form .filter-input,
  .inq-filter-form .filter-select {
    flex: 1 1 100%;
    min-width: 0;
  }
  .filter-date {
    flex: 1 1 45%;
    max-width: none;
  }
  .inq-bulk-bar {
    flex-wrap: wrap;
    font-size: 0.78rem;
  }
}

/* ── Dashboard Section Dividers ────────────────────────── */
.dash-section-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.8rem 0 0.8rem;
  padding: 0;
}
.dash-section-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.dash-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  margin: 0;
  padding: 0;
}
.dash-section-rule {
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: var(--gray-200, #e2e5e9);
}

/* Objections section — teal accent */
.dash-section-objections .dash-section-title {
  color: var(--primary, #1e3a5f);
}
.dash-section-objections .dash-section-rule {
  background: linear-gradient(90deg, var(--primary, #1e3a5f) 0%, transparent 100%);
}

/* Inquiries section — amber/orange accent */
.dash-section-inquiries .dash-section-title {
  color: #b45309;
}
.dash-section-inquiries .dash-section-rule {
  background: linear-gradient(90deg, #f59e0b 0%, transparent 100%);
}

/* Quick Actions section — green accent */
.dash-section-actions .dash-section-title {
  color: #047857;
}
.dash-section-actions .dash-section-rule {
  background: linear-gradient(90deg, #10b981 0%, transparent 100%);
}

/* Admin section — slate accent */
.dash-section-admin .dash-section-title {
  color: #475569;
}
.dash-section-admin .dash-section-rule {
  background: linear-gradient(90deg, #94a3b8 0%, transparent 100%);
}

/* Dark mode */
[data-theme='dark'] .dash-section-objections .dash-section-title {
  color: #60a5fa;
}
[data-theme='dark'] .dash-section-objections .dash-section-rule {
  background: linear-gradient(90deg, #60a5fa 0%, transparent 100%);
}
[data-theme='dark'] .dash-section-inquiries .dash-section-title {
  color: #fbbf24;
}
[data-theme='dark'] .dash-section-inquiries .dash-section-rule {
  background: linear-gradient(90deg, #fbbf24 0%, transparent 100%);
}
[data-theme='dark'] .dash-section-actions .dash-section-title {
  color: #34d399;
}
[data-theme='dark'] .dash-section-actions .dash-section-rule {
  background: linear-gradient(90deg, #34d399 0%, transparent 100%);
}
[data-theme='dark'] .dash-section-admin .dash-section-title {
  color: #94a3b8;
}
[data-theme='dark'] .dash-section-admin .dash-section-rule {
  background: linear-gradient(90deg, #64748b 0%, transparent 100%);
}
[data-theme='dark'] .dash-section-rule {
  background: var(--gray-600, #4b5563);
}

/* Reduce top margin for first section divider after the filter bar */
.stats-grid ~ .dash-section-divider:first-of-type,
.filters-bar + .dash-section-divider {
  margin-top: 1rem;
}

/* Inside dashboard-grid, remove extra top margin */
.dashboard-grid > .dash-section-divider {
  margin-top: 0.6rem;
  margin-bottom: 0.3rem;
}

@media (max-width: 768px) {
  .dash-section-title {
    font-size: 0.8rem;
  }
  .dash-section-icon {
    font-size: 1.1rem;
  }
}

/* ── OLS vs Policy Height Relationship Panel ─────────────── */
.ols-policy-relation {
  margin-top: 10px;
  border: 1px solid #e2e5e9;
  border-radius: 8px;
  background: #f8fafc;
}
.ols-policy-relation > summary {
  font-weight: 600;
  font-size: 0.85rem;
  color: #1e3a5f;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #e2e5e9;
}
.ols-rel-body {
  padding: 10px 12px;
}
.ols-rel-policy-ht {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
}
.ols-rel-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
}
.ols-rel-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e3a5f;
}
.ols-rel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 8px;
}
.ols-rel-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 5px 8px;
  border-bottom: 2px solid #e2e5e9;
  white-space: nowrap;
}
.ols-rel-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.ols-rel-table td small {
  display: block;
  font-size: 0.68rem;
  line-height: 1.3;
}
.ols-rel-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.ols-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.ols-status-ok {
  background: #dcfce7;
  color: #166534;
}
.ols-status-warn {
  background: #fef9c3;
  color: #854d0e;
}
.ols-status-danger {
  background: #fee2e2;
  color: #991b1b;
}
.ols-rel-note {
  font-size: 0.7rem;
  color: #94a3b8;
  line-height: 1.4;
  padding-top: 6px;
  border-top: 1px solid #e2e5e9;
}

/* Dark mode for OLS panel */
[data-theme="dark"] .ols-policy-relation {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] .ols-policy-relation > summary {
  color: #93c5fd;
  border-bottom-color: #334155;
}
[data-theme="dark"] .ols-rel-policy-ht {
  background: #1e3a5f;
  border-color: #2563eb;
}
[data-theme="dark"] .ols-rel-label { color: #cbd5e1; }
[data-theme="dark"] .ols-rel-val { color: #93c5fd; }
[data-theme="dark"] .ols-rel-table th {
  background: #334155;
  color: #cbd5e1;
  border-bottom-color: #475569;
}
[data-theme="dark"] .ols-rel-table td {
  border-bottom-color: #334155;
}
[data-theme="dark"] .ols-rel-table td small { color: #64748b; }
[data-theme="dark"] .ols-status-ok {
  background: #064e3b;
  color: #6ee7b7;
}
[data-theme="dark"] .ols-status-warn {
  background: #78350f;
  color: #fde68a;
}
[data-theme="dark"] .ols-status-danger {
  background: #7f1d1d;
  color: #fca5a5;
}
[data-theme="dark"] .ols-rel-note {
  color: #64748b;
  border-top-color: #334155;
}

/* ================================================================
   SLA Countdown Badges
   ================================================================ */
.sla-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  line-height: 1.3;
  vertical-align: middle;
  margin-left: 4px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.sla-overdue {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.sla-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.sla-ok {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

/* Dark mode SLA badges */
[data-theme="dark"] .sla-overdue {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #991b1b;
}
[data-theme="dark"] .sla-warning {
  background: #78350f;
  color: #fde68a;
  border-color: #92400e;
}
[data-theme="dark"] .sla-ok {
  background: #064e3b;
  color: #6ee7b7;
  border-color: #065f46;
}

/* ================================================================
   Language Toggle Button
   ================================================================ */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.2s, border-color 0.2s;
}
.lang-toggle:hover {
  background: var(--primary, #1a5632);
  color: #fff;
  border-color: var(--primary, #1a5632);
}
.lang-toggle-label {
  pointer-events: none;
}

/* ================================================================
   Duplicate Groups Panel
   ================================================================ */
.dupe-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--bg);
}
.dupe-group h4 {
  margin: 0 0 0.5rem 0;
}
.dupe-group .table {
  margin-bottom: 0;
}
.dupe-group .table th,
.dupe-group .table td {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}
.merge-primary-btn.btn-primary {
  background: var(--primary, #1a5632);
  color: #fff;
  border-color: var(--primary, #1a5632);
}
#dupesPanel .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#dupesPanel .badge-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 9px;
}
[data-theme="dark"] #dupesPanel .badge-warning {
  background: #78350f;
  color: #fde68a;
  border-color: #92400e;
}
[data-theme="dark"] .dupe-group {
  border-color: var(--border);
  background: var(--card-bg);
}

/* ================================================================
   Skip-to-Content Link (Accessibility)
   ================================================================ */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary, #1a5632);
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 6px 6px;
  z-index: 10000;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-to-content:focus {
  top: 0;
  outline: 2px solid var(--accent, #c8a415);
  outline-offset: 2px;
}

/* ================================================================
   Keyboard Navigation Focus Styles
   ================================================================ */
.keyboard-nav *:focus {
  outline: 2px solid var(--primary, #1a5632);
  outline-offset: 2px;
}
.keyboard-nav .nav-link:focus {
  outline-color: var(--accent, #c8a415);
  background: rgba(26, 86, 50, 0.08);
}

/* ================================================================
   Keyboard Shortcuts Overlay
   ================================================================ */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.shortcuts-dialog {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.shortcuts-dialog h3 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}
.shortcuts-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0 0 1rem;
}
.shortcuts-list dt {
  text-align: right;
}
.shortcuts-list dd {
  margin: 0;
  color: var(--text-secondary, #64748b);
}
kbd {
  display: inline-block;
  background: var(--bg-secondary, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
[data-theme="dark"] .shortcuts-dialog {
  background: var(--card-bg, #1e1e2e);
}
[data-theme="dark"] kbd {
  background: #2a2a3e;
  border-color: #3a3a58;
}

/* ================================================================
   Table Row Keyboard Selection
   ================================================================ */
.data-table tbody tr.kb-selected {
  outline: 2px solid var(--primary, #1a5632);
  outline-offset: -2px;
  background: rgba(26, 86, 50, 0.06);
}
[data-theme="dark"] .data-table tbody tr.kb-selected {
  background: rgba(52, 211, 153, 0.1);
  outline-color: var(--accent, #c8a415);
}

/* ================================================================
   Offline Queue Badge (PWA)
   ================================================================ */
.offline-queue-badge {
  display: inline-flex;
  align-items: center;
  background: #f59e0b;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  margin-right: 0.5rem;
}

/* ================================================================
   High-Contrast Mode
   ================================================================ */
@media (prefers-contrast: high) {
  :root {
    --primary: #005a20;
    --border: #333;
    --text: #000;
    --text-secondary: #222;
  }
  .card {
    border-width: 2px;
  }
  .btn {
    border-width: 2px;
  }
  .nav-link {
    border: 1px solid transparent;
  }
  .nav-link.active {
    border-color: var(--primary);
  }
}

/* ================================================================
   3D Building Height Visualiser
   ================================================================ */
.zoning-3d-toggle {
  position: absolute;
  top: 10px;
  right: 180px;
  z-index: 800;
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text, #1e293b);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: background 0.15s, border-color 0.15s;
}
.zoning-3d-toggle:hover {
  background: var(--primary, #1a5632);
  color: #fff;
  border-color: var(--primary, #1a5632);
}
.threed-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg, #f8fafc);
  display: flex;
  flex-direction: column;
}
.threed-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
}
.threed-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}
.threed-modal-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
}
.threed-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.threed-legend {
  position: absolute;
  bottom: 24px;
  left: 16px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  max-width: 260px;
  z-index: 10;
  pointer-events: auto;
}
[data-theme="dark"] .threed-modal {
  background: #0f172a;
}
[data-theme="dark"] .threed-modal-header {
  background: #1e293b;
  border-bottom-color: #334155;
}
[data-theme="dark"] .threed-legend {
  background: rgba(30, 41, 59, 0.92);
  color: #e2e8f0;
}
.threed-legend-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.82rem;
}
.threed-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.threed-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.threed-legend-conflict {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}
[data-theme="dark"] .threed-legend-conflict {
  border-top-color: #334155;
}

@media (max-width: 768px) {
  .zoning-3d-toggle {
    right: 10px;
    top: auto;
    bottom: 50px;
  }
  .threed-modal-controls {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
}

/* ================================================================
   Dashboard Widget Customisation
   ================================================================ */
.dash-customise-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.dash-custom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.dash-custom-panel {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.dash-custom-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}
.dash-custom-list {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-custom-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  cursor: grab;
  transition: box-shadow 0.12s, opacity 0.12s;
  user-select: none;
}
.dash-custom-item:active {
  cursor: grabbing;
}
.dash-custom-item.dragging {
  opacity: 0.5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.dash-custom-handle {
  color: var(--text-secondary, #94a3b8);
  font-size: 1rem;
  flex-shrink: 0;
  cursor: grab;
}
.dash-custom-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
}
.dash-custom-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.dash-custom-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
[data-theme="dark"] .dash-custom-panel {
  background: var(--card-bg, #1e1e2e);
}
[data-theme="dark"] .dash-custom-item {
  background: #2a2a3e;
  border-color: #3a3a58;
}
[data-theme="dark"] .dash-custom-handle {
  color: #64748b;
}

/* ══════════════════════════════════════════════════════════════════
   Ask AI — top-bar button + floating chat panel
   ══════════════════════════════════════════════════════════════════ */
.ask-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  margin-right: 0.5rem;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--primary, #1a5632);
  cursor: pointer;
  color: var(--primary, #1a5632);
  font: 600 0.82rem/1 inherit;
  letter-spacing: 0.02em;
  transition:
    background 0.15s,
    color 0.15s,
    box-shadow 0.15s,
    transform 0.1s;
}
.ask-ai-btn:hover {
  background: var(--green-light, #dcfce7);
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.2);
}
.ask-ai-btn:active {
  transform: translateY(1px);
}
.ask-ai-btn[aria-expanded="true"] {
  background: var(--primary, #1a5632);
  color: #fff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
}
.ask-ai-btn-icon {
  flex-shrink: 0;
  display: block;
}
.ask-ai-label {
  line-height: 1;
}
[data-theme="dark"] .ask-ai-btn {
  background: transparent;
}
@media (max-width: 600px) {
  .ask-ai-label {
    display: none;
  }
  .ask-ai-btn {
    padding: 6px;
    gap: 0;
  }
}

.ask-ai-panel {
  position: fixed !important;
  top: 64px;
  right: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  background: var(--white, #fff);
  color: var(--gray-800, #1f2937);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: top right;
}
.ask-ai-panel.open {
  display: flex;
  animation: askAiPop 0.18s ease;
}
@keyframes askAiPop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 520px) {
  .ask-ai-panel {
    right: 8px;
    left: 8px;
    width: auto;
  }
}

.ask-ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--primary, #1a5632);
  color: #fff;
  flex-shrink: 0;
}
.ask-ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.ask-ai-title-wrap h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}
.ask-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ask-ai-reset {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
}
.ask-ai-reset:hover {
  background: rgba(255, 255, 255, 0.18);
}
.ask-ai-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.ask-ai-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.ask-ai-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
  background: var(--gray-50, #f9fafb);
  color: var(--gray-800, #1f2937);
}
.ask-ai-welcome {
  background: var(--green-light, #dcfce7);
  border: 1px solid var(--green, #16a34a);
  border-radius: 10px;
  padding: 12px;
  color: var(--gray-800, #1f2937);
}
.ask-ai-welcome-title {
  display: block;
  margin-bottom: 4px;
  font: 700 0.72rem/1 inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary, #1a5632);
}
.ask-ai-welcome p {
  margin: 0 0 10px;
}
.ask-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ask-ai-suggestion {
  background: #fff;
  border: 1px solid var(--primary, #1a5632);
  color: var(--primary, #1a5632);
  padding: 5px 10px;
  border-radius: 999px;
  font: 500 0.78rem/1 inherit;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.ask-ai-suggestion:hover {
  background: var(--primary, #1a5632);
  color: #fff;
}

.ask-ai-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
}
.ask-ai-msg-label {
  display: block;
  font: 700 0.7rem/1 inherit;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 2px;
  opacity: 0.85;
}
.ask-ai-msg-user {
  align-self: flex-end;
  background: var(--primary, #1a5632);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ask-ai-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--gray-800, #1f2937);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-bottom-left-radius: 4px;
}
.ask-ai-msg-bot .ask-ai-msg-label {
  color: var(--primary, #1a5632);
}
.ask-ai-msg-error {
  align-self: flex-start;
  background: var(--red-light, #fef2f2);
  color: var(--red, #dc2626);
  border: 1px solid var(--red, #dc2626);
  border-bottom-left-radius: 4px;
  max-width: 92%;
}
.ask-ai-msg-notice {
  align-self: stretch;
  text-align: center;
  font-size: 0.72rem;
  color: var(--gray-500, #6b7280);
  background: transparent;
  padding: 2px 0;
}

.ask-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.ask-ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400, #9ca3af);
  animation: askAiTyping 1.2s infinite ease-in-out;
}
.ask-ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.ask-ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes askAiTyping {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.ask-ai-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  background: #fff;
  flex-shrink: 0;
}
.ask-ai-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--gray-300, #d1d5db);
  background: #fff;
  color: var(--gray-800, #1f2937);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.ask-ai-input::placeholder {
  color: var(--gray-400, #9ca3af);
}
.ask-ai-input:focus {
  border-color: var(--primary, #1a5632);
  box-shadow: 0 0 0 2px var(--green-light, #dcfce7);
}
.ask-ai-send {
  background: var(--primary, #1a5632);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.15s,
    transform 0.1s;
}
.ask-ai-send:hover:not(:disabled) {
  background: var(--primary-light, #2a7a4a);
}
.ask-ai-send:active:not(:disabled) {
  transform: scale(0.95);
}
.ask-ai-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .ask-ai-panel {
  background: var(--white, #1e1e36);
  border-color: var(--gray-300, #3a3a58);
}
[data-theme="dark"] .ask-ai-msg-bot {
  background: var(--gray-100, #16162a);
  border-color: var(--gray-300, #3a3a58);
  color: var(--gray-800, #e8e8f0);
}
[data-theme="dark"] .ask-ai-input {
  background: var(--gray-100, #16162a);
  color: var(--gray-800, #e8e8f0);
}
[data-theme="dark"] .ask-ai-input-row {
  background: var(--white, #1e1e36);
}
[data-theme="dark"] .ask-ai-msg-user {
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════════
   Objections Register polish
   ══════════════════════════════════════════════════════════════════ */
/* (1) Row hover — yellow tint for visibility in dark mode */
[data-theme="dark"] #objectionsTable tbody tr:hover,
[data-theme="dark"] .obj-row:hover,
[data-theme="dark"] .table tbody tr:hover {
  background: rgba(202, 138, 4, 0.22) !important;
  color: var(--gray-900, #f5f5fa) !important;
}
[data-theme="dark"] #objectionsTable tbody tr:hover a {
  color: var(--accent, #c8a415) !important;
}
[data-theme="dark"] #objectionsTable tbody tr:hover td {
  color: inherit !important;
}

/* (2) Sortable column headers + arrows */
#objectionsTable .sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  transition:
    background 0.12s,
    color 0.12s;
}
#objectionsTable .sortable-th:hover {
  background: var(--green-light, #dcfce7);
  color: var(--primary, #1a5632);
}
#objectionsTable .sortable-th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.45;
  min-width: 0.7em;
}
#objectionsTable .sortable-th.sorted .sort-arrow {
  opacity: 1;
}
#objectionsTable .sortable-th.sorted {
  color: var(--primary, #1a5632);
}
[data-theme="dark"] #objectionsTable .sortable-th:hover {
  background: rgba(202, 138, 4, 0.22);
  color: var(--accent, #c8a415);
}
[data-theme="dark"] #objectionsTable .sortable-th.sorted {
  color: var(--accent, #c8a415);
}
/* Render an empty arrow placeholder so the unsorted state hints at sortability */
#objectionsTable .sortable-th .sort-arrow:empty::before {
  content: "\2195"; /* ↕ */
  opacity: 0.35;
}
#objectionsTable .sortable-th.sorted .sort-arrow:empty::before {
  content: none;
}

/* (3) Quick-view side panel — dark/light mode aware */
.quick-view-panel {
  background: var(--white, #fff) !important;
  color: var(--gray-800, #1f2937);
  border-left: 1px solid var(--gray-200, #e5e7eb);
}
.quick-view-header {
  background: var(--gray-50, #f9fafb);
  border-bottom: 1px solid var(--gray-200, #e5e7eb) !important;
}
.quick-view-header h3 {
  color: var(--gray-900, #111827);
}
.quick-view-close {
  color: var(--gray-500, #6b7280);
}
.quick-view-close:hover {
  color: var(--primary, #1a5632);
}
.quick-view-body {
  background: var(--white, #fff);
  color: var(--gray-800, #1f2937);
}
.quick-view-footer {
  background: var(--gray-50, #f9fafb);
  border-top: 1px solid var(--gray-200, #e5e7eb) !important;
}
.qv-dl dt {
  color: var(--gray-500, #6b7280);
}
.qv-dl dd {
  color: var(--gray-800, #1f2937);
}
.qv-section {
  border-top: 1px solid var(--gray-200, #e5e7eb) !important;
}
.qv-section strong {
  color: var(--gray-500, #6b7280);
}
.qv-text {
  color: var(--gray-800, #1f2937);
}
.qv-text-muted {
  color: var(--gray-500, #6b7280);
}

[data-theme="dark"] .quick-view-panel {
  background: var(--white, #1e1e36) !important;
  color: var(--gray-800, #e8e8f0);
  border-left-color: var(--gray-300, #3a3a58);
  box-shadow: -6px 0 32px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .quick-view-header {
  background: var(--gray-100, #16162a);
  border-bottom-color: var(--gray-300, #3a3a58) !important;
}
[data-theme="dark"] .quick-view-header h3 {
  color: var(--gray-900, #f5f5fa);
}
[data-theme="dark"] .quick-view-close {
  color: var(--gray-500, #9a9ab0);
}
[data-theme="dark"] .quick-view-close:hover {
  color: var(--accent, #c8a415);
}
[data-theme="dark"] .quick-view-body {
  background: var(--white, #1e1e36);
  color: var(--gray-800, #e8e8f0);
}
[data-theme="dark"] .quick-view-footer {
  background: var(--gray-100, #16162a);
  border-top-color: var(--gray-300, #3a3a58) !important;
}
[data-theme="dark"] .qv-dl dt {
  color: var(--gray-500, #9a9ab0);
}
[data-theme="dark"] .qv-dl dd {
  color: var(--gray-800, #e8e8f0);
}
[data-theme="dark"] .qv-dl dd a {
  color: var(--accent, #c8a415);
}
[data-theme="dark"] .qv-section {
  border-top-color: var(--gray-300, #3a3a58) !important;
}
[data-theme="dark"] .qv-section strong {
  color: var(--gray-500, #9a9ab0);
}
[data-theme="dark"] .qv-text {
  color: var(--gray-800, #e8e8f0);
}
[data-theme="dark"] .qv-text-muted {
  color: var(--gray-500, #9a9ab0);
}
[data-theme="dark"] .quick-view-backdrop {
  background: rgba(0, 0, 0, 0.65);
}

/* ══════════════════════════════════════════════════════════════════
   Audit Log — advanced filters + export
   ══════════════════════════════════════════════════════════════════ */
.audit-adv-filters {
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.audit-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  align-items: flex-end;
}
.audit-filter-row .form-group {
  margin-bottom: 0;
  flex: 1 1 auto;
}
.audit-filter-row .form-group label {
  display: block;
  margin-bottom: 2px;
}
.form-control-sm {
  height: 32px;
  font-size: 0.82rem;
  padding: 2px 8px;
}
select.form-control-sm {
  padding: 2px 6px;
}
.audit-export-group .btn {
  white-space: nowrap;
}
[data-theme="dark"] .audit-adv-filters {
  background: var(--gray-100, #16162a);
  border-color: var(--gray-300, #3a3a58);
}

/* ══════════════════════════════════════════════════════════════════
   Site Status Report — form + dashboard summary
   ══════════════════════════════════════════════════════════════════ */
.ssr-fieldset {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  padding: 1rem 1rem 0.6rem;
  margin-bottom: 1rem;
  background: var(--white, #fff);
}
.ssr-legend {
  font: 700 0.82rem/1 inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary, #1a5632);
  padding: 0 6px;
}
.ssr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem 1rem;
}
.ssr-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.ssr-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}
.ssr-check input[type="checkbox"] {
  accent-color: var(--primary, #1a5632);
}
.ssr-legal-note {
  font-size: 0.8rem;
  color: var(--gray-500, #6b7280);
  background: var(--gray-50, #f9fafb);
  border-left: 3px solid var(--primary, #1a5632);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 0.8rem;
  line-height: 1.45;
}
.ssr-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ssr-photo-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--gray-200, #e5e7eb);
}
.req {
  color: var(--red, #dc2626);
}

/* Dark mode for SSR form */
[data-theme="dark"] .ssr-fieldset {
  background: var(--gray-100, #16162a);
  border-color: var(--gray-300, #3a3a58);
}
[data-theme="dark"] .ssr-legend {
  color: var(--accent, #c8a415);
}
[data-theme="dark"] .ssr-legal-note {
  background: rgba(200, 164, 21, 0.08);
  border-left-color: var(--accent, #c8a415);
  color: var(--gray-500, #9a9ab0);
}

/* ── Site Reports dashboard table ── */
.ssr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ssr-table th {
  background: var(--gray-50, #f9fafb);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--gray-200, #e5e7eb);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-500, #6b7280);
  white-space: nowrap;
}
.ssr-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
  vertical-align: top;
}
.ssr-table tbody tr:hover {
  background: var(--green-light, #dcfce7);
}
.ssr-table .ssr-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}
.ssr-table .ssr-actions button {
  font-size: 0.75rem;
  padding: 3px 8px;
}
[data-theme="dark"] .ssr-table th {
  background: var(--gray-100, #16162a);
  border-bottom-color: var(--gray-300, #3a3a58);
  color: var(--gray-500, #9a9ab0);
}
[data-theme="dark"] .ssr-table td {
  border-bottom-color: var(--gray-300, #3a3a58);
}
[data-theme="dark"] .ssr-table tbody tr:hover {
  background: rgba(202, 138, 4, 0.15);
}

/* ═══════════════════════════════════════════════════════════
   FIELD MODE — Dedicated PWA Inspection View
   Mobile-first, large touch targets (min 48px), offline-ready
   ═══════════════════════════════════════════════════════════ */

/* Container — full viewport feel */
.fm-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

/* Header bar */
.fm-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--primary, #1a5632);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  border-radius: 0 0 12px 12px;
}
.fm-back-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: background 0.15s;
}
.fm-back-btn:hover,
.fm-back-btn:active { background: rgba(255,255,255,0.15); }
.fm-title {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}
.fm-connectivity {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  padding: 6px 12px;
  border-radius: 20px;
}
.fm-conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.fm-conn-dot.offline {
  background: #ef4444;
  animation: fm-pulse 1.5s infinite;
}
@keyframes fm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Sync banner */
.fm-sync-banner {
  background: #fef3c7;
  color: #92400e;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #fcd34d;
}
.fm-sync-now-btn {
  background: #d97706;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}
.fm-sync-now-btn:active { transform: scale(0.96); }

/* Tabs */
.fm-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200, #e5e7eb);
  padding: 0 12px;
  background: var(--card-bg, #fff);
}
.fm-tab {
  flex: 1;
  padding: 14px 8px;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  text-align: center;
  color: var(--gray-400, #9ca3af);
  border-bottom: 3px solid transparent;
  min-height: 52px;
  transition: color 0.15s, border-color 0.15s;
}
.fm-tab.active {
  color: var(--primary, #1a5632);
  border-bottom-color: var(--primary, #1a5632);
}
.fm-tab:active { background: rgba(0,0,0,0.04); }

/* Panels */
.fm-panel {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Step indicator */
.fm-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
  padding: 8px 0;
}
.fm-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-400, #9ca3af);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.fm-step.active {
  background: var(--primary, #1a5632);
  color: #fff;
}
.fm-step.completed {
  background: #059669;
  color: #fff;
}
.fm-step-line {
  height: 3px;
  flex: 1;
  max-width: 40px;
  background: var(--gray-200, #e5e7eb);
  border-radius: 2px;
}

/* Fieldset */
.fm-fieldset {
  border: none;
  margin: 0;
  padding: 0;
}
.fm-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text, #111);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary, #1a5632);
}
.fm-legend-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #1a5632);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Fields — large touch targets */
.fm-field {
  margin-bottom: 18px;
}
.fm-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-600, #4b5563);
  margin-bottom: 6px;
}
.fm-label .req { color: #ef4444; }
.fm-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--gray-300, #d1d5db);
  border-radius: 12px;
  background: var(--card-bg, #fff);
  color: var(--text, #111);
  transition: border-color 0.15s;
  min-height: 52px;
  -webkit-appearance: none;
  appearance: none;
}
.fm-input:focus {
  outline: none;
  border-color: var(--primary, #1a5632);
  box-shadow: 0 0 0 3px rgba(26,86,50,0.15);
}
.fm-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}
select.fm-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
}
.fm-hint {
  font-size: 0.82rem;
  color: var(--gray-400, #9ca3af);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Voice input wrapper */
.fm-voice-wrap {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.fm-voice-wrap .fm-input { flex: 1; }
.fm-voice-btn {
  min-width: 52px;
  min-height: 52px;
  border: 2px solid var(--gray-300, #d1d5db);
  border-radius: 12px;
  background: var(--card-bg, #fff);
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.fm-voice-btn:active,
.fm-voice-btn.listening {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.fm-voice-btn.listening {
  animation: fm-pulse 1s infinite;
}
.fm-voice-btn-textarea {
  align-self: flex-start;
  margin-top: 0;
}

/* GPS row */
.fm-gps-row {
  display: flex;
  gap: 8px;
}
.fm-gps-row .fm-input { flex: 1; }
.fm-btn-gps {
  min-width: 80px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 52px;
}
.fm-btn-gps:active { transform: scale(0.96); background: #1d4ed8; }
.fm-btn-gps.capturing { animation: fm-pulse 1s infinite; }
.fm-gps-accuracy {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--gray-400, #9ca3af);
}

/* Photo section */
.fm-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.fm-photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--gray-200, #e5e7eb);
}
.fm-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fm-photo-thumb .fm-photo-geo {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.62rem;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.fm-photo-thumb .fm-photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239,68,68,0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fm-photo-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.fm-btn-camera,
.fm-btn-gallery {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 14px;
  cursor: pointer;
  min-height: 60px;
  transition: transform 0.1s;
}
.fm-btn-camera {
  background: var(--primary, #1a5632);
  color: #fff;
  border: none;
}
.fm-btn-gallery {
  background: var(--card-bg, #fff);
  color: var(--primary, #1a5632);
  border: 2px solid var(--primary, #1a5632);
}
.fm-btn-camera:active,
.fm-btn-gallery:active { transform: scale(0.96); }

/* Navigation row */
.fm-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
}
.fm-submit-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  flex-wrap: wrap;
}

/* Buttons */
.fm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  min-height: 52px;
  transition: all 0.15s;
  border: none;
  background: none;
  color: var(--text, #111);
}
.fm-btn:active { transform: scale(0.96); }

.fm-btn-next {
  background: var(--primary, #1a5632);
  color: #fff;
  margin-left: auto;
}
.fm-btn-prev {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
}
.fm-btn-draft {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
  flex: 1;
}
.fm-btn-submit {
  background: var(--primary, #1a5632);
  color: #fff;
  flex: 2;
}
.fm-btn-next:active,
.fm-btn-submit:active { background: #0f3d22; }

/* Draft / Submitted list items */
.fm-list { display: flex; flex-direction: column; gap: 10px; }
.fm-list-item {
  background: var(--card-bg, #fff);
  border: 2px solid var(--gray-200, #e5e7eb);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}
.fm-list-item:active { border-color: var(--primary, #1a5632); }
.fm-list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.fm-list-item-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text, #111);
}
.fm-list-item-meta {
  font-size: 0.82rem;
  color: var(--gray-400, #9ca3af);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.fm-list-item-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.fm-list-item-badge.draft {
  background: #fef3c7;
  color: #92400e;
}
.fm-list-item-badge.submitted {
  background: #d1fae5;
  color: #065f46;
}
.fm-list-item-badge.synced {
  background: #dbeafe;
  color: #1e40af;
}
.fm-list-item-badge.pending-sync {
  background: #fecaca;
  color: #991b1b;
}
.fm-list-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fm-list-btn {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid var(--gray-300, #d1d5db);
  border-radius: 10px;
  background: var(--card-bg, #fff);
  color: var(--text, #111);
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fm-list-btn:active { background: var(--gray-100, #f3f4f6); }
.fm-list-btn.primary {
  background: var(--primary, #1a5632);
  color: #fff;
  border-color: var(--primary, #1a5632);
}
.fm-list-btn.danger {
  color: #dc2626;
  border-color: #fca5a5;
}

.fm-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--gray-400, #9ca3af);
  font-size: 0.95rem;
}

/* Voice recording indicator (floating) */
.fm-voice-indicator {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #fff;
  padding: 12px 28px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
  z-index: 100;
  animation: fm-pulse 1.2s infinite;
}
.fm-voice-indicator::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
}

/* ── Field Mode Dark Mode ── */
[data-theme="dark"] .fm-header {
  background: #0f3d22;
}
[data-theme="dark"] .fm-input {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--gray-300, #3a3a58);
  color: var(--text, #e5e5e5);
}
[data-theme="dark"] .fm-input:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}
[data-theme="dark"] .fm-voice-btn {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--gray-300, #3a3a58);
  color: var(--gray-400, #9a9ab0);
}
[data-theme="dark"] .fm-btn-gps { background: #1d4ed8; }
[data-theme="dark"] .fm-btn-prev { background: var(--gray-100, #16162a); }
[data-theme="dark"] .fm-btn-draft { background: var(--gray-100, #16162a); }
[data-theme="dark"] .fm-sync-banner {
  background: #451a03;
  color: #fcd34d;
  border-bottom-color: #78350f;
}
[data-theme="dark"] .fm-sync-now-btn { background: #b45309; }
[data-theme="dark"] .fm-tabs {
  background: var(--card-bg, #1e1e2e);
  border-bottom-color: var(--gray-300, #3a3a58);
}
[data-theme="dark"] .fm-tab { color: var(--gray-400, #9a9ab0); }
[data-theme="dark"] .fm-tab.active { color: #22c55e; border-bottom-color: #22c55e; }
[data-theme="dark"] .fm-list-item {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--gray-300, #3a3a58);
}
[data-theme="dark"] .fm-list-btn {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--gray-300, #3a3a58);
  color: var(--text, #e5e5e5);
}
[data-theme="dark"] .fm-legend { color: var(--text, #e5e5e5); }
[data-theme="dark"] .fm-photo-thumb { border-color: var(--gray-300, #3a3a58); }
[data-theme="dark"] .fm-btn-gallery {
  background: var(--card-bg, #1e1e2e);
  color: #22c55e;
  border-color: #22c55e;
}
[data-theme="dark"] select.fm-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239a9ab0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ── Print-specific styles for SSR PDF generation ── */
@media print {
  .ssr-print-report { font-family: "Times New Roman", serif; color: #000; }
  .ssr-print-report .ssr-print-header { text-align: center; margin-bottom: 1.5rem; }
  .ssr-print-report .ssr-print-logo { height: 60px; margin-bottom: 6px; }
  .ssr-print-report .ssr-print-county { font-size: 14pt; font-weight: bold; text-transform: uppercase; }
  .ssr-print-report .ssr-print-dept { font-size: 11pt; font-weight: bold; }
  .ssr-print-report .ssr-print-office { font-size: 10pt; color: #444; }
  .ssr-print-report .ssr-print-title { font-size: 13pt; font-weight: bold; text-align: center; text-decoration: underline; margin: 1rem 0; }
  .ssr-print-report .ssr-print-section { margin-bottom: 0.8rem; }
  .ssr-print-report .ssr-print-section h4 { font-size: 10pt; font-weight: bold; text-transform: uppercase; border-bottom: 1px solid #999; padding-bottom: 2px; margin-bottom: 6px; }
  .ssr-print-report .ssr-print-dl { display: grid; grid-template-columns: 160px 1fr; gap: 2px 8px; font-size: 10pt; }
  .ssr-print-report .ssr-print-dl dt { font-weight: bold; }
  .ssr-print-report .ssr-print-dl dd { margin: 0; }
  .ssr-print-report .ssr-print-text { font-size: 10pt; white-space: pre-wrap; margin: 4px 0; }
  .ssr-print-report .ssr-print-photos { display: flex; flex-wrap: wrap; gap: 8px; }
  .ssr-print-report .ssr-print-photos img { max-width: 200px; max-height: 160px; border: 1px solid #ccc; }
  .ssr-print-report .ssr-print-sig { margin-top: 2rem; font-size: 10pt; }
  .ssr-print-report .ssr-print-sig .sig-line { border-bottom: 1px solid #000; width: 250px; display: inline-block; margin-bottom: 4px; }
}
