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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white;
    min-height: 100vh;
    padding: 0;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: hidden;
}

.header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    margin-bottom: 10px;
}

.content {
    padding: 10px 0;
}

.file-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.file-info h3 {
    margin-bottom: 10px;
    color: #495057;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
}

.info-label {
    font-weight: bold;
    color: #6c757d;
}

.alert {
    padding: 15px 40px 15px 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: 500;
    position: relative;
}

.alert.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert.info {
    background-color: #cce5ff;
    border: 1px solid #b3d7ff;
    color: #004085;
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: inherit;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

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

.alert-close:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

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

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 2px solid #ced4da;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-upload {
    background: #28a745;
    color: white;
}

.btn-upload:hover {
    background: #218838;
    transform: translateY(-2px);
}

.preview-note {
    background: #e9ecef;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-top: 20px;
    border-radius: 0 5px 5px 0;
}

.image-upload-section,
.settings-section {
    background: #f0f4ff;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
}

.image-upload-section h3,
.settings-section h3 {
    margin-bottom: 20px;
    color: #212529;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: none;
}

.accordion-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
    padding: 5px;
    margin: -5px;
}

.accordion-header h2 {
    margin: 0;
    flex: 1;
    font-size: 14px;
}

.accordion-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
    color: #667eea;
    margin-left: 10px;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding-top: 0;
    padding-bottom: 0;
}

.accordion-content.expanded {
    max-height: 10000px;
    padding-top: 20px;
    padding-bottom: 0;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.upload-item {
    background: #ffffff;
    border: 1px solid #d0d8ff;
    border-radius: 8px;
    padding: 12px;
}

.upload-item.has-file {
    border-color: #28a745;
}

.upload-item h4 {
    margin: 0 0 4px 0;
    color: #2c3e50;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.image-preview {
    width: 100%;
    height: 40px;
    border: none;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: visible;
    background: transparent;
    position: relative;
}

.image-preview.empty {
    background: transparent;
}

.mp3-preview {
    border: none !important;
}

.preview-buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.icon-btn {
    width: 15px !important;
    height: 15px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}

.icon-btn:hover {
    transform: scale(1.15) !important;
    opacity: 0.8 !important;
}

.icon-btn img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    filter: none !important;
}

.icon-btn.remove-icon img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(95%) saturate(1352%) hue-rotate(331deg) brightness(92%) contrast(87%) !important;
}

.icon-btn.hide-icon img {
    filter: brightness(0) saturate(100%) invert(40%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(90%) !important;
}

.icon-btn.unhide-icon img {
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(98%) contrast(85%) !important;
}

.icon-btn.preview-icon img {
    filter: brightness(0) saturate(100%) invert(40%) sepia(99%) saturate(2476%) hue-rotate(193deg) brightness(97%) contrast(96%) !important;
}

.icon-btn.play-icon img {
    filter: brightness(0) saturate(100%) invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(98%) contrast(85%) !important;
}

.file-label {
    width: 15px !important;
    height: 15px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}

.file-label:hover {
    transform: scale(1.15) !important;
    opacity: 0.8 !important;
}

.file-label img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    filter: brightness(0) saturate(100%) invert(66%) sepia(64%) saturate(456%) hue-rotate(123deg) brightness(95%) contrast(88%) !important;
}

.file-input {
    display: none;
}

.preview-upload-form {
    display: inline-flex;
    gap: 8px;
}

.upload-item.has-file .preview-upload-form {
    display: none !important;
}

.upload-item .upload-progress~.preview-upload-form,
.preview-buttons:has(.upload-progress) .preview-upload-form {
    display: none !important;
}

.tab-navigation {
    display: flex;
    background: transparent;
    border-bottom: 1px solid #e9ecef;
    padding: 0;
    margin: 0;
    gap: 0;
}

.tab-navigation.fixed-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    border-bottom: none;
}

