/* ==========================================================================
   Grand Holding Design System
   A clean, professional design system for land management
   ========================================================================== */

/* ---------- CSS Custom Properties (Design Tokens) ---------- */
:root {
    /* Brand Colors */
    --gh-primary: #1a56db;
    --gh-primary-hover: #1347b8;
    --gh-primary-light: #e8effc;
    --gh-primary-50: #eff6ff;

    /* Neutrals */
    --gh-white: #ffffff;
    --gh-gray-50: #f8fafc;
    --gh-gray-100: #f1f5f9;
    --gh-gray-200: #e2e8f0;
    --gh-gray-300: #cbd5e1;
    --gh-gray-400: #94a3b8;
    --gh-gray-500: #64748b;
    --gh-gray-600: #475569;
    --gh-gray-700: #334155;
    --gh-gray-800: #1e293b;
    --gh-gray-900: #0f172a;

    /* Semantic Colors */
    --gh-success: #059669;
    --gh-success-light: #ecfdf5;
    --gh-success-50: #ecfdf5;
    --gh-success-700: #047857;
    --gh-warning: #d97706;
    --gh-warning-light: #fffbeb;
    --gh-warning-50: #fffbeb;
    --gh-danger: #dc2626;
    --gh-danger-light: #fef2f2;
    --gh-danger-50: #fef2f2;
    --gh-info: #0891b2;
    --gh-info-light: #ecfeff;

    /* Accent Colors (for special highlights) */
    --gh-accent-50: #eff6ff;
    --gh-accent-600: #1a56db;
    --gh-accent-700: #1347b8;

    /* Person Colors (refined for accessibility) */
    --gh-person-ple: #d1fae5;
    --gh-person-ple-border: #6ee7b7;
    --gh-person-poppy: #fce7f3;
    --gh-person-poppy-border: #f9a8d4;
    --gh-person-pik: #dbeafe;
    --gh-person-pik-border: #93c5fd;
    --gh-person-pep: #fef9c3;
    --gh-person-pep-border: #fde047;
    --gh-person-o: #e0e7ff;
    --gh-person-o-border: #a5b4fc;
    --gh-person-multiple: #fff7ed;
    --gh-person-multiple-border: #fdba74;
    --gh-person-other: #f1f5f9;
    --gh-person-other-border: #cbd5e1;

    /* Typography */
    --gh-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --gh-font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

    --gh-text-xs: 0.75rem;     /* 12px */
    --gh-text-sm: 0.8125rem;   /* 13px */
    --gh-text-base: 0.9375rem; /* 15px */
    --gh-text-md: 1rem;        /* 16px */
    --gh-text-lg: 1.125rem;    /* 18px */
    --gh-text-xl: 1.25rem;     /* 20px */
    --gh-text-2xl: 1.5rem;     /* 24px */
    --gh-text-3xl: 1.875rem;   /* 30px */

    /* Spacing Scale */
    --gh-space-1: 0.25rem;  /* 4px */
    --gh-space-2: 0.5rem;   /* 8px */
    --gh-space-3: 0.75rem;  /* 12px */
    --gh-space-4: 1rem;     /* 16px */
    --gh-space-5: 1.25rem;  /* 20px */
    --gh-space-6: 1.5rem;   /* 24px */
    --gh-space-8: 2rem;     /* 32px */
    --gh-space-10: 2.5rem;  /* 40px */
    --gh-space-12: 3rem;    /* 48px */

    /* Borders & Radius */
    --gh-radius-sm: 0.375rem;  /* 6px */
    --gh-radius-md: 0.5rem;    /* 8px */
    --gh-radius-lg: 0.75rem;   /* 12px */
    --gh-radius-xl: 1rem;      /* 16px */
    --gh-radius-full: 9999px;

    --gh-border-color: #e2e8f0;
    --gh-border-color-dark: #cbd5e1;

    /* Shadows */
    --gh-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --gh-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --gh-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --gh-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --gh-transition-fast: 150ms ease;
    --gh-transition-base: 200ms ease;
    --gh-transition-slow: 300ms ease;

    /* Semantic Text Colors */
    --gh-text: var(--gh-gray-900);
    --gh-text-color: var(--gh-gray-900);
    --gh-text-secondary: var(--gh-gray-500);

    /* Semantic Border */
    --gh-border: var(--gh-border-color);

    /* Layout */
    --gh-navbar-height: 60px;
    --gh-sidebar-width: 280px;
}


/* ==========================================================================
   Base & Reset
   ========================================================================== */
body {
    font-family: var(--gh-font-family);
    font-size: var(--gh-text-base);
    color: var(--gh-gray-800);
    background-color: var(--gh-gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.gh-navbar {
    min-height: var(--gh-navbar-height);
    background: var(--gh-gray-900) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--gh-shadow-md);
    padding: 0 var(--gh-space-4);
    z-index: 1040;
}

.gh-navbar .navbar-brand {
    font-weight: 700;
    font-size: var(--gh-text-lg);
    letter-spacing: -0.02em;
    color: var(--gh-white) !important;
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
}

.gh-navbar .navbar-brand .brand-icon {
    width: 28px;
    height: 28px;
    background: var(--gh-primary);
    border-radius: var(--gh-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--gh-text-sm);
    font-weight: 700;
    color: white;
}

.gh-navbar .nav-link {
    font-size: var(--gh-text-sm);
    font-weight: 500;
    color: var(--gh-gray-400) !important;
    padding: var(--gh-space-2) var(--gh-space-3) !important;
    border-radius: var(--gh-radius-sm);
    transition: all var(--gh-transition-fast);
    white-space: nowrap;
}

.gh-navbar .nav-link:hover,
.gh-navbar .nav-link:focus {
    color: var(--gh-white) !important;
    background-color: rgba(255, 255, 255, 0.08);
}

.gh-navbar .nav-link.active {
    color: var(--gh-white) !important;
    background-color: rgba(255, 255, 255, 0.12);
}

/* Hamburger menu button (navbar-toggler) */
.gh-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
    padding: var(--gh-space-2);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gh-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
    outline: none;
}

.gh-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 24px;
    height: 24px;
}

/* Navbar Dropdown (Tools menu) */
.gh-navbar .dropdown-menu-dark {
    background: var(--gh-gray-800);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--gh-radius-md);
    box-shadow: var(--gh-shadow-lg);
    padding: var(--gh-space-1) 0;
    min-width: 200px;
}

.gh-navbar .dropdown-menu-dark .dropdown-item {
    color: var(--gh-gray-300);
    font-size: var(--gh-text-sm);
    font-weight: 500;
    padding: var(--gh-space-2) var(--gh-space-4);
    transition: all var(--gh-transition-fast);
}

.gh-navbar .dropdown-menu-dark .dropdown-item:hover,
.gh-navbar .dropdown-menu-dark .dropdown-item:focus {
    color: var(--gh-white);
    background-color: rgba(255, 255, 255, 0.1);
}

.gh-navbar .dropdown-menu-dark .dropdown-item.active {
    color: var(--gh-white);
    background-color: var(--gh-primary);
}

.gh-navbar .dropdown-menu-dark .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08);
    margin: var(--gh-space-1) 0;
}

/* Mobile navbar */
@media (max-width: 991.98px) {
    .gh-navbar .navbar-collapse {
        background: var(--gh-gray-900);
        padding: var(--gh-space-3);
        margin: 0 calc(-1 * var(--gh-space-4));
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        margin-top: var(--gh-space-2);
    }

    .gh-navbar .nav-link {
        padding: var(--gh-space-3) var(--gh-space-4) !important;
        font-size: var(--gh-text-base);
    }
}


/* ==========================================================================
   Page Layout
   ========================================================================== */
.gh-page {
    padding: var(--gh-space-4) var(--gh-space-4) var(--gh-space-8);
    max-width: 100%;
}

.gh-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--gh-space-3);
    margin-bottom: var(--gh-space-6);
}

.gh-page-title {
    font-size: var(--gh-text-2xl);
    font-weight: 700;
    color: var(--gh-gray-900);
    margin: 0;
    letter-spacing: -0.02em;
}

.gh-page-subtitle {
    font-size: var(--gh-text-base);
    color: var(--gh-gray-500);
    margin: var(--gh-space-1) 0 0;
    font-weight: 400;
}

@media (min-width: 768px) {
    .gh-page {
        padding: var(--gh-space-6) var(--gh-space-8) var(--gh-space-10);
    }
    .gh-page-title {
        font-size: var(--gh-text-3xl);
    }
}

/* Mobile optimizations for page layout */
@media (max-width: 767px) {
    .gh-page {
        padding: var(--gh-space-3) var(--gh-space-3) var(--gh-space-6);
    }

    .gh-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--gh-space-3);
        margin-bottom: var(--gh-space-4);
    }

    .gh-page-title {
        font-size: var(--gh-text-xl);
        line-height: 1.3;
    }

    .gh-page-subtitle {
        font-size: var(--gh-text-sm);
        margin-top: 4px;
    }

    /* Make action buttons full width on mobile */
    .gh-page-header .d-flex {
        width: 100%;
    }

    .gh-page-header .d-flex .gh-btn {
        flex: 1;
        justify-content: center;
    }
}

/* Breadcrumbs */
.gh-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-500);
    margin-bottom: var(--gh-space-4);
    flex-wrap: wrap;
}

.gh-breadcrumb a {
    color: var(--gh-primary);
    text-decoration: none;
    transition: color var(--gh-transition-fast);
}

.gh-breadcrumb a:hover {
    color: var(--gh-primary-hover);
    text-decoration: underline;
}

.gh-breadcrumb .separator {
    color: var(--gh-gray-300);
    font-size: var(--gh-text-xs);
}

/* Mobile breadcrumb optimizations */
@media (max-width: 767px) {
    .gh-breadcrumb {
        font-size: var(--gh-text-xs);
        margin-bottom: var(--gh-space-3);
        gap: var(--gh-space-1);
    }

    .gh-breadcrumb .separator {
        font-size: 10px;
    }
}


/* ==========================================================================
   Cards (Unified)
   ========================================================================== */
.gh-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    box-shadow: var(--gh-shadow-sm);
    transition: box-shadow var(--gh-transition-base);
    overflow: hidden;
}

.gh-card:hover {
    box-shadow: var(--gh-shadow-md);
}

/* Clickable card — entire card navigates on click */
.gh-card-clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.gh-card-clickable:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}
.gh-card-clickable:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Alert card variant for overdue payments/urgent items */
.gh-card-alert {
    border-left: 4px solid #dc2626;
    background: #fef2f2;
}

.gh-card-alert:hover {
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.gh-card-link {
    display: block;
    padding: var(--gh-space-3);
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.gh-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.gh-card-title {
    font-size: var(--gh-text-base);
    font-weight: 600;
    color: var(--gh-gray-900);
    margin-bottom: var(--gh-space-2);
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
    line-height: 1.4;
}

.gh-card-title i {
    color: var(--gh-gray-400);
    font-size: 0.9em;
    flex-shrink: 0;
}

.gh-card-title .title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.gh-card-meta {
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-700);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
    line-height: 1.4;
}

.gh-card-meta i {
    color: var(--gh-gray-400);
    font-size: 0.85em;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.gh-card-meta strong {
    color: var(--gh-gray-700);
}

/* Card header (title row + badge) */
.gh-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--gh-space-2);
    margin-bottom: var(--gh-space-1);
}

