/* ==========================================================================
   Jan Seva - Professional Administration Console Stylesheet
   Modern, Clean, Brand-Aligned (Core CSS3, Responsive 360px - 1440px)
   ========================================================================== */

:root {
    --adm-primary: #0f766e;
    --adm-primary-hover: #115e59;
    --adm-primary-light: #f0fdfa;
    --adm-accent: #d97706;
    --adm-danger: #e11d48;
    --adm-success: #16a34a;
    --adm-warning: #f59e0b;
    --adm-info: #0284c7;

    --adm-dark-sidebar: #0f172a;
    --adm-dark-sidebar-hover: #1e293b;
    --adm-dark-text: #0f172a;
    --adm-muted: #64748b;
    --adm-bg: #f8fafc;
    --adm-card-bg: #ffffff;
    --adm-border: #e2e8f0;

    --adm-sidebar-width: 260px;
    --adm-sidebar-collapsed-width: 72px;
    --adm-topbar-height: 64px;

    --adm-radius-sm: 6px;
    --adm-radius-md: 10px;
    --adm-radius-lg: 14px;
    --adm-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --adm-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.04);
    --adm-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08);

    --adm-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --adm-font-hi: 'Noto Sans Devanagari', 'Inter', sans-serif;
    --adm-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.admin-body {
    font-family: var(--adm-font-sans);
    background-color: var(--adm-bg);
    color: #334155;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    color: var(--adm-primary);
    text-decoration: none;
    transition: var(--adm-transition);
}

a:hover {
    color: var(--adm-primary-hover);
}

/* ==========================================================================
   LAYOUT STRUCTURE (Sidebar + Main Content Wrapper)
   ========================================================================== */

.admin-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: var(--adm-sidebar-width);
    background-color: var(--adm-dark-sidebar);
    color: #94a3b8;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    transition: width 0.3s ease, transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
    height: var(--adm-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    background: #09101d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 800;
    text-decoration: none;
}

.brand-icon-emblem {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: var(--adm-radius-sm);
    transition: var(--adm-transition);
}

.sidebar-collapse-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0 2rem 0;
    scrollbar-width: thin;
    scrollbar-color: #0284c7 #09101d;
}

.sidebar-nav-container::-webkit-scrollbar {
    width: 7px;
}
.sidebar-nav-container::-webkit-scrollbar-track {
    background: #09101d;
}
.sidebar-nav-container::-webkit-scrollbar-thumb {
    background: #0284c7;
    border-radius: 8px;
    border: 1px solid #0369a1;
}
.sidebar-nav-container::-webkit-scrollbar-thumb:hover {
    background: #38bdf8;
}

.nav-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #64748b;
    padding: 1rem 1.25rem 0.35rem 1.25rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--adm-transition);
}

.sidebar-menu li a:hover {
    color: #ffffff;
    background: var(--adm-dark-sidebar-hover);
}

.sidebar-menu li a.active {
    color: #ffffff;
    background: var(--adm-primary);
    font-weight: 600;
}

.menu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-menu li a.active .menu-icon {
    stroke: #ffffff;
}

.menu-badge {
    margin-left: auto;
    background: var(--adm-accent);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--adm-radius-full);
}

/* Main Content Area */
.admin-main-wrapper {
    margin-left: var(--adm-sidebar-width);
    width: calc(100% - var(--adm-sidebar-width));
    max-width: calc(100% - var(--adm-sidebar-width));
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow-x: hidden;
    transition: margin-left 0.3s ease, width 0.3s ease, max-width 0.3s ease;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.admin-topbar {
    height: var(--adm-topbar-height);
    background: var(--adm-card-bg);
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--adm-dark-text);
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--adm-dark-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.view-site-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--adm-primary);
    background: var(--adm-primary-light);
    padding: 0.4rem 0.85rem;
    border-radius: var(--adm-radius-sm);
    transition: var(--adm-transition);
}

.view-site-link:hover {
    background: #ccfbf1;
    color: var(--adm-primary-hover);
}

.notif-bell-btn {
    position: relative;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.4rem;
    border-radius: 50%;
    transition: var(--adm-transition);
}

.notif-bell-btn:hover {
    background: var(--adm-bg);
    color: var(--adm-dark-text);
}

.bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--adm-danger);
    border-radius: 50%;
}

.admin-user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-avatar-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--adm-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
}

.admin-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.admin-user-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--adm-dark-text);
}

.admin-role-tag {
    font-size: 0.725rem;
    color: var(--adm-muted);
}

