/* =========================================================
   Anusri Homes — Design tokens
   Palette: deep forest green (brand/nav), warm off-white (canvas),
            muted sage (secondary text/borders), amber-gold (one accent,
            used sparingly for primary actions), and the three plot-status
            colours which are functional, not decorative.
   Type: Poppins for headings/brand (a little architectural confidence),
         Inter for UI/body copy and data (quiet, legible at small sizes).
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --green-900: #14301F;
  --green-800: #1B4332;
  --green-700: #235A42;
  --green-600: #2F6B4F;
  --green-500: #3F8863;
  --sage-400: #6B8F7A;
  --sage-200: #C6D8CC;
  --sage-100: #E3EEE7;
  --canvas: #F6F5EF;
  --card: #FFFFFF;
  --ink: #1F2A24;
  --ink-soft: #4C5A52;
  --gold: #C9A227;
  --gold-dark: #A6841B;

  --available: #2E7D32;
  --available-bg: #E4F3E6;
  --hold: #E07B00;
  --hold-bg: #FDEBD5;
  --sold: #C0392B;
  --sold-bg: #FBE0DD;

  --radius: 12px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(20, 48, 31, 0.08);
  --shadow-md: 0 8px 24px rgba(20, 48, 31, 0.12);
  --sidebar-w: 236px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: 'Poppins', 'Inter', sans-serif;
  color: var(--green-900);
  margin: 0 0 4px;
}

a {
  color: var(--green-700);
  text-decoration: none;
}

p {
  color: var(--ink-soft);
  line-height: 1.5;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: currentColor;
  vertical-align: -0.15em;
}

.lightbox-camera-icon {
  color: var(--gold);
}

.project-amenities {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--green-500);
  border-left: 4px solid var(--green-700);
  border-radius: var(--radius-sm);
  background: var(--sage-100);
  box-shadow: var(--shadow-sm);
}

.project-amenities>strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-900);
  font-size: 13px;
  font-family: 'Poppins', 'Inter', sans-serif;
}

.project-amenities-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--green-900);
}

.project-amenities-list li {
  padding-left: 2px;
  overflow-wrap: anywhere;
}

.project-amenities-list li::marker {
  color: var(--gold);
}

input,
select,
textarea {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

button,
.btn,
.icon-btn,
.nav-link,
.tag-select button {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease, filter 0.2s ease;
  will-change: transform, box-shadow;
  border-radius: 5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 5px !important;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(20, 48, 31, 0.1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1.5px);
  filter: brightness(1.07);
  box-shadow: 0 5px 15px rgba(27, 67, 50, 0.2);
}

.btn:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-primary {
  background: linear-gradient(135deg, #1B4332 0%, #14301F 100%);
  color: #ffffff;
  border: 1px solid #0f2518;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #235A42 0%, #1B4332 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(27, 67, 50, 0.3);
}

.btn-gold {
  background: linear-gradient(135deg, #D4AF37 0%, #C9A227 100%);
  color: #211b04;
  border: 1px solid #a6841b;
}

.btn-gold:hover {
  background: linear-gradient(135deg, #E6C244 0%, #D4AF37 100%);
  color: #151102;
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.38);
}

.btn-outline {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAF8 100%);
  border: 1px solid var(--sage-200);
  color: var(--green-800);
}

.btn-outline:hover {
  background: linear-gradient(180deg, #F0F6F2 0%, #E3EEE7 100%);
  border-color: var(--sage-400);
  color: var(--green-900);
  box-shadow: 0 4px 14px rgba(27, 67, 50, 0.14);
}

.btn-danger {
  background: linear-gradient(135deg, #D32F2F 0%, #C0392B 100%);
  color: #ffffff;
  border: 1px solid #96271b;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #E53935 0%, #D32F2F 100%);
  box-shadow: 0 6px 18px rgba(192, 57, 43, 0.35);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px !important;
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F7F4 100%);
  border: 1px solid var(--sage-200);
  color: var(--green-800);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  text-decoration: none;
  height: 30px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-back:hover {
  background: linear-gradient(180deg, #E8F0EA 0%, #D9E7DC 100%);
  border-color: var(--sage-400);
  color: var(--green-900);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(27, 67, 50, 0.12);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 5px !important;
}

.btn-block {
  width: 100%;
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 5px !important;
  border: 1px solid var(--sage-200);
  background: linear-gradient(180deg, #FFFFFF 0%, #F6F9F7 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--green-800);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.icon-btn:hover {
  background: linear-gradient(180deg, #EBF3ED 0%, #DFEBE1 100%);
  border-color: var(--sage-400);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  color: var(--green-900);
}

.icon-btn:active {
  transform: translateY(0) scale(0.94);
}

/* ---------- Login page ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--green-900);
}

.auth-visual {
  background:
    linear-gradient(160deg, rgba(20, 48, 31, .92), rgba(27, 67, 50, .85)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  color: #EFEFE7;
}

.auth-visual .plot-chip {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  margin-bottom: 26px;
  width: fit-content;
}

.auth-visual h1 {
  color: #fff;
  font-size: 34px;
  max-width: 460px;
  line-height: 1.25;
}

.auth-visual p {
  color: #C9D8CE;
  max-width: 420px;
}

.auth-visual .legend-row {
  display: flex;
  gap: 22px;
  margin-top: 40px;
}

.auth-visual .legend-row span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #DCE7DF;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.dot.available {
  background: #4CAF50;
}

.dot.hold {
  background: #F0A93B;
}

.dot.sold {
  background: #E0685D;
}

.auth-panel {
  background: var(--canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
}

.auth-card .logo {
  margin-bottom: 28px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green-600);
}

/* ---------- Custom Styled Select Dropdowns ---------- */
select {
  text-align: left !important;
  text-align-last: left !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #ffffff;
  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='%25232d6a4f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding: 9px 36px 9px 14px !important;
  border: 1px solid var(--sage-200);
  border-radius: 6px !important;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  color: var(--green-900);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

select option {
  text-align: left !important;
  padding: 8px 12px;
}

select:hover {
  border-color: var(--sage-400);
  background-color: #fbfdfc;
}

select:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.16);
  outline: none;
}

.field-hint {
  font-size: 12px;
  color: var(--sage-400);
  margin-top: 4px;
}

.role-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--sage-100);
  padding: 4px;
  border-radius: 5px;
}

.role-toggle button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: 5px !important;
  font-weight: 600;
  font-size: 13px;
  color: var(--green-800);
}

.role-toggle button.active {
  background: var(--green-800);
  color: #fff;
}

.error-banner {
  background: var(--sold-bg);
  color: #8E241A;
  border: 1px solid #F3C4BE;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.success-banner {
  background: var(--available-bg);
  color: #1E5A22;
  border: 1px solid #B9E0BC;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--canvas);
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  max-width: var(--sidebar-w);
  background: var(--green-900);
  color: #E7EFE9;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  flex-shrink: 0;
  align-self: stretch;
  z-index: 100;
}

.sidebar .logo-wrap,
.sidebar .sidebar-brand {
  display: none !important;
}

