/*
 * ═══════════════════════════════════════════════════════════════
 *  GOPBPD — Global Responsive Stylesheet
 *  Ensures full flexibility across: mobile (320px+), tablet (768px+),
 *  laptop (1024px+), and desktop (1280px+)
 * ═══════════════════════════════════════════════════════════════
 */

/* ─── 0. META-VIEWPORT SAFETY ──────────────────────────────────
   Prevents content from ever exceeding the viewport width.
   Essential for preventing horizontal scroll on any device.
────────────────────────────────────────────────────────────────*/
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* ─── 1. ROOT / RESET ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    min-width: 320px;
}

img, video, svg, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ─── 2. FLUID CONTAINER ──────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(1rem, 4vw, 2rem);
    padding-right: clamp(1rem, 4vw, 2rem);
}

/* ─── 3. PUBLIC NAVBAR ────────────────────────────────────────── */
.navbar {
    padding: 0.8rem clamp(1rem, 4vw, 3rem);
    flex-wrap: nowrap;
    gap: 1rem;
}

.logo img {
    height: clamp(48px, 8vw, 80px);
}

.brand-text {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

/* Mobile nav — smooth slide-down */
@media (max-width: 1024px) {
    .navbar {
        padding: 0.6rem 1.25rem;
        position: relative;
    }

    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
        padding: 1.5rem 1.25rem;
        background: var(--nav-bg, #dbeafe);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--nav-border);
        display: none;
        z-index: 999;
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .nav-links li a.dropdown-toggle {
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
    }

    ul.dropdown-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        display: none;
        text-align: center !important;
        width: 100% !important;
    }

    ul.dropdown-menu li {
        width: 100% !important;
        text-align: center !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    ul.dropdown-menu li a {
        justify-content: center !important;
        text-align: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        display: block !important;
    }

    .dropdown:hover .dropdown-menu,
    .dropdown.active .dropdown-menu {
        display: block;
    }
}

@media (max-width: 480px) {
    .logo img {
        height: 44px;
    }
    .brand-text {
        font-size: 1.1rem;
    }
}

/* ─── 4. HERO SECTION ─────────────────────────────────────────── */
.hero {
    padding: clamp(5rem, 12vw, 10rem) 0 clamp(3rem, 8vw, 8rem);
    background-attachment: scroll; /* fixed causes perf issues on mobile */
}

.hero-container {
    padding: 0 clamp(1rem, 4vw, 3rem);
}

.hero-content h1 {
    font-size: clamp(2rem, 6vw, 5.5rem) !important;
    letter-spacing: clamp(-0.5px, -0.03em, -1.5px);
    word-break: break-word;
}

.hero-content p {
    font-size: clamp(0.95rem, 2.5vw, 1.25rem) !important;
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 4.5rem);
}

.hero-btns {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.hero-btns .btn,
.hero-btns .btn-portal {
    width: auto;
}

@media (max-width: 768px) {
    .hero {
        padding: 6rem 0 3rem !important;
        background-attachment: scroll !important;
    }
    .hero-container {
        padding: 0 1.25rem !important;
    }
    .hero-content h1 {
        font-size: clamp(1.8rem, 8vw, 2.8rem) !important;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 5rem 0 2.5rem !important;
    }
    .hero-content h1 {
        font-size: clamp(1.6rem, 9vw, 2.2rem) !important;
    }
    .hero-btns {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-btns .btn,
    .hero-btns .btn-portal {
        width: 100%;
        text-align: center;
    }
}

/* ─── 5. FEATURE CARDS ────────────────────────────────────────── */
.feature-cards-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .feature-cards-wrap {
        grid-template-columns: 1fr !important;
    }
    .feature-badge-card {
        padding: 2rem 1.5rem;
    }
}

/* ─── 6. SECTIONS & SECTION HEADERS ──────────────────────────── */
.section-padding {
    padding: clamp(3rem, 8vw, 10rem) clamp(1rem, 4vw, 2rem);
}

.wrisda-section-header h2 {
    font-size: clamp(1.8rem, 4vw, 3.5rem) !important;
}

.about-hero {
    padding: clamp(5rem, 10vw, 8rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 4rem);
    background-attachment: scroll !important;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 4rem);
}

.hero-subtext {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

/* ─── 7. CARDS / GRIDS ────────────────────────────────────────── */
.cards {
    grid-template-columns: repeat(auto-fit, minmax(clamp(240px, 45vw, 350px), 1fr));
}

.services-grid,
.docs-grid,
.mv-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(240px, 45vw, 300px), 1fr));
}

.values-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 30vw, 180px), 1fr));
}

.why-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(220px, 40vw, 280px), 1fr));
}

.partners-grid {
    gap: clamp(1rem, 3vw, 3rem);
}

.partner-card {
    padding: 1.25rem 1.75rem;
}

