/* =========================================================================
   Modern Dashboard CSS
   Overrides previous styles for a premium, clean aesthetic.
   ========================================================================= */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    background-color: #f8fafc !important;
    color: #1e293b !important;
    margin: 0;
    padding: 0;
}

.no-scroll {
    overflow: hidden !important;
}


/* Typography Overrides */
h1,
h2,
h3,
h4,
.title,
.subheading {
    color: #0f172a;
    font-weight: 600;
}

/* Sidebar Layout for Desktop */
@media (min-width: 1024px) {
    .header-panel {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background-color: #0f172a !important;
        /* Sleek dark sidebar */
        color: #f8fafc;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
        z-index: 1000;
        overflow-y: hidden;
        box-sizing: border-box;
    }

    .header-panel .content {
        display: flex;
        flex-direction: column;
        align-items: flex-start !important;
        padding: 30px 0 !important;
        height: 100%;
        max-width: 100% !important;
    }

    #navigation-logo {
        padding: 0 30px 40px 30px;
        border-bottom: 1px solid #1e293b;
        width: 100%;
        box-sizing: border-box;
    }

    #navigation-logo img {
        max-width: 200px;
        height: auto;
    }

    #burger {
        display: none !important;
    }

    .navigation-bar {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        margin-top: 30px;
    }

    .navigation-item {
        padding: 16px 30px !important;
        color: #94a3b8 !important;
        font-size: 15px !important;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease !important;
        border-left: 4px solid transparent;
    }

    .navigation-item:hover {
        background-color: #1e293b !important;
        color: #ffffff !important;
        border-left: 4px solid #3b82f6;
    }

    .navigation-item.active {
        color: #fff !important;
    }

    #dashboard-main-panel {
        margin-left: 280px !important;
        padding: 40px 50px !important;
        min-height: 100vh;
        box-sizing: border-box;
    }
}

/* Mobile & Tablet Layout */
@media (max-width: 1023px) {
    .header-panel {
        background-color: #0f172a !important;
        padding: 15px 20px;
        position: relative;
        z-index: 1000;
    }

    .header-panel .content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        max-width: 100% !important;
    }

    #navigation-logo {
        position: relative !important;
        top: auto !important;
        height: auto !important;
        padding: 0 !important;
        border-bottom: none !important;
    }

    #navigation-logo img {
        max-height: 40px;
    }

    #burger {
        color: white;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        padding: 5px;
        display: flex;
        font-size: 16pt;
        justify-content: center;
        align-items: center;
    }

    .navigation-bar {
        position: absolute;
        display: flex;
        width: 100%;
        height: auto;
        flex-direction: column;
        background-color: rgb(15, 23, 42);
        overflow: hidden;
        top: 65px;
        left: 0px;
    }

    .navigation-bar.hide-menu {
        display: none !important;
    }

    .navigation-item {
        padding: 10px 10px !important;
        color: #f1f5f9 !important;
        border-bottom: 1px solid rgb(15, 23, 42) !important;
        font-weight: 500;
    }

    .navigation-item.active {
        background-color: #1e293b !important;
        color: #fff !important;
        border-left: 4px solid #3b82f6;
        padding-left: 16px !important;
    }

    .nav-icon {
        width: 22px;
        text-align: center;
        margin-right: 12px;
        opacity: 0.8;
    }

    .navigation-item.active .nav-icon {
        opacity: 1;
        color: #3b82f6;
    }

    .navigation-item:last-child {
        border-bottom: none;
    }

    #dashboard-main-panel {
        padding: 20px 15px !important;
        min-height: calc(100vh - 80px);
    }
}

/* Toolbar Action Buttons */
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: white;
    background-color: #334155;
    /* Default background for contrast */
}

.toolbar-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toolbar-btn i {
    font-size: 1.1em;
}

#create-message-btn {
    background-color: #3b82f6 !important;
}


/* Dashboard Content Areas */
.dashboard-main-panel-content {
    animation: fadeIn 0.4s ease-in-out;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}

#dashboard-newsletter-container,
#dashboard-subscribers-container,
#dashboard-users-container {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modals Modernization */
/* =========================================================================
   Modern Modal & Form UX
   ========================================================================= */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