.sidebar nav {
  flex: 1;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group {
  margin-bottom: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #CBDBD0;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.nav-link.active {
  background: var(--green-700);
  color: #fff;
}

.mobile-header-brand {
  display: flex;
  align-items: center;
}

.mobile-header-brand img.topbar-logo {
  height: 38px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

.mobile-header-brand .topbar-title {
  display: none !important;
}

.mobile-app-header {
  display: none;
}

.admin-menu-toggle {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: var(--green-900);
  z-index: 10;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  font-size: 13.5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-footer .nav-link {
  padding: 8px 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold);
  color: #2A2205;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 60px;
  width: 100%;
  box-sizing: border-box;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--green-800);
  color: #ffffff !important;
  border: 1px solid var(--green-900);
  cursor: pointer;
  transition: all .18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  text-decoration: none;
}

.btn-back:hover {
  background: var(--green-900);
  transform: scale(1.06);
  color: #ffffff !important;
}

.btn-back svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-title-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.page-title {
  font-size: 22px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--green-900);
  margin: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-sub {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--sage-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar h2 {
  font-size: 22px;
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sidebar-logo {
  padding: 6px 10px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.sidebar-logo img {
  height: 38px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
  display: block;
}

.main>.card+.card:not(.stat-card) {
  margin-top: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--sage-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  box-sizing: border-box;
}

.grid {
  display: grid;
  gap: 18px;
  align-items: stretch;
  width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
}

.two-column-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 20px;
  align-items: start;
  width: 100%;
}

@media (max-width: 980px) {
  .two-column-layout {
    grid-template-columns: 1fr;
  }
}

.grid>.card,
.grid-2>.card,
.grid-3>.card,
.grid-4>.card,
#projectGrid>.project-card {
  margin-top: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

@media (max-width: 980px) {

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Stat Cards Base Layout */
#statCards,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: stretch;
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
}

#statCards .card,
#statCards .stat-card {
  margin-top: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--sage-200);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-height: 90px;
}

#statCards .stat-label {
  font-size: 11.5px;
  color: var(--sage-400);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

#statCards .stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  line-height: 1.1;
}

#statCards .stat-card.available .stat-value {
  color: var(--available);
}

#statCards .stat-card.hold .stat-value {
  color: var(--hold);
}

#statCards .stat-card.sold .stat-value {
  color: var(--sold);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge.available {
  background: var(--available-bg);
  color: var(--available);
}

.badge.hold {
  background: var(--hold-bg);
  color: var(--hold);
}

.badge.sold {
  background: var(--sold-bg);
  color: var(--sold);
}

.badge.canceled,
.badge.cancelled {
  background: #f1f3f4;
  color: #5f6368;
}

/* ---------- Project cards (Equal Size Alignment) ---------- */
#projectGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: stretch;
  gap: 20px;
  width: 100%;
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 290px;
  justify-content: space-between;
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
  border: 1px solid var(--sage-200);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  box-sizing: border-box;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--sage-400);
}

.project-card .thumb {
  height: 160px;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--sage-100) center/cover no-repeat;
  background-image:
    repeating-linear-gradient(0deg, rgba(27, 67, 50, .06) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, rgba(27, 67, 50, .06) 0 1px, transparent 1px 18px);
}

.project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.project-card h3 {
  font-size: 16.5px;
  margin: 12px 0 4px;
  color: var(--green-900);
  font-weight: 700;
  line-height: 1.3;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.project-card .loc {
  font-size: 13px;
  color: var(--sage-400);
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
}

.project-mini-stats {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--sage-100);
}

.project-mini-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- Themed File Upload Selector Button & Input ---------- */
input[type="file"] {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F7F4 100%);
  border: 1px solid var(--sage-200);
  color: var(--green-800);
  font-weight: 600;
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 5px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: linear-gradient(180deg, #E8F0EA 0%, #D9E7DC 100%);
  border-color: var(--sage-400);
  color: var(--green-900);
  box-shadow: 0 3px 8px rgba(27, 67, 50, 0.12);
  transform: translateY(-1px);
}

input[type="file"]::file-selector-button:active,
input[type="file"]::-webkit-file-upload-button:active {
  transform: translateY(0) scale(0.97);
}

/* ---------- Interactive Dropzone Upload UI & Upload Buttons ---------- */
.file-dropzone {
  border: 2px dashed #2d6a4f;
  background: #f3f8f5;
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.file-dropzone:hover,
.file-dropzone.dragover {
  background: #e8f3ed;
  border-color: #1b4332;
  transform: scale(1.01);
}

.file-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.dropzone-icon {
  font-size: 32px;
  margin-bottom: 6px;
  color: #1b4332;
}

.dropzone-title {
  font-weight: 700;
  color: #1b4332;
  font-size: 14px;
  margin-bottom: 3px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--sage-400);
}

.file-preview-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #b7e4c7;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #1b4332;
  margin-top: 8px;
}

.btn-upload,
button.btn-upload,
.dropzone-btn {
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%) !important;
  color: #ffffff !important;
  border: 1px solid #14301f !important;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(27, 67, 50, 0.2);
}

.btn-upload:hover,
button.btn-upload:hover,
.dropzone-btn:hover {
  background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(27, 67, 50, 0.3);
  transform: translateY(-1px);
}

/* ---------- Save & Submit Form Buttons ---------- */
.btn-save,
button.btn-save,
form button[type="submit"].btn-primary,
form .btn-primary {
  background: linear-gradient(135deg, #1B4332 0%, #14301F 100%);
  color: #ffffff;
  border: 1px solid #0f2518;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 6px !important;
  box-shadow: 0 3px 8px rgba(27, 67, 50, 0.2);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s ease;
}

.btn-save:hover,
button.btn-save:hover,
form button[type="submit"].btn-primary:hover,
form .btn-primary:hover {
  background: linear-gradient(135deg, #235A42 0%, #1B4332 100%);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(27, 67, 50, 0.32);
  transform: translateY(-1.5px);
  filter: brightness(1.07);
}

.btn-save:active,
button.btn-save:active,
form button[type="submit"].btn-primary:active,
form .btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ---------- Sidebar backdrop & Avatar image ---------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 95;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-user .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.sidebar-user .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Table ---------- */
/* ---------- Data Tables & Reference Table Design ---------- */
.table-card-container {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(20, 48, 31, 0.06);
  border: 1px solid var(--sage-200);
}

.summary-pills-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.summary-pill.total {
  background: #f3e8ff;
  color: #581c87;
  border: 1px solid #e9d5ff;
}

.summary-pill.available {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}

.summary-pill.hold {
  background: #fef7e0;
  color: #b06000;
  border: 1px solid #feefc3;
}

.summary-pill.sold {
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #fad2cf;
}

.summary-pill.info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.table-search-bar {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.table-search-bar input {
  width: 100%;
  padding: 11px 16px 11px 40px !important;
  border: 1px solid var(--sage-200);
  border-radius: 8px;
  font-size: 14px;
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}

.table-search-bar input:focus {
  border-color: #2d6a4f;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.16);
  outline: none;
}

.table-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sage-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.table-search-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--sage-400);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Green Theme Data Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 0;
}

.data-table thead tr {
  background: #f0f5f2 !important;
  border-bottom: 2px solid var(--sage-200);
}

.data-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--green-900) !important;
  padding: 13px 14px;
  border: none;
  border-bottom: 2px solid var(--sage-200) !important;
  white-space: nowrap;
}

.data-table th[data-sort] {
  cursor: pointer !important;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.data-table th[data-sort]:hover {
  background-color: #e8f3ed !important;
}

.data-table th[data-sort].active-sort {
  color: var(--green-900) !important;
  border-bottom: 2px solid var(--green-800) !important;
}

.data-table th .sort-icon {
  display: inline-block;
  font-size: 10px;
  margin-left: 4px;
  color: var(--green-800);
}

.data-table th:first-child {
  border-top-left-radius: 8px;
}

.data-table th:last-child {
  border-top-right-radius: 8px;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2ece9;
  color: var(--ink);
  vertical-align: middle;
}

.data-table tr.master-row {
  transition: background .15s ease;
  cursor: pointer;
}

.data-table tr.master-row:hover td {
  background: #f0f7f4;
}

.data-table tr.master-row.expanded td {
  background: #e8f5e9 !important;
  font-weight: 600;
}

.expand-toggle-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #95d5b2;
  background: #ffffff;
  color: #1b4332;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  padding: 0;
  line-height: 1;
}