@media (min-width:992px) {
    <?php if ($activeTab ==='agent'):?>.tab-navigation.fixed-top {
        width: 100%;
        max-width: 370px;
        min-width: 370px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    <?php else:?>.tab-navigation.fixed-top {
        width: 100%;
        left: 0;
        right: 0;
        transform: none;
    }

    <?php endif;
    ?>
}

@media (max-width:991px) {
    <?php if ($activeTab ==='agent'):?>.tab-navigation.fixed-top {
        width: 100% !important;
        min-width: 100%;
        left: 0;
        right: 0;
        transform: none;
    }

    <?php endif;
    ?>
}

.tab-navigation.fixed-top[data-user-type="delivery"] {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.tab-navigation.fixed-top[data-user-type="agent"] {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.tab-navigation.fixed-top[data-user-type="admin"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    padding-top: 0px;
}

/* Hide tab content until nav offset padding is applied (avoids layout jump under fixed nav) */
body.content-padding-pending #tab-home.active,
body.content-padding-pending #tab-setting.active {
    visibility: hidden;
}

/* Connection Monitor Animations */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    position: relative;
}

.tab-button .tab-icon {
    display: none;
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
    margin: 0 auto;
}

.tab-button .tab-text {
    display: block;
}

.tab-button .tab-icon-mobile {
    display: none;
}

@media (max-width:768px) {
    .tab-button {
        padding: 10px 5px;
    }

    .tab-button .tab-icon {
        display: block;
    }

    .tab-button .tab-icon-desktop {
        display: none;
    }

    .tab-button .tab-icon-mobile {
        display: block !important;
    }

    .tab-button .tab-text {
        display: none;
    }
}

.tab-button.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-bottom: 2px solid #ffffff;
    border-radius: 0;
    font-weight: 600;
    font-size: 14px;
}

.nav-home-refresh-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.nav-home-refresh-btn--working .nav-home-refresh-icon {
    animation: hub-nav-refresh-spin 0.75s linear infinite;
}

@keyframes hub-nav-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

.tab-content {
    display: none;
    padding: 0px;
}

.tab-content.active {
    display: block;
}

#tab-home {
    padding-left: 0;
    padding-right: 0;
}

#tab-agent {
    padding: 0px;
}

#tab-agent .settings-section {
    background: transparent;
    padding: 0px;
    border: transparent;
}

/* Single space below fixed nav on agent tab: no extra content padding */
.content:has(#tab-agent.active) {
    padding-top: 0px !important;
}

#tab-facebook .settings-section {
    background: transparent;
    padding: 0px;
    border: transparent;
}

.setting-menu-item:hover {
    background: #e0e7ff !important;
    color: #667eea !important;
    border-color: #c0d0ff !important;
}

.setting-menu-item.active:hover {
    background: #5568d3 !important;
    color: white !important;
}

body.settings-active .content {
    padding: 0;
    /* padding-top set by index.php nav offset script (navbar height + 20px) */
}

body.settings-active #settingsForm {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.settings-active #formSettingsContainer {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
    align-items: start;
}

body.settings-active #formSettingsContainer>div:first-child {
    min-height: 0;
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body.settings-active #formSettingsContainer>div:last-child {
    min-height: 0;
    height: 100%;
    overflow-y: auto !important;
}

body.settings-active {
    padding-bottom: 0 !important;
}

body:not(.settings-active) {
    overflow-y: scroll;
}

/* Settings tab: natural height (no fixed viewport) - removed max-height/height so it flows like home tab */

.save-button-container {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 15px 30px;
    border-top: 2px solid #dee2e6;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 100;
}

.cloaking-upload-item {
    background: #f0d8d8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
}

.cloaking-upload-item.has-file {
    border-color: #dc3545;
}

.cloaking-upload-item h4 {
    color: #dc3545 !important;
}

.selected-file-name {
    font-size: 14px;
    color: #495057;
}

.php-files-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.php-files-section h3 {
    margin-bottom: 15px;
    color: #495057;
}

.php-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.php-file-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
}

.php-file-item h4 {
    margin-bottom: 15px;
    color: #495057;
}

.file-status {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 14px;
}