.gh-card-header .gh-card-title {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    margin-bottom: 0;
    min-width: 0;
}

.gh-card-id {
    font-size: var(--gh-text-base);
    font-weight: 700;
    color: var(--gh-gray-900);
}

.gh-card-group {
    font-size: var(--gh-text-xs);
    color: var(--gh-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gh-card-badge {
    flex-shrink: 0;
}

.gh-card-ref {
    font-size: var(--gh-text-xs);
    color: var(--gh-gray-500);
    margin-bottom: var(--gh-space-1);
    padding-bottom: var(--gh-space-1);
    border-bottom: 1px solid var(--gh-gray-100);
}

.gh-card-details {
    margin-bottom: var(--gh-space-1);
}

.gh-card-meta-secondary {
    color: var(--gh-gray-500);
    font-size: 0.8em;
}

.gh-card-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--gh-space-2);
    padding-top: var(--gh-space-1);
    border-top: 1px solid var(--gh-gray-100);
    margin-top: var(--gh-space-1);
}

.gh-card-tax {
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-700);
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
}

.gh-card-tax i {
    color: var(--gh-gray-400);
    font-size: 0.85em;
    flex-shrink: 0;
}

.gh-card-task-badge {
    margin-top: var(--gh-space-1);
}

.gh-badge-under-consideration {
    background: #7c3aed;
    color: white;
}


/* Mobile card optimizations */
@media (max-width: 767px) {
    .gh-card {
        border-radius: var(--gh-radius-md);
    }

    .gh-card-link {
        padding: var(--gh-space-3);
    }

    .gh-card-title {
        font-size: var(--gh-text-sm);
        margin-bottom: var(--gh-space-1);
    }

    .gh-card-meta {
        font-size: var(--gh-text-xs);
        margin-bottom: 4px;
        line-height: 1.4;
    }

    .gh-card-meta i {
        font-size: 11px;
    }
}

/* Tighter card padding for 2-col on phones */
@media (max-width: 479px) {
    .gh-card-link {
        padding: var(--gh-space-2) var(--gh-space-2);
    }

    .gh-card-title {
        font-size: 13px;
    }

    .gh-card-footer {
        gap: 4px;
    }

    .gh-card-footer .badge {
        font-size: 10px;
        padding: 2px 5px;
    }
}

/* Card grid — always 2 columns (fits iPhone SE 375px+), tighter gap on mobile */
.gh-card-grid {
    display: grid;
    gap: var(--gh-space-2);
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 576px) {
    .gh-card-grid {
        gap: var(--gh-space-3);
    }
    .gh-card-link {
        padding: var(--gh-space-3) var(--gh-space-4);
    }
}

@media (min-width: 768px) {
    .gh-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .gh-card-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
    .gh-card-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1400px) {
    .gh-card-grid { grid-template-columns: repeat(5, 1fr); }
}

/* Mobile utility: hide secondary card details on phones */
@media (max-width: 479px) {
    .gh-mobile-hide {
        display: none !important;
    }

    /* Compact card footer on single-column */
    .gh-card-footer {
        flex-wrap: wrap;
    }
}

/* Group card grid (slightly different — single col on mobile) */
.gh-group-grid {
    display: grid;
    gap: var(--gh-space-4);
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .gh-group-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 992px) {
    .gh-group-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
    .gh-group-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1400px) {
    .gh-group-grid { grid-template-columns: repeat(5, 1fr); }
}


/* ==========================================================================
   Sidebar (Filter Panel)
   ========================================================================== */
.gh-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - var(--gh-navbar-height));
}

/* Mobile: Sidebar is a collapsible panel at top */
.gh-sidebar {
    width: 100%;
    background: var(--gh-white);
    border-bottom: 1px solid var(--gh-border-color);
    overflow: hidden;
    transition: max-height var(--gh-transition-slow), padding var(--gh-transition-slow);
    max-height: 52px; /* collapsed: just the toggle */
}

.gh-sidebar.expanded {
    max-height: 2000px;
    padding-bottom: var(--gh-space-4);
}

.gh-sidebar-toggle {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: var(--gh-space-3) var(--gh-space-4);
    background: var(--gh-primary-50);
    border: none;
    font-weight: 600;
    font-size: var(--gh-text-sm);
    color: var(--gh-primary);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    min-height: 48px;
}

.gh-sidebar-toggle:hover {
    background: var(--gh-primary-light);
}

.gh-sidebar-toggle .toggle-icon {
    transition: transform var(--gh-transition-base);
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-400);
}

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

.gh-sidebar-body {
    padding: 0 var(--gh-space-4) var(--gh-space-2);
}

.gh-sidebar-body label {
    font-weight: 500;
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-700);
    margin-bottom: var(--gh-space-1);
    display: block;
}

.gh-sidebar-body .form-control,
.gh-sidebar-body .form-select {
    font-size: var(--gh-text-base);
    border-color: var(--gh-border-color);
    border-radius: var(--gh-radius-sm);
}

.gh-sidebar-body .form-control:focus,
.gh-sidebar-body .form-select:focus {
    border-color: var(--gh-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.gh-sidebar-body hr {
    border-color: var(--gh-gray-200);
    margin: var(--gh-space-3) 0;
}

.gh-main {
    flex: 1;
    padding: var(--gh-space-4);
    min-width: 0;
}

/* Desktop: sidebar as sticky column */
@media (min-width: 768px) {
    .gh-layout {
        flex-direction: row;
    }

    .gh-sidebar {
        width: var(--gh-sidebar-width);
        flex-shrink: 0;
        max-height: none;
        border-bottom: none;
        border-right: 1px solid var(--gh-border-color);
        position: sticky;
        top: var(--gh-navbar-height);
        height: calc(100vh - var(--gh-navbar-height));
        overflow-y: auto;
        padding-bottom: var(--gh-space-4);
    }

    .gh-sidebar-toggle {
        display: none;
    }

    .gh-sidebar-body {
        padding: var(--gh-space-4) var(--gh-space-5);
    }

    .gh-main {
        padding: var(--gh-space-6);
    }
}


/* ==========================================================================
   Person Color System
   ========================================================================== */
/* Higher specificity without !important */
.gh-card.person-ple        { background-color: var(--gh-person-ple); border-left: 3px solid var(--gh-person-ple-border); }
.gh-card.person-poppy      { background-color: var(--gh-person-poppy); border-left: 3px solid var(--gh-person-poppy-border); }
.gh-card.person-pik        { background-color: var(--gh-person-pik); border-left: 3px solid var(--gh-person-pik-border); }
.gh-card.person-pep        { background-color: var(--gh-person-pep); border-left: 3px solid var(--gh-person-pep-border); }
.gh-card.person-o          { background-color: var(--gh-person-o); border-left: 3px solid var(--gh-person-o-border); }
.gh-card.person-multiple   { background-color: var(--gh-person-multiple); border-left: 3px solid var(--gh-person-multiple-border); }
.gh-card.person-other      { background-color: var(--gh-person-other); border-left: 3px solid var(--gh-person-other-border); }

/* Person badges (inline pill for task tables) */
.gh-person-badge {
    display: inline-block;
    padding: 0.15em 0.55em;
    font-size: var(--gh-text-xs);
    font-weight: 500;
    border-radius: var(--gh-radius-full);
    border: 1px solid;
    margin: 1px 2px;
    white-space: nowrap;
}
.gh-person-badge.person-ple      { background: var(--gh-person-ple); border-color: var(--gh-person-ple-border); color: #065f46; }
.gh-person-badge.person-poppy    { background: var(--gh-person-poppy); border-color: var(--gh-person-poppy-border); color: #9d174d; }
.gh-person-badge.person-pik      { background: var(--gh-person-pik); border-color: var(--gh-person-pik-border); color: #1e40af; }
.gh-person-badge.person-pep      { background: var(--gh-person-pep); border-color: var(--gh-person-pep-border); color: #92400e; }
.gh-person-badge.person-o        { background: var(--gh-person-o); border-color: var(--gh-person-o-border); color: #3730a3; }
.gh-person-badge.person-other    { background: var(--gh-person-other); border-color: var(--gh-person-other-border); color: var(--gh-gray-600); }

/* Owner badges */
.owner-badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: var(--gh-text-xs);
    font-weight: 500;
    border-radius: var(--gh-radius-full);
    border: 1px solid;
}

.owner-suntorn   { background: var(--gh-person-ple); border-color: var(--gh-person-ple-border); color: #065f46; }
.owner-pimolpan  { background: var(--gh-person-poppy); border-color: var(--gh-person-poppy-border); color: #9d174d; }
.owner-sermchai  { background: var(--gh-person-pik); border-color: var(--gh-person-pik-border); color: #1e40af; }
.owner-pimolrat  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.owner-default   { background: var(--gh-gray-100); border-color: var(--gh-gray-300); color: var(--gh-gray-600); }


/* ==========================================================================
   Tables
   ========================================================================== */
.gh-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-md);
    background: var(--gh-white);
    position: relative;
}

/* Horizontal scroll indicator (fade on right edge) */
@media (max-width: 991px) {
    .gh-table-wrap::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.05));
        pointer-events: none;
        transition: opacity var(--gh-transition-base);
    }

    .gh-table-wrap.scrolled-to-end::after {
        opacity: 0;
    }
}

.gh-table-wrap .table {
    margin-bottom: 0;
    font-size: var(--gh-text-sm);
}

.gh-table-wrap .table th {
    font-weight: 600;
    font-size: var(--gh-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gh-gray-600);
    background: var(--gh-gray-50);
    border-bottom: 2px solid var(--gh-border-color);
    padding: var(--gh-space-3) var(--gh-space-3);
    white-space: nowrap;
}

.gh-table-wrap .table td {
    padding: var(--gh-space-3) var(--gh-space-3);
    vertical-align: middle;
    color: var(--gh-gray-700);
    border-bottom: 1px solid var(--gh-gray-100);
}

.gh-table-wrap .table tbody tr:hover {
    background-color: var(--gh-gray-50);
}

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

/* Mobile table optimizations */
@media (max-width: 767px) {
    .gh-table-wrap {
        border-radius: var(--gh-radius-sm);
        margin-bottom: var(--gh-space-3);
    }

    .gh-table-wrap .table {
        font-size: 11px;
    }

    .gh-table-wrap .table th {
        font-size: var(--gh-text-xs); /* 12px - WCAG AA compliant */
        padding: var(--gh-space-2);
        letter-spacing: 0.02em;
    }

    .gh-table-wrap .table td {
        padding: var(--gh-space-2);
    }

    /* Make scroll indicator more visible on mobile */
    .gh-table-wrap::after {
        width: 60px;
        background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.08));
    }
}


/* ==========================================================================
   Helper / Tooltip Icons (replaces inline styles)
   ========================================================================== */
.gh-help-icon {
    cursor: help;
    font-size: 0.75rem;
}

/* Tax paid/unpaid inline indicators */
.gh-tax-paid-icon {
    font-size: 0.85rem;
}

.gh-tax-unpaid {
    font-size: 0.75rem;
    font-weight: 600;
}

.gh-tax-breakdown-paid-icon {
    font-size: 0.7rem;
}

.gh-tax-breakdown-unpaid {
    font-size: 0.65rem;
    font-weight: 600;
}

/* ==========================================================================
   Badges & Status
   ========================================================================== */
.gh-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--gh-space-1);
    padding: 0.2em 0.65em;
    font-size: var(--gh-text-xs);
    font-weight: 600;
    border-radius: var(--gh-radius-full);
    line-height: 1.4;
    white-space: nowrap;
}

