/* ============================================================
   MUHOZA HUB — MASTER STYLESHEET
   Muhoza Real Estate Ltd. | Property & Vehicle Marketplace
   Cross-device compatible: iOS, Android, Windows, macOS, tablets
   ============================================================ */

/* ------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------ */
:root {
  --color-primary: #102A43;
  --color-action: #1D4ED8;
  --color-background: #F3F6FA;
  --color-surface: #FFFFFF;
  --color-text: #334155;
  --color-muted: #64748B;
  --color-border: #E2E8F0;

  --color-success: #15803D;
  --color-warning: #B45309;
  --color-danger: #B91C1C;

  --color-primary-hover: #0B1F33;
  --color-action-hover: #1E40AF;
  --color-action-soft: #EFF4FF;
  --color-success-soft: #ECFDF5;
  --color-warning-soft: #FEF6E7;
  --color-danger-soft: #FEF2F2;

  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --fs-hero: 44px;
  --fs-h1: 32px;
  --fs-h2: 26px;
  --fs-h3: 20px;
  --fs-listing-title: 18px;
  --fs-price: 24px;
  --fs-body: 15px;
  --fs-small: 13px;
  --fs-label: 12px;
  --fs-button: 15px;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.2;
  --lh-snug: 1.4;
  --lh-normal: 1.6;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 8px rgba(16, 42, 67, 0.06);
  --shadow-hover: 0 8px 24px rgba(16, 42, 67, 0.10);
  --shadow-focus: 0 0 0 3px rgba(29, 78, 216, 0.25);

  --container-width: 1280px;
  --container-pad: 20px;
  --transition-fast: 160ms ease;

  --z-nav: 100;
  --z-drawer: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* ------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  background-color: #F3F6FA;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
  -ms-interpolation-mode: bicubic;
}

a {
  color: #1D4ED8;
  text-decoration: none;
  -webkit-transition: color 160ms ease;
  transition: color 160ms ease;
}

a:hover {
  color: #1E40AF;
  text-decoration: underline;
}

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #1D4ED8;
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
  border-radius: 6px;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 12px;
  color: #102A43;
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }

p {
  margin: 0 0 16px;
}

hr {
  border: none;
  border-top: 1px solid #E2E8F0;
  margin: 24px 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------
   3. LAYOUT
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.section {
  padding: 48px 0;
}

.section-lg {
  padding: 64px 0;
}

.section-head {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: justify;
     -ms-flex-pack: justify;
   justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
}

.grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  margin: -12px;
}

.grid > * {
  padding: 12px;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  width: 100%;
}

@supports (display: grid) {
  .grid {
    display: grid;
    margin: 0;
    gap: 24px;
  }
  .grid > * {
    padding: 0;
    width: auto;
  }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  @media (max-width: 1023px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 640px) {
    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }
  }
}

@media (min-width: 1024px) {
  .grid-2 > * { width: 50%; }
  .grid-3 > * { width: 33.3333%; }
  .grid-4 > * { width: 25%; }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .grid-2 > *,
  .grid-3 > *,
  .grid-4 > * { width: 50%; }
}

@media (max-width: 640px) {
  .grid > * { width: 100%; }
}

/* ------------------------------------------------------------
   4. NAVIGATION — SINGLE SOURCE OF TRUTH
   ------------------------------------------------------------ */
.nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 1px 2px rgba(16, 42, 67, 0.04);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  height: auto;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #102A43;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}

.nav-brand:hover { text-decoration: none; color: #102A43; }

.nav-brand img,
.nav-brand svg {
  height: 55px;
  width: auto;
  max-height: 55px;
  object-fit: contain;
  display: block;
}

/* Desktop nav links — horizontal row */
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.nav-links > li {
  display: inline-block;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  color: #1E293B;
  font-weight: 500;
  font-size: 15px;
  padding: 6px 0;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: #1D4ED8;
  text-decoration: none;
  border-bottom-color: #1D4ED8;
}

/* Right-side actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Sign-in inside the mobile drawer — HIDDEN on desktop */
.nav-mobile-only {
  display: none !important;
}

.nav-mobile-signin {
  color: #1D4ED8 !important;
  font-weight: 600 !important;
}

/* Hamburger — hidden by default */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: #102A43;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover { background: #F3F6FA; }

/* Backdrop */
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 67, 0.45);
  z-index: 99;
  -webkit-tap-highlight-color: transparent;
}