.file-status.exists {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.file-status.missing {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.php-file-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.php-file-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.php-file-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    text-align: center;
}

.popup-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.popup-close {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 15px;
}

.popup-close:hover {
    background: #5a6268;
}

.product-display {
    display: inline-block;
    max-width: 18ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.toggle-section {
    transition: all 0.3s ease;
}

.toggle-header {
    transition: all 0.2s ease;
}

.toggle-header:hover {
    opacity: 0.8;
}

.toggle-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 10px;
    margin-left: 8px;
}

.toggle-section.active .toggle-arrow {
    transform: rotate(180deg);
}

.toggle-content {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding-top: 0;
}

.toggle-section.active .toggle-content {
    max-height: 2000px;
    padding-top: 15px;
}

@media (max-width:768px) {
    body {
        padding: 0 10px 10px 10px;
    }

    .container {
        padding-top: 0px;
    }

    .content {
        padding-top: 10px;
        padding-bottom: 20px;
    }

    textarea {
        min-height: 300px;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .timezone-form-row {
        flex-direction: column !important;
    }

    .timezone-form-row select {
        width: 100% !important;
    }

    .timezone-form-row button {
        width: 100%;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    #addNewDomainBtn {
        width: 100% !important;
    }

    .domain-actions {
        flex-direction: column !important;
        width: 100%;
    }

    .domain-actions button {
        width: 100% !important;
    }

    .settings-section h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-settings-card .domain-actions {
        flex-direction: column !important;
        width: 100%;
    }

    .product-settings-card .domain-actions button {
        width: 100% !important;
    }
}

.product-settings-card {
    background: white;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
    overflow: visible;
}

.product-settings-card .product-fields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
    position: relative;
}

.product-settings-card .product-field {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 10px;
}

.product-settings-card .product-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.product-settings-card .product-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.product-settings-card .product-field .product-value {
    padding: 10px;
    color: #495057;
    font-size: 14px;
}

.product-settings-card .product-actions {
    flex: 1 1 auto;
    min-width: 0;
    overflow: visible;
}

.product-settings-card .product-actions label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.product-settings-card .product-actions-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width:768px) {
    .product-settings-card .product-fields-container {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 10px;
    }

    .product-settings-card .product-field {
        flex: none;
    }

    .product-settings-card .product-field:first-child {
        grid-column: 1 / -1;
    }

    .product-settings-card .product-actions {
        grid-column: 1 / -1;
    }

    .product-settings-card .product-actions label {
        display: none;
    }

    .product-settings-card .product-actions-buttons {
        flex-wrap: nowrap;
    }

    .product-settings-card .product-field-cities {
        grid-column: 1 / -1;
    }

    .product-settings-card .product-field .cities-button {
        width: 100%;
        max-width: 100%;
    }
}