.expand-toggle-btn:hover {
  background: #1b4332;
  color: #ffffff;
  border-color: #1b4332;
}

.expand-toggle-btn.expanded {
  background: #1b4332;
  color: #ffffff;
}

tr.detail-row td {
  padding: 0 !important;
  background: #f4f9f5 !important;
  border-bottom: 2px solid #b7e4c7;
  white-space: normal !important;
  max-width: 100%;
  text-align: left !important;
}

.detail-row-container,
.detail-row-container * {
  text-align: left !important;
}

.detail-row-container {
  padding: 16px 18px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  white-space: normal !important;
  animation: fadeIn .22s ease-in-out;
  text-align: left !important;
}

/* Responsive Filter Bar & Search Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 16px;
}

.filter-bar .field {
  flex: 1;
  min-width: 180px;
  margin: 0;
}

.table-search-bar {
  position: relative;
  width: 100%;
  flex: 2;
  min-width: 240px;
  margin-bottom: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid var(--sage-200);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 620px;
}

.data-table th,
.data-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 11px 12px;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 14px !important;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 18px !important;
  text-align: right !important;
}

@media (max-width: 768px) {
  .table-search-bar {
    min-width: 100%;
  }

  .filter-bar .field {
    min-width: 100%;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 12.5px;
  }

  .detail-meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px 14px;
  }
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 20px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left !important;
}

.detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: left !important;
  align-items: flex-start !important;
}

.detail-meta-item label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--sage-400);
  text-align: left !important;
}

.detail-meta-item span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  white-space: normal !important;
  text-align: left !important;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-pill.available {
  background: #e6f4ea;
  color: #137333;
}

.badge-pill.hold {
  background: #fef7e0;
  color: #b06000;
}

.badge-pill.sold {
  background: #fce8e6;
  color: #c5221f;
}

.badge-pill.canceled,
.badge-pill.cancelled {
  background: #f1f3f4;
  color: #5f6368;
  border: 1px solid #dadce0;
}

/* Summary Pills Bar */
.summary-pills-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.summary-pill.total {
  background: #f0f4f1;
  color: var(--green-900);
  border: 1px solid var(--sage-200);
}

.summary-pill.sold {
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #f8c4c0;
}

.summary-pill.hold {
  background: #fef7e0;
  color: #b06000;
  border: 1px solid #f6e3b4;
}

.summary-pill.available {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}

.btn-cyan {
  background: #0284c7;
  color: #fff;
  border: 1px solid #0369a1;
}

.btn-cyan:hover {
  background: #0369a1;
  color: #fff;
}

.btn-green-action {
  background: #16a34a;
  color: #fff;
  border: 1px solid #15803d;
}

.btn-green-action:hover {
  background: #15803d;
  color: #fff;
}

.btn-red-action {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
}

.btn-red-action:hover {
  background: #b91c1c;
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

/* ---------- Map / plot canvas ---------- */
.map-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: auto;
  border: 1px solid var(--sage-200);
  background: var(--sage-100);
  background-image:
    linear-gradient(rgba(27, 67, 50, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 67, 50, .07) 1px, transparent 1px);
  background-size: 24px 24px;
}

.map-wrap img.map-img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.map-wrap.zoom-active {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 64px 18px 24px;
  border: none;
  border-radius: 0;
  background: rgba(8, 20, 15, .86);
  background-image: none;
  touch-action: none;
  cursor: zoom-in;
}

.map-wrap.zoom-active .map-canvas {
  margin: 0 auto;
  min-width: 0;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

body:has(#mapWrap.zoom-active) .map-zoom-controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 1002;
  transform: translateX(-50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

.map-zoom-mode-indicator {
  display: none;
  position: sticky;
  top: 10px;
  left: 10px;
  z-index: 12;
  width: max-content;
  max-width: calc(100% - 20px);
  margin: 10px;
  padding: 7px 12px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  background: var(--green-900);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(20, 48, 31, .25);
  pointer-events: none;
}

.map-wrap.zoom-active .map-zoom-mode-indicator {
  display: block;
}

.map-canvas {
  position: relative;
  min-width: 100%;
}

.map-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  background: var(--sage-100);
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-sm);
}

.map-zoom-controls .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-zoom-controls .icon-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.map-zoom-exit {
  color: var(--sold);
  border-color: var(--sold-bg);
}

.map-zoom-exit[hidden] {
  display: none !important;
}

.map-zoom-exit:not([hidden]) {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  width: 42px;
  height: 42px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--sold);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(20, 48, 31, .35);
}

.map-zoom-exit:hover {
  background: var(--sold-bg);
  color: var(--sold);
}

.map-zoom-controls span {
  min-width: 42px;
  text-align: center;
  color: var(--green-800);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.map-zoom-controls span:hover {
  text-decoration: underline;
  color: var(--gold-dark);
}

.btn-edit-layout {
  background: linear-gradient(135deg, var(--gold), #e6b844);
  color: #2a2205;
  border-color: #b78919;
  box-shadow: 0 4px 12px rgba(201, 162, 39, .25);
}

.btn-edit-layout:hover {
  background: linear-gradient(135deg, #e6b844, var(--gold));
  transform: translateY(-1px);
}

.btn-grid-gen {
  background: #f0fdf4;
  color: var(--green-900);
  border-color: var(--green-700);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(46, 125, 50, .12);
}

.btn-grid-gen:hover,
.btn-grid-gen.active {
  background: var(--green-800);
  color: #fff;
  border-color: var(--green-900);
  transform: translateY(-1px);
}

.btn-mass-delete {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fff;
  font-weight: 600;
}

.btn-mass-delete:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
  transform: translateY(-1px);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #b91c1c;
  font-weight: 600;
}

.btn-danger:hover {
  background: #b91c1c;
  color: #fff;
  border-color: #991b1b;
  transform: translateY(-1px);
}

.batch-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  flex-wrap: wrap;
  gap: 10px;
  animation: slideDown 0.2s ease-out;
}

.batch-action-bar .batch-info {
  font-size: 14px;
  font-weight: 600;
}

.batch-action-bar .batch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-action-bar .btn-outline {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  background: transparent;
}

.batch-action-bar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.plot-box {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transition: filter .12s ease, transform .1s ease;
}

.plot-box:hover {
  filter: brightness(1.08);
  transform: scale(1.02);
  z-index: 5;
}

.plot-box.available {
  background: rgba(46, 125, 50, .78);
}

.plot-box.hold {
  background: rgba(224, 123, 0, .82);
}

.plot-box.sold {
  background: rgba(192, 57, 43, .82);
}

.plot-box.drawing {
  border-style: dashed;
  background: rgba(201, 162, 39, .35);
  border-color: var(--gold);
}

.btn-xs {
  padding: 2px 7px;
  font-size: 11px;
  min-height: 24px;
  line-height: 1.2;
  font-weight: 600;
}

.plot-box.grid-selection-box {
  border: 2px dashed #0284c7;
  background: rgba(14, 165, 233, 0.2);
  z-index: 10;
  pointer-events: none;
}

.plot-box.grid-preview {
  border: 2px dashed #15803d;
  background: rgba(34, 197, 94, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  z-index: 9;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.1s ease, background 0.15s ease;
  user-select: none;
}

.plot-box.grid-preview:hover {
  filter: brightness(1.15);
  transform: scale(1.03);
  z-index: 11;
}

.plot-box.grid-preview.skipped {
  border: 2px dashed #94a3b8;
  background: rgba(148, 163, 184, 0.35);
  color: #64748b;
  text-decoration: line-through;
  opacity: 0.65;
}

.plot-box.grid-preview.skipped:hover {
  opacity: 0.9;
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

/* Precision Cursor Magnifier Loupe */
.map-magnifier {
  position: absolute;
  width: 150px;
  height: 175px;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
  transition: opacity 0.12s ease;
  user-select: none;
}

.map-magnifier-lens {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid var(--green-900);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), inset 0 0 14px rgba(0, 0, 0, 0.3);
  background-repeat: no-repeat;
  background-color: #ffffff;
  position: relative;
  overflow: hidden;
}

.map-magnifier-reticle {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-magnifier-reticle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(220, 38, 38, 0.85);
  box-shadow: 0 0 2px #fff;
}

.map-magnifier-reticle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(220, 38, 38, 0.85);
  box-shadow: 0 0 2px #fff;
}

.map-magnifier-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #dc2626;
  border: 1.5px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.map-magnifier-badge {
  margin-top: 5px;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.25);
  letter-spacing: 0.3px;
}