.nav-backdrop.open { display: block; }

/* ------------------------------------------------------------
   4a. NAV — TABLET & MOBILE (≤ 900px)
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .nav-inner {
    min-height: 68px;
    gap: 12px;
  }

  .nav-brand img,
  .nav-brand svg {
    height: 42px;
    max-height: 42px;
  }

  /* Show hamburger */
  .nav-toggle { display: inline-flex; }

  /* Drawer — links hidden until .open */
  .nav-links {
    position: fixed;
    top: 0;
    right: -320px;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #FFFFFF;
    border-left: 1px solid #E2E8F0;
    box-shadow: -6px 0 24px rgba(16, 42, 67, 0.18);
    padding: 90px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
    transition: right 220ms ease;
  }

  .nav-links.open { right: 0; }

  .nav-links > li {
    display: block;
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 14px 16px;
    border-radius: 8px;
    border-bottom: none;
    font-size: 16px;
    font-weight: 500;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: #EFF4FF;
    color: #1D4ED8;
    border-bottom-color: transparent;
  }

  /* Reveal mobile-only sign-in INSIDE the drawer */
  .nav-links .nav-mobile-only {
    display: block !important;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid #E2E8F0;
    width: 100%;
  }

  /* Hide crowded desktop buttons on mobile */
  .nav-signin,
  .nav-admin {
    display: none !important;
  }

  .nav-user {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Lock body scroll when drawer is open */
  body:has(.nav-links.open) { overflow: hidden; }
}

/* ------------------------------------------------------------
   4b. NAV — SMALL PHONE (≤ 480px)
   ------------------------------------------------------------ */
@media (max-width: 480px) {
  .nav-inner {
    min-height: 60px;
    gap: 8px;
  }

  .nav-brand img,
  .nav-brand svg {
    height: 36px;
    max-height: 36px;
  }

  .nav-actions { gap: 6px; }

  .nav-user { display: none !important; }

  .nav-links {
    width: 280px;
    padding: 80px 20px 20px 20px;
  }
}

/* ------------------------------------------------------------
   4c. SUPERADMIN & READMIN — hide extra links on mobile
   ------------------------------------------------------------ */
.sadmin-nav .nav-extra,
.readmin-nav .nav-extra {
  display: inline-flex;
}

@media (max-width: 640px) {
  .sadmin-nav .nav-extra,
  .readmin-nav .nav-extra { display: none; }
  .sadmin-nav .nav-actions,
  .readmin-nav .nav-actions { gap: 8px; }
}

@media (max-width: 380px) {
  .sadmin-nav .nav-brand img {
    height: 32px;
    max-height: 32px;
  }
}

/* ------------------------------------------------------------
   5. BUTTONS
   ------------------------------------------------------------ */
.btn {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: center;
     -ms-flex-pack: center;
   justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  -webkit-transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
  text-align: center;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:hover { text-decoration: none; }

.btn-primary {
  background: #102A43;
  color: #FFFFFF;
}
.btn-primary:hover {
  background: #0B1F33;
  color: #FFFFFF;
}

.btn-action {
  background: #1D4ED8;
  color: #FFFFFF;
}
.btn-action:hover {
  background: #1E40AF;
  color: #FFFFFF;
}

.btn-secondary {
  background: #FFFFFF;
  color: #102A43;
  border-color: #E2E8F0;
}
.btn-secondary:hover {
  border-color: #102A43;
  color: #102A43;
}

.btn-ghost {
  background: transparent;
  color: #334155;
}
.btn-ghost:hover {
  background: #F3F6FA;
  color: #102A43;
}

.btn-danger {
  background: #B91C1C;
  color: #FFFFFF;
}
.btn-danger:hover {
  background: #991B1B;
  color: #FFFFFF;
}

.btn-block { width: 100%; }

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ------------------------------------------------------------
   6. FORMS
   ------------------------------------------------------------ */
.field {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 16px;
  font-family: inherit;
  color: #334155;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  -webkit-transition: border-color 160ms ease, box-shadow 160ms ease;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  -webkit-box-shadow: none;
          box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2'%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;
  padding-right: 40px;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: #1D4ED8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
}

.textarea {
  min-height: 120px;
  resize: vertical;
  font-size: 16px;
}

.field-error {
  font-size: 13px;
  color: #B91C1C;
}

.field-hint {
  font-size: 13px;
  color: #64748B;
}

.field-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 16px;
}