.gh-badge-open    { background: var(--gh-danger-light); color: var(--gh-danger); }
.gh-badge-waiting { background: var(--gh-warning-light); color: var(--gh-warning); }
.gh-badge-complete { background: var(--gh-success-light); color: var(--gh-success); }
.gh-badge-info    { background: var(--gh-info-light); color: var(--gh-info); }
.gh-badge-neutral { background: var(--gh-gray-100); color: var(--gh-gray-600); }
.gh-badge-warning { background: var(--gh-warning-light); color: var(--gh-warning); }
.gh-badge-success { background: var(--gh-success-light); color: var(--gh-success); }
.gh-badge-danger  { background: var(--gh-danger-light); color: var(--gh-danger); }
.gh-badge-count   { background: var(--gh-gray-100); color: var(--gh-gray-600); font-weight: 500; }

/* Active Filter Badges */
.gh-active-filters {
    background: var(--gh-primary-50);
    border: 1px solid var(--gh-primary-light);
    border-radius: var(--gh-radius-md);
    padding: var(--gh-space-3) var(--gh-space-4);
}

.gh-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--gh-space-1);
    padding: 0.35rem 0.65rem;
    font-size: var(--gh-text-xs);
    font-weight: 500;
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-full);
    color: var(--gh-gray-700);
    white-space: nowrap;
}

.gh-filter-badge i.bi {
    font-size: 0.875rem;
    color: var(--gh-primary);
}

.gh-filter-badge-remove {
    margin-left: var(--gh-space-1);
    color: var(--gh-gray-500);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color var(--gh-transition-fast);
}

.gh-filter-badge-remove:hover {
    color: var(--gh-danger);
}

@media (max-width: 767px) {
    .gh-active-filters {
        padding: var(--gh-space-2) var(--gh-space-3);
    }

    .gh-filter-badge {
        font-size: 11px;
        padding: 0.25rem 0.5rem;
    }

    .gh-filter-badge i.bi {
        font-size: 0.75rem;
    }
}


/* ==========================================================================
   Buttons (extended)
   ========================================================================== */
.gh-btn {
    font-size: var(--gh-text-sm);
    font-weight: 500;
    padding: var(--gh-space-2) var(--gh-space-4);
    border-radius: var(--gh-radius-sm);
    transition: all var(--gh-transition-fast);
    display: inline-flex;
    align-items: center;
    gap: var(--gh-space-2);
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.5;
}

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

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

.gh-btn-outline {
    background: var(--gh-white);
    color: var(--gh-gray-700);
    border-color: var(--gh-border-color);
}

.gh-btn-outline:hover {
    background: var(--gh-gray-50);
    border-color: var(--gh-gray-300);
    color: var(--gh-gray-900);
}

.gh-btn-success {
    background: var(--gh-success);
    color: var(--gh-white);
    border-color: var(--gh-success);
}

.gh-btn-success:hover {
    background: #047857;
    color: var(--gh-white);
}

.gh-btn-danger {
    background: var(--gh-white);
    color: var(--gh-danger);
    border-color: var(--gh-danger);
}

.gh-btn-danger:hover {
    background: var(--gh-danger);
    color: var(--gh-white);
}

.gh-btn-sm {
    font-size: var(--gh-text-xs);
    padding: var(--gh-space-1) var(--gh-space-3);
}

/* Mobile: Increase touch targets to minimum 44px */
@media (max-width: 767px) {
    .gh-btn,
    .gh-btn-primary,
    .gh-btn-outline,
    .gh-btn-success,
    .gh-btn-danger {
        min-height: 44px;
        padding: var(--gh-space-3) var(--gh-space-4);
    }

    .gh-btn-sm {
        min-height: 44px;
        padding: var(--gh-space-2) var(--gh-space-4);
        font-size: var(--gh-text-sm);
    }

    .gh-btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: var(--gh-space-2);
    }
}


/* ==========================================================================
   Page Header v2
   ========================================================================== */
.gh-page-header-v2 {
    margin-bottom: var(--gh-space-3);
}

.gh-page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.gh-page-header-top .gh-page-title {
    margin: 0;
    font-size: var(--gh-text-2xl);
    font-weight: 700;
    color: var(--gh-gray-900);
}

.gh-page-header-actions {
    display: flex;
    gap: var(--gh-space-2);
    align-items: center;
    flex-shrink: 0;
}

.gh-search-bar {
    position: relative;
}

.gh-search-form {
    display: flex;
    gap: var(--gh-space-2);
    align-items: center;
}

.gh-search-hint {
    color: var(--gh-gray-400);
    cursor: help;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.gh-search-input {
    flex: 1;
    font-size: 16px !important;
}

.gh-search-active {
    margin-top: var(--gh-space-1);
}

@media (max-width: 767px) {
    .gh-page-header-v2 {
        margin-bottom: var(--gh-space-2);
    }

    .gh-page-header-top {
        flex-direction: row;
        align-items: center;
        gap: var(--gh-space-2);
    }

    .gh-page-header-top .gh-page-title {
        font-size: var(--gh-text-lg);
        flex: 1;
        min-width: 0;
    }

    .gh-page-header-actions {
        flex-shrink: 0;
        gap: var(--gh-space-1);
    }

    /* Hide button labels on mobile, show icons only */
    .gh-page-header-actions .gh-btn span {
        display: none;
    }

    .gh-page-header-actions .gh-btn {
        min-width: 40px;
        min-height: 40px;
        padding: var(--gh-space-2);
        justify-content: center;
    }
}

/* ==========================================================================
   KPI Grid — 3 compact cards + 1 big tax card
   ========================================================================== */
.gh-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr;
    gap: var(--gh-space-2);
    margin-bottom: var(--gh-space-3);
    align-items: stretch;
}

.gh-kpi-grid--equal {
    grid-template-columns: repeat(4, 1fr);
}

.gh-kpi-band {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--gh-space-2);
    margin-bottom: var(--gh-space-3);
    align-items: stretch;
}

.gh-kpi-item {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    padding: var(--gh-space-4);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gh-kpi-item--compact {
    padding: var(--gh-space-2) var(--gh-space-3);
}

.gh-kpi-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gh-gray-500);
    margin-bottom: var(--gh-space-1);
}

.gh-kpi-value {
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--gh-gray-900);
    line-height: 1.2;
}

.gh-kpi-unit {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--gh-gray-500);
}

.gh-kpi-change {
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.25rem;
}

.gh-kpi-change--up {
    color: var(--gh-danger);
}

.gh-kpi-change--down {
    color: var(--gh-success);
}

.gh-kpi-sub {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--gh-gray-400);
    margin-top: var(--gh-space-1);
}

/* ---- Big Tax Card ---- */
.gh-kpi-tax-card {
    background: linear-gradient(135deg, var(--gh-primary-50) 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--gh-radius-lg);
    padding: var(--gh-space-3);
    display: flex;
    flex-direction: column;
}

.gh-kpi-tax-header {
    text-align: center;
    padding-bottom: var(--gh-space-2);
    margin-bottom: var(--gh-space-2);
    border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.gh-kpi-tax-total {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gh-gray-900);
    line-height: 1.2;
}

/* ---- Tax Breakdown Mini Cards ---- */
.gh-kpi-tax-breakdown {
    display: flex;
    gap: var(--gh-space-2);
    flex: 1;
}

.gh-tax-mini {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--gh-radius-sm);
    padding: var(--gh-space-2);
    text-align: center;
    border-top: 2px solid var(--gh-gray-300);
}

.gh-tax-mini-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gh-gray-600);
    margin-bottom: 0.125rem;
}

.gh-tax-mini-count {
    font-size: 0.6875rem;
    color: var(--gh-gray-400);
    font-weight: 400;
}

.gh-tax-mini-value {
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--gh-gray-900);
    margin-top: 0.125rem;
}

.gh-tax-mini-sub {
    font-size: 0.625rem;
    color: var(--gh-gray-400);
    margin-top: 0.125rem;
}

