/* 2030 Hosting Admin Console CSS Design System (2030-latest-console Theme) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* ── Surfaces (2030 Cool Light Aluminium Tokens) ── */
    --bg-dark: #eef0f3;              /* Page background: cool light silver */
    --bg-primary: #eef0f3;
    --bg-secondary: #ffffff;
    --card-bg: #ffffff;              /* Card / panel: pure white */
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --card-border: #d4d8de;          /* Card border: light aluminium edge */
    --border-color: #d4d8de;
    --border: #e2e5e9;               /* Divider lines: light silver */

    /* ── Text & Typography ── */
    --text-primary: #1a1d24;         /* Primary text: near-black */
    --text-light: #1a1d24;
    --text-secondary: #5c6370;       /* Secondary text: medium grey */
    --text-muted: #64748b;           /* Muted text: slate grey */
    --text-color: #1a1d24;

    /* ── Buttons & Actions (Dark Anodised Aluminium) ── */
    --primary: #2d333f;              /* Button fill: dark anodised aluminium */
    --primary-hover: #3e4757;        /* Button hover: lighter slate */
    --primary-text: #f3f4f6;         /* Button text: light grey */

    --outline-border: #cbd5e1;       /* Outline btn border: medium silver */
    --outline-hover: rgba(45, 51, 63, 0.06);

    /* ── Accents & State Colors ── */
    --accent-indigo: #4f46e5;
    --accent-indigo-hover: #4338ca;
    --accent-cyan: #0284c7;
    --accent-emerald: #15803d;
    --accent-amber: #b45309;
    --accent-rose: #dc2626;

    /* ── Status States (Refined Soft Pastels) ── */
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #065f46;

    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --warning-text: #92400e;

    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;

    --info-bg: #eff6ff;
    --info-border: #bfdbfe;
    --info-text: #1e40af;

    /* ── Typography Families ── */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* ── Radii & Shadows ── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-modal: 0 20px 40px -8px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .page-title h1, .section-title, .modal-header h3, .metric-value, .brand-title h2 {
    font-family: var(--font-heading);
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

/* ── Auth View ── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg-dark);
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--glass-shadow);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header img {
    height: 48px;
    margin-bottom: 16px;
    object-fit: contain;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: #2d333f;
    box-shadow: 0 0 0 3px rgba(45, 51, 63, 0.1);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.25;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--card-border);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 51, 63, 0.15);
}

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

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #b0b7c3;
    color: #1e293b;
}

.btn-danger {
    background: var(--accent-rose);
    color: #ffffff;
    border-color: #b91c1c;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: var(--accent-emerald);
    color: #ffffff;
    border-color: #166534;
}

.btn-success:hover {
    background: #166534;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: inline-flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.btn-group .btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--card-border);
}

.btn-group .btn:last-child {
    border-right: none;
}

.btn-group .btn.active {
    background: var(--primary);
    color: #ffffff;
}

/* ── Dashboard Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 18px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.brand img {
    height: 32px;
    object-fit: contain;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    font-family: var(--font-heading);
}

.brand-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-title span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #475569;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item a:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.nav-item.active a {
    color: #ffffff;
    background: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(45, 51, 63, 0.2);
}

.sidebar-footer {
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 32px 36px;
    max-width: calc(100vw - 260px);
}

/* ── Top Header ── */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title h1 {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

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

/* ── Alert Banner ── */
.alert-banner {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.alert-banner.hidden {
    display: none;
}

.alert-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-badge {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ── Metric Cards Grid ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

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

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.metric-icon {
    font-size: 1.25rem;
}

.metric-value {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--accent-emerald);
    margin-top: 8px;
    font-weight: 500;
}

.metric-sub.warning {
    color: var(--accent-amber);
}

.metric-sub.danger {
    color: var(--accent-rose);
}

/* ── Card Sections & Tables ── */
.card-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-card);
}

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

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.custom-table, .table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.custom-table th, .table th {
    padding: 12px 16px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.custom-table td, .table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.custom-table tbody tr:hover, .table tbody tr:hover {
    background: #f8fafc;
}

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

/* ── Badges & Status Indicators ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-transform: capitalize;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.status-dot.offline { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
.status-dot.unknown { background: #f59e0b; }

/* ── Progress Bars ── */
.progress-bar-container {
    width: 100%;
    background: #e2e8f0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, #0284c7, #4f46e5);
    transition: width 0.4s ease;
}

.progress-bar-fill.warning {
    background: linear-gradient(90deg, #d97706, #b45309);
}

.progress-bar-fill.danger {
    background: linear-gradient(90deg, #dc2626, #b91c1c);
}

/* ── Modals & Dialogs ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

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

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    padding: 28px 32px;
    box-shadow: var(--shadow-modal);
    transform: translateY(16px) scale(0.98);
    transition: var(--transition);
    color: var(--text-primary);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* ── Toast Notifications (Rule 6 Standard) ── */
#adminToastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.admin-toast {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 420px;
    pointer-events: auto;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--text-primary);
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.success { border-left-color: var(--accent-emerald); }
.admin-toast.error { border-left-color: var(--accent-rose); }
.admin-toast.warning { border-left-color: var(--accent-amber); }
.admin-toast.info { border-left-color: var(--accent-cyan); }

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Support Ticket & Thread Specifics ── */
#ticketMessagesContainer {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

#ticketMessagesContainer::-webkit-scrollbar {
    width: 6px;
}

#ticketMessagesContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#ticketDetailsModal .modal-card {
    max-width: 980px !important;
    width: 92% !important;
}

/* ── Utility Classes ── */
.hidden {
    display: none !important;
}

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

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

.text-danger {
    color: var(--accent-rose);
}

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

.text-primary {
    color: var(--text-primary);
}

/* ── Mobile Topbar & Off-Canvas Navigation (Base Hidden on Desktop) ── */
.mobile-top-header {
    display: none;
}

.mobile-drawer-backdrop {
    display: none;
}

.mobile-sidebar-close {
    display: none;
}

/* ── Mobile & Tablet Responsive Optimizations (<= 992px) ── */
@media (max-width: 992px) {
    /* Mobile Sticky Top Header */
    .mobile-top-header {
        display: flex;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        height: 58px;
        background: #ffffff;
        border-bottom: 1px solid var(--border);
        padding: 0 16px;
        align-items: center;
        justify-content: space-between;
        z-index: 1050;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .mobile-menu-btn {
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        color: var(--text-primary);
        cursor: pointer;
        transition: var(--transition);
        margin: 0;
        padding: 0;
    }

    .mobile-menu-btn:active {
        background: #e2e8f0;
        transform: scale(0.96);
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-brand-title {
        font-family: var(--font-heading);
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--text-primary);
    }

    .mobile-role-badge {
        font-size: 0.65rem;
        background: #e2e8f0;
        color: #334155;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }

    .mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-icon-btn {
        background: #f8fafc;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        width: 38px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
        cursor: pointer;
        transition: var(--transition);
        margin: 0;
        padding: 0;
    }

    .mobile-icon-btn:active {
        background: #e2e8f0;
    }

    /* Off-Canvas Backdrop */
    .mobile-drawer-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1080;
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .mobile-drawer-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* Off-Canvas Sidebar Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    }

    .mobile-sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        font-size: 1.6rem;
        line-height: 1;
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        padding: 4px 8px;
    }

    .mobile-sidebar-close:hover {
        color: var(--text-primary);
    }

    /* Main Content Reset */
    .app-layout {
        display: block;
        min-height: 100vh;
    }

    .main-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 18px 14px 40px 14px !important;
    }

    /* Top Header & Page Titles */
    .top-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 20px;
    }

    .page-title h1 {
        font-size: 1.35rem;
    }

    .page-title p {
        font-size: 0.82rem;
    }

    .top-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .top-actions .btn {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    /* Metrics Grid: Fluid 2 Columns */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 20px !important;
    }

    .metric-card {
        padding: 14px 14px !important;
        border-radius: var(--radius-sm) !important;
    }

    .metric-header {
        font-size: 0.72rem !important;
        margin-bottom: 6px !important;
    }

    .metric-icon {
        font-size: 1.1rem !important;
    }

    .metric-value {
        font-size: 1.45rem !important;
    }

    .metric-sub {
        font-size: 0.74rem !important;
        line-height: 1.35 !important;
    }

    /* Card Sections & Responsive Tables */
    .card-section {
        padding: 16px 14px !important;
        margin-bottom: 20px !important;
        border-radius: var(--radius-md) !important;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 14px;
    }

    .section-title {
        font-size: 1.05rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        border-radius: 8px;
    }

    .custom-table th, .table th {
        padding: 9px 10px !important;
        font-size: 0.72rem !important;
        white-space: nowrap;
    }

    .custom-table td, .table td {
        padding: 10px 10px !important;
        font-size: 0.82rem !important;
    }

    .custom-table td .btn, .table td .btn {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    /* Modal Dialogs: Mobile Bottom Sheet Transformation */
    .modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 94vh !important;
        max-height: 94dvh !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 22px 16px !important;
        overflow-y: auto !important;
        transform: translateY(100%) !important;
        box-sizing: border-box !important;
    }

    .modal-overlay.active .modal-card {
        transform: translateY(0) !important;
    }

    .modal-header {
        padding-bottom: 12px;
        margin-bottom: 14px;
    }

    .modal-header h3 {
        font-size: 1.15rem;
    }

    .modal-close {
        font-size: 1.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Support Ticket Modal Specific Mobile Layout */
    #ticketDetailsModal .modal-card {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 95vh !important;
        max-height: 95dvh !important;
        padding: 20px 16px !important;
    }

    #ticketDetailsModal .modal-card > div[style*="background: #f8fafc"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        padding: 12px !important;
    }

    #ticketDetailsModal select#ticketModalStatusSelect,
    #ticketDetailsModal select#ticketModalAssignSelect {
        min-width: 100% !important;
        width: 100% !important;
    }

    #ticketMessagesContainer {
        min-height: 180px !important;
        max-height: 280px !important;
        padding: 12px 10px !important;
    }

    #ticketReplyForm textarea#ticketReplyMessage {
        min-height: 90px !important;
    }

    #ticketReplyForm div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    #ticketReplyForm div[style*="justify-content: space-between"] > div {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
    }

    #ticketReplyForm div[style*="justify-content: space-between"] > div:last-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    #ticketReplyForm .btn {
        width: 100% !important;
    }

    /* Form Controls & Ergonomics */
    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS auto-zoom on focus */
    }

    /* Floating Toast Alerts on Mobile */
    #adminToastContainer {
        top: 10px !important;
        left: 12px !important;
        right: 12px !important;
        min-width: auto !important;
        max-width: 100% !important;
    }

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

/* ── Small Phones Optimization (<= 480px) ── */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    .metric-card {
        padding: 12px 10px !important;
    }

    .metric-value {
        font-size: 1.3rem !important;
    }

    .page-title h1 {
        font-size: 1.2rem;
    }
}