.partner-card img {
    height: clamp(80px, 15vw, 150px);
}

@media (max-width: 640px) {
    .services-grid,
    .docs-grid,
    .mv-grid,
    .why-grid,
    .values-grid,
    .partners-grid {
        grid-template-columns: 1fr !important;
    }

    .partner-card {
        flex-direction: row;
        padding: 1rem;
    }

    .partner-card img {
        height: 60px;
    }
}

/* ─── 8. PRODUCTS GRID ────────────────────────────────────────── */
.products-grid-portal {
    grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 40vw, 280px), 1fr));
    gap: clamp(1rem, 2vw, 2rem);
}

@media (max-width: 480px) {
    .products-grid-portal {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
}

@media (max-width: 340px) {
    .products-grid-portal {
        grid-template-columns: 1fr !important;
    }
}

/* Product Modal */
.product-modal-container {
    height: auto;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: clamp(16px, 4vw, 28px);
}

.modal-content-grid {
    grid-template-columns: 1fr 1.2fr;
}

@media (max-width: 768px) {
    .modal-content-grid {
        grid-template-columns: 1fr !important;
    }
    .modal-img-box {
        border-radius: 28px 28px 0 0 !important;
        height: 280px;
        position: relative;
    }
    .modal-name {
        font-size: clamp(1.3rem, 4vw, 2rem);
    }
    .modal-price {
        font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    }
    .modal-specs-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .modal-specs-grid {
        grid-template-columns: 1fr !important;
    }
    .modal-details {
        padding: 1.25rem !important;
    }
}

/* ─── 9. FOOTER ───────────────────────────────────────────────── */
.wrisda-footer {
    padding: clamp(2rem, 5vw, 5rem) 0 clamp(1rem, 3vw, 2rem);
}

.footer-top-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: clamp(1.5rem, 3vw, 3rem);
}

@media (max-width: 960px) {
    .footer-top-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    .footer-top-grid .footer-col:first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .footer-top-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        text-align: center;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}

/* ─── 10. AUTH PAGES (Sign In / Sign Up / Forgot PW) ─────────── */
.login-split-container {
    flex-direction: row;
    max-width: min(1000px, 96vw);
}

@media (max-width: 768px) {
    .login-split-container {
        flex-direction: column !important;
        min-height: auto;
        border-radius: 20px;
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    .login-left {
        padding: 2rem 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--nav-border);
    }
    .login-left .big-logo {
        width: clamp(140px, 50vw, 200px);
    }
    .login-right {
        padding: 2rem 1.5rem;
    }
    .auth-card {
        max-width: 100%;
    }
    .login-redesign-container {
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
    }
    .login-redesign-left {
        display: none;
    }
    .login-redesign-right {
        padding: 1.5rem !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 1rem;
    }
    .auth-card {
        padding: 1.5rem !important;
    }
}

/* Signup form grid rows */
.name-row {
    grid-template-columns: 2fr 0.7fr 2fr 0.7fr;
}

.contact-row,
.id-row {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
    .name-row {
        grid-template-columns: 1fr 1fr !important;
    }
    .name-row .auth-group:nth-child(1),
    .name-row .auth-group:nth-child(3) {
        grid-column: span 2;
    }
    .contact-row,
    .id-row {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .name-row {
        grid-template-columns: 1fr !important;
    }
    .name-row .auth-group:nth-child(1),
    .name-row .auth-group:nth-child(3) {
        grid-column: span 1;
    }
}

/* ─── 11. PORTAL LAYOUT (Dashboard, Sidebars) ─────────────────── */
/* Sidebar is position:fixed, slides in on mobile */
.saas-sidebar,
.admin-sidebar,
.cus-sidebar,
.portal-sidebar,
.inv-styled-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Admin main content — pad from topbar height */
.admin-main,
.portal-main {
    padding-top: var(--topbar-height, 70px);
    min-width: 0;
}

@media (max-width: 1024px) {
    .admin-main,
    .portal-main {
        margin-left: 0 !important;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 64px !important;
    }

    .saas-sidebar,
    .admin-sidebar,
    .cus-sidebar,
    .portal-sidebar,
    .inv-styled-sidebar {
        transform: translateX(-100%);
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 9999;
        box-shadow: none;
    }

    .saas-sidebar.open,
    .admin-sidebar.open,
    .cus-sidebar.open,
    .portal-sidebar.open,
    .inv-styled-sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 2px 0 24px rgba(0,0,0,0.18);
    }

    .cus-header {
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        padding-left: 4rem !important;
    }
}

@media (max-width: 768px) {
    .admin-main,
    .portal-main,
    .portal-content {
        padding: 4rem 1rem 1.5rem !important;
    }

    .portal-content {
        padding-top: 1rem !important;
    }
}

@media (max-width: 480px) {
    .admin-main,
    .portal-main {
        padding: 3.5rem 0.75rem 1rem !important;
    }
}