/* Tax mini color variants */
.gh-tax-mini--vacant    { border-top-color: #f59e0b; }
.gh-tax-mini--agricultural { border-top-color: #10b981; }
.gh-tax-mini--residential  { border-top-color: #3b82f6; }
.gh-tax-mini--other        { border-top-color: #6b7280; }
.gh-tax-mini--unspecified  { border-top-color: #8b5cf6; }

/* ---- Card Tax Breakdown Rows ---- */
.gh-card-tax-breakdown {
    flex-basis: 100%;
    margin-top: 0.25rem;
    padding: 0.375rem 0.5rem;
    border-top: 1px dashed var(--gh-gray-200);
    background: var(--gh-gray-50, #f9fafb);
    border-radius: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gh-card-tax-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

.gh-card-tax-row-label {
    color: var(--gh-gray-600);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-card-tax-row-value {
    font-weight: 600;
    color: var(--gh-gray-800);
    white-space: nowrap;
}

/* Tablet KPI */
@media (max-width: 991px) and (min-width: 768px) {
    .gh-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gh-kpi-grid--equal {
        grid-template-columns: repeat(4, 1fr);
    }

    .gh-kpi-tax-card {
        grid-column: 1 / -1;
    }
}

/* Mobile KPI — 2-column grid, area + tax span full */
@media (max-width: 767px) {
    .gh-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--gh-space-2);
    }

    .gh-kpi-item--compact {
        padding: var(--gh-space-2) var(--gh-space-3);
    }

    /* Area KPI spans full width (long Thai text) — only on overview page */
    .gh-kpi-grid:not(.gh-kpi-grid--equal) .gh-kpi-item--compact:nth-child(3) {
        grid-column: 1 / -1;
    }

    .gh-kpi-label {
        font-size: 0.625rem;
        margin-bottom: 0.125rem;
    }

    .gh-kpi-value {
        font-size: var(--gh-text-base);
    }

    .gh-kpi-tax-card {
        grid-column: 1 / -1;
        padding: var(--gh-space-3);
    }

    .gh-kpi-tax-total {
        font-size: var(--gh-text-xl);
    }

    .gh-kpi-tax-breakdown {
        flex-direction: row;
        gap: var(--gh-space-2);
    }

    .gh-tax-mini {
        flex: 1;
        min-width: 0;
    }
}

/* Very small phones — stack KPIs vertically */
@media (max-width: 374px) {
    .gh-kpi-grid {
        grid-template-columns: 1fr;
    }

    .gh-kpi-grid:not(.gh-kpi-grid--equal) .gh-kpi-item--compact:nth-child(3) {
        grid-column: auto;
    }
}


/* ==========================================================================
   Tab Navigation (View Switcher)
   ========================================================================== */
.gh-tabs {
    display: flex;
    gap: var(--gh-space-2);
    margin-bottom: var(--gh-space-3);
    background: var(--gh-gray-100);
    border-radius: var(--gh-radius-full);
    padding: var(--gh-space-1);
    width: fit-content;
}

.gh-tab {
    padding: var(--gh-space-2) var(--gh-space-5);
    font-size: var(--gh-text-base);
    font-weight: 600;
    color: var(--gh-gray-500);
    text-decoration: none;
    border-radius: var(--gh-radius-full);
    transition: all var(--gh-transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.gh-tab:hover {
    color: var(--gh-gray-700);
    background: var(--gh-gray-200);
}

.gh-tab.active {
    color: var(--gh-white);
    background: var(--gh-primary);
    box-shadow: var(--gh-shadow-sm);
}

.gh-tab.active:hover {
    background: var(--gh-primary-hover);
    color: var(--gh-white);
}

/* Mobile tab optimizations */
@media (max-width: 767px) {
    .gh-tabs {
        width: 100%;
        margin-bottom: var(--gh-space-4);
    }

    .gh-tab {
        flex: 1;
        padding: var(--gh-space-2) var(--gh-space-3);
        font-size: var(--gh-text-sm);
        text-align: center;
    }
}


/* ==========================================================================
   Sort Controls
   ========================================================================== */
.gh-sort-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--gh-space-2);
    margin-bottom: var(--gh-space-3);
}

.gh-sort-bar .sort-label {
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-500);
    font-weight: 500;
}

.gh-sort-btn {
    font-size: var(--gh-text-xs);
    font-weight: 500;
    padding: var(--gh-space-1) var(--gh-space-3);
    border-radius: var(--gh-radius-full);
    border: 1px solid var(--gh-border-color);
    background: var(--gh-white);
    color: var(--gh-gray-600);
    text-decoration: none;
    transition: all var(--gh-transition-fast);
}

.gh-sort-btn:hover {
    border-color: var(--gh-gray-300);
    background: var(--gh-gray-50);
    color: var(--gh-gray-800);
}

.gh-sort-btn.active {
    background: var(--gh-primary);
    border-color: var(--gh-primary);
    color: var(--gh-white);
}

/* Mobile sort bar — horizontally scrollable, larger touch targets */
@media (max-width: 767px) {
    .gh-sort-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: var(--gh-space-2);
        margin-bottom: var(--gh-space-3);
        padding-bottom: var(--gh-space-1);
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE */
    }

    .gh-sort-bar::-webkit-scrollbar {
        display: none;
    }

    .gh-sort-bar .sort-label {
        flex-shrink: 0;
        font-size: var(--gh-text-xs);
    }

    .gh-sort-btn {
        font-size: var(--gh-text-xs);
        padding: var(--gh-space-2) var(--gh-space-3);
        min-height: 36px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}


/* ==========================================================================
   Collapsible Sections
   ========================================================================== */
.gh-section {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    margin-bottom: var(--gh-space-4);
    overflow: hidden;
}

.gh-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--gh-space-4) var(--gh-space-5);
    background: var(--gh-white);
    border: none;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--gh-text-md);
    color: var(--gh-gray-900);
    text-align: left;
    transition: background var(--gh-transition-fast);
}

.gh-section-header:hover {
    background: var(--gh-gray-50);
}

.gh-section-header .chevron {
    transition: transform var(--gh-transition-base);
    color: var(--gh-gray-400);
}

.gh-section-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.gh-section-body {
    padding: 0 var(--gh-space-5) var(--gh-space-5);
}

/* Mobile optimizations for collapsible sections */
@media (max-width: 767px) {
    .gh-section {
        margin-bottom: var(--gh-space-3);
    }

    .gh-section-header {
        padding: var(--gh-space-3) var(--gh-space-4);
        font-size: var(--gh-text-base);
        min-height: 48px;
    }

    .gh-section-header .chevron {
        font-size: var(--gh-text-lg);
    }

    .gh-section-body {
        padding: 0 var(--gh-space-4) var(--gh-space-4);
    }
}


/* ==========================================================================
   Filter Status Bar
   ========================================================================== */
.gh-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--gh-space-3);
    padding: var(--gh-space-3) var(--gh-space-4);
    background: var(--gh-primary-50);
    border: 1px solid var(--gh-primary-light);
    border-radius: var(--gh-radius-md);
    margin-bottom: var(--gh-space-4);
    font-size: var(--gh-text-sm);
}

/* Mobile filter bar optimizations */
@media (max-width: 767px) {
    .gh-filter-bar {
        padding: var(--gh-space-2) var(--gh-space-3);
        gap: var(--gh-space-2);
        margin-bottom: var(--gh-space-3);
        font-size: var(--gh-text-xs);
        border-radius: var(--gh-radius-sm);
    }

    /* Stack filter bar content vertically on mobile */
    .gh-filter-bar > div {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--gh-space-1);
    }

    /* Hide decorative separators on mobile */
    .gh-filter-bar .mx-2 {
        display: none;
    }
}


/* ==========================================================================
   Detail Page Styles
   ========================================================================== */
.gh-detail-grid {
    display: grid;
    gap: var(--gh-space-3);
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .gh-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .gh-detail-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gh-detail-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    padding: var(--gh-space-3) var(--gh-space-4);
    min-width: 0;
}

.leaflet-container {
    max-width: 100%;
}

.gh-detail-card-title {
    font-size: var(--gh-text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gh-gray-500);
    margin-bottom: var(--gh-space-3);
    padding-bottom: var(--gh-space-2);
    border-bottom: 1px solid var(--gh-gray-200);
}

.gh-detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--gh-space-1) 0;
    font-size: var(--gh-text-sm);
    border-bottom: 1px solid var(--gh-gray-100);
}

.gh-detail-row:last-child {
    border-bottom: none;
}

.gh-detail-label {
    color: var(--gh-gray-500);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: var(--gh-space-3);
}

.gh-detail-value {
    color: var(--gh-gray-900);
    font-weight: 500;
    text-align: right;
}

/* Collapsible detail card toggle button */
.gh-detail-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-size: var(--gh-text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gh-gray-500);
    padding: 0;
    padding-bottom: var(--gh-space-2);
    margin-bottom: var(--gh-space-3);
    border-bottom: 1px solid var(--gh-gray-200);
    text-align: left;
}

.gh-detail-toggle .chevron {
    transition: transform var(--gh-transition-base);
    color: var(--gh-gray-400);
}

.gh-detail-toggle.collapsed .chevron {
    transform: rotate(-90deg);
}

/* Desktop: always show detail card body regardless of collapse state */
@media (min-width: 768px) {
    .gh-detail-card .gh-detail-card-body.collapse:not(.show),
    .gh-detail-card .gh-detail-card-body.collapsing {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .gh-detail-toggle {
        cursor: default;
        pointer-events: none;
    }
}

/* Mobile optimizations for detail cards */
@media (max-width: 767px) {
    .gh-detail-card {
        padding: var(--gh-space-3);
    }

    .gh-detail-toggle {
        font-size: var(--gh-text-sm);
        padding: var(--gh-space-1) 0;
        padding-bottom: var(--gh-space-2);
        margin-bottom: 0;
        min-height: 40px;
    }

    .gh-detail-toggle:not(.collapsed) {
        margin-bottom: var(--gh-space-2);
    }

    .gh-detail-row {
        padding: var(--gh-space-1) 0;
        font-size: var(--gh-text-sm);
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .gh-detail-label {
        font-size: var(--gh-text-xs);
        margin-right: 0;
    }

    .gh-detail-value {
        text-align: left;
        font-size: var(--gh-text-sm);
    }

    /* Compact spacing for detail grid on mobile */
    .gh-detail-grid {
        gap: var(--gh-space-3);
    }
}


/* ==========================================================================
   Mobile Data Cards (Generic)
   ========================================================================== */
.gh-data-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    overflow: hidden;
    margin-bottom: var(--gh-space-3);
    padding: var(--gh-space-4);
    transition: box-shadow var(--gh-transition-base);
}

.gh-data-card:hover {
    box-shadow: var(--gh-shadow-md);
}

.gh-data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--gh-space-3);
    padding-bottom: var(--gh-space-3);
    border-bottom: 1px solid var(--gh-gray-200);
}

.gh-data-card-title {
    font-weight: 600;
    font-size: var(--gh-text-base);
    color: var(--gh-gray-900);
}

.gh-data-card-row {
    display: flex;
    justify-content: space-between;
    padding: var(--gh-space-2) 0;
    font-size: var(--gh-text-sm);
    border-bottom: 1px solid var(--gh-gray-100);
}

.gh-data-card-row:last-child {
    border-bottom: none;
}

.gh-data-card-label {
    color: var(--gh-gray-500);
    font-weight: 500;
    flex-shrink: 0;
    margin-right: var(--gh-space-3);
}

.gh-data-card-value {
    color: var(--gh-gray-900);
    font-weight: 400;
    text-align: right;
}

.gh-data-card-actions {
    display: flex;
    gap: var(--gh-space-2);
    margin-top: var(--gh-space-3);
    padding-top: var(--gh-space-3);
    border-top: 1px solid var(--gh-gray-100);
}

/* Mobile data card optimizations */
@media (max-width: 767px) {
    .gh-data-card {
        padding: var(--gh-space-3);
        margin-bottom: var(--gh-space-2);
    }

    .gh-data-card-header {
        margin-bottom: var(--gh-space-2);
        padding-bottom: var(--gh-space-2);
    }

    .gh-data-card-title {
        font-size: var(--gh-text-sm);
    }

    .gh-data-card-row {
        padding: 6px 0;
        font-size: var(--gh-text-xs);
    }

    .gh-data-card-label {
        font-size: var(--gh-text-xs);
    }

    .gh-data-card-value {
        font-size: var(--gh-text-xs);
    }

    .gh-data-card-actions {
        gap: var(--gh-space-2);
        margin-top: var(--gh-space-2);
        padding-top: var(--gh-space-2);
    }
}

/* ==========================================================================
   Task Cards (Mobile)
   ========================================================================== */
.gh-task-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    overflow: hidden;
    margin-bottom: var(--gh-space-3);
    transition: box-shadow var(--gh-transition-base);
}

.gh-task-card:hover {
    box-shadow: var(--gh-shadow-md);
}

.gh-task-card-header {
    padding: var(--gh-space-3) var(--gh-space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gh-gray-100);
    font-weight: 500;
}

.gh-task-card-body {
    padding: var(--gh-space-4);
}

.gh-task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gh-space-4);
    padding: var(--gh-space-3);
    background: var(--gh-gray-50);
    border-radius: var(--gh-radius-sm);
    margin-bottom: var(--gh-space-3);
    font-size: var(--gh-text-sm);
}

.gh-task-card-footer {
    padding: var(--gh-space-3) var(--gh-space-4);
    display: flex;
    gap: var(--gh-space-2);
    border-top: 1px solid var(--gh-gray-100);
    background: var(--gh-gray-50);
}

/* Mobile task card optimizations */
@media (max-width: 767px) {
    .gh-task-card {
        margin-bottom: var(--gh-space-2);
    }

    .gh-task-card-header {
        padding: var(--gh-space-2) var(--gh-space-3);
        font-size: var(--gh-text-sm);
    }

    .gh-task-card-body {
        padding: var(--gh-space-3);
    }

    .gh-task-card-meta {
        gap: var(--gh-space-3);
        padding: var(--gh-space-2);
        margin-bottom: var(--gh-space-2);
        font-size: var(--gh-text-xs);
    }

    .gh-task-card-footer {
        padding: var(--gh-space-2) var(--gh-space-3);
    }
}


/* ==========================================================================
   Map View
   ========================================================================== */
.gh-map-container {
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    overflow: hidden;
    box-shadow: var(--gh-shadow-md);
}

.gh-map-container #map {
    height: 75vh;
    width: 100%;
}


/* ==========================================================================
   Forms (Enhanced)
   ========================================================================== */
.gh-form-card {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-lg);
    padding: var(--gh-space-6);
    box-shadow: var(--gh-shadow-sm);
}