.btn-magnifier-toggle.active {
  background: #f0fdf4;
  border-color: var(--green-700);
  color: var(--green-900);
  font-weight: 600;
}

/* Docked Side Panel Drawers (Grid Gen, Edit Layout, Plot Detail) */
.side-drawer,
.grid-gen-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  background: #ffffff;
  z-index: 1050;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
  border-left: 1px solid var(--sage-200);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.side-drawer.open,
.grid-gen-drawer.open {
  transform: translateX(0);
}

.side-drawer-header,
.grid-gen-drawer-header {
  padding: 14px 18px;
  background: var(--green-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.side-drawer-header h3,
.grid-gen-drawer-header h3 {
  margin: 0;
  font-size: 15px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-drawer-header button,
.grid-gen-drawer-header button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s ease;
}

.side-drawer-header button:hover,
.grid-gen-drawer-header button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.side-drawer-body,
.grid-gen-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  background: #ffffff;
}

.side-drawer-footer,
.grid-gen-drawer-footer {
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--sage-200);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .side-drawer,
  .grid-gen-drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

.dir-badge-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dir-badge-grid button {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--sage-200);
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.dir-badge-grid button:hover {
  background: #e2e8f0;
  border-color: var(--sage-300);
}

.dir-badge-grid button.active {
  background: var(--green-900);
  border-color: var(--green-900);
  color: #fff;
  font-weight: 600;
}

.dir-flow-diagram {
  background: #f4fbf7;
  border: 1px solid #ccebd7;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-900);
  line-height: 1.45;
  margin-top: 6px;
  white-space: pre-line;
}

.plot-box.shape-circle,
.plot-box.shape-ellipse {
  border-radius: 50%;
}

.plot-box.shape-triangle {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.plot-box.shape-diamond {
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.plot-box.shape-polygon {
  border-radius: 0;
}

.polygon-point {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.shape-picker {
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.shape-picker select {
  min-height: 34px;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  padding: 5px 8px;
}

.four-directions {
  grid-template-columns: 1fr 1fr;
}

.report-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  display: block;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.map-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
}

.map-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.map-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--sage-400);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(20, 48, 31, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"],
.modal-overlay.hidden,
.modal-overlay[hidden] {
  display: none !important;
}

#plotModal {
  z-index: 100001 !important;
}

#statusModal,
#massDeleteModal,
#imageLightboxModal {
  z-index: 100005 !important;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 100000;
  box-sizing: border-box;
}

.modal.modal-wide {
  max-width: 760px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header button {
  width: 38px;
  height: 38px;
  border: 2px solid var(--green-800);
  border-radius: 5px !important;
  background: #fff;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  color: var(--green-900);
}

.modal-header button:hover {
  background: var(--green-800);
  color: #fff;
}

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

@media (max-width: 560px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ---------- Detail drawer bits ---------- */
.kv-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--sage-200);
  font-size: 13.5px;
  width: 100%;
}

.kv-row span:first-child {
  color: var(--sage-400);
  font-weight: 500;
  flex-shrink: 0;
}

.kv-row span:last-child {
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sage-400);
  font-weight: 700;
  margin: 18px 0 8px;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--sage-100);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 6px;
}

.doc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.contact-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.contact-row .btn {
  flex: 1;
}

/* ---------- Notifications list ---------- */
.notif-item {
  padding: 14px;
  border-bottom: 1px solid var(--sage-100);
}

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

.notif-item .meta {
  font-size: 12px;
  color: var(--sage-400);
  margin-top: 4px;
}

.recipient-preview {
  background: var(--sage-100);
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: -4px 0 16px;
  font-size: 12px;
  color: var(--ink-soft);
}

.recipient-preview strong {
  display: block;
  color: var(--green-800);
  margin-bottom: 3px;
}

.recipient-preview span {
  display: block;
  line-height: 1.45;
}

/* ---------- Misc ---------- */
.tag-select button {
  padding: 7px 15px;
  border-radius: 5px !important;
  border: 1px solid var(--sage-200);
  background: linear-gradient(180deg, #FFFFFF 0%, #F9FBF9 100%);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tag-select button:hover {
  transform: translateY(-1px);
  border-color: var(--sage-400);
  background: var(--sage-100);
  color: var(--green-900);
}

.tag-select button.active {
  background: linear-gradient(135deg, #1B4332 0%, #14301F 100%);
  border-color: #0f2518;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(27, 67, 50, 0.28);
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--sage-400);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--sage-200);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green-900);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  z-index: 9999;
}

.toast.error {
  background: var(--sold);
}

.small-muted {
  font-size: 12px;
  color: var(--sage-400);
}

.locked-note {
  font-size: 12px;
  color: var(--sage-400);
  margin-top: 10px;
  text-align: center;
}