/* ─── 12. TOPBAR / CUS-HEADER ─────────────────────────────────── */
.cus-header {
    height: clamp(52px, 8vw, 70px);
    padding: 0 clamp(0.75rem, 2vw, 1.5rem);
}

.global-search-container {
    max-width: clamp(180px, 30vw, 380px);
}

@media (max-width: 640px) {
    .global-search-container {
        display: none; /* Hide search on very small screens to save space */
    }
    .topbar-brand {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    .cus-topbar-icons {
        gap: 0.5rem;
    }
    .role-switcher-select {
        font-size: 0.75rem;
        padding: 0.35rem 1.4rem 0.35rem 0.5rem;
    }
}

/* ─── 13. STATS GRIDS ─────────────────────────────────────────── */
.admin-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 18vw, 200px), 1fr));
}

.stats-container {
    grid-template-columns: repeat(auto-fit, minmax(clamp(180px, 30vw, 240px), 1fr));
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 22vw, 240px), 1fr));
}

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

@media (max-width: 768px) {
    .admin-stats-grid,
    .stats-container,
    .stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    .admin-stat-info .stat-value {
        font-size: clamp(1.2rem, 4vw, 1.85rem);
    }
}

@media (max-width: 360px) {
    .admin-stats-grid,
    .stats-container,
    .stat-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 14. QUICK ACTIONS ROW ───────────────────────────────────── */
.quick-actions-row {
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 20vw, 260px), 1fr));
}

@media (max-width: 768px) {
    .quick-actions-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .quick-actions-row {
        grid-template-columns: 1fr !important;
    }
    .quick-action-btn {
        width: 100%;
    }
}

/* ─── 15. ADMIN SECTION CARD ──────────────────────────────────── */
.admin-section-card {
    padding: clamp(1.25rem, 3vw, 3rem);
    border-radius: clamp(16px, 3vw, 32px);
}

/* ─── 16. FORM GRIDS ──────────────────────────────────────────── */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

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

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 17. TABLES ──────────────────────────────────────────────── */
.table-responsive,
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    margin-bottom: 1rem;
}

/* Allow individual page tables to scroll rather than squishing */
.table-responsive table,
.saas-table-container .saas-table,
.pro-table {
    min-width: 540px;
}