.gh-form-card .form-control,
.gh-form-card .form-select {
    border-color: var(--gh-border-color);
    border-radius: var(--gh-radius-sm);
    font-size: var(--gh-text-base);
    padding: var(--gh-space-2) var(--gh-space-3);
}

.gh-form-card .form-control:focus,
.gh-form-card .form-select:focus {
    border-color: var(--gh-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.gh-form-card label {
    font-weight: 500;
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-700);
}

/* Required field indicator — red asterisk after label */
.gh-form-card label.requiredField::after,
.gh-form-card .required label::after,
label.requiredField::after {
    content: ' *';
    color: var(--gh-danger, #dc2626);
    font-weight: 700;
}

/* Mobile: prevent iOS zoom on input focus + improve spacing */
@media (max-width: 767px) {
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
        padding: var(--gh-space-3) var(--gh-space-3);
    }

    .form-label {
        font-size: var(--gh-text-base);
        font-weight: 600;
        margin-bottom: var(--gh-space-2);
    }

    .mb-3 {
        margin-bottom: var(--gh-space-5) !important;
    }

    /* Increase checkbox/radio touch targets */
    .form-check-input {
        width: 20px;
        height: 20px;
        margin-top: 0.15em;
    }

    .form-check {
        padding-left: 2rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-check-label {
        font-size: var(--gh-text-base);
        padding-left: var(--gh-space-2);
    }
}


/* ==========================================================================
   Login Page
   ========================================================================== */
.gh-login-wrap {
    min-height: calc(100vh - var(--gh-navbar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gh-space-4);
    background: linear-gradient(135deg, var(--gh-gray-50), var(--gh-primary-50));
}

.gh-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--gh-white);
    border-radius: var(--gh-radius-xl);
    box-shadow: var(--gh-shadow-xl);
    padding: var(--gh-space-8) var(--gh-space-6);
}

.gh-login-card h2 {
    font-size: var(--gh-text-2xl);
    font-weight: 700;
    color: var(--gh-gray-900);
    text-align: center;
    margin-bottom: var(--gh-space-6);
}


/* ==========================================================================
   Responsive Table → Cards on Mobile
   ========================================================================== */
@media (min-width: 768px) {
    .gh-mobile-cards {
        display: none;
    }
}

@media (max-width: 767px) {
    .gh-desktop-table {
        display: none;
    }
}


/* ==========================================================================
   Misc Utilities
   ========================================================================== */
.gh-empty-state {
    text-align: center;
    padding: var(--gh-space-10) var(--gh-space-4);
    color: var(--gh-gray-500);
}

.gh-empty-state i {
    font-size: 2.5rem;
    margin-bottom: var(--gh-space-4);
    color: var(--gh-gray-300);
    display: block;
}

/* Mobile empty state optimizations */
@media (max-width: 767px) {
    .gh-empty-state {
        padding: var(--gh-space-6) var(--gh-space-3);
        font-size: var(--gh-text-sm);
    }

    .gh-empty-state i {
        font-size: 2rem;
        margin-bottom: var(--gh-space-3);
    }
}

.gh-divider {
    border: none;
    border-top: 1px solid var(--gh-gray-200);
    margin: var(--gh-space-4) 0;
}

/* Zoomable images */
.gh-zoomable {
    cursor: zoom-in;
    transition: transform var(--gh-transition-base);
    border-radius: var(--gh-radius-md);
}

.gh-zoomable:hover {
    transform: scale(1.01);
}

/* Zoom controls */
.gh-zoom-controls {
    position: absolute;
    bottom: var(--gh-space-5);
    right: var(--gh-space-5);
    background: rgba(0, 0, 0, 0.6);
    padding: var(--gh-space-2) var(--gh-space-3);
    border-radius: var(--gh-radius-md);
    display: flex;
    gap: var(--gh-space-2);
}

.gh-zoom-controls button {
    color: white;
    background: none;
    border: none;
    padding: var(--gh-space-1);
    cursor: pointer;
    border-radius: var(--gh-radius-sm);
    transition: background var(--gh-transition-fast);
}

.gh-zoom-controls button:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Clickable image */
.gh-img-clickable {
    cursor: pointer;
    transition: opacity var(--gh-transition-base);
    border-radius: var(--gh-radius-md);
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.gh-img-clickable:hover {
    opacity: 0.85;
}

/* ==========================================================================
   HTMX Progress Bar
   ========================================================================== */
#htmx-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gh-primary), #60a5fa);
    z-index: 9999;
    width: 0;
    opacity: 0;
    pointer-events: none;
}


/* Scrollbar styling */
.gh-sidebar::-webkit-scrollbar {
    width: 4px;
}

.gh-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.gh-sidebar::-webkit-scrollbar-thumb {
    background: var(--gh-gray-300);
    border-radius: 2px;
}

/* Bulk tax table improvements */
.gh-bulk-table .form-control-sm {
    font-size: var(--gh-text-sm);
    padding: var(--gh-space-1) var(--gh-space-2);
    border-radius: var(--gh-radius-sm);
}

.gh-bulk-table .actions .btn {
    display: block;
    width: 28px;
    text-align: center;
    padding: var(--gh-space-1) 0;
    margin-bottom: 2px;
}

/* Summary card (for detail pages) */
.gh-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--gh-space-4);
}

.gh-summary-item {
    text-align: center;
}

.gh-summary-item .label {
    font-size: var(--gh-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gh-gray-500);
}

.gh-summary-item .value {
    font-size: var(--gh-text-lg);
    font-weight: 700;
    color: var(--gh-gray-900);
    margin-top: var(--gh-space-1);
}

/* Mobile optimizations for summary grid */
@media (max-width: 767px) {
    .gh-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--gh-space-3);
    }

    .gh-summary-item {
        padding: var(--gh-space-3);
        background: var(--gh-gray-50);
        border-radius: var(--gh-radius-md);
    }

    .gh-summary-item .label {
        font-size: var(--gh-text-xs);
    }

    .gh-summary-item .value {
        font-size: var(--gh-text-base);
        margin-top: 4px;
        word-break: break-word;
    }
}

/* Resource items */
.gh-resource-item {
    padding: var(--gh-space-4);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-md);
    background: var(--gh-white);
    margin-bottom: var(--gh-space-3);
    transition: box-shadow var(--gh-transition-base);
}

.gh-resource-item:hover {
    box-shadow: var(--gh-shadow-sm);
}

.gh-resource-item .item-title {
    font-weight: 600;
    font-size: var(--gh-text-base);
}

.gh-resource-item .item-description {
    margin-top: var(--gh-space-2);
    color: var(--gh-gray-600);
    font-size: var(--gh-text-sm);
    white-space: pre-wrap;
}


/* ==========================================================================
   Task Page — Summary Stat Cards
   ========================================================================== */
.gh-task-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gh-space-3);
    margin-bottom: var(--gh-space-4);
}

@media (max-width: 575px) {
    .gh-task-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gh-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--gh-space-4) var(--gh-space-3);
    border-radius: var(--gh-radius-lg);
    border: 2px solid var(--gh-border-color);
    background: var(--gh-white);
    text-decoration: none;
    transition: all var(--gh-transition-fast);
    cursor: pointer;
}

.gh-stat-card:hover {
    box-shadow: var(--gh-shadow-md);
    transform: translateY(-1px);
}

.gh-stat-card--active {
    border-width: 2px;
}