/* ---------- Tablet ---------- */
@media (max-width: 860px) {
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    height: 100vh;
    width: min(300px, 85vw);
    padding-top: 72px;
    transform: translateX(-105%);
    transition: transform .2s ease;
    overflow-y: auto;
  }

  .sidebar.menu-open {
    transform: translateX(0);
    box-shadow: 20px 0 50px rgba(20, 48, 31, .3);
  }

  .sidebar-footer {
    display: block;
  }

  .mobile-app-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 110;
    height: 62px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--sage-200);
    box-shadow: var(--shadow-sm);
  }

  .mobile-app-header strong {
    color: var(--green-900);
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: 17px;
  }

  .mobile-app-header .admin-menu-toggle {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 7px 11px;
    border: 1px solid var(--sage-200);
    border-radius: var(--radius-sm);
    background: var(--green-800);
    color: #fff;
    font-weight: 700;
    box-shadow: none;
  }

  .main {
    padding: 82px 18px 40px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  #statCards,
  .stat-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-auto-rows: 1fr !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  #statCards .stat-card,
  .stat-grid .stat-card {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 60px !important;
    padding: 10px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 2px !important;
    border-radius: var(--radius-sm) !important;
  }

  #statCards .stat-card .stat-label,
  .stat-grid .stat-card .stat-label {
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: .02em !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  #statCards .stat-card .stat-value,
  .stat-grid .stat-card .stat-value {
    font-size: 19px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
  }

  .card {
    padding: 16px;
  }

  .topbar {
    gap: 10px;
  }

  .topbar h2 {
    font-size: 19px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1;
  }

  /* Buttons/inputs sized for comfortable tapping (Apple/Google HIG: 44px min) */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .btn-sm {
    min-height: 38px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    padding: 12px 13px;
    font-size: 16px;
  }

  /* 16px prevents iOS auto-zoom-on-focus */

  /* Data tables don't fit phone widths — turn each row into a stacked card instead of a horizontal-scroll table. */
  .table-wrap {
    overflow-x: auto !important;
    max-width: 100%;
  }

  table.data-table.stack-on-mobile,
  table.data-table.stack-on-mobile tbody,
  table.data-table.stack-on-mobile tr,
  table.data-table.stack-on-mobile td {
    display: block;
    width: 100%;
  }

  table.data-table.stack-on-mobile thead {
    display: none;
  }

  table.data-table.stack-on-mobile tr {
    border: 1px solid var(--sage-100);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 4px 0;
  }

  table.data-table.stack-on-mobile td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px dashed #F0EFE7;
    padding: 9px 12px;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  table.data-table.stack-on-mobile td:last-child {
    border-bottom: none;
  }

  table.data-table.stack-on-mobile td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--sage-400);
    text-align: left;
    flex-shrink: 0;
  }

  table.data-table.stack-on-mobile td[colspan],
  table.data-table.stack-on-mobile tr.table-empty-row td,
  table.data-table.stack-on-mobile tr.table-loading-row td {
    display: block !important;
    text-align: center !important;
    justify-content: center !important;
    border-bottom: none !important;
  }

  table.data-table.stack-on-mobile td[colspan]::before,
  table.data-table.stack-on-mobile tr.table-empty-row td::before,
  table.data-table.stack-on-mobile tr.table-loading-row td::before {
    display: none !important;
    content: none !important;
  }

  .modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;
    padding: 16px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .modal {
    width: 100% !important;
    max-width: 540px !important;
    max-height: 88vh !important;
    border-radius: var(--radius-sm) !important;
    padding: 22px !important;
    box-sizing: border-box !important;
    margin: auto !important;
    position: relative !important;
    z-index: 100000 !important;
  }

  .modal.modal-wide {
    max-width: 720px !important;
  }

  .contact-row {
    flex-direction: column;
  }

  .map-toolbar {
    gap: 8px;
  }

  .map-zoom-controls {
    order: 3;
  }

  .shape-picker {
    width: 100%;
    justify-content: space-between;
  }

  .shape-picker select {
    flex: 1;
    max-width: 210px;
  }

  .map-legend {
    gap: 10px 16px;
  }

  .auth-panel {
    padding: 20px;
  }

  .auth-card .logo img {
    width: 150px;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    text-align: center;
  }

  .four-directions {
    grid-template-columns: 1fr;
  }
}

/* ---------- Customer workspace ---------- */
.filter-bar {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.customer-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.customer-row-card {
  background: #fff;
  border: 1px solid var(--sage-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.customer-row-card:hover {
  border-color: var(--sage-400);
}

.customer-row-card.expanded {
  border-color: var(--green-700);
  box-shadow: var(--shadow-md);
}

.customer-row-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  background: #fff;
  transition: background .15s ease;
}

.customer-row-card.expanded .customer-row-header {
  background: var(--sage-100);
  border-bottom: 1px solid var(--sage-200);
}

.customer-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.customer-row-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-row-name-group strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--green-900);
}

.customer-row-sub {
  font-size: 13px;
  color: var(--ink-soft);
}

.customer-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-expand-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.customer-row-details {
  animation: fadeIn .2s ease;
}

.customer-details-inner {
  padding: 18px;
  background: #FAFCFA;
  border-top: 1px solid var(--sage-100);
}

.btn-call {
  background: var(--green-800);
  color: #fff;
  border: 1px solid var(--green-900);
}

.btn-call:hover {
  background: var(--green-900);
  color: #fff;
}

.btn-wa {
  background: #25D366;
  color: #fff;
  border: 1px solid #1EBE57;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.btn-wa:hover {
  background: #1EBE57;
  color: #fff;
}

.btn-call.btn-icon-only,
.btn-wa.btn-icon-only,
.btn-wa-group.btn-icon-only {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 2px;
}

.btn-call.btn-icon-only:hover,
.btn-wa.btn-icon-only:hover,
.btn-wa-group.btn-icon-only:hover {
  transform: translateY(-1.5px) scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.btn-call.btn-icon-only svg,
.btn-wa.btn-icon-only svg,
.btn-wa-group.btn-icon-only svg {
  margin: 0 !important;
  width: 14px !important;
  height: 14px !important;
}

.customer-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.customer-actions .btn-icon-only {
  flex: 0 0 30px;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  align-self: center;
}

.btn-wa-group {
  background: #075E54;
  color: #fff;
  border: 1px solid #054840;
}

.btn-wa-group:hover {
  background: #128C7E;
  color: #fff;
}

.customer-detail {
  min-height: 360px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.deal-card {
  border: 1px solid var(--sage-100);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #fff;
  margin-bottom: 10px;
}

.deal-card h4 {
  font-size: 15px;
  margin-bottom: 8px;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .customer-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .action-row .btn {
    flex: 1;
  }
}

/* ---------- Text Size Scaling ---------- */
html[data-text-size="small"] body,
html[data-text-size="small"] .data-table,
html[data-text-size="small"] .data-table th,
html[data-text-size="small"] .data-table td,
html[data-text-size="small"] .nav-link,
html[data-text-size="small"] .btn,
html[data-text-size="small"] .field input,
html[data-text-size="small"] .field select,
html[data-text-size="small"] .field textarea,
html[data-text-size="small"] .detail-meta-item span,
html[data-text-size="small"] .card {
  font-size: 12px !important;
}

html[data-text-size="small"] .page-title {
  font-size: 19px !important;
}

html[data-text-size="medium"] body {
  font-size: 14px;
}

html[data-text-size="large"] body,
html[data-text-size="large"] .data-table,
html[data-text-size="large"] .data-table th,
html[data-text-size="large"] .data-table td,
html[data-text-size="large"] .nav-link,
html[data-text-size="large"] .btn,
html[data-text-size="large"] .field input,
html[data-text-size="large"] .field select,
html[data-text-size="large"] .field textarea,
html[data-text-size="large"] .detail-meta-item span,
html[data-text-size="large"] .card {
  font-size: 15.5px !important;
}

html[data-text-size="large"] .page-title {
  font-size: 25px !important;
}

html[data-text-size="xlarge"] body,
html[data-text-size="xlarge"] .data-table,
html[data-text-size="xlarge"] .data-table th,
html[data-text-size="xlarge"] .data-table td,
html[data-text-size="xlarge"] .nav-link,
html[data-text-size="xlarge"] .btn,
html[data-text-size="xlarge"] .field input,
html[data-text-size="xlarge"] .field select,
html[data-text-size="xlarge"] .field textarea,
html[data-text-size="xlarge"] .detail-meta-item span,
html[data-text-size="xlarge"] .card {
  font-size: 18px !important;
}

html[data-text-size="xlarge"] .page-title {
  font-size: 28px !important;
}

/* Map/plot canvas: touch panning/drawing shouldn't also scroll the page underneath it. */
@media (max-width: 860px) {
  .map-wrap {
    touch-action: pan-y;
  }

  .map-wrap.drawing-active {
    touch-action: none;
  }

  .plot-box {
    min-width: 22px;
    min-height: 22px;
  }
}

/* ---------- Site Photos Gallery & Single-Image Showcase ---------- */
.photo-gallery-wrap {
  margin-top: 24px;
}

.photo-gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.gallery-scroll-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sage-100);
  color: var(--green-900);
  border: 1.5px solid var(--sage-200);
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}

.icon-btn-sm:hover {
  background: var(--green-800);
  color: #ffffff;
  border-color: var(--green-800);
  transform: scale(1.05);
}