@media (min-width:769px) {
    .product-settings-card .product-fields-container {
        display: flex;
        flex-wrap: nowrap;
    }

    .product-settings-card .product-field {
        flex: 1 1 0;
        min-width: 0;
    }

    .product-settings-card .product-field:first-child {
        flex: 2 1 0;
        min-width: 150px;
    }

    .product-settings-card .product-actions {
        flex: 2.5 1 0;
        min-width: 200px;
    }

    .product-settings-card .product-actions-buttons {
        flex-wrap: nowrap;
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .product-settings-card .product-actions button {
        flex: 0 0 auto;
        min-width: 40px;
    }
}

.product-settings-card .product-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.product-settings-card .product-actions button img {
    width: 20px;
    height: 20px;
    display: block;
}

.product-settings-card .product-actions .btn-save {
    background: #28a745;
    color: white;
}

.product-settings-card .product-actions .btn-cancel {
    background: #6c757d;
    color: white;
}

.product-settings-card .product-actions .btn-edit {
    background: #667eea;
    color: white;
}

.product-settings-card .product-actions .btn-remove {
    background: #dc3545;
    color: white;
}

.agent-card {
    background: white;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
}

.agent-card .agent-fields-container {
    margin-bottom: 10px;
}

.agent-card .agent-field {
    margin-bottom: 10px;
}

.agent-card .agent-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.agent-card .agent-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.agent-card .agent-value {
    padding: 10px;
    color: #495057;
    font-size: 14px;
}

.agent-card .agent-divider {
    width: 100%;
    height: 1px;
    background: #d0d8ff;
    margin: 15px 0;
}

.agent-card .agent-actions {
    display: flex;
    gap: 10px;
}

.agent-card .agent-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.agent-card .agent-actions button img {
    width: 20px;
    height: 20px;
    display: block;
}

.agent-card .agent-actions .btn-save {
    background: #28a745;
    color: white;
}

.agent-card .agent-actions .btn-cancel {
    background: #6c757d;
    color: white;
}

.agent-card .agent-actions .btn-edit {
    background: #667eea;
    color: white;
}

.agent-card .agent-actions .btn-remove {
    background: #dc3545;
    color: white;
}

.agent-sidebar-card {
    background: white;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.agent-sidebar-card .product-input-container-sidebar,
.agent-sidebar-card .upsell-product-input-container-sidebar {
    position: relative;
    width: 100%;
}

.agent-sidebar-card .product-input-sidebar,
.agent-sidebar-card .upsell-product-input-sidebar {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.agent-sidebar-card .product-suggestions-sidebar,
.agent-sidebar-card .upsell-product-suggestions-sidebar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: none;
}

.agent-sidebar-card .product-suggestion-item-sidebar:hover {
    background: #f0f4ff;
}

.agent-sidebar-card .product-tags-container-sidebar,
.agent-sidebar-card .upsell-product-tags-container-sidebar {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.agent-sidebar-card .product-tag-sidebar,
.agent-sidebar-card .upsell-product-tag-sidebar {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.agent-sidebar-card .product-tag-close-sidebar {
    cursor: pointer;
    font-weight: bold;
    color: #666;
}

.agent-sidebar-card .product-tag-close-sidebar:hover {
    color: #dc3545;
}

.product-settings-card .product-actions .btn-toggle-hide {
    background: #ffc107;
    color: white;
}

.product-settings-card .product-actions .btn-toggle-expand {
    background: #17a2b8;
    color: white;
}

.product-settings-card .delivery-divider {
    width: 100%;
    height: 1px;
    background: #d0d8ff;
    margin: 15px 0;
    border: none;
}

.product-settings-card .product-fields-container {
    cursor: pointer;
    user-select: none;
}

.product-settings-card .product-actions {
    position: relative;
}

.product-settings-card .product-actions::after {
    content: '▼';
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 12px;
    transition: transform 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

@media (max-width:768px) {
    .product-settings-card .product-actions::after {
        right: -20px;
    }
}

.product-settings-card.expanded .product-actions::after {
    transform: translateY(-50%) rotate(180deg);
}

.product-settings-card .delivery-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.product-settings-card.expanded .delivery-section {
    max-height: 5000px;
    overflow: visible;
}

.product-settings-card .delivery-divider {
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-settings-card.expanded .delivery-divider {
    opacity: 1;
    margin: 15px 0;
}

.product-settings-card .delivery-config-section {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.product-settings-card .delivery-config-fields-inline {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.product-settings-card .delivery-config-field {
    flex: 1 1 auto;
    min-width: 150px;
}

.product-settings-card .delivery-config-field.delivery-company-field,
.product-settings-card .delivery-config-field.selected-cities-field {
    flex: 0 0 50%;
    width: 50%;
    box-sizing: border-box;
}

@media (max-width:768px) {
    .product-settings-card .delivery-config-fields-inline {
        flex-direction: column;
    }

    .product-settings-card .delivery-config-field.delivery-company-field,
    .product-settings-card .delivery-config-field.selected-cities-field {
        flex: 1 1 auto;
        width: 100%;
    }
}

.product-settings-card .delivery-config-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #495057;
    font-size: 14px;
}

.product-settings-card .delivery-config-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    background: white;
}

.product-settings-card .delivery-config-field .delivery-value {
    padding: 10px;
    color: #495057;
    font-size: 14px;
}

.product-settings-card .delivery-config-field.except-cities-field {
    flex: 2 1 auto;
    min-width: 200px;
}

.product-settings-card .city-dropdown-container {
    position: relative;
    width: 100%;
    z-index: 1;
}

.product-settings-card .city-dropdown-toggle {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.product-settings-card .city-dropdown-toggle:after {
    content: '▼';
    font-size: 10px;
    color: #666;
}

.product-settings-card .city-dropdown-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.product-settings-card .city-dropdown-menu.open {
    display: block;
}

.product-settings-card .city-search-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    box-sizing: border-box;
}

.product-settings-card .city-select-all {
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

.product-settings-card .city-select-all:hover {
    background: #e9ecef;
}

.product-settings-card .city-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
}

.product-settings-card .city-checkbox-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.product-settings-card .city-checkbox-item:hover {
    background: #f0f4ff;
}

.product-settings-card .city-checkbox-item:last-child {
    border-bottom: none;
}

.product-settings-card .city-checkbox-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.product-settings-card .city-checkbox-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-weight: normal;
}

.product-settings-card .city-warning {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.product-settings-card .city-warning.show {
    display: block;
}

.product-settings-card .delivery-company-set {
    width: 100%;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #d0d8ff;
    border-radius: 6px;
    background: #e2d4ff;
    overflow: visible;
}

.product-settings-card .delivery-company-set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.product-settings-card .delivery-company-set-header label {
    font-weight: 600;
    color: #667eea;
    font-size: 14px;
    margin: 0;
}

.product-settings-card .delivery-company-set-number {
    font-weight: 600;
    color: #667eea;
}

.product-settings-card .delivery-company-set-remove {
    background: #dc3545;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s;
}

.product-settings-card .delivery-company-set-remove:hover {
    background: #c82333;
}

.product-settings-card .delivery-company-set-remove:before {
    content: '×';
    color: white;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

.product-settings-card .delivery-value-text {
    padding: 10px;
    color: #495057;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.4;
}

@media (min-width:769px) {
    .product-settings-card .delivery-config-section {
        display: flex;
        flex-wrap: nowrap;
        gap: 15px;
    }

    .product-settings-card .delivery-config-field {
        flex: 1 1 0;
        min-width: 0;
    }

    .product-settings-card .delivery-value-text {
        padding: 8px 10px;
        font-size: 13px;
    }
}

.product-settings-card .add-delivery-company-btn {
    width: 100%;
    padding: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.product-settings-card .add-delivery-company-btn:hover {
    background: #5568d3;
}

.product-settings-card .add-delivery-company-btn:before {
    content: '+';
    font-size: 20px;
    font-weight: bold;
}

@media (max-width:768px) {
    .product-settings-card .delivery-config-section {
        flex-direction: column;
    }

    .product-settings-card .delivery-config-field {
        width: 100%;
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-popup {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    color: white;
    position: relative;
}

.loading-popup h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: white;
}

.loading-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
}

.operation-list {
    margin-bottom: 25px;
}

.operation-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
}

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

.operation-name {
    font-weight: 600;
    font-size: 14px;
}

.operation-time {
    font-size: 12px;
    opacity: 0.9;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-bar {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.operation-status {
    font-size: 11px;
    opacity: 0.8;
    text-align: right;
}

.loading-ok-button {
    width: 100%;
    padding: 15px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.loading-ok-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

.loading-ok-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* Notes Feature Styles */
.notes-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.notes-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.notes-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.notes-popup-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.notes-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #666;
    padding: 0 4px;
}

.notes-cards-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.notes-loading-msg {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.notes-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    user-select: none;
    position: relative;
    transition: border-color 0.15s ease, opacity 0.15s ease;
}

.notes-card.dragging {
    opacity: 0.95;
    border: 2px solid #6878E2 !important;
}

.notes-card.note-color-red {
    background: #ffcdd2;
}

.notes-card.note-color-blue {
    background: #bbdefb;
}

.notes-card.note-color-yellow {
    background: #fff9c4;
}

.notes-card.note-color-green {
    background: #c8e6c9;
}

.notes-card.note-color-white {
    background: #fafafa;
}

.notes-card.note-color-red .notes-card-actions button img {
    filter: brightness(0) saturate(100%) invert(27%) sepia(98%) saturate(2000%) hue-rotate(350deg);
}

.notes-card.note-color-red .notes-card-actions .notes-position-handle {
    color: #c62828;
}

.notes-card.note-color-blue .notes-card-actions button img {
    filter: brightness(0) saturate(100%) invert(28%) sepia(90%) saturate(1000%) hue-rotate(195deg);
}

.notes-card.note-color-blue .notes-card-actions .notes-position-handle {
    color: #1976d2;
}

.notes-card.note-color-green .notes-card-actions button img {
    filter: brightness(0) saturate(100%) invert(42%) sepia(70%) saturate(800%) hue-rotate(95deg);
}

.notes-card.note-color-green .notes-card-actions .notes-position-handle {
    color: #388e3c;
}

.notes-card.note-color-yellow .notes-card-actions button img {
    filter: brightness(0) saturate(100%) invert(35%) sepia(60%) saturate(800%) hue-rotate(15deg);
}

.notes-card.note-color-yellow .notes-card-actions .notes-position-handle {
    color: #B8860B;
}

.notes-card.note-color-white .notes-card-actions button img {
    filter: none;
}

.notes-card.note-color-white .notes-card-actions .notes-position-handle {
    color: #333;
}

.notes-card-text {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 1.5em;
    border: none;
    background: transparent;
    resize: none;
    font: inherit;
    padding: 4px 0;
    overflow-y: hidden;
}

.notes-card-text:focus {
    outline: none;
}

.notes-card-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.notes-card-actions .notes-action-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notes-card-actions .notes-action-save-only {
    flex: 0 0 auto;
}

.notes-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-card-actions button img {
    width: 18px;
    height: 18px;
}

.notes-card-actions .notes-color-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid #ddd;
}

.notes-card-actions .notes-color-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 6px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.notes-card-actions .notes-color-dropdown button {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.notes-card-actions .notes-position-handle {
    cursor: grab;
    padding: 6px;
}

.notes-card-actions .notes-position-handle:active {
    cursor: grabbing;
}

.notes-bottom-bar {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
}

.notes-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #ccc;
}

.notes-btn-add {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

.notes-btn-add:disabled {
    background: #9e9e9e !important;
    color: #fff !important;
    border-color: #9e9e9e !important;
    cursor: not-allowed;
}

/* 
   -------------------------------------------------------------------------
   MODERN DASHBOARD & DRAWER SYSTEM (Settings Redesign)
   -------------------------------------------------------------------------
*/

/* 1. Global Variables & Modern Resets for Settings */
:root {
    --primary-color: #4F46E5;
    /* Indigo-600 */
    --primary-hover: #4338CA;
    /* Indigo-700 */
    --bg-color: #F3F4F6;
    /* Gray-100 */
    --card-bg: #FFFFFF;
    --text-main: #111827;
    /* Gray-900 */
    --text-sub: #6B7280;
    /* Gray-500 */
    --border-color: #E5E7EB;
    /* Gray-200 */
    --drawer-width: 500px;
    --drawer-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Settings Page Context Specifics */
body.settings-active {
    background-color: var(--bg-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Modern font stack */
}

/* 2. Redesigned Sidebar & Layout */
#tab-setting>div {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    gap: 20px !important;
}

/* Sidebar */
#setting-sidebar {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 24px 0 !important;
}

.setting-menu-item {
    border: 1px solid #667eea !important;
    background: #667eea !important;
    color: white !important;
    font-weight: 600 !important;
    border-radius: 50px !important;
    padding: 12px 24px !important;
    margin-bottom: 0 !important;
    transition: all 0.3s ease !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-menu-item:hover {
    background: #5568d3 !important;
    border-color: #5568d3 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.setting-menu-item.active {
    background: white !important;
    color: #667eea !important;
    border-color: white !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

/* Content Area */
#tab-setting>div>div:last-child {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.setting-content-section {
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 24px;
}

/* Mobile: hide settings content, show desktop-only message */
@media (max-width: 768px) {
    #tab-setting .tab-setting-desktop-content {
        display: none !important;
    }

    #tab-setting .tab-setting-mobile-message {
        display: block !important;
    }
}

/* Titles & Headers */
.setting-content-section h2,
.drawer-header h2 {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    margin-bottom: 24px !important;
    letter-spacing: -0.025em;
}

/* Tables & Lists Headers */
.setting-list-header {
    display: flex;
    padding: 12px 24px;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-sub);
    font-weight: 600;
}

/* Settings tables: Colorlib-style simple table + horizontal scroll */
.setting-table-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 32px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 122, 224, 0.4) rgba(0, 0, 0, 0.05);
}

.setting-table-scroll-wrap::-webkit-scrollbar {
    height: 8px;
}

.setting-table-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.setting-table-scroll-wrap::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.setting-table-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Settings table layout — column tracks defined in table-override.css (subgrid) */
.setting-table-scroll-wrap .setting-table-header {
    background: #f8fafc !important;
    color: #374151 !important;
    gap: 0 !important;
    align-items: center;
    font-weight: 600;
    font-size: 12px;
    padding: 0 !important;
    border: none !important;
}
.setting-table-scroll-wrap .setting-table-header > div {
    min-width: 0;
    padding: 11px 14px !important;
    border: none !important;
    border-right: 1px solid #e5e7eb !important;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.setting-table-scroll-wrap .setting-table-body > div {
    gap: 0 !important;
    align-items: center;
    background: #fff !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    transition: background 0.12s ease;
}
.setting-table-scroll-wrap .setting-table-body > div:hover {
    background: #f8fafc !important;
    transform: none !important;
    box-shadow: none !important;
}
.setting-table-scroll-wrap .setting-table-body > div > div {
    min-width: 0;
    min-height: 0 !important;
    padding: 10px 14px !important;
    font-size: 13px;
    color: #4b5563;
    border: none !important;
    border-right: 1px solid #f1f5f9 !important;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.setting-table-scroll-wrap .setting-table-body > div > div:first-child {
    color: #333;
    font-weight: 500;
}
.setting-table-scroll-wrap .setting-table-body > div > div:last-child {
    justify-content: center;
}

/* Input/Select styling - aligned with modern design */
.setting-table-scroll-wrap .setting-table-body>div>div input,
.setting-table-scroll-wrap .setting-table-body>div>div select {
    max-width: 100%;
    box-sizing: border-box;
}

/* Display values with ellipsis */
.setting-table-scroll-wrap .setting-table-body [class$="-display"],
.setting-table-scroll-wrap .setting-table-body .profile-display,
.setting-table-scroll-wrap .setting-table-body .profile-link-display,
.setting-table-scroll-wrap .setting-table-body .password-display,
.setting-table-scroll-wrap .setting-table-body .twofa-display,
.setting-table-scroll-wrap .setting-table-body .eight-code-display,
.setting-table-scroll-wrap .setting-table-body .vcc-display,
.setting-table-scroll-wrap .setting-table-body .phone-display,
.setting-table-scroll-wrap .setting-table-body .note-display,
.setting-table-scroll-wrap .setting-table-body .gender-display,
.setting-table-scroll-wrap .setting-table-body .role-display {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-weight: 500;
    color: #374151;
}

/* Click-to-copy cells (Profile Link, Password, 8 Code) */
.setting-content-section .copyable-value {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 6px;
}

.setting-content-section .copyable-value:hover {
    background: rgba(102, 126, 234, 0.12);
    transform: scale(1.02);
}

/* Real <table> in settings (e.g. Facebook Monitoring) */
.setting-content-section table.setting-fixed-table {
    table-layout: fixed;
    min-width: max-content;
}

.setting-content-section table.setting-fixed-table th,
.setting-content-section table.setting-fixed-table td {
    min-width: 140px;
    max-width: 140px;
    width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 12px 8px;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
}

.setting-content-section .setting-table-scroll-wrap table.setting-fixed-table {
    width: 100%;
}

/* Admin credentials sidebar card – Modern Premium Design */
.admin-credentials-sidebar-card {
    width: 100%;
    max-width: 480px;
}

.admin-credentials-sidebar-card .admin-creds-card-inner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.admin-credentials-sidebar-card .admin-creds-card-inner:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.4), 0 5px 15px rgba(0, 0, 0, 0.15);
}

.admin-credentials-sidebar-card .admin-creds-card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.admin-credentials-sidebar-card .admin-creds-header {
    padding: 32px 24px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
}

.admin-credentials-sidebar-card .admin-creds-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    font-size: 32px;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-credentials-sidebar-card .admin-creds-header-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-credentials-sidebar-card .admin-creds-header-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.5;
    font-weight: 400;
}

.admin-credentials-sidebar-card .admin-creds-block {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #ffffff;
}

.admin-credentials-sidebar-card .admin-creds-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-credentials-sidebar-card .admin-creds-item-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-credentials-sidebar-card .admin-creds-item-value-wrap {
    min-height: 48px;
    display: flex;
    align-items: center;
}

.admin-credentials-sidebar-card .admin-creds-field-value,
.admin-credentials-sidebar-card .admin-creds-item-value-wrap input,
.admin-credentials-sidebar-card .admin-creds-current-pw-wrap input {
    font-size: 15px;
    color: #1e293b;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    box-sizing: border-box;
    width: 100%;
    background: #f9fafb;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.admin-credentials-sidebar-card .admin-creds-item-value-wrap input {
    background: #fff;
    border-color: #d1d5db;
}

.admin-credentials-sidebar-card .admin-creds-item-value-wrap input:focus,
.admin-credentials-sidebar-card .admin-creds-current-pw-wrap input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.admin-credentials-sidebar-card .admin-creds-field-value {
    border-color: transparent;
    font-weight: 600;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

.admin-credentials-sidebar-card .admin-creds-current-pw-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    border: 2px solid #fbbf24;
}

.admin-credentials-sidebar-card .admin-creds-current-pw-wrap .admin-creds-item-label {
    color: #92400e;
    margin: 0 0 4px 0;
}

.admin-credentials-sidebar-card .admin-creds-current-pw-wrap .admin-creds-item-label em {
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: 11px;
    color: #b45309;
}

.admin-credentials-sidebar-card .admin-creds-current-pw-wrap input {
    background: #fff;
    border-color: #fbbf24;
}

.admin-credentials-sidebar-card .admin-creds-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
}

.admin-credentials-sidebar-card .admin-creds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    min-width: 48px;
    min-height: 48px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #64748b;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.admin-credentials-sidebar-card .admin-creds-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.admin-credentials-sidebar-card .admin-creds-btn:hover::before {
    width: 200px;
    height: 200px;
}