.gh-stat-card__count {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.gh-stat-card__label {
    font-size: var(--gh-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--gh-space-1);
}

/* Card color variants */
.gh-stat-card--open {
    border-color: var(--gh-danger-light);
}
.gh-stat-card--open .gh-stat-card__count { color: var(--gh-danger); }
.gh-stat-card--open .gh-stat-card__label { color: var(--gh-danger); }
.gh-stat-card--open.gh-stat-card--active {
    background: var(--gh-danger-light);
    border-color: var(--gh-danger);
}

.gh-stat-card--overdue {
    border-color: #fecaca;
}
.gh-stat-card--overdue .gh-stat-card__count { color: #991b1b; }
.gh-stat-card--overdue .gh-stat-card__label { color: #991b1b; }
.gh-stat-card--overdue.gh-stat-card--active {
    background: #fef2f2;
    border-color: #991b1b;
}

.gh-stat-card--waiting {
    border-color: var(--gh-warning-light);
}
.gh-stat-card--waiting .gh-stat-card__count { color: var(--gh-warning); }
.gh-stat-card--waiting .gh-stat-card__label { color: var(--gh-warning); }
.gh-stat-card--waiting.gh-stat-card--active {
    background: var(--gh-warning-light);
    border-color: var(--gh-warning);
}

.gh-stat-card--complete {
    border-color: var(--gh-success-light);
}
.gh-stat-card--complete .gh-stat-card__count { color: var(--gh-success); }
.gh-stat-card--complete .gh-stat-card__label { color: var(--gh-success); }
.gh-stat-card--complete.gh-stat-card--active {
    background: var(--gh-success-light);
    border-color: var(--gh-success);
}

/* Person filter cards */
.gh-person-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--gh-space-3);
    margin-bottom: var(--gh-space-4);
}

@media (max-width: 768px) {
    .gh-person-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 575px) {
    .gh-person-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.gh-stat-card--person-ple {
    border-color: var(--gh-person-ple-border);
}
.gh-stat-card--person-ple .gh-stat-card__count { color: #065f46; }
.gh-stat-card--person-ple .gh-stat-card__label { color: #065f46; }
.gh-stat-card--person-ple.gh-stat-card--active {
    background: var(--gh-person-ple);
    border-color: var(--gh-person-ple-border);
}

.gh-stat-card--person-poppy {
    border-color: var(--gh-person-poppy-border);
}
.gh-stat-card--person-poppy .gh-stat-card__count { color: #9d174d; }
.gh-stat-card--person-poppy .gh-stat-card__label { color: #9d174d; }
.gh-stat-card--person-poppy.gh-stat-card--active {
    background: var(--gh-person-poppy);
    border-color: var(--gh-person-poppy-border);
}

.gh-stat-card--person-pik {
    border-color: var(--gh-person-pik-border);
}
.gh-stat-card--person-pik .gh-stat-card__count { color: #1e40af; }
.gh-stat-card--person-pik .gh-stat-card__label { color: #1e40af; }
.gh-stat-card--person-pik.gh-stat-card--active {
    background: var(--gh-person-pik);
    border-color: var(--gh-person-pik-border);
}

.gh-stat-card--person-pep {
    border-color: var(--gh-person-pep-border);
}
.gh-stat-card--person-pep .gh-stat-card__count { color: #92400e; }
.gh-stat-card--person-pep .gh-stat-card__label { color: #92400e; }
.gh-stat-card--person-pep.gh-stat-card--active {
    background: var(--gh-person-pep);
    border-color: var(--gh-person-pep-border);
}

.gh-stat-card--person-unassigned {
    border-color: var(--gh-gray-300);
}
.gh-stat-card--person-unassigned .gh-stat-card__count { color: var(--gh-gray-600); }
.gh-stat-card--person-unassigned .gh-stat-card__label { color: var(--gh-gray-600); }
.gh-stat-card--person-unassigned.gh-stat-card--active {
    background: var(--gh-gray-100);
    border-color: var(--gh-gray-500);
}


/* ==========================================================================
   Task Page — Inline Status Dropdown
   ========================================================================== */
.gh-status-dropdown {
    position: relative;
    display: inline-block;
}

.gh-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25em 0.6em;
    font-size: var(--gh-text-xs);
    font-weight: 600;
    border-radius: var(--gh-radius-full);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--gh-transition-fast);
    line-height: 1.4;
}

.gh-status-btn--open {
    background: var(--gh-danger-light);
    color: var(--gh-danger);
}
.gh-status-btn--open:hover { background: #fecaca; }

.gh-status-btn--waiting {
    background: var(--gh-warning-light);
    color: var(--gh-warning);
}
.gh-status-btn--waiting:hover { background: #fef3c7; }

.gh-status-btn--complete {
    background: var(--gh-success-light);
    color: var(--gh-success);
}
.gh-status-btn--complete:hover { background: #d1fae5; }

.gh-status-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 140px;
    margin-top: 4px;
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-md);
    box-shadow: var(--gh-shadow-lg);
    padding: var(--gh-space-1) 0;
}

.gh-status-menu.open {
    display: block;
}

.gh-status-option {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: var(--gh-space-2) var(--gh-space-3);
    font-size: var(--gh-text-sm);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gh-gray-700);
    text-align: left;
    transition: background var(--gh-transition-fast);
}

.gh-status-option:hover {
    background: var(--gh-gray-50);
}

.gh-status-option.active {
    font-weight: 600;
    background: var(--gh-primary-50);
    color: var(--gh-primary);
}


/* ==========================================================================
   Task Page — Deadline Styling
   ========================================================================== */
.gh-deadline {
    font-size: var(--gh-text-sm);
    white-space: nowrap;
}

.gh-deadline--overdue {
    color: var(--gh-danger);
    font-weight: 600;
}

.gh-deadline--today {
    color: var(--gh-warning);
    font-weight: 600;
}


/* ==========================================================================
   Task Page — Expandable Details
   ========================================================================== */
.gh-task-details-wrap {
    margin-top: var(--gh-space-1);
}

.gh-task-details-text {
    font-size: var(--gh-text-sm);
    line-height: 1.5;
    max-height: 2.5em;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.gh-task-details-wrap.expanded .gh-task-details-text {
    max-height: none;
}

.gh-task-details-toggle {
    border: none;
    background: none;
    color: var(--gh-primary);
    font-size: var(--gh-text-xs);
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
}

.gh-task-details-toggle:hover {
    text-decoration: underline;
}

.gh-task-details-toggle .hide-label {
    display: none;
}

.gh-task-details-wrap.expanded .gh-task-details-toggle .show-label {
    display: none;
}

.gh-task-details-wrap.expanded .gh-task-details-toggle .hide-label {
    display: inline;
}


/* ==========================================================================
   Task Page — Notes tooltip icon
   ========================================================================== */
.gh-notes-icon {
    display: inline-flex;
    align-items: center;
    margin-left: var(--gh-space-2);
    color: var(--gh-gray-400);
    cursor: help;
    font-size: var(--gh-text-sm);
}

.gh-notes-icon:hover {
    color: var(--gh-primary);
}


/* ==========================================================================
   Task Page — Icon-only button
   ========================================================================== */
.gh-btn-icon {
    padding: var(--gh-space-1) var(--gh-space-2);
    min-width: unset;
}


/* ==========================================================================
   Tax Table Enhancements (Plot Detail)
   ========================================================================== */

/* Color dot before usage code text */
.gh-usage-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Year total row — prominent highlight */
.gh-tax-total-row td {
    background: var(--gh-primary-50) !important;
    border-top: 2px solid var(--gh-primary-light) !important;
    border-bottom: 2px solid var(--gh-primary-light) !important;
    font-weight: 700;
    font-size: var(--gh-text-base);
    color: var(--gh-gray-900);
    padding-top: var(--gh-space-3);
    padding-bottom: var(--gh-space-3);
}

/* Grand total row — dark, eye-catching */
.gh-tax-grand-total td {
    background: var(--gh-gray-800) !important;
    color: var(--gh-white) !important;
    font-weight: 700;
    font-size: var(--gh-text-md);
    padding-top: var(--gh-space-3);
    padding-bottom: var(--gh-space-3);
    border: none !important;
}

/* Zebra striping for detailed tables */
.gh-table-zebra tbody tr:nth-child(even) td {
    background: var(--gh-gray-50);
}

.gh-table-zebra tbody tr:hover td {
    background: var(--gh-primary-50);
}

/* Sticky header for scrollable tables */
.gh-table-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gh-gray-50);
}

/* ==========================================================================
   Global Mobile Optimizations
   ========================================================================== */
@media (max-width: 767px) {
    /* Ensure all images are responsive */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Improve link tap targets */
    a {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }

    /* Better spacing for inline elements */
    .d-flex.gap-2 {
        gap: var(--gh-space-2) !important;
    }

    .d-flex.gap-3 {
        gap: var(--gh-space-2) !important;
    }

    /* Reduce excessive margins */
    .mb-3 {
        margin-bottom: var(--gh-space-3) !important;
    }

    .mb-4 {
        margin-bottom: var(--gh-space-3) !important;
    }

    .mb-5 {
        margin-bottom: var(--gh-space-4) !important;
    }

    .mt-3 {
        margin-top: var(--gh-space-3) !important;
    }

    .mt-4 {
        margin-top: var(--gh-space-3) !important;
    }

    /* Improve modal readability */
    .modal-body {
        font-size: var(--gh-text-base);
        padding: var(--gh-space-4);
    }

    .modal-header {
        padding: var(--gh-space-3) var(--gh-space-4);
    }

    .modal-footer {
        padding: var(--gh-space-3) var(--gh-space-4);
    }

    .modal-title {
        font-size: var(--gh-text-lg);
    }
}

/* Filter Sections */
.filter-section {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gh-border);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gh-text-secondary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--gh-primary);
}

.filter-section-title i {
    color: var(--gh-primary);
    margin-right: 0.25rem;
}

.filter-section .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--gh-text);
}

.filter-section .form-check-label {
    font-size: 0.875rem;
}

/* Compact form controls in sidebar */
.gh-sidebar .form-control-sm,
.gh-sidebar .form-select-sm {
    font-size: 0.875rem;
}

/* ---------- Utility Classes for Common Patterns ---------- */

/* Usage Badge Colors - Replace hardcoded inline backgrounds */
.gh-badge-usage-vacant {
    background: var(--gh-warning);
    color: #000;
}

.gh-badge-usage-agricultural {
    background: var(--gh-success);
    color: #fff;
}

.gh-badge-usage-residential {
    background: var(--gh-primary);
    color: #fff;
}

.gh-badge-usage-other {
    background: var(--gh-gray-500);
    color: #fff;
}

/* Success/Warning/Danger background variants */
.gh-bg-success-50 {
    background: #ecfdf5;
    color: #065f46;
}

.gh-bg-warning-50 {
    background: #fffbeb;
    color: #92400e;
}

.gh-bg-danger-50 {
    background: #fef2f2;
    color: #991b1b;
}

.gh-bg-info-50 {
    background: #cfe2ff;
    color: #084298;
}

.gh-bg-accent-50 {
    background: var(--gh-primary-50);
    color: var(--gh-primary);
}

/* Text color utilities */
.gh-text-danger {
    color: var(--gh-danger);
}

.gh-text-success {
    color: var(--gh-success);
}

.gh-text-warning {
    color: var(--gh-warning);
}

.gh-text-muted {
    color: var(--gh-gray-600);
}

/* Flex layout utilities */
.gh-flex {
    display: flex;
}

.gh-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gh-flex-center {
    display: flex;
    align-items: center;
}

.gh-flex-col {
    display: flex;
    flex-direction: column;
}

.gh-flex-gap-1 {
    gap: var(--gh-space-1);
}

.gh-flex-gap-2 {
    gap: var(--gh-space-2);
}

.gh-flex-gap-3 {
    gap: var(--gh-space-3);
}

.gh-flex-gap-4 {
    gap: var(--gh-space-4);
}

.gh-flex-wrap {
    flex-wrap: wrap;
}

.gh-flex-shrink-0 {
    flex-shrink: 0;
}

.gh-min-w-0 {
    min-width: 0;
}

/* Grid layout utilities */
.gh-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.gh-grid-auto-1fr {
    display: grid;
    grid-template-columns: auto 1fr;
}

.gh-grid-auto-1fr-auto {
    display: grid;
    grid-template-columns: auto 1fr auto;
}

.gh-grid-gap-2 {
    gap: var(--gh-space-2);
}

.gh-grid-gap-3 {
    gap: var(--gh-space-3);
}

.gh-col-span-2 {
    grid-column: span 2;
}

/* Alignment utilities */
.gh-align-center {
    align-items: center;
}

.gh-align-start {
    align-items: start;
}

.gh-justify-end {
    justify-content: flex-end;
}

/* Border utilities */
.gh-border-radius {
    border-radius: var(--gh-radius-md);
}

.gh-border-radius-sm {
    border-radius: var(--gh-radius-sm);
}

/* Padding utilities */
.gh-p-3 {
    padding: var(--gh-space-3);
}

.gh-p-4 {
    padding: var(--gh-space-4);
}

.gh-py-2 {
    padding-top: var(--gh-space-2);
    padding-bottom: var(--gh-space-2);
}

.gh-px-3 {
    padding-left: var(--gh-space-3);
    padding-right: var(--gh-space-3);
}

/* Margin utilities */
.gh-mb-2 {
    margin-bottom: var(--gh-space-2);
}

.gh-mb-3 {
    margin-bottom: var(--gh-space-3);
}

.gh-mb-4 {
    margin-bottom: var(--gh-space-4);
}

.gh-mt-2 {
    margin-top: var(--gh-space-2);
}

.gh-mt-auto {
    margin-top: auto;
}

.gh-grid-full-width {
    grid-column: 1 / -1;
}

.gh-gap-3 {
    gap: var(--gh-space-3);
}

.gh-min-w-0 {
    min-width: 0;
}

.gh-mb-1 {
    margin-bottom: var(--gh-space-1);
}

/* Font size utilities */
.gh-font-sm {
    font-size: var(--gh-text-sm);
}

.gh-font-xs {
    font-size: var(--gh-text-xs);
}

.gh-font-lg {
    font-size: var(--gh-text-lg);
}

.gh-font-xl {
    font-size: var(--gh-text-xl);
}

/* Font weight utilities */
.gh-font-normal {
    font-weight: 400;
}

.gh-font-medium {
    font-weight: 500;
}

.gh-font-semibold {
    font-weight: 600;
}

.gh-font-bold {
    font-weight: 700;
}

/* Visibility utility */
.gh-hidden {
    display: none !important;
}

/* White space utilities */
.gh-nowrap {
    white-space: nowrap;
}

/* Avatar circle utility */
.gh-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--gh-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.gh-avatar-gradient-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.gh-avatar-neutral {
    background: var(--gh-gray-200);
    color: var(--gh-gray-600);
}

/* Rental card components */
.gh-rental-rent-highlight {
    background: var(--gh-accent-50);
    padding: var(--gh-space-3);
    border-radius: var(--gh-radius-sm);
    margin-bottom: var(--gh-space-3);
}

.gh-rental-rent-highlight .gh-rent-label {
    font-size: var(--gh-text-sm);
    color: var(--gh-gray-600);
    margin-bottom: var(--gh-space-1);
}

.gh-rental-rent-highlight .gh-rent-value {
    font-size: var(--gh-text-xl);
    font-weight: 600;
    color: var(--gh-accent-700);
}

.gh-rental-rent-highlight .gh-rent-freq {
    font-size: var(--gh-text-sm);
    font-weight: 400;
    color: var(--gh-gray-600);
}

.gh-rental-overdue-banner {
    background: var(--gh-danger-50);
    border-left: 4px solid var(--gh-danger);
    padding: var(--gh-space-3);
    margin: var(--gh-space-3) 0;
    border-radius: 0 var(--gh-radius-sm) var(--gh-radius-sm) 0;
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
    color: #991b1b;
}

.gh-rental-payment-info {
    color: var(--gh-success-700);
    background: var(--gh-success-50);
    padding: var(--gh-space-2);
    border-radius: var(--gh-radius-sm);
    margin-top: var(--gh-space-2);
}

/* Responsive max-width utilities */
.gh-max-w-500 {
    max-width: 500px;
}

@media (max-width: 767px) {
    .gh-max-w-500 {
        max-width: 100%;
    }
}

/* ==========================================================================
   Scroll to Top Button
   ========================================================================== */
.gh-scroll-top {
    position: fixed;
    bottom: var(--gh-space-6);
    right: var(--gh-space-4);
    width: 48px;
    height: 48px;
    border-radius: var(--gh-radius-full);
    background: var(--gh-primary);
    color: var(--gh-white);
    border: none;
    box-shadow: var(--gh-shadow-lg);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--gh-transition-base);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--gh-text-lg);
}

.gh-scroll-top:hover {
    background: var(--gh-primary-hover);
    transform: translateY(-2px);
}

.gh-scroll-top:active {
    transform: translateY(0);
}

.gh-scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 767px) {
    .gh-scroll-top {
        bottom: max(var(--gh-space-4), env(safe-area-inset-bottom));
        right: var(--gh-space-3);
    }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast {
    min-width: 280px;
    font-size: var(--gh-text-sm);
    box-shadow: var(--gh-shadow-lg);
}

.toast-body {
    padding: var(--gh-space-3) var(--gh-space-4);
}

@media (max-width: 767px) {
    .toast-container {
        width: 100%;
        padding: var(--gh-space-2) !important;
        left: 0;
        right: 0;
    }

    .toast {
        min-width: auto;
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   Quick Search Presets
   ========================================================================== */
.gh-quick-search-presets .badge {
    padding: 0.4rem 0.75rem;
    font-size: var(--gh-text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--gh-transition-fast);
}

.gh-quick-search-presets .badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--gh-shadow-sm);
}

@media (max-width: 767px) {
    .gh-quick-search-presets .badge {
        font-size: 11px;
        padding: 0.3rem 0.6rem;
    }
}

/* ==========================================================================
   View Mode Toggle (Simple vs Pro)
   ========================================================================== */

/* Simple Mode: Hide advanced filters */
.simple-mode .gh-advanced-filters {
    display: none !important;
}

/* Pro Mode: Show everything */
.pro-mode .gh-advanced-filters {
    display: block;
}

/* Simple Mode: Larger buttons for easier tapping */
.simple-mode .gh-btn {
    min-height: 44px;
    padding: var(--gh-space-3) var(--gh-space-4);
}

.simple-mode .gh-btn-sm {
    min-height: 40px;
}

/* Simple Mode: More spacing for easier interaction */
.simple-mode .filter-section {
    margin-bottom: var(--gh-space-3);
}

/* Pro Mode: More compact layout */
.pro-mode .filter-section {
    margin-bottom: var(--gh-space-2);
}

@media (max-width: 767px) {
    /* Simple mode on mobile: Even larger tap targets */
    .simple-mode .gh-btn {
        min-height: 48px;
        font-size: var(--gh-text-base);
    }

    .simple-mode .form-select,
    .simple-mode .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* =================================================================
   Sticky Detail Page Header
   ================================================================= */

.gh-page-header-sticky {
    position: sticky;
    top: var(--gh-navbar-height);
    background: var(--gh-gray-50);
    z-index: 100;
    margin: calc(-1 * var(--gh-space-4)) calc(-1 * var(--gh-space-4)) var(--gh-space-4);
    padding: var(--gh-space-4);
    border-bottom: 1px solid var(--gh-border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (max-width: 767px) {
    .gh-page-header-sticky {
        margin: calc(-1 * var(--gh-space-3)) calc(-1 * var(--gh-space-3)) var(--gh-space-3);
        padding: var(--gh-space-3);
    }
}

/* =================================================================
   Section Jump Links - Quick Navigation
   ================================================================= */

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--gh-navbar-height) + var(--gh-space-4));
}

.gh-section-jump-links {
    background: var(--gh-white);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-md);
    padding: var(--gh-space-3) var(--gh-space-4);
    margin-bottom: var(--gh-space-5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Page-type accents: distinguish plot vs group detail at a glance */
.gh-section-jump-links--plot {
    background: var(--gh-primary-50);
    border-color: var(--gh-primary);
    border-top: 4px solid var(--gh-primary);
}
.gh-section-jump-links--plot .gh-section-jump-link {
    background: var(--gh-white);
}
.gh-section-jump-links--group {
    background: var(--gh-success-light);
    border-color: var(--gh-success);
    border-top: 4px solid var(--gh-success);
}
.gh-section-jump-links--group .gh-section-jump-link {
    background: var(--gh-white);
}
.gh-section-jump-links--group .gh-section-jump-link:hover {
    background: var(--gh-success-light);
    border-color: var(--gh-success);
    color: var(--gh-success-700);
}
.gh-section-jump-links--group .gh-jump-link-badge {
    background: var(--gh-success);
}
.gh-section-jump-links--group .gh-section-jump-link:hover .gh-jump-link-badge {
    background: var(--gh-success-700);
}

.gh-section-jump-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gh-space-2);
    justify-content: center;
}