.site-photo-grid {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 16px;
  overflow: hidden;
  background: #0f241a;
  border: 1.5px solid var(--sage-200);
  box-shadow: 0 4px 18px rgba(10, 25, 18, 0.08);
  box-sizing: border-box;
  outline: none;
}

.site-photo-grid:focus-visible {
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.35);
}

.site-showcase-container {
  position: relative;
  width: 100%;
  height: 380px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-showcase-track {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.site-showcase-slide {
  flex: 0 0 100%;
  min-width: 100%;
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: #0d1e17;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-showcase-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  transition: transform 0.35s ease;
}

.site-showcase-slide:hover img {
  transform: scale(1.02);
}

.site-showcase-overlay {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(10, 25, 18, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  z-index: 4;
}

.site-showcase-caption-text {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.site-showcase-counter {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold, #d4af37);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.showcase-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(10, 25, 18, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  font-size: 24px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  z-index: 6;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.showcase-nav-arrow:hover {
  background: var(--green-800);
  border-color: var(--gold, #d4af37);
  transform: translateY(-50%) scale(1.1);
  color: #ffffff;
}

.showcase-nav-arrow.prev {
  left: 14px;
}

.showcase-nav-arrow.next {
  right: 14px;
}

.showcase-dots {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 5;
  background: rgba(10, 25, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.showcase-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.25s ease;
}

.showcase-dot:hover {
  background: rgba(255, 255, 255, 0.85);
}

.showcase-dot.active {
  width: 22px;
  background: var(--gold, #d4af37);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.showcase-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--sage-100);
  border-top: 1px solid var(--sage-200);
}

.showcase-control-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--green-900);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--green-800) 0%, var(--green-900) 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(20, 48, 31, 0.16);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.showcase-control-btn:hover {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-800) 100%);
  border-color: var(--gold);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(20, 48, 31, 0.22);
}

.showcase-control-btn:active {
  transform: translateY(0) scale(0.97);
}

.showcase-control-btn:focus-visible,
.lightbox-arrow-btn:focus-visible,
.lightbox-popup-header button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.showcase-position {
  min-width: 58px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.project-description-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.project-description-list li {
  position: relative;
  padding-left: 18px;
}

.project-description-list li::before {
  content: '';
  position: absolute;
  top: 0.7em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.project-description-empty {
  margin: 12px 0 0;
}

.project-amenities {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--green-500);
  border-left: 4px solid var(--green-700);
  border-radius: var(--radius-sm);
  background: var(--sage-100);
  box-shadow: var(--shadow-sm);
}

.project-amenities>strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-900);
  font-size: 13px;
  font-family: 'Poppins', 'Inter', sans-serif;
}

.project-amenities-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--green-900);
}

.project-amenities-list li {
  padding-left: 2px;
  overflow-wrap: anywhere;
}

.project-amenities-list li::marker {
  color: var(--gold);
}

.description-points-editor {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.description-point-row {
  position: relative;
}

.description-point-input {
  width: 100%;
  padding-right: 44px !important;
}

.description-remove-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  border-radius: 50% !important;
  color: var(--green-900);
  font-size: 12px;
  line-height: 1;
  transform: translateY(-50%);
}

.description-remove-btn:hover {
  background: var(--sold-bg);
  border-color: var(--sold);
  color: var(--sold);
  transform: translateY(-50%);
}

.description-add-btn {
  margin-top: 10px;
}

@media (max-width: 860px) {
  .site-showcase-container {
    height: clamp(220px, 55vw, 320px) !important;
  }

  .lightbox-stage {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    column-gap: 8px;
    padding: 10px;
    min-height: 220px;
  }

  .lightbox-arrow-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 24px !important;
  }
}

@media (max-width: 600px) {
  .modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99999 !important;
    padding: 12px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  .modal,
  .modal.modal-wide {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    padding: 16px !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
    margin: auto !important;
    position: relative !important;
    z-index: 100000 !important;
  }

  .description-point-row {
    min-height: 44px;
  }

  .description-remove-btn {
    right: 8px;
  }

  .lightbox-popup-card {
    width: 100%;
    max-height: 92vh;
  }

  .lightbox-popup-header {
    padding: 10px 12px;
  }

  .lightbox-stage {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    column-gap: 4px;
    min-height: 190px;
    padding: 8px 6px;
  }

  .lightbox-arrow-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 21px !important;
  }
}

.photo-delete-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.9);
  color: #ffffff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
  z-index: 5;
}

.photo-delete-badge:hover {
  background: #dc2626;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.5);
}

@media (max-width: 768px) {
  .site-showcase-container {
    height: 290px;
  }

  .showcase-nav-arrow {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .showcase-nav-arrow.prev {
    left: 8px;
  }

  .showcase-nav-arrow.next {
    right: 8px;
  }

  .site-showcase-overlay {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 10px;
  }

  .showcase-dots {
    bottom: 50px;
  }

  .showcase-control-btn span {
    display: none;
  }
}

@media (max-width: 480px) {
  .site-showcase-container {
    height: 230px;
  }
}

@media (max-width: 860px) {
  table.data-table.stack-on-mobile {
    min-width: 0;
  }

  table.data-table.stack-on-mobile td {
    white-space: normal;
  }
}

@media (max-width: 1100px) {
  .salespeople-main .two-column-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Premium Lightbox Image Popup Modal ---------- */
#lightboxModal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(8, 18, 13, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.lightbox-popup-card {
  position: relative;
  background: #0d1e17;
  border: 1.5px solid var(--sage-300);
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.6);
  max-width: 1080px;
  width: 95vw;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.lightbox-popup-header {
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
  color: #ffffff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f0a93b;
  flex-shrink: 0;
}

.lightbox-popup-header h3 {
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-popup-header button {
  width: 34px;
  height: 34px;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.lightbox-popup-header button:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}

.lightbox-stage {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  column-gap: 14px;
  align-items: center;
  justify-content: center;
  background: #08140f;
  padding: 16px;
  flex: 1;
  min-height: 280px;
  max-height: 64vh;
  overflow: hidden;
  touch-action: pan-y;
  box-sizing: border-box;
}

.lightbox-img-wrap {
  grid-column: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  position: relative;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lightbox-arrow-btn {
  position: static !important;
  transform: none !important;
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  background: var(--green-800) !important;
  color: #ffffff !important;
  border: 2px solid var(--gold) !important;
  font-size: 28px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding-bottom: 3px !important;
  cursor: pointer !important;
  z-index: 20 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 12px rgba(201, 162, 39, 0.3) !important;
}

.lightbox-arrow-btn.prev {
  grid-column: 1;
}

.lightbox-arrow-btn.next {
  grid-column: 3;
}

.lightbox-arrow-btn:hover {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
  color: var(--green-900) !important;
  border-color: #ffffff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 8px 26px rgba(201, 162, 39, 0.55) !important;
}

/* Scaled down preview images strip BELOW the current viewing image */
.lightbox-thumb-strip-wrap {
  background: #0d1e17;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 16px 14px 16px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.lightbox-thumb-strip {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 4px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(255, 255, 255, 0.08);
  -webkit-overflow-scrolling: touch;
}

.lightbox-thumb-strip::-webkit-scrollbar {
  height: 5px;
}

.lightbox-thumb-strip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
}

.lightbox-thumb-strip::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 6px;
}

.lightbox-thumb-item {
  width: 76px;
  height: 54px;
  min-width: 76px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.5;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  background: #000;
}

.lightbox-thumb-item:hover {
  opacity: 0.85;
  transform: scale(1.06);
  border-color: rgba(240, 169, 59, 0.6);
}

.lightbox-thumb-item.active {
  border-color: #f0a93b;
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 14px rgba(240, 169, 59, 0.7);
}

.lightbox-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 600px) {
  .lightbox-stage {
    padding: 12px 42px;
    max-height: 54vh;
  }

  .lightbox-img-wrap img {
    max-height: 50vh;
  }

  .lightbox-arrow-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 22px !important;
  }

  .lightbox-thumb-item {
    width: 62px;
    height: 44px;
    min-width: 62px;
  }
}