.admin-credentials-sidebar-card .admin-creds-btn img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.admin-credentials-sidebar-card .admin-creds-btn:hover {
    background: #f9fafb;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.admin-credentials-sidebar-card .admin-creds-btn:hover img {
    transform: scale(1.1);
}

.admin-credentials-sidebar-card .admin-creds-btn:active {
    transform: translateY(0);
}

.admin-credentials-sidebar-card .admin-creds-btn-save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.admin-credentials-sidebar-card .admin-creds-btn-save::before {
    background: rgba(255, 255, 255, 0.2);
}

.admin-credentials-sidebar-card .admin-creds-btn-save:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d94 100%);
    border-color: #5568d3;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.admin-credentials-sidebar-card .admin-creds-otp-section {
    padding: 28px 24px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    position: relative;
}

.admin-credentials-sidebar-card .admin-creds-otp-section::before {
    content: '🔐';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 32px;
    opacity: 0.1;
}

.admin-credentials-sidebar-card .admin-creds-otp-title {
    font-size: 16px;
    font-weight: 700;
    color: #4338ca;
    margin: 0 0 8px 0;
    letter-spacing: -0.3px;
}

.admin-credentials-sidebar-card .admin-creds-otp-desc {
    font-size: 13px;
    color: #6366f1;
    margin: 0 0 20px 0;
    line-height: 1.6;
    font-weight: 500;
}

