/* assets/css/mobile.css - DBC Monitoring Mobile UI */
:root {
  --primary-blue: #1b3b80;
  --secondary-blue: #2563eb;
  --accent-blue: #0284c7;
  --header-bg: #e2f0fb;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --input-bg: #f8fafc;
  --success-green: #16a34a;
  --danger-red: #dc2626;
  --card-bg: #ffffff;
  --card-radius: 14px;
  --btn-radius: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-dark);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* Mobile Container */
.mobile-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: #ffffff;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Header Styles - Matching Page 1 */
.login-header-banner {
  background: linear-gradient(180deg, #cce4f7 0%, #e8f4fc 100%);
  position: relative;
  padding: 24px 16px 16px;
  text-align: center;
  overflow: hidden;
}

.login-header-banner::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-image: radial-gradient(circle at 10px 10px, rgba(27, 59, 128, 0.1) 2px, transparent 0);
  background-size: 20px 20px;
  opacity: 0.6;
  pointer-events: none;
}

.login-title {
  color: #103b7e;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
}

.login-emblem-wrap {
  width: 86px;
  height: 86px;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px;
}

.login-emblem-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sub-header-bar {
  background-color: #12377b;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  letter-spacing: 0.2px;
}

/* Login Card */
.login-body {
  padding: 24px 20px;
  flex: 1;
}

.login-card {
  border: 1px solid #e2e8f0;
  border-radius: var(--card-radius);
  padding: 24px 18px;
  box-shadow: var(--shadow);
  background: #ffffff;
}

.login-card-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 22px;
}

/* Input Fields */
.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.input-icon svg {
  width: 18px;
  height: 18px;
}