/* ---------- PWA Install Web App Popup Banner ---------- */
.pwa-install-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  max-width: 440px;
  width: calc(100vw - 32px);
  animation: slideUpPwa .35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpPwa {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-install-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1.5px solid var(--sage-200);
  border-left: 5px solid var(--green-800);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 16px 40px rgba(10, 25, 18, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pwa-install-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
}

.pwa-install-info {
  flex: 1;
  min-width: 0;
}

.pwa-install-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--green-900);
  line-height: 1.25;
  margin-bottom: 3px;
}

.pwa-install-sub {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.pwa-install-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

.btn-pwa-close {
  background: transparent;
  border: none;
  font-size: 11.5px;
  color: var(--sage-400);
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
}

.btn-pwa-close:hover {
  color: var(--ink);
  text-decoration: underline;
}

@media (max-width: 600px) {
  .pwa-install-banner {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }

  .pwa-install-card {
    flex-wrap: wrap;
    padding: 14px;
  }

  .pwa-install-actions {
    flex-direction: row;
    width: 100%;
    justify-content: flex-end;
    margin-top: 6px;
  }
}

/* =========================================================
   Sales Report Page — Responsive & Mobile/Tablet Layouts
   ========================================================= */

.reports-main {
  max-width: 1200px;
  width: 100%;
}

.otp-gate-card {
  margin-bottom: 20px;
  border-left: 4px solid var(--gold);
}

.otp-gate-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.otp-gate-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f3e8ff;
  color: #581c87;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.otp-gate-title-wrap h3 {
  margin: 0 0 2px 0;
  font-size: 17px;
}

.otp-gate-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 16px 0;
}

.otp-step-wrap {
  margin-top: 14px;
}

.otp-input-field {
  max-width: 320px;
}

.otp-input {
  font-size: 20px !important;
  font-weight: 700 !important;
  letter-spacing: 6px !important;
  text-align: center !important;
  font-family: monospace, sans-serif !important;
  background: #fbfdfc !important;
}

.otp-action-btns {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.report-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}

.report-summary-pills .summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-table-card {
  margin-bottom: 20px;
}

.report-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  width: 100%;
}

.report-filter-bar .field {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.report-filter-bar .field-search {
  flex: 1.6;
  min-width: 240px;
}

.report-table-header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.report-table-header-wrap .section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-900);
}

.report-idx-badge {
  display: inline-block;
  padding: 2px 6px;
  background: var(--sage-100);
  border: 1px solid var(--sage-200);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green-900);
}

.plot-number-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: var(--green-900);
}

.area-tag {
  display: inline-block;
  font-size: 11.5px;
  color: var(--sage-400);
  margin-left: 3px;
}

.phone-link {
  color: var(--green-700);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.phone-link:hover {
  color: var(--green-900);
  text-decoration: underline;
}

.report-contact-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.salesperson-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-controls-card {
  margin-top: 18px;
}

.report-controls-card .report-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.report-controls-card .report-heading-text h3 {
  margin: 0;
  font-size: 17px;
}

.report-format-field {
  max-width: 340px;
  margin-bottom: 18px;
}

.report-download-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tablet portrait & landscape adjustments (max-width: 860px) */
@media (max-width: 860px) {
  .report-table-wrap {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow-x: visible !important;
    padding: 0 !important;
  }

  table.report-preview-table.stack-on-mobile {
    min-width: 0 !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
  }

  table.report-preview-table.stack-on-mobile thead {
    display: none !important;
  }

  table.report-preview-table.stack-on-mobile tbody {
    display: block !important;
    width: 100% !important;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item {
    display: block !important;
    background: #ffffff !important;
    border: 1px solid var(--sage-200) !important;
    border-radius: 10px !important;
    margin-bottom: 14px !important;
    box-shadow: 0 2px 8px rgba(20, 48, 31, 0.06) !important;
    overflow: hidden !important;
    padding: 0 !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item:hover {
    border-color: var(--sage-400) !important;
    box-shadow: 0 4px 14px rgba(20, 48, 31, 0.12) !important;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #edf4f0 !important;
    font-size: 13px !important;
    text-align: right !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item td.cell-idx {
    background: #f0f7f3 !important;
    border-bottom: 1.5px solid var(--sage-200) !important;
    font-weight: 700 !important;
    padding: 8px 14px !important;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item td:last-child {
    border-bottom: none !important;
  }

  table.report-preview-table.stack-on-mobile tr.report-row-item td::before {
    content: attr(data-label) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .04em !important;
    color: var(--sage-400) !important;
    text-align: left !important;
    flex: 0 0 auto !important;
    margin-right: 12px !important;
    max-width: 45% !important;
  }

  table.report-preview-table.stack-on-mobile tr.table-empty-row td,
  table.report-preview-table.stack-on-mobile tr.table-loading-row td,
  table.report-preview-table.stack-on-mobile td[colspan] {
    display: block !important;
    text-align: center !important;
    padding: 36px 16px !important;
    border: 1px dashed var(--sage-200) !important;
    border-radius: 8px !important;
    background: #fff !important;
    margin-bottom: 10px !important;
  }

  table.report-preview-table.stack-on-mobile tr.table-empty-row td::before,
  table.report-preview-table.stack-on-mobile tr.table-loading-row td::before,
  table.report-preview-table.stack-on-mobile td[colspan]::before {
    display: none !important;
    content: none !important;
  }

  .report-contact-actions {
    justify-content: flex-end;
  }
}

/* Tablet & Mobile filter bar stacking (max-width: 768px) */
@media (max-width: 768px) {
  .report-filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .report-filter-bar .field,
  .report-filter-bar .field-search {
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* Mobile screens (max-width: 600px) */
@media (max-width: 600px) {
  .report-summary-pills {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .report-summary-pills .summary-pill {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 6px !important;
    font-size: 11.5px !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  .btn-otp-request {
    width: 100% !important;
    white-space: normal !important;
    text-align: center !important;
    padding: 12px 14px !important;
    height: auto !important;
    min-height: 46px !important;
  }

  .otp-input-field {
    max-width: 100% !important;
    width: 100% !important;
  }

  .otp-action-btns {
    flex-direction: column !important;
    width: 100% !important;
  }

  .otp-action-btns .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  .report-format-field {
    max-width: 100% !important;
    width: 100% !important;
  }

  .report-download-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 10px !important;
  }

  .report-download-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* ---------- Area Input Group & Unit Selector (Attached at end of input box) ---------- */
.area-input-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
  position: relative !important;
}

.area-input-group input.area-value-input {
  flex: 1 1 auto !important;
  width: 1% !important;
  min-width: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
  margin: 0 !important;
}

.area-input-group select.area-unit-select {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 110px !important;
  max-width: 130px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-left: 1px solid var(--sage-200) !important;
  background-color: var(--sage-100) !important;
  color: var(--green-900) !important;
  font-weight: 600 !important;
  margin: 0 !important;
  cursor: pointer !important;
  padding: 9px 34px 9px 12px !important;
}

.area-input-group select.area-unit-select:hover {
  background-color: #dbe7df !important;
  border-color: var(--sage-400) !important;
}

.area-input-group select.area-unit-select:focus {
  border-color: var(--green-600) !important;
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.16) !important;
  z-index: 2 !important;
}

.area-input-group input.area-value-input:focus {
  z-index: 2 !important;
  border-color: var(--green-600) !important;
}

@media (max-width: 480px) {
  .area-input-group select.area-unit-select {
    min-width: 96px !important;
    padding-right: 28px !important;
    font-size: 13px !important;
  }
}

/* ==========================================================================
   Account Security & Profile — Mobile & Tablet Compliant Styles
   ========================================================================== */
.security-page-shell {
  max-width: 1020px;
  margin: 0 auto;
  width: 100%;
}

.security-hero {
  background: linear-gradient(135deg, #183b2c 0%, #255d44 50%, #1b4332 100%);
  border-radius: 16px;
  padding: 24px;
  color: #ffffff;
  margin-bottom: 24px;
  box-shadow: 0 4px 18px rgba(24, 59, 44, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.security-hero-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.security-hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #2d6a4f;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  overflow: hidden;
  object-fit: cover;
}

.security-hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.security-hero-info {
  min-width: 0;
}

.security-hero-name {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 4px 0;
  line-height: 1.3;
  word-break: break-word;
}

.security-hero-role {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #b7e4c7;
  letter-spacing: 0.3px;
}

.security-hero-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.security-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: #e8f3ed;
  font-weight: 500;
}

.security-status-pill i.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #52b788;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.3);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  align-items: stretch;
}

.security-grid .card {
  margin-top: 0 !important;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.security-grid .card.card-full {
  grid-column: 1 / -1;
}

.security-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--sage-100);
}

.security-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--sage-100);
  color: var(--green-900);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.security-card-icon svg {
  width: 20px;
  height: 20px;
}

.security-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-900);
  margin: 0;
  line-height: 1.25;
}

.security-card-sub {
  font-size: 12px;
  color: var(--sage-400);
  margin: 2px 0 0 0;
}

.avatar-preview-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--cream-50);
  border-radius: 12px;
  border: 1px solid var(--sage-100);
}

.avatar-preview-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-800);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--sage-200);
}