#modal-container.hide {
    display: none;
    pointer-events: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    background: #ffffff;
    width: 1200px !important;
    height: 85vh !important;
    max-width: 95vw;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex !important;
    flex-direction: column !important;
    animation: modalPopIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    overflow: hidden !important;
    /* Block all horizontal scroll */
}

.modal-body,
#modal-content-container {
    flex-grow: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* No horizontal scroll inside modal */
    padding: 30px !important;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Allow shrinking if needed */
}





@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10001;
}


.modal-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px 40px !important;
    overflow-y: auto;
    position: relative;
    width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}

.modal-body * {
    box-sizing: border-box !important;
}



.modal-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

#add-form-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
    letter-spacing: -0.02em;
}

/* Form Layouts within Modal */
.form-group {
    margin-bottom: 25px;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 4px;
    text-align: left !important;
}

.form-input {
    display: inline-block !important;
    padding: 12px 16px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    color: #1e293b !important;
    background: #f8fafc !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

.form-input:focus {
    border-color: #3b82f6 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.btn-success {
    background-color: #10b981 !important;
    color: white !important;
}

.btn-primary {
    background-color: #3b82f6 !important;
    color: white !important;
}

.btn-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}


.modal-body .form-input,
.form-group .form-input,
textarea.form-input {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    margin-bottom: 25px !important;
    width: 100% !important;
    max-width: 100% !important;
}

.form-input:focus {
    background: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1) !important;
}

textarea.form-input {
    resize: vertical !important;
    min-height: 400px !important;
    line-height: 1.6 !important;
    text-align: left !important;
}

#newsletter-form {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

#custom-form-inputs {
    width: 100% !important;
}




.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 30px;
    border-top: 1px solid #f1f5f9;
}

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

    .modal-body {
        padding: 30px 20px;
    }
}