/* ==========================================================================
   MAIN CONTENT & CONTAINER
   ========================================================================== */

.admin-content-body {
    padding: 1.75rem;
    flex-grow: 1;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-heading {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--adm-dark-text);
}

.admin-breadcrumbs {
    font-size: 0.8rem;
    color: var(--adm-muted);
    margin-bottom: 0.5rem;
}

.admin-breadcrumbs ol {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    list-style: none;
}

.admin-breadcrumbs a {
    color: var(--adm-muted);
}

.admin-breadcrumbs a:hover {
    color: var(--adm-primary);
}

.admin-breadcrumbs .crumb-separator {
    color: #cbd5e1;
}

.admin-breadcrumbs .active {
    color: var(--adm-dark-text);
    font-weight: 600;
}

/* ==========================================================================
   METRICS & SUMMARY CARDS
   ========================================================================== */

.metrics-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    background: var(--adm-card-bg);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-lg);
    padding: 1.35rem 1.25rem;
    box-shadow: var(--adm-shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--adm-transition);
}

.metric-card:hover {
    box-shadow: var(--adm-shadow-md);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.metric-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.metric-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--adm-muted);
}

.metric-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--adm-radius-md);
    background: var(--adm-primary-light);
    color: var(--adm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon-wrap svg {
    width: 20px;
    height: 20px;
}

.metric-val {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--adm-dark-text);
    line-height: 1.1;
    margin-bottom: 0.35rem;
}

.metric-sub {
    font-size: 0.775rem;
    color: var(--adm-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Color Accent Variations */
.metric-card.accent-donations .metric-icon-wrap { background: #dcfce7; color: #15803d; }
.metric-card.accent-warning .metric-icon-wrap { background: #fef3c7; color: #b45309; }
.metric-card.accent-danger .metric-icon-wrap { background: #ffe4e6; color: #e11d48; }
.metric-card.accent-info .metric-icon-wrap { background: #e0f2fe; color: #0284c7; }

/* Dashboard Quick Summary Banners */
.dashboard-split-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.summary-strip-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-pill-card {
    background: var(--adm-card-bg);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.pill-icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-pill-card .pill-label {
    font-size: 0.75rem;
    color: var(--adm-muted);
    font-weight: 600;
}

.summary-pill-card .pill-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--adm-dark-text);
}

/* ==========================================================================
   CHARTS & VISUALIZATIONS
   ========================================================================== */

.chart-card {
    background: var(--adm-card-bg);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--adm-shadow-sm);
    margin-bottom: 1.75rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.chart-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--adm-dark-text);
}

.pure-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 200px;
    padding-top: 1rem;
    border-bottom: 1px solid var(--adm-border);
    margin-bottom: 0.5rem;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar-fill {
    width: 75%;
    max-width: 44px;
    background: var(--adm-primary);
    border-radius: var(--adm-radius-sm) var(--adm-radius-sm) 0 0;
    transition: height 0.6s ease;
    min-height: 4px;
    position: relative;
}

.bar-fill:hover {
    background: var(--adm-primary-hover);
}

.bar-tooltip {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--adm-dark-text);
    white-space: nowrap;
}

.bar-label {
    font-size: 0.725rem;
    color: var(--adm-muted);
    margin-top: 0.4rem;
    text-align: center;
}

/* ==========================================================================
   TABLES & LIST MODULES
   ========================================================================== */

.card-box {
    background: var(--adm-card-bg);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-lg);
    box-shadow: var(--adm-shadow-sm);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.card-box-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-box-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--adm-dark-text);
}

.filter-toolbar {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    flex-grow: 1;
    min-width: 220px;
}

.search-input-wrap svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    stroke: var(--adm-muted);
}

.search-input-wrap input {
    width: 100%;
    padding: 0.5rem 0.85rem 0.5rem 2.25rem;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
}

.filter-select {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
    background: #ffffff;
    color: #334155;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    color: var(--adm-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--adm-border);
}

.admin-table td {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--adm-border);
    color: #334155;
    vertical-align: middle;
}

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

.admin-table tr:hover td {
    background-color: #f8fafc;
}

/* Empty State */
.empty-table-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--adm-muted);
}

.empty-icon {
    width: 48px;
    height: 48px;
    stroke: #94a3b8;
    margin: 0 auto 0.75rem auto;
}

.empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--adm-dark-text);
    margin-bottom: 0.25rem;
}

.empty-sub {
    font-size: 0.85rem;
}