.gh-section-jump-link {
    position: relative; /* For absolute positioning of count badge */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--gh-space-1);
    padding: var(--gh-space-3) var(--gh-space-4);
    min-width: 80px;
    background: var(--gh-gray-50);
    border: 1px solid var(--gh-border-color);
    border-radius: var(--gh-radius-md);
    text-decoration: none;
    color: var(--gh-text-color);
    font-size: var(--gh-text-sm);
    font-weight: 500;
    transition: all var(--gh-transition-fast);
    /* Mobile tap target */
    min-height: 48px;
}

.gh-section-jump-link:hover {
    background: var(--gh-primary-light);
    border-color: var(--gh-primary);
    color: var(--gh-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.gh-section-jump-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.gh-section-jump-link i {
    font-size: 1.25rem;
}

.gh-section-jump-link span {
    font-size: var(--gh-text-xs);
    white-space: nowrap;
}

/* Count badge on jump links */
.gh-jump-link-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--gh-primary);
    color: var(--gh-white);
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.gh-section-jump-link:hover .gh-jump-link-badge {
    background: var(--gh-primary-hover);
}

/* Orange badge variant (for detailed records count) */
.gh-jump-link-badge-orange {
    background: var(--gh-warning);
    right: auto;
    left: -6px;
}

.gh-section-jump-link:hover .gh-jump-link-badge-orange {
    background: var(--gh-warning-hover);
}

/* Mobile optimizations */
@media (max-width: 767px) {
    .gh-section-jump-links {
        margin-left: calc(-1 * var(--gh-space-4));
        margin-right: calc(-1 * var(--gh-space-4));
        border-left: none;
        border-right: none;
        border-radius: 0;
        padding: var(--gh-space-3);
    }

    .gh-section-jump-container {
        gap: var(--gh-space-2);
    }

    .gh-section-jump-link {
        flex: 1;
        min-width: 70px;
        padding: var(--gh-space-2) var(--gh-space-3);
    }

    .gh-section-jump-link i {
        font-size: 1.125rem;
    }
}

/* =================================================================
   iPhone Safe Area Insets (Notch Support)
   ================================================================= */

/* Support for iPhone notch/Dynamic Island */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    /* Navbar safe areas */
    .gh-navbar {
        padding-left: max(var(--gh-space-4), env(safe-area-inset-left));
        padding-right: max(var(--gh-space-4), env(safe-area-inset-right));
    }

    /* Main content safe areas */
    .gh-main {
        padding-left: max(var(--gh-space-4), env(safe-area-inset-left));
        padding-right: max(var(--gh-space-4), env(safe-area-inset-right));
        padding-bottom: max(var(--gh-space-4), env(safe-area-inset-bottom));
    }

    /* Fixed elements safe areas */
    .gh-scroll-top {
        right: max(var(--gh-space-4), calc(env(safe-area-inset-right) + var(--gh-space-2)));
        bottom: max(var(--gh-space-6), calc(env(safe-area-inset-bottom) + var(--gh-space-2)));
    }

    /* Toast container safe areas */
    .toast-container {
        top: max(var(--gh-space-3), env(safe-area-inset-top));
        right: max(var(--gh-space-3), calc(env(safe-area-inset-right) + var(--gh-space-2)));
    }
}

/* =================================================================
   Enhanced Mobile Tap Targets (WCAG 2.5.5 Level AAA)
   ================================================================= */

@media (max-width: 767px) {
    /* All buttons minimum 48px height */
    .gh-btn,
    .btn {
        min-height: 48px;
        min-width: 48px;
        padding: var(--gh-space-3) var(--gh-space-4);
    }

    .gh-btn-sm,
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        padding: var(--gh-space-2) var(--gh-space-3);
    }

    /* Nav links minimum tap target */
    .nav-link,
    .gh-breadcrumb a,
    .gh-page-header a.gh-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Form inputs minimum height */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .form-control-sm,
    .form-select-sm {
        min-height: 44px;
        font-size: 16px;
    }

    /* Checkbox and radio minimum tap area */
    .form-check-input {
        width: 24px;
        height: 24px;
        margin-top: 0.125rem;
    }

    .form-check {
        min-height: 44px;
        padding-left: 2rem;
        display: flex;
        align-items: center;
    }

    /* Table action buttons */
    .gh-table-wrap .gh-btn {
        min-width: 44px;
    }

    /* Section collapse buttons */
    .gh-section-header {
        min-height: 52px;
        padding: var(--gh-space-3) var(--gh-space-4);
    }

    /* Breadcrumb links */
    .gh-breadcrumb a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: var(--gh-space-2) var(--gh-space-1);
    }

    /* Modal close buttons */
    .btn-close {
        width: 48px;
        height: 48px;
        padding: 0;
    }

    /* Dropdown items */
    .dropdown-item {
        min-height: 48px;
        padding: var(--gh-space-3) var(--gh-space-4);
        display: flex;
        align-items: center;
    }

    /* Badge links (only standalone badge links, not inline card badges) */
    a.badge {
        min-height: 32px;
        padding: 0.5rem 0.75rem;
        display: inline-flex;
        align-items: center;
        font-size: 13px;
    }

    /* Keep inline card badges compact */
    .gh-card .badge,
    .gh-card-badge .badge {
        min-height: auto;
        padding: 0.2em 0.5em;
        font-size: 11px;
    }

    /* Icon-only buttons */
    .gh-btn i:only-child {
        margin: 0;
    }

    /* Pagination */
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: var(--gh-text-sm);
        padding: var(--gh-space-2);
    }

    .pagination {
        flex-wrap: nowrap;
        gap: var(--gh-space-1);
    }

    /* Per-page selector: compact on mobile */
    .gh-pagination-wrap {
        flex-direction: column;
        gap: var(--gh-space-2);
    }

    .gh-pagination-wrap .d-flex {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--gh-space-1);
    }
}