.field-row > .field {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 calc(50% - 8px);
          flex: 1 1 calc(50% - 8px);
  min-width: 0;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .field-row > .field {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
  }
}

/* ------------------------------------------------------------
   7. CARDS
   ------------------------------------------------------------ */
.card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  -webkit-transition: box-shadow 160ms ease, border-color 160ms ease;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.10);
  border-color: #CBD5E1;
}

.card-body {
  padding: 16px;
}

.listing-card {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  -webkit-transition: box-shadow 160ms ease, border-color 160ms ease;
  transition: box-shadow 160ms ease, border-color 160ms ease;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

.listing-card:hover {
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.10);
  border-color: #CBD5E1;
  text-decoration: none;
  color: inherit;
}

.listing-card-media {
  position: relative;
  background: #F3F6FA;
  overflow: hidden;
  padding-top: 56.25%;
}

.listing-card-media img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  -webkit-transition: -webkit-transform 320ms ease;
  transition: transform 320ms ease;
}

@supports (aspect-ratio: 16 / 9) {
  .listing-card-media {
    padding-top: 0;
    aspect-ratio: 16 / 9;
  }
  .listing-card-media img {
    position: static;
    width: 100%;
    height: 100%;
  }
}

.listing-card:hover .listing-card-media img {
  -webkit-transform: scale(1.03);
      -ms-transform: scale(1.03);
          transform: scale(1.03);
}

.listing-card-body {
  padding: 16px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  gap: 8px;
  -webkit-box-flex: 1;
     -ms-flex-positive: 1;
          flex-grow: 1;
}

.listing-card-location {
  font-size: 13px;
  color: #64748B;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  gap: 4px;
}

.listing-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #102A43;
  line-height: 1.4;
  margin: 0;
}

.listing-card-price {
  font-size: 24px;
  font-weight: 700;
  color: #102A43;
  margin-top: 4px;
}

.listing-card-meta {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #64748B;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #E2E8F0;
}

.listing-card-meta span {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  gap: 4px;
}

.category-tile {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: #102A43;
  text-decoration: none;
  color: #FFFFFF;
  padding-top: 75%;
}

.category-tile img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  -webkit-transition: -webkit-transform 320ms ease;
  transition: transform 320ms ease;
}

@supports (aspect-ratio: 4 / 3) {
  .category-tile {
    padding-top: 0;
    aspect-ratio: 4 / 3;
  }
  .category-tile img {
    position: static;
    width: 100%;
    height: 100%;
  }
}

.category-tile:hover img {
  -webkit-transform: scale(1.05);
      -ms-transform: scale(1.05);
          transform: scale(1.05);
}

.category-tile::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: -webkit-gradient(linear, left top, left bottom, from(rgba(16,42,67,0.1)), to(rgba(16,42,67,0.85)));
  background: linear-gradient(180deg, rgba(16,42,67,0.1) 0%, rgba(16,42,67,0.85) 100%);
}

.category-tile-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px;
  z-index: 1;
}

.category-tile-content h3 {
  color: #FFFFFF;
  font-size: 20px;
  margin: 0 0 4px;
}

.category-tile-content p {
  margin: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}

/* ------------------------------------------------------------
   8. HERO
   ------------------------------------------------------------ */
.hero {
  background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF), to(#F3F6FA));
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F6FA 100%);
  padding: 64px 0 48px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #1D4ED8;
  background: #EFF4FF;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 44px;
  line-height: 1.1;
  max-width: 720px;
  margin-bottom: 16px;
}

.hero-lead {
  font-size: 17px;
  color: #334155;
  max-width: 620px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 30px; }
  .hero-lead { font-size: 15px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 26px; }
  .hero-lead { font-size: 14px; }
}

.search-panel {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(16, 42, 67, 0.06);
}