/* ==========================================================================
   STATUS BADGES & TAGS
   ========================================================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #e0f2fe; color: #0369a1; }
.badge-primary { background: #ccfbf1; color: #0f766e; }
.badge-neutral { background: #f1f5f9; color: #475569; }

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */

.btn-adm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--adm-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--adm-transition);
    text-decoration: none;
}

.btn-adm-primary {
    background: var(--adm-primary);
    color: #ffffff !important;
}

.btn-adm-primary:hover {
    background: var(--adm-primary-hover);
}

.btn-adm-secondary {
    background: #ffffff;
    border: 1px solid var(--adm-border);
    color: #334155 !important;
}

.btn-adm-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-adm-danger {
    background: #fee2e2;
    color: #b91c1c !important;
    border: 1px solid #fca5a5;
}

.btn-adm-danger:hover {
    background: #fecaca;
}

.btn-adm-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.775rem;
}

.btn-adm-icon {
    padding: 0.35rem;
    border-radius: var(--adm-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--adm-muted);
}

.btn-adm-icon:hover {
    color: var(--adm-dark-text);
    background: #f1f5f9;
}

/* ==========================================================================
   ALERTS & FLASH MESSAGES
   ========================================================================== */

.adm-alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--adm-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.adm-alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.adm-alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.adm-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.adm-alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.adm-alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
}

.adm-alert-close:hover {
    opacity: 1;
}

/* ==========================================================================
   PAGINATION CONTROLS
   ========================================================================== */

.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--adm-border);
    font-size: 0.825rem;
    color: var(--adm-muted);
}

.pagination-nav {
    display: flex;
    gap: 0.35rem;
}

.pagination-nav a,
.pagination-nav span {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius-sm);
    font-weight: 600;
}

.pagination-nav a.active,
.pagination-nav span.active {
    background: var(--adm-primary);
    color: #ffffff;
    border-color: var(--adm-primary);
}

/* ==========================================================================
   CONFIRMATION MODAL
   ========================================================================== */

.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.admin-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.admin-modal-box {
    background: #ffffff;
    border-radius: var(--adm-radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 440px;
    padding: 1.75rem;
    text-align: center;
}

.admin-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}

.admin-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--adm-dark-text);
    margin-bottom: 0.5rem;
}

.admin-modal-desc {
    font-size: 0.875rem;
    color: var(--adm-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.admin-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ==========================================================================
   COLLAPSED & MOBILE RESPONSIVE
   ========================================================================== */

/* Collapsed Desktop Sidebar */
body.sidebar-collapsed .admin-sidebar {
    width: var(--adm-sidebar-collapsed-width);
}

body.sidebar-collapsed .admin-main-wrapper {
    margin-left: var(--adm-sidebar-collapsed-width);
    width: calc(100% - var(--adm-sidebar-collapsed-width));
    max-width: calc(100% - var(--adm-sidebar-collapsed-width));
}

body.sidebar-collapsed .sidebar-brand span,
body.sidebar-collapsed .nav-group-title,
body.sidebar-collapsed .sidebar-menu li a span,
body.sidebar-collapsed .menu-badge {
    display: none;
}

body.sidebar-collapsed .sidebar-menu li a {
    justify-content: center;
    padding: 0.75rem 0;
}

/* Responsive Breakpoints (1024px, 768px, 480px, 360px) */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: var(--adm-sidebar-width);
        transform: translateX(-100%);
        box-shadow: 0 0 25px rgba(0,0,0,0.5);
        z-index: 1050 !important;
        transition: transform 0.3s ease;
    }

    body.mobile-sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .metrics-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .dashboard-split-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Dashboard & Panel Responsive Grid Utilities */
.admin-split-2-1,
.form-split-grid,
.dashboard-split-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    align-items: flex-start;
}

.admin-split-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
    align-items: flex-start;
}

.dash-stat-grid-4,
.metrics-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.dash-stat-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.dash-stat-grid-2,
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

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