/* Table Responsive Scrolling Wrapper Update */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Dashboard Toolbar & Search Inputs */
.dashboard-toolbar {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-title {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.toolbar-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    min-width: 250px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%2394a3b8"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>') no-repeat;
    background-position: 12px center;
    background-size: 16px;
    padding-left: 38px !important;
    background-color: #ffffff;
    height: 44px !important;
    max-height: 44px !important;
    align-self: flex-start !important;
}

.filter-select,
.sort-select,
select.form-input {
    height: 44px !important;
    max-height: 44px !important;
    align-self: flex-start !important;
}

.filter-select,
select.form-input {
    min-width: 150px;
    cursor: pointer;
    background-color: #ffffff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-weight: 500;
    color: #334155;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-select:hover,
select.form-input:hover {
    border-color: #3b82f6 !important;
}

.filter-select:focus,
select.form-input:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

/* Empty State Container */
.empty-state-container {
    background-color: white;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.empty-state-icon {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.empty-state-container h3 {
    margin: 0 0 10px 0;
    color: #334155;
    font-size: 20px;
}

.empty-state-container p {
    color: #64748b;
    margin: 0;
}

/* Dashboard Tables Modernization */
.table-container {
    flex-grow: 1;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    margin-top: 10px;
}

.styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    background-color: transparent;
}

.styled-table thead tr {
    background-color: #f1f5f9 !important;
    color: #475569;
    text-align: left;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.styled-table th,
.styled-table td {
    padding: 18px 20px !important;
    border: none !important;
}

.styled-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.styled-table tbody tr:hover {
    background-color: #f8fafc;
}

.styled-table tbody tr:last-of-type td {
    border-bottom: none;
}

.styled-table td {
    color: #1e293b;
    font-size: 15px;
    border-bottom: 1px solid #f1f5f9 !important;
}

.styled-table td:first-child,
.styled-table th:first-child {
    border-left: none !important;
}

.styled-table td:last-child,
.styled-table th:last-child {
    border-right: none !important;
}

/* Status and Role Badges */
.status-badge {
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.82em;
    font-weight: 600;
    color: white;
    display: inline-block;
    letter-spacing: 0.03em;
}

.status-published,
.status-active {
    background-color: #10b981;
}

.status-draft {
    background-color: #f59e0b;
}

.status-inactive {
    background-color: #ef4444;
}

.status-archived {
    background-color: #94a3b8;
}

.role-root {
    background-color: #8b5cf6;
}

.role-admin {
    background-color: #3b82f6;
}

.role-user {
    background-color: #64748b;
}

/* Table Typography & Actions */
.row-title {
    color: #0f172a;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 480px;
    line-height: 1.4;
    font-size: 15px;
    margin-bottom: 2px;
}


.row-meta {
    color: #64748b;
    font-size: 0.9em;
}

.actions-col {
    text-align: right;
    min-width: 150px;
    white-space: nowrap;
}

.action-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 10px !important;
    border-radius: 50% !important;
    color: #64748b !important;
    font-size: 16px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-2px);
}

.action-btn i {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:active {
    transform: translateY(0);
}

/* Profile View Modernization */
.profile-container {
    max-width: 850px;
    margin-top: 24px;
}

.profile-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.profile-hero {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    padding: 40px;
    color: white;
    display: flex;
    align-items: center;
    gap: 32px;
}

.profile-avatar-large {
    width: 110px;
    height: 110px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 800;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.profile-hero-content h3 {
    margin: 0 0 8px 0 !important;
    font-size: 28px !important;
    color: white !important;
    font-weight: 700 !important;
}

.profile-hero-content .status-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    backdrop-filter: blur(4px);
}

.profile-body {
    padding: 40px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.profile-value {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-value i {
    color: #94a3b8;
    width: 18px;
    text-align: center;
}

.profile-edit-section {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #f1f5f9;
}

.action-edit:hover {
    background: rgba(3, 105, 161, 0.1) !important;
    color: #0369a1 !important;
}

.action-delete:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    color: #dc2626 !important;
}

.action-unsubscribe:hover {
    background-color: #fef2f2;
}

.action-resubscribe {
    color: #10b981;
}

.action-resubscribe:hover {
    background-color: #ecfdf5;
}

/* Toggle Switch UX */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #10b981;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* Refined Toggle Switch */
.toggle-switch {
    display: inline-block;
    position: relative;
    width: 44px;
    height: 22px;
    margin: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 22px;
    border: 1px solid #cbd5e1;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
    background-color: #10b981;
    border-color: #10b881;
}

input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

input:disabled+.toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================================
   Responsive: Tablet (max-width: 1023px)
   ========================================================================= */
@media (max-width: 1023px) {

    /* Fix header: override absolute position from common.css for mobile */
    #navigation-logo {
        position: relative !important;
        top: auto !important;
        height: auto !important;
    }

    .small-logo {
        height: 40px !important;
    }

    /* Auth forms: constrain width on tablet */
    form {
        width: 100% !important;
        padding: 0 20px !important;
        box-sizing: border-box !important;
    }

    .form-input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Toolbar: stack title above actions */
    .dashboard-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .toolbar-title {
        font-size: 22px !important;
    }

    .toolbar-actions {
        flex-wrap: wrap !important;
        gap: 10px !important;
        flex-direction: column !important;
    }

    .toolbar-actions .search-input {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: 44px !important;
    }

    .toolbar-actions .filter-select,
    .toolbar-actions .sort-select {
        flex: 1 1 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .toolbar-actions .toolbar-btn {
        flex: 1 1 auto !important;
        justify-content: center !important;
        width: 100% !important;
    }

    /* Tables: reduce padding, font-size for denser display */
    .styled-table th,
    .styled-table td {
        padding: 12px 14px !important;
        font-size: 13px !important;
    }

    .row-title {
        max-width: 260px !important;
        font-size: 14px !important;
    }

    .row-meta {
        font-size: 12px !important;
    }

    .actions-col {
        min-width: 80px !important;
    }

    .action-btn {
        padding: 8px !important;
        font-size: 14px !important;
    }

    /* Modal: reduce width, use viewport */
    .modal-card {
        width: 95vw !important;
        height: 90vh !important;
        border-radius: 14px !important;
    }

    .modal-body {
        padding: 20px !important;
    }

    /* Profile Section */
    .profile-container {
        max-width: 100% !important;
    }

    .profile-hero {
        padding: 28px !important;
        gap: 20px !important;
    }

    .profile-avatar-large {
        width: 80px !important;
        height: 80px !important;
        font-size: 30px !important;
        border-radius: 22px !important;
    }

    .profile-hero-content h3 {
        font-size: 22px !important;
    }

    .profile-body {
        padding: 24px !important;
    }

    .profile-grid {
        gap: 24px !important;
    }

    .profile-edit-section {
        max-width: 100% !important;
    }

    /* Password change mode */
    #profile-password-mode {
        padding: 18px !important;
    }
}

/* =========================================================================
   Responsive: Mobile (max-width: 640px)
   ========================================================================= */
@media (max-width: 640px) {

    /* Main panel padding */
    #dashboard-main-panel {
        padding: 16px 12px !important;
    }

    /* Auth forms: full width on mobile */
    form {
        max-width: 100% !important;
        padding: 0 16px !important;
    }

    .button {
        width: auto !important;
        max-width: 100% !important;
    }

    /* Toolbar: tighter, everything full-width */
    .toolbar-title {
        font-size: 20px !important;
    }

    .toolbar-actions {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .toolbar-actions .search-input,
    .toolbar-actions .filter-select,
    .toolbar-actions .sort-select {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        max-height: 44px !important;
    }

    .toolbar-actions .toolbar-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Tables: card-like rows on very small screens */
    .table-container {
        border-radius: 8px !important;
        margin-top: 8px !important;
    }

    .styled-table th,
    .styled-table td {
        padding: 10px 10px !important;
        font-size: 12px !important;
    }

    .styled-table thead tr {
        font-size: 11px !important;
    }

    .row-title {
        max-width: 140px !important;
        font-size: 13px !important;
        -webkit-line-clamp: 1 !important;
        line-clamp: 1 !important;
    }

    .actions-col {
        min-width: 60px !important;
    }

    .action-btn {
        padding: 6px !important;
        font-size: 13px !important;
    }

    .status-badge {
        padding: 4px 10px !important;
        font-size: 0.72em !important;
    }

    /* Modal: fully use the viewport */
    .modal-card {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    textarea.form-input {
        min-height: 200px !important;
    }

    /* Profile: stack hero vertically */
    .profile-hero {
        flex-direction: column !important;
        text-align: center !important;
        padding: 24px 20px !important;
        gap: 16px !important;
    }

    .profile-hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .profile-hero-content h3 {
        font-size: 20px !important;
    }

    .profile-avatar-large {
        width: 70px !important;
        height: 70px !important;
        font-size: 26px !important;
        border-radius: 18px !important;
    }

    /* Profile grid: single column */
    .profile-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .profile-body {
        padding: 20px 16px !important;
    }

    .profile-value {
        font-size: 14px !important;
    }

    .profile-card {
        border-radius: 12px !important;
    }

    /* Form rows: single column */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Password change mode on mobile */
    #profile-password-mode {
        padding: 14px !important;
        margin-top: 12px !important;
    }

    #profile-password-mode h4 {
        font-size: 15px !important;
    }

    /* Empty state */
    .empty-state-container {
        padding: 40px 16px !important;
    }

    .empty-state-icon {
        font-size: 36px !important;
    }

    .empty-state-container h3 {
        font-size: 17px !important;
    }

    /* User list: avatar and name stacking */
    .styled-table td div[style*="display: flex"][style*="gap: 14px"] {
        gap: 10px !important;
    }

    .styled-table td div[style*="width: 40px"][style*="height: 40px"] {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }

    /* Subscriber/User role dropdown smaller */
    .styled-table select.form-input {
        padding: 5px 8px !important;
        font-size: 12px !important;
        min-width: 110px !important;
    }

    /* Toggle switch label text */
    .toggle-switch {
        width: 38px !important;
        height: 20px !important;
    }

    .toggle-slider:before {
        height: 14px !important;
        width: 14px !important;
    }

    input:checked+.toggle-slider:before {
        transform: translateX(18px) !important;
    }
}

/* =========================================================================
   Responsive: Very small phones (max-width: 400px)
   ========================================================================= */
@media (max-width: 400px) {
    .toolbar-title {
        font-size: 18px !important;
    }

    .toolbar-btn {
        font-size: 12px !important;
        padding: 8px 12px !important;
    }

    .profile-hero-content h3 {
        font-size: 18px !important;
    }

    .profile-label {
        font-size: 10px !important;
    }

    .profile-value {
        font-size: 13px !important;
    }
}