@media (max-width: 768px) {
    .saas-table th,
    .saas-table td,
    .pro-table th,
    .pro-table td {
        padding: 0.75rem 0.875rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .saas-table th,
    .saas-table td,
    .pro-table th,
    .pro-table td {
        padding: 0.6rem 0.65rem;
        font-size: 0.775rem;
    }
}

/* ─── 18. MODALS ──────────────────────────────────────────────── */
.modal {
    padding: 0.75rem;
    align-items: flex-end; /* Bottom-sheet feel on mobile */
}

.modal-content,
.modal-dialog,
.styled-modal,
.cus-modal-content {
    width: 100%;
    max-width: clamp(300px, 92vw, 560px);
    max-height: 92vh;
    overflow-y: auto;
    border-radius: clamp(16px, 3vw, 24px);
    margin: auto;
}

@media (min-width: 600px) {
    .modal {
        align-items: center;
    }
}

@media (max-width: 600px) {
    .modal-content,
    .modal-dialog,
    .styled-modal,
    .cus-modal-content {
        max-width: 100% !important;
        width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        margin-bottom: 0;
    }
    .modal {
        align-items: flex-end;
        padding: 0;
    }
    .modal-header h2 {
        font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    }
    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    .modal-footer .btn,
    .modal-footer button {
        width: 100% !important;
        justify-content: center;
    }
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* ─── 19. BUTTONS ─────────────────────────────────────────────── */
.btn {
    white-space: nowrap;
    max-width: 100%;
}

@media (max-width: 480px) {
    /* Buttons inside card actions become full-width */
    .card-actions .btn,
    .card-footer .btn,
    .portal-page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── 20. ALERTS / FLASH MESSAGES ─────────────────────────────── */
.flash-messages {
    left: 50%;
    transform: translateX(-50%);
    width: min(90vw, 450px);
}

.alert {
    padding: clamp(0.75rem, 2vw, 1.5rem) clamp(1rem, 3vw, 2rem);
    font-size: clamp(0.875rem, 2vw, 1.1rem);
    border-radius: clamp(12px, 2vw, 16px);
}

@media (max-width: 600px) {
    .flash-messages {
        top: auto;
        bottom: 1rem;
        transform: translateX(-50%);
    }
    .alert {
        padding: 1rem 1.25rem;
        font-size: 0.9rem;
        border-radius: 14px;
        flex-direction: row;
        gap: 0.75rem;
    }
    .alert::before {
        font-size: 1.5rem !important;
    }
}

/* ─── 21. NOTIFICATIONS PAGE ──────────────────────────────────── */
.notifications-list {
    max-width: 100%;
}

@media (max-width: 768px) {
    .notification-item {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ─── 22. GREETING BANNER ─────────────────────────────────────── */
.greeting-banner {
    padding: clamp(1rem, 3vw, 1.75rem) clamp(1rem, 3vw, 2rem);
    border-radius: clamp(12px, 2.5vw, 20px);
}

.greeting-content h2 {
    font-size: clamp(1.1rem, 3vw, 1.9rem);
}

@media (max-width: 600px) {
    .greeting-banner {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

/* ─── 23. PORTAL PAGE HEADER ──────────────────────────────────── */
.portal-page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.portal-page-header h1,
.portal-page-header h2 {
    font-size: clamp(1.3rem, 3.5vw, 2rem);
    min-width: 0;
    flex: 1;
}

/* ─── 24. ATTENDANCE MODAL ────────────────────────────────────── */
.attendance-card {
    width: min(500px, 96vw);
    border-radius: clamp(16px, 3vw, 24px);
}

.attendance-body .camera-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 4 / 3;
}

@media (max-width: 480px) {
    .attendance-card {
        width: 100%;
        border-radius: 16px;
    }
    .btn-capture,
    .btn-cancel {
        width: 100%;
        padding: 0.75rem;
    }
    .attendance-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ─── 25. MISC LAYOUT UTILITIES ───────────────────────────────── */

/* Flex stack helper */
.flex-wrap-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Prevent inline content overflow */
.text-truncate-mobile {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Two-column layouts that collapse on tablet */
.two-col-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .two-col-layout {
        grid-template-columns: 1fr !important;
    }
}

/* Cart layout */
.cart-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr !important;
    }
    .cart-summary-container {
        order: -1;
    }
}

/* Billing layout */
.billing-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .billing-dashboard-layout {
        grid-template-columns: 1fr !important;
    }
}

/* Inline-grid overrides */
@media (max-width: 900px) {
    [style*="grid-template-columns: 1.5fr 1fr"],
    [style*="grid-template-columns:1.5fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns:1fr 2fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns: 1fr 3fr"],
    [style*="grid-template-columns:1fr 3fr"],
    [style*="grid-template-columns: 3fr 1fr"],
    [style*="grid-template-columns:3fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 26. PURCHASING SIDEBAR ──────────────────────────────────── */
@media (max-width: 1024px) {
    #purchasingSidebar {
        transform: translateX(-100%);
        width: 260px !important;
        transition: transform 0.3s ease;
    }
    #purchasingSidebar.open {
        transform: translateX(0);
    }
}

/* ─── 27. HOME PAGE MARQUEE ───────────────────────────────────── */
@media (max-width: 768px) {
    .marquee-section::before,
    .marquee-section::after {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .wrisda-grid-item {
        width: clamp(240px, 80vw, 320px) !important;
    }
}

/* ─── 28. ABOUT PAGE ──────────────────────────────────────────── */
.about-grid-stack {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .about-grid-stack {
        grid-template-columns: 1fr !important;
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    .about-card {
        padding: 1.75rem;
    }
    .about-card h2 {
        font-size: clamp(1.5rem, 4vw, 2.5rem);
    }
    .mv-item {
        padding: 2rem;
    }
    .mv-item h3 {
        font-size: clamp(1.5rem, 4vw, 2.25rem);
    }
    .mission-vision,
    .cta-section {
        padding: 4rem 1.25rem;
    }
}

/* ─── 29. OVERALL DASHBOARD TOP SECTION ───────────────────────── */
.dashboard-top-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-top-section {
        grid-template-columns: 1fr !important;
    }
}

/* Analytics grid */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 30. REDUCE MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ─── 31. NOTIFICATION DROPDOWN ──────────────────────────────── */
/* Prevent the dropdown from overflowing the screen on small devices */
.cus-dropdown-panel {
    max-width: calc(100vw - 2rem);
}

@media (max-width: 480px) {
    .cus-dropdown-panel {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        animation: slideUpPanel 0.25s ease !important;
    }

    @keyframes slideUpPanel {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    .cus-panel-body {
        max-height: 55vh;
    }

    /* Clock In/Out button text label — hide on very small screens */
    .cus-icon-wrap .btn span:last-of-type {
        display: none;
    }
}


/* ══════════════════════════════════════════════════════════════
   §33 — PORTAL PAGE CONTENT RESPONSIVENESS
   Covers all inner-portal pages that use the card-row grid layout:
   admin/customers, accounting/customers, site_visits, etc.
   ══════════════════════════════════════════════════════════════ */

/* Admin main correct base padding */
.admin-main {
    padding: 80px 2rem 2rem;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Page wrapper max-width – use full width on smaller screens */
.admin-main > [style*="max-width: 1300px"],
.admin-main > div[style*="max-width"] {
    max-width: 100% !important;
    padding: 0;
}

/* ── Page title row ── */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-title-row h1 {
    font-size: clamp(1.2rem, 3.5vw, 1.6rem) !important;
    word-break: break-word;
}

/* ── Search bar ── */
.um-search-wrap {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.um-search-box {
    width: 100%;
    max-width: 100%;
    flex: 1 1 200px;
}

.um-search-input {
    width: 100%;
}

/* ══ CARD-ROW GRID TABLES ══════════════════════════════════════ */
/*
   These are used on all portal list pages. They use a CSS variable
   --grid-config with many fractional columns. On small screens we
   convert them to scrollable wrappers or stacked cards.
*/

/* Wrap the header + rows in a horizontal-scroll zone on tablet */
@media (max-width: 1024px) {
    .admin-main {
        padding: 72px 1.25rem 1.5rem !important;
    }
}

@media (max-width: 900px) {
    /* Reduce column count by overriding the --grid-config variable */
    :root {
        --grid-config: 2fr 1.5fr 1fr 1fr 0.8fr !important;
    }

    .modern-table-header,
    .user-row-card {
        font-size: 0.82rem;
        padding: 0.85rem 1rem !important;
        gap: 0.6rem !important;
    }

    /* Hide low-priority columns on medium screens */
    .modern-table-header span:nth-child(5),
    .user-row-card > *:nth-child(5) {
        display: none;
    }
}

@media (max-width: 768px) {
    .admin-main {
        padding: 68px 0.875rem 1.25rem !important;
    }

    /* Switch the table/card layout to a scrollable container */
    .user-list-container,
    .modern-table-header {
        min-width: 0;
    }

    /* On mobile, hide the fixed-column header entirely and
       show data as stacked label–value cards instead */
    .modern-table-header {
        display: none !important;
    }

    .user-row-card {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.6rem !important;
        padding: 1rem 1rem !important;
        border-left: 4px solid #3b82f6 !important;
        position: relative;
    }

    /* Push the actions button to top-right of the card */
    .ellipsis-actions {
        position: absolute !important;
        top: 0.75rem;
        right: 0.75rem;
    }

    /* Give each data cell a label via CSS counter / data-label */
    .user-basic-info {
        gap: 0.75rem;
    }

    .info-name {
        font-size: 0.95rem !important;
        white-space: normal !important;
    }

    .info-sub {
        font-size: 0.78rem !important;
    }

    .data-cell,
    .data-muted {
        font-size: 0.82rem !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
    }

    /* View ID button full width on mobile */
    .view-id-btn {
        width: 100%;
        justify-content: center;
    }

    /* Status pill inline */
    .status-pill {
        font-size: 0.75rem;
    }

    /* Page title */
    .page-title-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .page-title-row h1 {
        font-size: clamp(1.1rem, 4vw, 1.4rem) !important;
    }

    /* Search full width */
    .um-search-wrap {
        flex-direction: column;
    }

    .um-search-box {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 64px 0.75rem 1rem !important;
    }

    .user-row-card {
        padding: 0.875rem 0.875rem !important;
        border-radius: 12px !important;
    }

    .page-title-row h1 {
        font-size: 1.1rem !important;
    }

    .page-title-row p {
        font-size: 0.78rem !important;
    }
}

/* ══ SITE VISITS / INSTALLATION PAGES ═════════════════════════ */
/* These pages use similar card-row grids */
.sv-row-card,
.project-row-card,
.inv-row-card {
    display: grid;
    min-width: 0;
}

@media (max-width: 768px) {
    .sv-row-card,
    .project-row-card,
    .inv-row-card {
        display: flex !important;
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 0.5rem !important;
    }

    .sv-table-header,
    .project-table-header,
    .inv-table-header {
        display: none !important;
    }
}

/* ══ GENERAL PORTAL INNER CONTENT WRAPPER ══════════════════════ */
.portal-inner-content,
.portal-page-content,
.page-content-wrapper {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* ══ RESPONSIVE SAAS TABLE (used in many portals) ═════════════ */
@media (max-width: 900px) {
    .saas-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 14px;
    }

    .saas-table {
        min-width: 640px;
    }
}

@media (max-width: 600px) {
    .saas-table th,
    .saas-table td {
        padding: 0.65rem 0.75rem !important;
        font-size: 0.78rem !important;
    }
}

/* ══ RESPONSIVE TWO/THREE PANEL LAYOUTS ════════════════════════ */
.portal-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .portal-split-layout {
        grid-template-columns: 1fr !important;
    }
}

.portal-three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .portal-three-col {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 640px) {
    .portal-three-col {
        grid-template-columns: 1fr !important;
    }
}

/* ══ PORTAL FILTER / TOOLBAR ROWS ══════════════════════════════ */
.filter-row,
.toolbar-row,
.portal-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .filter-row,
    .toolbar-row,
    .portal-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-row select,
    .filter-row input,
    .toolbar-row select,
    .toolbar-row input,
    .portal-toolbar select,
    .portal-toolbar input {
        width: 100%;
    }

    .filter-row .btn,
    .toolbar-row .btn,
    .portal-toolbar .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ══ PORTAL DETAIL CARDS (invoice, PO, quotation, etc.) ════════ */
.detail-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .detail-card-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* ══ INLINE FLEX ROWS THAT SHOULD STACK ════════════════════════ */
@media (max-width: 640px) {
    .flex-row-wrap,
    .info-row-flex,
    .header-action-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .header-action-row .btn,
    .header-action-row button {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }
}

/* ══ ENGINEER PORTAL PAGES ═════════════════════════════════════ */

/* Metrics row stack on mobile */
@media (max-width: 600px) {
    .eng-metrics {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    .eng-page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
}

/* Engineer item row adaptations */
@media (max-width: 480px) {
    .eng-item-row {
        padding: 0.5rem 0.6rem !important;
        gap: 0.5rem !important;
    }
    .eng-item-title {
        font-size: 0.78rem !important;
    }
    .eng-status-pill {
        font-size: 0.58rem !important;
        padding: 0.15rem 0.45rem !important;
    }
}

/* Calendar styling updates for smaller screens */
@media (max-width: 480px) {
    .calendar-card {
        padding: 0.75rem !important;
    }
    .calendar-grid {
        gap: 0.25rem !important;
    }
    .date-cell {
        font-size: 0.8rem !important;
        aspect-ratio: 1.1 / 1 !important;
        border-radius: 6px !important;
    }
    .day-name {
        font-size: 0.65rem !important;
        padding-bottom: 0.5rem !important;
    }
    .calendar-title {
        font-size: 1.1rem !important;
    }
    .nav-btn {
        width: 36px !important;
        height: 36px !important;
    }
    .schedule-container {
        padding: 1rem 0.5rem !important;
    }
}

/* Engineer site visits cards stacking on mobile */
@media (max-width: 600px) {
    .visit-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
    }
    .visit-card .time-slot {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0.5rem 1rem !important;
        width: 100% !important;
    }
    .visit-card .time-slot div {
        margin: 0 !important;
    }
    .visit-card .time-main {
        font-size: 1.1rem !important;
    }
    .visit-card .time-period {
        font-size: 0.8rem !important;
    }
    .visit-card .status-badge {
        align-self: flex-start !important;
    }
    .visit-card .btn-action-eng,
    .visit-card .btn-action-eng + span,
    .visit-card div:last-child {
        width: 100% !important;
    }
    .visit-card .btn-action-eng {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
    }
}

/* Security card form sizing on mobile */
@media (max-width: 600px) {
    .security-card {
        padding: 1.5rem !important;
        margin: 1.5rem auto !important;
        border-radius: 20px !important;
    }
}

/* ══ PRESERVE PRINT ═════════════════════════════════════════════ */
@media print {
    .user-row-card {
        display: grid !important;
        grid-template-columns: var(--grid-config, repeat(auto-fit, 1fr)) !important;
        break-inside: avoid;
    }
    .modern-table-header {
        display: grid !important;
    }
}

@media print {
    .saas-sidebar,
    .admin-sidebar,
    .cus-sidebar,
    .floating-portal-burger,
    .cus-sidebar-toggle,
    header,
    .cus-header,
    .flash-messages,
    #sidebar-overlay {
        display: none !important;
    }

    .admin-main,
    .portal-main,
    .admin-layout {
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    table {
        min-width: unset !important;
        width: 100%;
    }
}


/* ══════════════════════════════════════════════════════════════
   §34 — HOME PAGE SPECIFIC RESPONSIVE FIXES
   ══════════════════════════════════════════════════════════════ */

/* Hero button row — stacks on phone */
.hero-btns,
.hero > .hero-container > .hero-content > div[style*="display: flex"][style*="gap: 1.5rem"] {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* Home stats counter row — wraps on narrow screens */
#homeStatsRow {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

@media (max-width: 480px) {
    #homeStatsRow {
        grid-template-columns: 1fr 1fr !important;
        display: grid !important;
        gap: 0.75rem;
        width: 100%;
    }
    #homeStatsRow > div {
        min-width: 0 !important;
        padding: 0.85rem 1rem !important;
    }
    #homeStatsRow > div > div:first-child {
        font-size: 1.7rem !important;
    }
}

@media (max-width: 340px) {
    #homeStatsRow {
        grid-template-columns: 1fr !important;
    }
}

/* Hero section inline button groups */
@media (max-width: 600px) {
    .hero section > div[style*="display: flex"],
    div[style*="display: flex; gap: 1.5rem; justify-content: center"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
        width: 100%;
    }

    .hero .btn, .hero a.btn {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }
}


/* ══ PARTNER CARDS ══════════════════════════════════════════════
   These have inline min-width: 350px — override for mobile
══════════════════════════════════════════════════════════════ */
.partner-card {
    min-width: clamp(240px, 85vw, 350px) !important;
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3rem) !important;
}

.partner-card img {
    height: clamp(90px, 18vw, 150px) !important;
}

@media (max-width: 640px) {
    .partners-grid {
        flex-direction: column !important;
        align-items: center;
        gap: 1rem;
    }
    .partner-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 440px !important;
    }
}


/* ══ DOCS GRID ══════════════════════════════════════════════════ */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 42vw, 280px), 1fr));
    gap: 1rem;
}