.admin-credentials-sidebar-card .admin-creds-otp-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #4338ca;
    margin-bottom: 20px;
    cursor: pointer;
    font-weight: 600;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.admin-credentials-sidebar-card .admin-creds-otp-toggle:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(4px);
}

.admin-credentials-sidebar-card .admin-creds-otp-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.admin-credentials-sidebar-card .admin-creds-otp-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.admin-credentials-sidebar-card .admin-creds-otp-section .admin-creds-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-credentials-sidebar-card .admin-creds-otp-section .admin-creds-field-label {
    font-size: 12px;
    font-weight: 700;
    color: #4338ca;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-credentials-sidebar-card .admin-creds-otp-section .admin-creds-field input {
    padding: 14px 16px;
    border: 2px solid #c7d2fe;
    border-radius: 12px;
    font-size: 14px;
    box-sizing: border-box;
    width: 100%;
    background: #fff;
    font-weight: 500;
    transition: all 0.3s ease;
}

.admin-credentials-sidebar-card .admin-creds-otp-section .admin-creds-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.admin-credentials-sidebar-card .admin-creds-otp-section .otp-save-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-credentials-sidebar-card .admin-creds-otp-section .otp-save-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d94 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.admin-credentials-sidebar-card .admin-creds-otp-section .otp-save-btn:active {
    transform: translateY(0);
}