.input-field {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid #cbd5e1;
  border-radius: var(--btn-radius);
  font-size: 14px;
  color: #1e293b;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-field:focus {
  border-color: var(--secondary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #64748b;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: #1f64e2;
  color: #ffffff;
  border: none;
  border-radius: var(--btn-radius);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:active {
  background: #1852bd;
  transform: scale(0.98);
}

.btn-success {
  background: #22c55e;
  color: #ffffff;
  border: none;
  border-radius: var(--btn-radius);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.btn-success:active {
  background: #16a34a;
}

.btn-sm-add {
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.login-links-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 10px;
}

.link-registration,
.link-forgot {
  font-size: 13px;
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.link-forgot {
  color: #2563eb;
  text-align: right;
}

.link-registration:hover,
.link-forgot:hover {
  text-decoration: underline;
  color: #1e40af;
}

.verified-user-badge {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.verified-user-badge strong {
  color: #14532d;
}

.btn-change-user {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-otp-action {
  background: #1f64e2;
  color: #ffffff;
  border: none;
  border-radius: var(--btn-radius);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  min-width: 90px;
}

.btn-otp-action:hover {
  background: #1852bd;
}

.btn-otp-action:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Footer Banner - Matching Page 1 */
.login-footer-banner {
  background-color: #12377b;
  color: #ffffff;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-footer-banner img {
  height: 18px;
  vertical-align: middle;
}

/* App Header for Internal Pages (Map, Form) */
.app-topbar {
  background-color: #12377b;
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-topbar .left-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.app-topbar .left-brand img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
}

/* Ward & Segment Selector Dropdowns */
.ward-selector-btn, .segment-selector-btn {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.ward-selector-btn:hover, .segment-selector-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ward-dropdown-menu, .segment-dropdown-menu {
  position: absolute;
  top: 38px;
  right: 0;
  left: auto;
  min-width: 140px;
  max-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  color: #1e293b;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
  z-index: 1500;
  display: none;
  padding: 4px 0;
}

.ward-dropdown-menu.show, .segment-dropdown-menu.show {
  display: block;
}

.ward-dropdown-item {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f8fafc;
}

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

.ward-dropdown-item:hover, .ward-dropdown-item.active {
  background-color: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.ward-dropdown-item input[type="radio"] {
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0;
}

/* Map Screen - Matching Page 2 */
#map-container {
  width: 100%;
  height: calc(100vh - 105px);
  min-height: 480px;
  position: relative;
  background: #cbd5e1;
}

/* Map Popups */
.leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.map-popup-card {
  padding: 6px;
  text-align: center;
  min-width: 170px;
}

.map-popup-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.map-popup-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 8px;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-completed {
  background: #dcfce7;
  color: #166534;
}

.map-popup-btn,
.leaflet-container .leaflet-popup-content a.map-popup-btn {
  display: block;
  background: #1f64e2;
  color: #ffffff !important;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  text-align: center;
  cursor: pointer;
  letter-spacing: 0.2px;
}

.map-popup-btn:hover,
.leaflet-container .leaflet-popup-content a.map-popup-btn:hover {
  background: #1852bd;
  color: #ffffff !important;
}

/* Completed Polygon Checkmark Badge (Page 2) */
.completed-polygon-marker-icon {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.completed-check-badge {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  background: #16a34a;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.completed-check-badge.badge-green {
  background: #16a34a !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45) !important;
}

.completed-check-badge.badge-red {
  background: #dc2626 !important; /* Red for Door Lock */
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.5), 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.completed-check-badge.badge-yellow {
  background: #eab308 !important; /* Yellow for Pending Portion Entry */
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.55), 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.completed-check-badge svg {
  display: block;
}

.completed-check-badge:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

/* View Only Mode for Completed Survey */
.survey-view-only-mode input:not([type="button"]):not([type="submit"]),
.survey-view-only-mode select:not(#portion_floor),
.survey-view-only-mode textarea {
  pointer-events: none !important;
  background-color: #f8fafc !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
  cursor: default !important;
}

.survey-view-only-mode input[type="radio"],
.survey-view-only-mode input[type="checkbox"] {
  pointer-events: none !important;
  cursor: default !important;
}

.survey-view-only-mode .camera-circle-btn,
.survey-view-only-mode .photo-remove-btn {
  display: none !important;
}

.survey-view-only-mode .camera-label {
  pointer-events: none !important;
  cursor: default !important;
  color: #166534 !important;
  font-weight: 600 !important;
}

.survey-view-only-mode #portion_count {
  pointer-events: none !important;
  background: #f1f5f9 !important;
}

/* Form Screen - Matching Page 3 */
.survey-page-body {
  padding: 14px 16px 80px;
  background: #ffffff;
  flex: 1;
}

/* Camera Circular Button (Reduced Compact Size) */
.camera-box-wrap {
  text-align: center;
  margin: 8px 0 12px;
}

.camera-circle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #16a34a;
  background: #ffffff;
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #16a34a;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.2);
  transition: transform 0.15s, background 0.15s;
  padding: 0;
  outline: none;
}

.camera-circle-btn:active {
  transform: scale(0.92);
  background: #f0fdf4;
}

.camera-circle-btn svg {
  width: 26px;
  height: 26px;
}

.camera-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 4px 10px;
  display: inline-block;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.photo-preview-box {
  position: relative;
  max-width: 200px;
  margin: 10px auto;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #16a34a;
  display: none;
}

.photo-preview-box img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.photo-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(220, 38, 38, 0.85);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
}

/* ========================================================
   Fast Camera Fullscreen Viewfinder Modal (Matching UI)
   ======================================================== */
.fast-camera-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000000;
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.fast-cam-topbar {
  height: 52px;
  background: #0b1120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fast-cam-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.fast-cam-title svg {
  color: #ef4444;
}

.fast-cam-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.fast-cam-close-btn:active {
  background: #475569;
}

.fast-cam-viewfinder {
  flex: 1;
  position: relative;
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fast-cam-viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fast-cam-guide-box {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 18px;
  right: 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  pointer-events: none;
}

.fast-cam-center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.fast-cam-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease-out;
  z-index: 5;
}

.fast-cam-bottombar {
  height: 96px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 24px;
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fast-cam-btn-native,
.fast-cam-btn-flip {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  min-width: 50px;
  padding: 0;
}

.fast-cam-btn-native span {
  color: #94a3b8;
}

.fast-cam-btn-native:active,
.fast-cam-btn-flip:active {
  transform: scale(0.92);
}

.fast-cam-shutter-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3.5px solid #ffffff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
}

.fast-cam-shutter-btn:active {
  transform: scale(0.92);
}

.fast-cam-shutter-inner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

/* Form Controls */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 5px;
}

.form-label span.req {
  color: #dc2626;
}

.form-select, .form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #1e293b;
  background-color: #ffffff;
  outline: none;
}

.form-select:focus, .form-control:focus {
  border-color: #2563eb;
}

.form-readonly {
  background-color: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 4px 0;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: #2563eb;
}

/* Building Details Section - Matching Page 3 */
.section-divider {
  border-top: 2px solid #22c55e;
  margin: 18px 0 14px;
}

.section-header-title {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 14px;
}

/* Building Details 2-Column Top Grid (Matching Page 3 Screenshot) */
/* Green Divider Bar matching screenshot */
.green-divider-bar {
  height: 3px;
  background: #16a34a;
  border-radius: 2px;
  margin: 10px 0 14px 0;
}

/* Building Details 2-Column Top Grid (Matching Mobile Screenshot) */
.building-details-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  align-items: start;
}

.detail-label-blue {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #103b7e;
  margin-bottom: 5px;
}

.detail-label-blue span.req {
  color: #dc2626;
}

/* Status Card */
.status-card-box {
  background: #ffffff;
  border: 1.5px solid #86efac;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.status-card-header {
  background-color: #16a34a;
  color: #ffffff;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px 8px 0 0;
  letter-spacing: 0.3px;
}

.status-card-table-wrap {
  max-height: 140px;
  overflow-y: auto;
}

.status-summary-table-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
}

.status-summary-table-mini th {
  padding: 5px 4px;
  color: #1e293b;
  font-weight: 700;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.status-summary-table-mini td {
  padding: 6px 4px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}

.status-summary-table-mini tr:last-child td {
  border-bottom: none;
}

.status-fl-val {
  color: #1d4ed8;
  font-weight: 700;
  font-size: 12px;
}

.status-num-val {
  color: #1d4ed8;
  font-weight: 700;
  font-size: 13px;
}

.status-text-pending {
  color: #dc2626;
  font-weight: 700;
  font-size: 12px;
}

.status-text-completed {
  color: #16a34a;
  font-weight: 700;
  font-size: 12px;
}

.status-row-active {
  background-color: #eff6ff !important;
}

.status-row:hover {
  background-color: #f8fafc;
}

/* Portions Collapse / Expand Controls Bar (Centered) */
.portion-controls-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 14px 0 12px 0;
  font-size: 13px;
}

.portion-controls-btn {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
}

/* Portion Card Box (Matching Mobile Design Screenshot) */
.portion-card-box {
  background: #f8fbff;
  border: 1.5px solid #60a5fa;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}

.portion-card-header {
  background: #ffffff;
  padding: 10px 14px 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}

.portion-title-text {
  font-weight: 800;
  font-size: 15px;
  color: #103b7e;
}

.portion-sub-text {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-top: 2px;
}

.portion-header-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
}

.portion-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
}

.portion-status-badge.badge-pending {
  background: #fef3c7;
  color: #d97706;
}

.portion-status-badge.badge-completed {
  background: #dcfce7;
  color: #16a34a;
}

.portion-status-badge.badge-doorlock {
  background: #fee2e2;
  color: #dc2626;
}

/* Dedicated Door Lock Row */
.portion-doorlock-row {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 9px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.door-lock-label {
  font-size: 13px;
  font-weight: 800;
  color: #103b7e;
  white-space: nowrap;
}

.door-lock-options {
  display: flex;
  gap: 14px;
  align-items: center;
}

.door-lock-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  margin: 0;
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
}

.door-lock-radio-label input[type="radio"] {
  cursor: pointer;
  accent-color: #2563eb;
  margin: 0;
  width: 16px;
  height: 16px;
}

.door-lock-notice {
  background: #fef2f2;
  border: 1px dashed #f87171;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portion-body-locked {
  background: #f8fafc;
  opacity: 0.75;
}

.toggle-arrow-icon {
  transition: transform 0.2s ease;
}

.toggle-arrow-icon.expanded {
  transform: rotate(180deg);
}

.portion-card-body {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

/* Step 2 Bottom Navigation Buttons */
.step2-footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 30px;
}

.btn-step-prev {
  flex: 1;
  background: #475569;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.15s;
}

.btn-step-prev:hover {
  background: #334155;
}

.btn-step-submit {
  flex: 1.25;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
  transition: background 0.15s;
}

.btn-step-submit:hover {
  background: #15803d;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.portion-controls-btn:hover {
  background: #eff6ff;
}

/* Portions List Chips */
.portion-card-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.portion-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
}