/* Mobile Data Tables & Universal Table Wrappers */
.table-responsive,
.admin-table-wrap,
.data-table-wrap,
div[style*="overflow-x: auto"] {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
    display: block !important;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

/* Preserve table readability on mobile with minimum width and smooth horizontal pan */
.table-responsive table,
.admin-table-wrap table,
.data-table-wrap table,
div[style*="overflow-x: auto"] > table,
.adm-table,
.admin-table,
.data-table,
.table {
    min-width: 680px;
    width: 100%;
    border-collapse: collapse;
}

/* Universal Admin Modal System (100% Mobile & Desktop Compatible) */
.admin-modal,
div[id$="Modal"],
div[id*="Modal"] {
    box-sizing: border-box;
}

div[id$="Modal"][style*="position: fixed"],
div[id*="Modal"][style*="position: fixed"],
.admin-modal {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(4px);
    z-index: 9999 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 1.5rem 0.75rem !important;
    box-sizing: border-box !important;
}

div[id$="Modal"] > div,
div[id*="Modal"] > div,
.admin-modal > div {
    max-width: 560px !important;
    width: 100% !important;
    margin: 1.5rem auto 3rem auto !important;
    box-sizing: border-box !important;
    border-radius: var(--adm-radius-lg) !important;
    background: #ffffff !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15) !important;
}

@media (max-width: 991px) {
    .admin-split-2-1,
    .admin-split-1-1,
    .dashboard-split-grid,
    .form-split-grid {
        grid-template-columns: 1fr !important;
    }

    .admin-main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    /* Universal Mobile Grid Override: Collapse multi-column inline grids */
    .admin-content-body div[style*="grid-template-columns: 1fr 1fr"],
    .admin-content-body div[style*="grid-template-columns: 2fr 1fr"],
    .admin-content-body div[style*="grid-template-columns: 2fr 1fr 1fr"],
    .admin-content-body div[style*="grid-template-columns: 1.3fr 0.7fr"],
    .admin-content-body div[style*="grid-template-columns: 1fr 340px"],
    .admin-content-body div[style*="grid-template-columns: 380px 1fr"],
    .admin-content-body div[style*="grid-template-columns: 340px 1fr"],
    .card-box div[style*="grid-template-columns: 1fr 1fr"],
    .card-box div[style*="grid-template-columns: 2fr 1fr"],
    .card-box div[style*="grid-template-columns: 2fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .metrics-grid-4,
    .dash-stat-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .summary-strip-row {
        grid-template-columns: 1fr !important;
    }

    .dash-stat-grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    }

    .dash-stat-grid-2,
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr !important;
    }

    .admin-content-body {
        padding: 0.75rem 0.5rem !important;
    }

    .page-header-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .page-header-row > div:last-child {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }

    .page-heading {
        font-size: 1.2rem;
        word-break: break-word;
        line-height: 1.3;
    }

    .filter-toolbar,
    .table-filter-form,
    form[action*="index.php"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.65rem !important;
        padding: 0.85rem !important;
    }

    .filter-toolbar select,
    .filter-toolbar input,
    .filter-toolbar button,
    .filter-select,
    .table-filter-form select,
    .table-filter-form input,
    .table-filter-form button,
    form[action*="index.php"] select,
    form[action*="index.php"] input[type="date"],
    form[action*="index.php"] input[type="text"],
    form[action*="index.php"] input[type="search"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
        box-sizing: border-box !important;
    }

    .search-input-wrap {
        width: 100% !important;
    }

    .pagination-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .hide-mobile {
        display: none !important;
    }

    /* Topbar Mobile Cleanup */
    .topbar-left {
        max-width: 65%;
        overflow: hidden;
    }

    .topbar-title {
        font-size: 0.9rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 160px;
    }

    .view-site-link span {
        display: none !important;
    }

    .view-site-link {
        padding: 0.4rem 0.6rem !important;
    }

    /* Modals on Mobile */
    div[id$="Modal"][style*="position: fixed"],
    div[id*="Modal"][style*="position: fixed"],
    .admin-modal {
        padding: 0.75rem 0.5rem 3.5rem 0.5rem !important;
    }

    div[id$="Modal"] > div,
    div[id*="Modal"] > div,
    .admin-modal > div {
        margin: 0.5rem auto 3rem auto !important;
        width: 100% !important;
        border-radius: 12px !important;
    }

    /* Touch Target & Form Input Ergonomics */
    .btn-adm,
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="file"],
    select,
    .filter-select {
        min-height: 44px;
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .metrics-grid-4,
    .dash-stat-grid-4 {
        grid-template-columns: 1fr !important;
    }

    .dash-stat-grid-3,
    .dash-stat-grid-2 {
        grid-template-columns: 1fr !important;
    }

    .card-box {
        padding: 0.85rem !important;
        border-radius: 8px !important;
    }

    .table-responsive table,
    .admin-table-wrap table,
    .data-table-wrap table,
    div[style*="overflow-x: auto"] > table,
    .adm-table,
    .admin-table,
    .data-table,
    .table {
        min-width: 580px;
    }
}