.avatar-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview-meta {
  flex: 1;
  min-width: 0;
}

.avatar-preview-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--green-900);
  margin-bottom: 2px;
}

.avatar-preview-desc {
  font-size: 12px;
  color: var(--sage-400);
  line-height: 1.4;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap input {
  width: 100% !important;
  padding-right: 44px !important;
}

.btn-toggle-pw {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  padding: 6px 8px !important;
  cursor: pointer;
  color: var(--sage-400) !important;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px !important;
  height: 34px !important;
  box-shadow: none !important;
  transition: color 0.15s ease, background 0.15s ease;
  z-index: 3;
}

.btn-toggle-pw:hover,
.btn-toggle-pw:focus-visible {
  color: var(--green-900) !important;
  background: var(--sage-100) !important;
}

.btn-toggle-pw svg {
  width: 18px;
  height: 18px;
}

.pw-req-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 18px 0;
  padding: 12px;
  background: var(--cream-50);
  border-radius: 10px;
  border: 1px solid var(--sage-100);
}

.pw-req-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-soft);
  transition: all 0.2s ease;
}

.pw-req-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sage-200);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
}

.pw-req-item.met {
  color: #1b4332;
  font-weight: 600;
}

.pw-req-item.met .pw-req-icon {
  background: #2d6a4f;
}

.display-scale-preview {
  margin-top: 14px;
  padding: 14px;
  background: var(--cream-50);
  border-radius: 10px;
  border: 1px solid var(--sage-100);
}

.display-scale-preview-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sage-400);
  margin-bottom: 6px;
}

.display-scale-preview-sample {
  color: var(--ink-soft);
  line-height: 1.5;
  transition: font-size 0.2s ease;
}

/* Tablet Responsive Breakpoint (≤ 980px) */
@media (max-width: 980px) {
  .security-hero {
    padding: 20px;
    gap: 16px;
  }

  .security-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .security-grid .card.card-full {
    grid-column: auto;
  }
}

/* Mobile Responsive Breakpoint (≤ 640px) */
@media (max-width: 640px) {
  .security-hero {
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    border-radius: 14px;
  }

  .security-hero-left {
    gap: 14px;
    width: 100%;
  }

  .security-hero-avatar {
    width: 58px;
    height: 58px;
    font-size: 22px;
  }

  .security-hero-name {
    font-size: 18px;
  }

  .security-hero-badges {
    width: 100%;
    justify-content: flex-start;
  }

  .pw-req-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .file-dropzone {
    padding: 20px 12px;
  }

  .dropzone-title {
    font-size: 13.5px;
  }

  .dropzone-sub {
    font-size: 11.5px;
  }
}

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

.spin-icon {
  animation: spin 0.9s linear infinite;
  display: inline-block;
}

/* ==========================================================================
   Database Backups & Redundancy — Spacious Desktop & Responsive Styles
   ========================================================================== */
.backup-page-shell {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.backup-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.backup-stat-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--sage-200);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.backup-stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.backup-stat-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sage-400);
}

.backup-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--sage-100);
  color: var(--green-900);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.backup-stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  color: var(--green-900);
  line-height: 1.1;
}

.backup-stat-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.backup-layout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.backup-main-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--sage-200);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.backup-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.backup-filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.backup-filter-pills button {
  background: var(--cream-50);
  border: 1px solid var(--sage-200);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green-900);
  cursor: pointer;
  transition: all 0.15s ease;
}

.backup-filter-pills button:hover {
  background: var(--sage-100);
  border-color: var(--sage-400);
}

.backup-filter-pills button.active {
  background: var(--green-900);
  color: #ffffff;
  border-color: var(--green-900);
  box-shadow: 0 2px 6px rgba(27, 67, 50, 0.2);
}

.backup-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--sage-200);
}

.backup-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.backup-table th {
  background: #f4f8f5;
  color: var(--green-900);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sage-200);
  white-space: nowrap;
}

.backup-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--sage-100);
  font-size: 13.5px;
  vertical-align: middle;
}

.backup-table tbody tr {
  transition: background 0.15s ease;
}

.backup-table tbody tr:hover {
  background: #fbfdfc;
}

.backup-table tbody tr:last-child td {
  border-bottom: none;
}

.backup-file-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-900);
}

.btn-download-backup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--sage-100);
  color: var(--green-900);
  border: 1px solid var(--sage-200);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-download-backup:hover {
  background: var(--green-800);
  color: #ffffff;
  border-color: var(--green-900);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.restore-guide-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--sage-200);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.restore-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sage-100);
}

.restore-guide-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-900);
  margin: 0;
}

.restore-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.restore-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-800);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.terminal-code-box {
  background: #183b2c;
  color: #a7f3d0;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 10px 0 14px 0;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.terminal-code-box code {
  color: #ecfdf5;
  display: block;
}

/* Tablet Responsive Breakpoint (≤ 1024px) */
@media (max-width: 1024px) {
  .backup-layout-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .backup-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile Responsive Breakpoint (≤ 768px) */
@media (max-width: 768px) {
  .backup-stats-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .backup-main-card {
    padding: 18px 14px;
  }

  .backup-table-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .backup-filter-pills {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .backup-table th {
    display: none;
  }

  .backup-table,
  .backup-table tbody,
  .backup-table tr,
  .backup-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .backup-table tbody tr {
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid var(--sage-200);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .backup-table td {
    padding: 6px 0;
    border-bottom: 1px dashed var(--sage-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .backup-table td:last-child {
    border-bottom: none;
    padding-top: 10px;
    justify-content: flex-end;
  }

  .backup-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--sage-400);
    margin-right: 12px;
  }
}