/* Bottom Nav Bar */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 50px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 3px 6px;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  gap: 2px;
  flex: 1;
  padding: 3px 6px;
  border-radius: 10px;
  transition: all 0.15s ease;
}

.bottom-nav-link.active {
  background: #e0edff;
  color: #1d4ed8;
  font-weight: 700;
}

.bottom-nav-link:hover:not(.active) {
  color: #1e293b;
}

.bottom-nav-link svg {
  width: 18px;
  height: 18px;
}

/* Toasts and Alerts */
.toast-msg {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2000;
  display: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { top: -40px; opacity: 0; }
  to { top: 20px; opacity: 1; }
}

/* Grid layout for 2-column on mobile */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.portion-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}

.portion-fields-grid .form-group {
  margin-bottom: 0;
}

/* Hidden elements */
.d-none {
  display: none !important;
}

/* Floating Drawing Tool Bar */
.drawing-toolbar-floating {
  position: absolute;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 30px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  max-width: 92%;
  animation: slideDown 0.25s ease;
}

.drawing-toolbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.drawing-pulse-dot {
  width: 9px;
  height: 9px;
  background: #ef4444;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
  animation: pulseDot 1.4s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.drawing-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-draw-action {
  border: none;
  border-radius: 16px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-draw-undo {
  background: #f1f5f9;
  color: #334155;
}

.btn-draw-done {
  background: #16a34a;
  color: #ffffff;
}

.btn-draw-done:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.btn-draw-cancel {
  background: #fee2e2;
  color: #dc2626;
  width: 26px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Modal for New Building Polygon */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card-custom {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 20px 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Building Usage Map Legend */
.map-usage-legend-box {
  position: absolute;
  bottom: 24px;
  right: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  z-index: 1000;
  max-width: 270px;
  width: calc(100% - 24px);
  max-height: 310px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 11px;
  animation: popIn 0.2s ease;
}

.legend-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.legend-items-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.legend-item-row:hover {
  background: #f1f5f9;
}

.legend-item-row.active-filter {
  background: #e2e8f0;
  font-weight: 700;
}

.legend-chip {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 7px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.legend-label-wrap {
  display: flex;
  align-items: center;
  flex: 1;
}

.legend-count-badge {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 10px;
}

/* =========================================================
   Mobile GIS Map Page Layout (Page 2 Responsive Upgrade)
   ========================================================= */
body.map-page-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: #0f387d;
}

.mobile-wrapper.map-screen-wrapper {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
  padding-bottom: 50px; /* space for fixed bottom nav bar */
}

/* App Header Topbar */
.app-topbar {
  background-color: #0f387d;
  color: #ffffff;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-topbar .left-brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-topbar .left-brand img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  padding: 1.5px;
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.topbar-brand-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.topbar-brand-sub {
  font-size: 9.5px;
  color: #bfdbfe;
  font-weight: 500;
  line-height: 1.1;
}

.topbar-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ward-badge-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.segment-badge-pill {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 3px 8px;
  border-radius: 16px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* 3-Card Summary Stats Bar */
.map-stats-summary-bar {
  background: #eef5fc;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.map-stat-card {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border-radius: 9px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
}

.map-stat-icon {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.map-stat-icon svg {
  width: 13px;
  height: 13px;
}

.stat-icon-blue {
  background: #0284c7;
}

.stat-icon-green {
  background: #10b981;
}

.stat-icon-red {
  background: #ef4444;
}

.map-stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.map-stat-label {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.1;
  white-space: nowrap;
}

.map-stat-value {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.stat-val-pending {
  color: #dc2626;
}

/* Action Toolbar (Legend, Streets, Draw, GPS, Sat) */
.map-action-toolbar {
  background: #ffffff;
  padding: 4px 6px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.btn-map-action {
  border: none;
  border-radius: 6px;
  padding: 5px 2px;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  white-space: nowrap;
  min-width: 0;
}

.btn-map-action svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.btn-map-action span {
  white-space: nowrap;
}

.btn-map-action:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.btn-action-legend {
  background: #4f46e5;
}

.btn-action-streets {
  background: #2563eb;
}

.btn-action-draw {
  background: #ea580c;
}

.btn-action-gps {
  background: #10b981;
}

.btn-action-sat {
  background: #0284c7;
}

@media (max-width: 375px) {
  .map-action-toolbar {
    padding: 4px 3px;
    gap: 3px;
  }
  .btn-map-action {
    font-size: 9px;
    padding: 5px 1px;
    gap: 1.5px;
  }
  .btn-map-action svg {
    width: 10px;
    height: 10px;
  }
}

/* Map Viewport Area */
.map-viewport-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #cbd5e1;
}

.map-viewport-wrapper #map-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 0;
}

.map-viewport-wrapper .drawing-toolbar-floating {
  top: 10px;
}

/* Compact Leaflet Zoom Controls */
.map-viewport-wrapper .leaflet-bar a {
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
  font-size: 14px !important;
}

/* Custom Leaflet Locate Control */
.leaflet-control-custom-locate {
  background-color: #ffffff;
  width: 28px;
  height: 28px;
  line-height: 28px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: #1e293b;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}

.leaflet-control-custom-locate svg {
  width: 14px;
  height: 14px;
}

.leaflet-control-custom-locate:hover {
  background-color: #f8fafc;
}

/* High-Precision GPS Pulsing Marker */
.gps-custom-icon {
  background: transparent !important;
  border: none !important;
}

.gps-pulse-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.gps-pulse-wrapper:active {
  cursor: grabbing;
}

.gps-pulse-dot {
  width: 14px;
  height: 14px;
  background-color: #2563eb;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 5px;
  left: 5px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.gps-pulse-ring {
  width: 24px;
  height: 24px;
  background-color: rgba(37, 99, 235, 0.35);
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  animation: gpsPulseAnimation 2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  z-index: 1;
}

@keyframes gpsPulseAnimation {
  0% {
    transform: scale(0.6);
    opacity: 0.95;
  }
  70% {
    transform: scale(1.9);
    opacity: 0.1;
  }
  100% {
    transform: scale(2.3);
    opacity: 0;
  }
}