/* =================================================================
   Overview Page Mobile Enhancements
   ================================================================= */

/* Active filters: horizontally scrollable on mobile */
@media (max-width: 767px) {
    .gh-active-filters .d-flex {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: var(--gh-space-1);
    }

    .gh-active-filters .d-flex::-webkit-scrollbar {
        display: none;
    }

    .gh-filter-badge {
        flex-shrink: 0;
    }

    /* "Clear All" button stays visible */
    .gh-active-filters .ms-auto {
        flex-shrink: 0;
    }
}

/* Mobile card enhancements — larger tap area, cleaner layout */
@media (max-width: 767px) {
    .gh-card {
        /* Subtle active state for touch feedback */
        -webkit-tap-highlight-color: rgba(26, 86, 219, 0.08);
    }

    .gh-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Card header: keep plot ID prominent */
    .gh-card-id {
        font-size: var(--gh-text-base);
    }

    /* Card reference: slightly more visible */
    .gh-card-ref {
        font-size: var(--gh-text-xs);
        padding-bottom: var(--gh-space-1);
    }

    /* Card footer tax: make amount prominent */
    .gh-card-tax {
        font-size: var(--gh-text-sm);
    }

    .gh-card-tax strong {
        font-size: var(--gh-text-base);
    }

    /* Task badge: full width for visibility */
    .gh-card-task-badge {
        margin-top: var(--gh-space-2);
    }

    .gh-card-task-badge .gh-badge {
        display: block;
        text-align: center;
        padding: var(--gh-space-2);
        font-size: var(--gh-text-xs);
        min-height: auto;
    }
}

/* On very small screens, reduce main padding to maximize content */
@media (max-width: 374px) {
    .gh-main {
        padding: var(--gh-space-2) var(--gh-space-2);
    }

    .gh-card-link {
        padding: var(--gh-space-2);
    }

    .gh-card-meta {
        font-size: 11px;
    }
}

/* Tabs: equal-width on mobile for clean look */
@media (max-width: 479px) {
    .gh-tabs {
        gap: var(--gh-space-1);
        padding: 3px;
    }

    .gh-tab {
        font-size: var(--gh-text-xs);
        padding: var(--gh-space-2);
    }
}

/* Filter section title icons: larger touch target on mobile */
@media (max-width: 767px) {
    .filter-section {
        margin-bottom: var(--gh-space-3);
    }

    .filter-section-title {
        font-size: var(--gh-text-sm);
        padding-bottom: var(--gh-space-1);
        margin-bottom: var(--gh-space-2);
    }

    /* Quick search badges inside sidebar: proper sizing */
    .gh-sidebar .badge {
        min-height: 36px;
        font-size: 13px;
        padding: var(--gh-space-2) var(--gh-space-3);
    }
}

/* =================================================================
   Mobile Enhancements for Detail Pages
   ================================================================= */

/* Mobile "More" dropdown in page headers */
@media (max-width: 767px) {
    .gh-page-header .dropdown-menu {
        min-width: 200px;
    }

    .gh-page-header .dropdown-menu .dropdown-item {
        padding: var(--gh-space-3) var(--gh-space-4);
        font-size: var(--gh-text-base);
    }

    /* Ensure task/tax mobile cards have enough spacing */
    .gh-mobile-cards .gh-data-card + .gh-data-card {
        margin-top: var(--gh-space-2);
    }

    /* Mobile task card: ensure actions are full width */
    .gh-mobile-cards .gh-data-card-actions {
        flex-wrap: wrap;
    }

    .gh-mobile-cards .gh-data-card-actions .gh-btn {
        min-height: 44px;
    }

    /* Person badges in mobile cards */
    .gh-mobile-cards .gh-person-badge {
        margin-bottom: var(--gh-space-1);
    }

    /* Tax total row: responsive font size */
    .gh-tax-total-row td {
        font-size: var(--gh-text-sm) !important;
    }

    /* Plot detail: reduce map height on mobile */
    #plotMiniMap {
        height: 180px !important;
    }

    /* Rentals page: stack search form below title */
    .gh-page-header .gh-max-w-500 {
        width: 100%;
        max-width: 100%;
    }

    .gh-page-header .gh-max-w-500 form {
        flex: 1;
        min-width: 0;
    }

    .gh-page-header .gh-max-w-500 form input {
        min-width: 0;
    }

    /* Rental card: stack status badges vertically on small screens */
    .gh-card .gh-card-title .d-flex.gap-2 {
        gap: var(--gh-space-1) !important;
    }
}

/* Mobile back button: make it more prominent */
@media (max-width: 767px) {
    .gh-page-header .gh-btn-outline:first-child {
        font-weight: 600;
    }
}

/* ==========================================================================
   Bulk Actions Toolbar
   ========================================================================== */
.gh-bulk-toolbar {
    padding: var(--gh-space-3) var(--gh-space-4);
    background: var(--gh-primary-light);
    border-radius: var(--gh-radius-md);
    margin-bottom: var(--gh-space-3);
    border: 1px solid var(--gh-primary);
}

.gh-bulk-toolbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--gh-space-2);
}

.gh-bulk-toolbar-actions {
    display: flex;
    gap: var(--gh-space-2);
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .gh-bulk-toolbar {
        padding: var(--gh-space-2) var(--gh-space-3);
    }

    .gh-bulk-toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .gh-bulk-toolbar-actions {
        flex-wrap: wrap;
    }

    .gh-bulk-toolbar-actions .gh-btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
}

/* ==========================================================================
   Universal Search
   ========================================================================== */

.gh-search-wrapper {
    position: relative;
    max-width: 360px;
    width: 100%;
    margin-left: auto;
    order: 1;         /* Between brand and hamburger in flex layout */
}

.gh-search-form { width: 100%; }

.gh-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.gh-search-icon {
    position: absolute;
    left: var(--gh-space-3);
    color: var(--gh-gray-400);
    font-size: var(--gh-text-sm);
    pointer-events: none;
    z-index: 1;
}

.gh-search-input {
    width: 100%;
    padding: 6px var(--gh-space-3);
    padding-left: calc(var(--gh-space-3) + 1.25rem + var(--gh-space-2));
    padding-right: 4.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--gh-radius-md);
    color: var(--gh-white);
    font-size: var(--gh-text-sm);
    transition: all var(--gh-transition-fast);
    outline: none;
}

.gh-search-input::placeholder { color: var(--gh-gray-400); }

.gh-search-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gh-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.25);
}

.gh-search-spinner {
    position: absolute;
    right: 3.5rem;
    color: var(--gh-gray-400);
}

.gh-search-shortcut {
    position: absolute;
    right: var(--gh-space-3);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--gh-radius-sm);
    padding: 2px 6px;
    font-size: 11px;
    color: var(--gh-gray-400);
    font-family: var(--gh-font-mono);
    pointer-events: none;
}

/* Dropdown */
.gh-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--gh-space-1);
    background: var(--gh-white);
    border-radius: var(--gh-radius-lg);
    box-shadow: var(--gh-shadow-xl);
    border: 1px solid var(--gh-border-color);
    z-index: 1050;
    max-height: 480px;
    overflow-y: auto;
    display: none;
}

.gh-search-dropdown:not(:empty) { display: block; }

.gh-search-results { padding: var(--gh-space-2) 0; }

.gh-search-category-header {
    display: flex;
    align-items: center;
    gap: var(--gh-space-2);
    padding: var(--gh-space-2) var(--gh-space-4);
    font-size: var(--gh-text-xs);
    font-weight: 600;
    color: var(--gh-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gh-gray-100);
}

.gh-search-count {
    margin-left: auto;
    background: var(--gh-gray-100);
    border-radius: var(--gh-radius-full);
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gh-gray-600);
}

.gh-search-item {
    display: block;
    padding: var(--gh-space-2) var(--gh-space-4);
    text-decoration: none;
    color: var(--gh-gray-800);
    transition: background var(--gh-transition-fast);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.gh-search-item:hover,
.gh-search-item:focus,
.gh-search-item.gh-search-active {
    background: var(--gh-primary-50);
    border-left-color: var(--gh-primary);
    color: var(--gh-gray-900);
    text-decoration: none;
}

.gh-search-item-title {
    font-size: var(--gh-text-sm);
    font-weight: 600;
    line-height: 1.3;
}

.gh-search-item-meta {
    font-size: var(--gh-text-xs);
    color: var(--gh-gray-500);
    margin-top: 1px;
}

.gh-search-item-group {
    position: relative;
    padding-right: 40px;
}

.gh-search-item-map-btn {
    position: absolute;
    right: var(--gh-space-3);
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--gh-gray-500);
    background: transparent;
    cursor: pointer;
    transition: background var(--gh-transition-fast), color var(--gh-transition-fast);
}

.gh-search-item-map-btn:hover {
    background: var(--gh-primary);
    color: #fff;
}

.gh-search-see-all {
    font-style: italic;
    font-size: var(--gh-text-xs) !important;
    color: var(--gh-primary) !important;
    font-weight: 500;
}

.gh-search-footer {
    border-top: 1px solid var(--gh-gray-200);
    padding: var(--gh-space-2) var(--gh-space-4);
    text-align: center;
}

.gh-search-footer-link {
    font-size: var(--gh-text-sm);
    color: var(--gh-primary);
    text-decoration: none;
    font-weight: 500;
}

.gh-search-footer-link:hover { text-decoration: underline; }

.gh-search-empty {
    text-align: center;
    padding: var(--gh-space-6) var(--gh-space-4);
    color: var(--gh-gray-500);
}

.gh-search-empty i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: var(--gh-space-2);
}

.gh-search-empty p {
    margin: 0;
    font-size: var(--gh-text-sm);
}

/* Mobile: search sits between brand and hamburger */
@media (max-width: 991.98px) {
    .gh-search-wrapper {
        flex: 1;
        max-width: none;
        margin: 0 var(--gh-space-2);
        order: 1;
    }

    .gh-navbar .navbar-toggler {
        order: 2;
    }

    .gh-navbar .navbar-collapse {
        order: 3;
    }

    .gh-search-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 8px var(--gh-space-3);
        padding-left: calc(var(--gh-space-3) + 1.25rem + var(--gh-space-2));
        padding-right: var(--gh-space-3);
    }

    .gh-search-shortcut { display: none !important; }

    .gh-search-spinner {
        right: var(--gh-space-3);
    }

    .gh-search-dropdown {
        position: fixed;
        top: auto;
        left: var(--gh-space-3);
        right: var(--gh-space-3);
        max-height: 60vh;
    }
}

/* Very small phones: shorten placeholder */
@media (max-width: 374px) {
    .gh-search-wrapper {
        min-width: 0;
    }
}

/* ==========================================================================
   Tenant / Form Page Mobile Enhancements
   ========================================================================== */

/* Form cards: tighter padding on mobile */
@media (max-width: 767px) {
    .gh-form-card {
        padding: var(--gh-space-3);
    }

    .gh-form-card h5 {
        font-size: 14px;
    }

    /* Ensure form inputs have proper touch target size */
    .gh-form-card .form-control,
    .gh-form-card .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* KPI band: 2-col grid on small mobile */
@media (max-width: 479px) {
    .gh-kpi-band {
        grid-template-columns: 1fr 1fr;
    }
}