@media (max-width: 520px) {
    .docs-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }
    .doc-card {
        padding: 1.25rem !important;
    }
}


/* ══ PROJECT DETAILS MODAL ══════════════════════════════════════ */
/* The modal inner grid collapses to a flex column on mobile */
#projectDetailsModal .modal-content {
    max-height: 95vh !important;
    border-radius: clamp(16px, 3vw, 32px) !important;
}

.project-modal-inner {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .project-modal-inner {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        overflow-y: auto !important;
        max-height: 85vh;
    }

    /* Image section takes a fixed height */
    .project-modal-inner > div:first-child {
        height: 220px !important;
        min-height: 220px !important;
        flex-shrink: 0;
    }

    /* Details section */
    .project-modal-inner > div:last-child {
        padding: 1.5rem !important;
        overflow-y: auto !important;
        flex: 1;
    }

    #projectDetailsModal #modalTitle {
        font-size: clamp(1.3rem, 4vw, 2rem) !important;
    }
}

@media (max-width: 480px) {
    #projectDetailsModal {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    #projectDetailsModal .modal-content {
        border-radius: 20px 20px 0 0 !important;
        max-height: 92vh !important;
    }
    .project-modal-inner > div:first-child {
        height: 180px !important;
        min-height: 180px !important;
    }
    .project-modal-inner > div:last-child {
        padding: 1.25rem !important;
    }
}