/* 3. Modern Cards (Delivery Config, etc) */
.settings-card-modern {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.settings-card-modern:hover {
    border-color: #D1D5DB;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.settings-input {
    border: 1px solid #D1D5DB !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.settings-input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

/* Action Buttons (Icons) */
.action-btn-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: 1px solid transparent;
}

.btn-icon:hover {
    background: #F3F4F6;
    border-color: #E5E7EB;
}

.btn-icon img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.btn-icon:hover img {
    opacity: 1;
}

/* 4. DRAWER SYSTEM */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    width: var(--drawer-width);
    max-width: 90vw;
    background: white;
    height: 100%;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: var(--drawer-transition);
    display: flex;
    flex-direction: column;
}

.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
}

.drawer-header h2 {
    margin: 0 !important;
    font-size: 18px;
}

.drawer-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.drawer-close-btn:hover {
    background: #F3F4F6;
    color: var(--text-main);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #F9FAFB;
}

.drawer-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: white;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Drawer Card Styles (Similar to main cards but inside drawer) */
.drawer-card-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

/* Primary Button Modern */
.btn-modern-primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.btn-modern-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-modern-secondary {
    background-color: white;
    color: var(--text-main);
    border: 1px solid #D1D5DB;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-modern-secondary:hover {
    background-color: #F9FAFB;
    border-color: #9CA3AF;
}

/* Tag style for list items */
.tag-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    background: #EEF2FF;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 500;
}

/* Mobile Responsiveness for Drawer */
@media (max-width: 640px) {
    :root {
        --drawer-width: 100%;
    }
}