.search-tabs {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 12px;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

.search-tab {
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #64748B;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-transition: all 160ms ease;
  transition: all 160ms ease;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.search-tab:hover {
  color: #102A43;
  background: #F3F6FA;
}

.search-tab.active {
  color: #1D4ED8;
  background: #EFF4FF;
}

.search-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 12px;
  -webkit-box-align: end;
     -ms-flex-align: end;
        align-items: flex-end;
}

.search-grid > .field {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 200px;
          flex: 1 1 200px;
  min-width: 0;
  margin-bottom: 0;
}

.search-grid > .field:first-child {
  -ms-flex-preferred-size: 300px;
      flex-basis: 300px;
  -webkit-box-flex: 2;
      -ms-flex-positive: 2;
          flex-grow: 2;
}

.search-grid > button {
  -ms-flex-negative: 0;
      flex-shrink: 0;
}

@media (max-width: 640px) {
  .search-panel { padding: 16px; }
  .search-grid > .field,
  .search-grid > .field:first-child {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
  }
  .search-grid > button {
    width: 100%;
  }
}

/* ------------------------------------------------------------
   9. BADGES
   ------------------------------------------------------------ */
.badge {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success { background: #ECFDF5; color: #15803D; }
.badge-warning { background: #FEF6E7; color: #B45309; }
.badge-danger  { background: #FEF2F2; color: #B91C1C; }
.badge-info    { background: #EFF4FF; color: #1D4ED8; }
.badge-muted   { background: #F1F5F9; color: #64748B; }
.badge-featured{ background: #102A43; color: #FFFFFF; }

.badge-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

/* ------------------------------------------------------------
   10a. RESPONSIVE TABLE → CARD (mobile ≤ 768px)
   Add this block right after Section 10 in your stylesheet.
   Requires: <table class="table"> with <td data-label="…"> cells
   ------------------------------------------------------------ */
@media (max-width: 768px) {

  /* Wrapper no longer scrolls horizontally — rows become cards */
  .table-wrap.table-responsive {
    overflow-x: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }

  .table-responsive .table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
    font-size: 15px;
  }

  /* Hide the header row entirely */
  .table-responsive .table thead {
    display: none;
  }

  .table-responsive .table tbody,
  .table-responsive .table tr,
  .table-responsive .table td {
    display: block;
    width: 100%;
  }

  /* Each <tr> becomes a card */
  .table-responsive .table tbody tr {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 4px 0;
    box-shadow: 0 2px 8px rgba(16, 42, 67, 0.06);
    margin: 0 0 12px;
    overflow: hidden;
  }

  .table-responsive .table tbody tr:hover {
    background: #FFFFFF;
  }

  /* Each <td> becomes a labeled row inside the card */
  .table-responsive .table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid #F1F5F9;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .table-responsive .table td:last-child {
    border-bottom: none;
  }

  /* Label on the left, value on the right */
  .table-responsive .table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    white-space: nowrap;
  }

  /* Value side takes remaining space and aligns right */
  .table-responsive .table td > * {
    min-width: 0;
  }

  /* The "Property" cell — make it the card header */
  .table-responsive .table td[data-label="Property"] {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    background: #F8FAFC;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #102A43;
  }

  .table-responsive .table td[data-label="Property"]::before {
    display: none; /* no label on the header cell */
  }

  .table-responsive .table td[data-label="Property"] strong {
    font-size: 16px;
    font-weight: 700;
    color: #102A43;
    line-height: 1.3;
  }

  .table-responsive .table td[data-label="Property"] .text-muted {
    font-size: 13px;
    font-weight: 400;
  }

  /* The "Actions" cell — full-width buttons */
  .table-responsive .table td[data-label="Actions"] {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
    background: #FAFBFC;
    text-align: left;
  }

  .table-responsive .table td[data-label="Actions"]::before {
    align-self: flex-start;
    margin-bottom: 4px;
  }

  .table-responsive .table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .table-responsive .table-actions .btn {
    flex: 1 1 auto;
    min-width: 100px;
  }
}

/* ------------------------------------------------------------
   11. DASHBOARD / SIDEBAR
   ------------------------------------------------------------ */
.dashboard {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 24px;
  padding: 24px 0;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  -webkit-box-align: start;
     -ms-flex-align: start;
        align-items: flex-start;
}

.dashboard > .sidebar {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 260px;
          flex: 0 0 260px;
  max-width: 260px;
}

.dashboard > :not(.sidebar) {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 300px;
          flex: 1 1 300px;
  min-width: 0;
}

@media (max-width: 900px) {
  .dashboard {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
       -ms-flex-direction: column;
           flex-direction: column;
  }
  .dashboard > .sidebar {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
    max-width: 100%;
  }
}

.sidebar {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
}

.sidebar-nav {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav a {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #334155;
  font-weight: 500;
  font-size: 15px;
  min-height: 44px;
  text-decoration: none;
}

.sidebar-nav a:hover {
  background: #F3F6FA;
  color: #102A43;
  text-decoration: none;
}

.sidebar-nav a.active {
  background: #EFF4FF;
  color: #1D4ED8;
}

.stat-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  -webkit-box-flex: 1;
      -ms-flex: 1 1 200px;
          flex: 1 1 200px;
  min-width: 160px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748B;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #102A43;
  line-height: 1;
}

/* ------------------------------------------------------------
   12. FILTERS
   ------------------------------------------------------------ */
.filters {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  width: 100%;
}

.filters-head {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: justify;
     -ms-flex-pack: justify;
   justify-content: space-between;
  margin-bottom: 16px;
}

.filter-group {
  padding: 16px 0;
  border-top: 1px solid #E2E8F0;
}

.filter-group:first-of-type { border-top: none; padding-top: 0; }

.filter-group h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #102A43;
  margin: 0 0 12px;
}

.filter-option {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 15px;
  color: #334155;
  cursor: pointer;
  min-height: 36px;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  accent-color: #1D4ED8;
  -webkit-appearance: checkbox;
  -moz-appearance: checkbox;
  appearance: auto;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.results-layout {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 24px;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  -webkit-box-align: start;
     -ms-flex-align: start;
        align-items: flex-start;
}

.results-layout > .filters {
  -webkit-box-flex: 0;
      -ms-flex: 0 0 280px;
          flex: 0 0 280px;
  max-width: 280px;
}

.results-layout > :not(.filters) {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 400px;
          flex: 1 1 400px;
  min-width: 0;
}

@media (max-width: 900px) {
  .results-layout {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
       -ms-flex-direction: column;
           flex-direction: column;
  }
  .results-layout > .filters {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
    max-width: 100%;
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    height: 100dvh;
    width: 320px;
    max-width: 90vw;
    border-radius: 0;
    overflow-y: auto;
    z-index: 200;
    -webkit-transition: left 220ms ease;
    transition: left 220ms ease;
    box-shadow: 0 8px 24px rgba(16, 42, 67, 0.10);
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .results-layout > .filters.open {
    left: 0;
  }
}

/* ------------------------------------------------------------
   13. GALLERY
   ------------------------------------------------------------ */
.gallery {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 12px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}

.gallery-main {
  position: relative;
  background: #F3F6FA;
  overflow: hidden;
  -webkit-box-flex: 2;
      -ms-flex: 2 1 400px;
          flex: 2 1 400px;
  min-width: 0;
  padding-top: 75%;
}

.gallery-main img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}

@supports (aspect-ratio: 4 / 3) {
  .gallery-main {
    padding-top: 0;
    aspect-ratio: 4 / 3;
  }
  .gallery-main img {
    position: static;
    width: 100%;
    height: 100%;
  }
}

.gallery-thumbs {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 12px;
  -webkit-box-flex: 1;
      -ms-flex: 1 1 200px;
          flex: 1 1 200px;
  min-width: 0;
}

.gallery-thumb {
  background: #F3F6FA;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  -webkit-box-flex: 1;
      -ms-flex: 1 1 calc(50% - 6px);
          flex: 1 1 calc(50% - 6px);
  min-width: 80px;
  padding-top: calc(50% - 6px);
  position: relative;
}

.gallery-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}

.gallery-thumb.active { border-color: #1D4ED8; }

@media (max-width: 768px) {
  .gallery {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
       -ms-flex-direction: column;
           flex-direction: column;
  }
  .gallery-main {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
  }
  .gallery-thumbs {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
  }
  .gallery-thumb {
    -ms-flex-preferred-size: calc(25% - 9px);
        flex-basis: calc(25% - 9px);
    padding-top: calc(25% - 9px);
  }
}

/* ------------------------------------------------------------
   14. CONTACT PANEL
   ------------------------------------------------------------ */
.contact-panel {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
}

.contact-panel h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.contact-panel .btn { width: 100%; margin-bottom: 12px; }

@media (min-width: 901px) {
  .contact-panel {
    position: -webkit-sticky;
    position: sticky;
    top: 108px;
  }
}

/* ------------------------------------------------------------
   15. FOOTER
   ------------------------------------------------------------ */
.footer {
  background: #102A43;
  color: rgba(255,255,255,0.75);
  margin-top: 64px;
  padding: 48px 0 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.footer-grid {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-grid > * {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 200px;
          flex: 1 1 200px;
  min-width: 0;
}

.footer-grid > *:first-child {
  -ms-flex-preferred-size: 300px;
      flex-basis: 300px;
  -webkit-box-flex: 2;
      -ms-flex-positive: 2;
          flex-grow: 2;
}

@media (max-width: 900px) {
  .footer-grid > * {
    -ms-flex-preferred-size: calc(50% - 16px);
        flex-basis: calc(50% - 16px);
    -webkit-box-flex: 0;
        -ms-flex-positive: 0;
            flex-grow: 0;
  }
  .footer-grid > *:first-child {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
    -webkit-box-flex: 0;
        -ms-flex-positive: 0;
            flex-grow: 0;
  }
}

@media (max-width: 560px) {
  .footer-grid > * {
    -ms-flex-preferred-size: 100%;
        flex-basis: 100%;
  }
}

.footer h4 {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
}

.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  gap: 8px;
}

.footer a {
  color: rgba(255,255,255,0.75);
  font-size: 15px;
}

.footer a:hover { color: #FFFFFF; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 24px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
     -ms-flex-pack: justify;
   justify-content: space-between;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

/* ------------------------------------------------------------
   16. MODAL & TOAST
   ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(16,42,67,0.55);
  display: none;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: center;
     -ms-flex-pack: center;
   justify-content: center;
  z-index: 300;
  padding: 16px;
  overflow-y: auto;
}

.modal-backdrop.open { display: -webkit-box; display: -ms-flexbox; display: flex; }

.modal {
  background: #FFFFFF;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.10);
  margin: auto;
}

.modal-head {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: justify;
     -ms-flex-pack: justify;
   justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h3 { margin: 0; }

.toast-wrap {
  position: fixed;
  top: 100px;
  right: 16px;
  z-index: 400;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
     -ms-flex-direction: column;
         flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-left: 4px solid #1D4ED8;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.10);
  font-size: 15px;
  min-width: 260px;
  pointer-events: auto;
}

.toast-success { border-left-color: #15803D; }
.toast-error   { border-left-color: #B91C1C; }
.toast-warning { border-left-color: #B45309; }

@media (max-width: 640px) {
  .toast-wrap {
    top: 80px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
  .toast { min-width: 0; }
}

/* ------------------------------------------------------------
   17. UTILITIES
   ------------------------------------------------------------ */
.text-muted { color: #64748B; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

.flex { display: -webkit-box; display: -ms-flexbox; display: flex; }
.flex-between {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: justify;
     -ms-flex-pack: justify;
   justify-content: space-between;
  -ms-flex-wrap: wrap;
      flex-wrap: wrap;
}
.flex-center {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
     -ms-flex-align: center;
        align-items: center;
  -webkit-box-pack: center;
     -ms-flex-pack: center;
   justify-content: center;
}
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------
   18. EMPTY STATE
   ------------------------------------------------------------ */
.empty-state {
  text-align: center;
  padding: 64px 16px;
  background: #FFFFFF;
  border: 1px dashed #E2E8F0;
  border-radius: 12px;
}

.empty-state h3 {
  color: #102A43;
  margin-bottom: 8px;
}

.empty-state p {
  color: #64748B;
  max-width: 420px;
  margin: 0 auto 24px;
}

/* ------------------------------------------------------------
   19. MOBILE / TOUCH ENHANCEMENTS
   ------------------------------------------------------------ */
.table-wrap,
.gallery-thumbs,
.filters {
  -webkit-overflow-scrolling: touch;
}

.filter-toggle,
.mobile-only-action {
  padding-bottom: env(safe-area-inset-bottom);
}

@media (pointer: coarse) {
  .btn,
  .nav-links a,
  .sidebar-nav a,
  .filter-option,
  .search-tab {
    min-height: 44px;
  }
  .filter-option input[type="checkbox"],
  .filter-option input[type="radio"] {
    width: 20px;
    height: 20px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 24px 0 16px;
  }
  .nav-inner {
    height: 56px;
  }
}

/* ------------------------------------------------------------
   20. PRINT
   ------------------------------------------------------------ */
@media print {
  .nav,
  .footer,
  .toast-wrap,
  .nav-toggle,
  .btn {
    display: none !important;
  }
  body {
    background: #FFFFFF;
    color: #000000;
  }
  .card {
    box-shadow: none;
    border: 1px solid #999999;
  }
}

/* ------------------------------------------------------------
   21. RESPONSIVE FIXES — overflow & flex/grid safety
   ------------------------------------------------------------ */
.container,
.section,
.section-lg,
.card,
.card-body,
.listing-card,
.listing-card-body,
.search-panel,
.dashboard,
.results-layout,
.sidebar,
.contact-panel,
.footer-grid > *,
.nav-inner {
  min-width: 0;
}

img,
video,
iframe {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

.listing-card-title,
.listing-card-price,
.listing-card-location,
.listing-card-meta {
  overflow-wrap: anywhere;
}

.stat-card {
  overflow-wrap: anywhere;
}

.table th,
.table td {
  overflow-wrap: anywhere;
}

.footer a,
.footer-bottom,
.empty-state p {
  overflow-wrap: anywhere;
}

p,
li,
td,
th {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .section {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .section-lg {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .section-head {
    align-items: flex-start;
    gap: 12px;
  }

  .search-panel {
    padding: 16px;
  }

  .contact-panel {
    padding: 18px;
  }

  .empty-state {
    padding: 40px 16px;
  }

  .footer {
    margin-top: 40px;
    padding-top: 32px;
  }
}

@media (max-width: 900px) {
  .contact-panel {
    position: static;
    top: auto;
  }
}


/* ============================================================
   22. ADVERTISER DASHBOARD — RESPONSIVE TABLE / MOBILE FIX
   Keep table columns readable instead of breaking words vertically.
   This block intentionally overrides the broad overflow-wrap rules above.
   ============================================================ */

.dashboard,
.dashboard > *,
.dashboard .card,
.dashboard .card-body,
.dashboard main,
.dashboard section {
  min-width: 0;
  max-width: 100%;
}

.dashboard table,
.dashboard .table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.dashboard th,
.dashboard td,
.dashboard .table th,
.dashboard .table td {
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  vertical-align: middle;
  padding: 12px 14px;
  line-height: 1.4;
}

.dashboard th,
.dashboard .table th {
  white-space: normal;
  font-weight: 700;
  text-align: left;
}

.dashboard td,
.dashboard .table td {
  white-space: normal;
}

.dashboard .table-wrap,
.dashboard .table-responsive,
.dashboard .table-container {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.dashboard .table-wrap table,
.dashboard .table-responsive table,
.dashboard .table-container table,
.dashboard table.table {
  min-width: 720px;
}

.dashboard td img,
.dashboard .table td img {
  width: 48px;
  height: 48px;
  min-width: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.dashboard td a,
.dashboard td strong,
.dashboard td span,
.dashboard td button {
  max-width: 100%;
  overflow-wrap: normal;
  word-break: normal;
}

.dashboard .badge,
.dashboard .status,
.dashboard [class*="status"] {
  white-space: nowrap;
  word-break: normal;
}

.dashboard .filters,
.dashboard .filter-tabs,
.dashboard .status-filters,
.dashboard .dashboard-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  max-width: 100%;
}

.dashboard .filters > *,
.dashboard .filter-tabs > *,
.dashboard .status-filters > *,
.dashboard .dashboard-tabs > * {
  flex: 0 0 auto;
  min-width: max-content;
}

@media (max-width: 768px) {
  .dashboard {
    width: 100%;
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .dashboard > :not(.sidebar) {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
  }

  .dashboard .card,
  .dashboard .card-body {
    max-width: 100%;
  }

  .dashboard .table-wrap,
  .dashboard .table-responsive,
  .dashboard .table-container {
    margin-right: 0;
    border-radius: 10px;
  }

  .dashboard table,
  .dashboard .table {
    font-size: 14px;
  }

  .dashboard th,
  .dashboard td,
  .dashboard .table th,
  .dashboard .table td {
    padding: 10px 12px;
  }

  .dashboard .table-wrap table,
  .dashboard .table-responsive table,
  .dashboard .table-container table,
  .dashboard table.table {
    min-width: 680px;
  }

  .dashboard h1 {
    font-size: clamp(22px, 6vw, 30px);
    overflow-wrap: normal;
  }

  .dashboard .btn,
  .dashboard button {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .dashboard .table-wrap table,
  .dashboard .table-responsive table,
  .dashboard .table-container table,
  .dashboard table.table {
    min-width: 640px;
  }
}

/* ============================================================
   20. RESPONSIVE HARDENING PATCH
   Added after the original rules to override conflicting mobile
   table/card rules and prevent layout overflow on small screens.
   ============================================================ */

/* Prevent flex/grid children and long content from forcing the page wide. */
html,
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body {
  overflow-x: clip;
}

.container,
.section,
.section-lg,
.dashboard,
.dashboard > *,
.dashboard main,
.dashboard section,
.card,
.card-body,
.filters,
.results-layout,
.results-layout > *,
.search-panel,
.contact-panel,
.footer,
.footer-grid > * {
  min-width: 0;
  max-width: 100%;
}

.container {
  padding-left: clamp(12px, 3vw, 20px);
  padding-right: clamp(12px, 3vw, 20px);
}

img,
video,
iframe,
embed,
object {
  max-width: 100%;
}

/* Long IDs, URLs, emails and user-entered text should not break layouts. */
.dashboard,
.dashboard p,
.dashboard td,
.dashboard th,
.card,
.card-body,
.field,
.field-hint,
.field-error {
  overflow-wrap: anywhere;
}

/* Tables stay readable and scroll INSIDE their wrapper on narrow screens.
   This intentionally overrides the earlier generic table-to-card rule,
   which can hide column headers or show empty labels when data-label is absent. */
.table-wrap,
.table-responsive,
.table-container,
.dashboard .table-wrap,
.dashboard .table-responsive,
.dashboard .table-container {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.table-wrap table,
.table-responsive table,
.table-container table,
.dashboard .table-wrap table,
.dashboard .table-responsive table,
.dashboard .table-container table,
.dashboard table.table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

/* Cancel mobile card-conversion display rules so ordinary tables remain tables. */
@media (max-width: 768px) {
  .table-responsive .table thead,
  .dashboard .table-responsive .table thead {
    display: table-header-group !important;
  }

  .table-responsive .table tbody,
  .table-responsive .table tr,
  .table-responsive .table td,
  .dashboard .table-responsive .table tbody,
  .dashboard .table-responsive .table tr,
  .dashboard .table-responsive .table td {
    display: revert !important;
    width: auto;
  }

  .table-responsive .table tbody tr,
  .dashboard .table-responsive .table tbody tr {
    border: 0;
    padding: 0;
    box-shadow: none;
    overflow: visible;
  }

  .table-responsive .table td,
  .dashboard .table-responsive .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #E2E8F0;
    vertical-align: top;
  }

  .table-responsive .table td::before,
  .dashboard .table-responsive .table td::before {
    content: none !important;
    display: none !important;
  }

  .dashboard .table-wrap table,
  .dashboard .table-responsive table,
  .dashboard .table-container table,
  .dashboard table.table,
  .table-wrap table,
  .table-responsive table,
  .table-container table {
    min-width: 680px;
    font-size: 13px;
  }

  .dashboard th,
  .dashboard td,
  .dashboard .table th,
  .dashboard .table td {
    padding: 9px 10px;
  }
}

/* Small screens: tighten spacing, stack controls, keep tap targets usable. */
@media (max-width: 768px) {
  .section { padding-top: 32px; padding-bottom: 32px; }
  .section-lg { padding-top: 40px; padding-bottom: 40px; }

  .dashboard {
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .dashboard > .sidebar,
  .dashboard > :not(.sidebar) {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .dashboard .stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .dashboard .stat-card {
    min-width: 0;
    padding: 12px;
  }

  .dashboard .stat-value { font-size: clamp(20px, 5vw, 28px); }

  .section-head {
    align-items: flex-start;
    gap: 12px;
  }

  .section-head > * { min-width: 0; }

  .field-row,
  .search-grid {
    width: 100%;
  }

  .field-row > .field,
  .search-grid > .field,
  .search-grid > .field:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .search-panel,
  .contact-panel { padding: 16px; }

  .table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .table-actions .btn { max-width: 100%; }

  input,
  select,
  textarea,
  .input,
  .select,
  .textarea {
    max-width: 100%;
    font-size: 16px; /* avoids iOS Safari zooming focused inputs */
  }

  pre,
  code {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero { padding: 28px 0 22px; }
  .hero h1 { font-size: clamp(24px, 7vw, 30px); }

  .search-panel,
  .contact-panel,
  .card-body,
  .sidebar,
  .filters { padding: 12px; }

  .dashboard .stat-grid { grid-template-columns: 1fr 1fr; }

  .btn {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .nav-inner { gap: 8px; }
  .nav-brand { gap: 8px; }

  .footer-grid { gap: 20px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 340px) {
  .dashboard .stat-grid { grid-template-columns: 1fr; }
  .nav-brand img,
  .nav-brand svg { max-width: 100px; }
  .nav-links { width: min(280px, 90vw); }
}

/* Respect devices with safe-area insets and reduced motion. */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}