/* ══ HOME SECTION HEADINGS ══════════════════════════════════════ */
@media (max-width: 768px) {
    div[style*="font-family: 'Yeseva One'"][style*="font-size: 2.5rem"],
    h2[style*="font-size: 3rem"],
    h2[style*="font-size: 2.5rem"] {
        font-size: clamp(1.6rem, 5vw, 2.2rem) !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   §35 — WAREHOUSE / PORTAL DASHBOARD BENTO GRIDS
   ══════════════════════════════════════════════════════════════ */

/* Warehouse "Quick Actions" 1fr 1fr grid */
div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 1.5rem"] {
    display: grid;
}

@media (max-width: 640px) {
    /* Collapse any 2-col inline grid to 1-col */
    div[style*="grid-template-columns: 1fr 1fr"],
    .quick-actions-row {
        grid-template-columns: 1fr !important;
    }
}

/* Dashboard dash-wrapper bento grid */
.dash-wrapper {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .dash-wrapper {
        padding: 0.75rem 0 1.5rem !important;
        gap: 1rem !important;
    }
    .bento-card {
        padding: 1rem !important;
    }
    .right-panel-card {
        padding: 1rem !important;
    }
}

@media (max-width: 480px) {
    .dash-wrapper {
        padding: 0.5rem 0 1rem !important;
    }
    .bento-card {
        padding: 0.875rem !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   §36 — INLINE STYLE OVERRIDES FOR HARDCODED FIXED WIDTHS
   These CSS rules use specificity to override inline styles
   that were baked into templates without responsive thought.
   ══════════════════════════════════════════════════════════════ */

/* Marquee project cards — keep minimum at 80vw on small screens */
@media (max-width: 520px) {
    .wrisda-grid-item {
        width: clamp(260px, 88vw, 340px) !important;
    }
}

/* Ensure all inline-style tables are always horizontally scrollable */
div[style*="overflow-x: auto"] {
    max-width: 100%;
}

/* Any flex-row with gap that might overflow on small screens */
@media (max-width: 480px) {
    div[style*="display: flex"][style*="gap: 0.8rem"],
    div[style*="display: flex"][style*="gap: 1rem"],
    div[style*="display: flex"][style*="gap: 0.75rem"] {
        flex-wrap: wrap;
    }
}

/* Fix action links inside bento cards on mobile */
@media (max-width: 480px) {
    a[style*="display: flex"][style*="align-items: center"][style*="gap: 0.8rem"] {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    a[style*="display: flex"][style*="align-items: center"][style*="gap: 0.8rem"] span:last-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}


/* ══════════════════════════════════════════════════════════════
   §37 — PORTAL HEADER (cus-header) TABLET ADJUSTMENT
   Keeps topbar left offset correct on 768–1024px range
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {
    .cus-header {
        left: 0 !important;
        padding: 0 1.25rem !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   §38 — FOOTER RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .wrisda-footer {
        padding: 2rem 0 1rem !important;
    }
    .footer-bottom p {
        font-size: 0.8rem !important;
        text-align: center;
    }
}


/* ══════════════════════════════════════════════════════════════
   §39 — TYPOGRAPHY FLUID SCALING
   Ensures headings and body text never appear too large on phone.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    h1 { font-size: clamp(1.5rem, 7vw, 2.2rem) !important; }
    h2 { font-size: clamp(1.25rem, 5.5vw, 1.8rem) !important; }
    h3 { font-size: clamp(1rem, 4.5vw, 1.4rem) !important; }
}


/* ══════════════════════════════════════════════════════════════
   §40 — SIGN IN / SIGN UP FORM FULL-SCREEN ON PHONE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .form-section {
        padding: 0.75rem !important;
        min-height: 100dvh;
    }
    .auth-card {
        padding: 1.25rem !important;
    }
    .auth-header h2 {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }
    .btn-full {
        padding: 0.85rem !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   §41 — PRODUCTS PAGE GRID
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    .products-grid-portal {
        grid-template-columns: 1fr !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   §42 — GLOBAL SAFE UTILITIES
   ══════════════════════════════════════════════════════════════ */

/* Prevent images from bleeding outside containers */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent very long words from breaking layouts */
p, span, label, td, th, a {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Ensure all form elements are touch-friendly (min 44px hit area) */
@media (max-width: 768px) {
    input, select, textarea, button {
        min-height: 44px;
    }
    /* But don't force it on tiny icon buttons */
    .cus-icon-btn, .sidebar-collapse-btn, .nav-btn {
        min-height: unset;
    }
}

/* Make sure inline-block elements with fixed px font don't overflow */
@media (max-width: 360px) {
    .dept-badge, .saas-badge, .status-pill {
        font-size: 0.6rem !important;
        padding: 2px 5px !important;
    }
}

/* Notification panel mobile — bottom sheet already handled, 
   just ensure body doesn't overflow when it's open */
body.notif-open {
    overflow: hidden;
}

/* ─── 43. CAMERA VERIFICATION MODAL RESPONSIVENESS ───────────── */
@media (max-width: 400px) {
    #camera-modal div[style*="width:340px"] {
        width: 90vw !important;
        height: calc(90vw * 1.235) !important;
    }
    #webcam-video {
        width: 100% !important;
        height: 100% !important;
    }
    #camera-modal svg {
        width: 100% !important;
        height: 100% !important;
    }
}

/* ─── 44. CUSTOMER MY ORDERS GRID RESPONSIVENESS ──────────────── */
@media (max-width: 600px) {
    .supply-order-item > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    .supply-order-item > div[style*="display: grid"] > div {
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0;
        padding: 0 0 0.75rem 0 !important;
    }
    .supply-order-item > div[style*="display: grid"] > div:last-child {
        border-bottom: none;
        padding-bottom: 0 !important;
    }
}

/* ─── 45. PORTAL METRICS CARD GRID RESPONSIVENESS ──────────────── */
@media (max-width: 540px) {
    .metrics-row {
        grid-template-columns: 1fr !important;
    }
}

/* ─── 46. GLOBAL PORTAL CONTENT & BODY OVERFLOW FIXES ─────────── */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

@media (max-width: 768px) {
    /* Globally override excessive inline padding for customer portals on mobile */
    .portal-content,
    div.portal-content[style*="padding: 2.5rem"],
    div.portal-content[style*="padding:2.5rem"],
    .admin-main > div[style*="padding: 2rem"],
    .admin-main > div[style*="padding:2rem"] {
        padding: clamp(0.75rem, 3vw, 1.25rem) !important;
    }

    /* Reduce default profile card padding on mobile */
    .profile-card {
        padding: 1.25rem 1rem !important;
        border-radius: 16px !important;
    }

    /* Collapsed gap for 1fr 2fr layouts on mobile */
    div[style*="grid-template-columns: 1fr 2fr"],
    div[style*="grid-template-columns:1fr 2fr"] {
        gap: 1.25rem !important;
    }
}

/* ─── 47. MOBILE CARD WRAPPING FOR ACTION ITEMS ───────────────── */
@media (max-width: 640px) {
    .modern-action-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
    .modern-action-right {
        width: 100% !important;
        justify-content: space-between !important;
        border-top: 1px solid #f1f5f9;
        padding-top: 0.75rem;
    }
}

/* ─── 48. MOBILE FULLCALENDAR STACKING OVERRIDES ──────────────── */
@media (max-width: 600px) {
    .fc-header-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }
    .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
    }
    .fc-toolbar-title {
        font-size: 1.25rem !important;
        text-align: center !important;
        margin: 0.25rem 0 !important;
    }
}
