html, body {
    margin: 0;
    overflow-x: hidden;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Only structural offsets for Blazor shell. Visual styling comes from admin.css */
.main-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 90;
}

#main-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 250px;
    z-index: 85;
    overflow-y: hidden;
}

#main-sidebar .sidebar-wrapper {
    height: 100%;
}

/* Topbar user avatar */
.sidebar-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #4f46e5;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: default;
}

.dark .sidebar-user-avatar {
    background: #6366f1;
}

.sidebar-user-avatar-placeholder,
.dark .sidebar-user-avatar-placeholder {
    background: rgba(99, 102, 241, 0.18);
    color: transparent;
}

/* Sidebar logout button pinned to the bottom */
.sidebar-logout-section {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(229, 231, 235, 0.6);
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-logout-btn:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

.dark .sidebar-logout-section {
    border-top-color: rgba(148, 163, 184, 0.18);
}

.dark .sidebar-logout-btn {
    color: #94a3b8;
}

.dark .sidebar-logout-btn:hover {
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.25);
    border-color: rgba(248, 113, 113, 0.3);
}

.main-content {
    padding-top: 88px !important;
    min-height: 100vh;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.blazor-sidebar .dropdown-menu.blazor-submenu {
    position: static;
    display: block;
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: 250px;
        width: calc(100% - 250px);
    }
}

/* Decorative ray background used by Impressions/Clicks KPI cards */
.kpi-rays {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 220% 220%;
}

.kpi-rays-green {
    background-image:
        repeating-conic-gradient(
            from 0deg at 50% 50%,
            rgba(34, 197, 94, 0.11) 0deg,
            rgba(34, 197, 94, 0.11) 1deg,
            transparent 1deg,
            transparent 7deg
        );
}

.kpi-rays-blue {
    background-image:
        repeating-conic-gradient(
            from 0deg at 50% 50%,
            rgba(14, 165, 233, 0.11) 0deg,
            rgba(14, 165, 233, 0.11) 1deg,
            transparent 1deg,
            transparent 7deg
        );
}

/* Footer — centered copyright (override template's absolute/flex footer) */
.main-footer {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    margin-top: auto !important;
    z-index: auto !important;
}

.main-footer-inner {
    padding: 0.75rem 1rem 1rem;
    text-align: center;
}

.main-footer-divider {
    max-width: 12rem;
    margin: 0 auto 0.75rem;
    border: none;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgb(209 213 219 / 0.6),
        transparent
    );
}

.main-footer-copy {
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgb(156 163 175);
    letter-spacing: 0.02em;
}

@media (max-width: 767px) {
    .main-footer {
        margin-top: 1rem !important;
    }

    .main-footer-inner {
        padding: 0.5rem 0.75rem 0.75rem;
    }

    .main-footer-copy {
        font-size: 0.78rem;
    }
}

/* Match Select2 multi-select with AdminTemplate form styles */
.select2-container--default .select2-selection--multiple.admin-select2-selection,
.select2-container--default .select2-selection--single.admin-select2-selection {
    min-height: 42px;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 0.25rem 0.5rem;
}

/* Multi-select: avoid Select2 default floats so × and label do not overlap */
.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.25rem 0.1rem 0 !important;
}

/* Select2 4.1 default uses position:absolute on __remove + padding-left on __choice; override fully */
.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice {
    float: none !important;
    display: inline-flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    border-radius: 9999px;
    padding: 0.2rem 0.6rem 0.2rem 0.35rem !important;
    margin-top: 0.15rem;
    margin-right: 0;
    margin-left: 0.25rem;
    line-height: 1.25;
    overflow: visible !important;
    position: relative;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice__display {
    padding-left: 0 !important;
    padding-right: 0 !important;
    flex: 1 1 auto;
    min-width: 0;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice__remove {
    position: static !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    float: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    margin: 0 !important;
    padding: 0;
    color: #6366f1;
    line-height: 1;
    font-size: 0.9rem;
    font-weight: 700;
    border: none !important;
    border-radius: 9999px;
    background: #e0e7ff;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-search--inline {
    flex: 1 1 8rem;
    min-width: 5em;
}

/* Single-select (country): clear × vs selected label */
.select2-container--default .select2-selection--single.admin-select2-selection .select2-selection__rendered {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.35rem !important;
    padding-right: 1.75rem !important;
    line-height: 1.35;
    min-height: 38px;
}

.select2-container--default .select2-selection--single.admin-select2-selection .select2-selection__clear {
    float: none !important;
    order: 2;
    margin-left: auto !important;
    margin-right: 0 !important;
    flex-shrink: 0;
    padding: 0 0.15rem;
    line-height: 1;
    font-weight: 700;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-search__field {
    margin-top: 0.2rem !important;
    font-size: 0.875rem;
}

.select2-container--default.select2-container--focus .select2-selection--multiple.admin-select2-selection,
.select2-container--default.select2-container--focus .select2-selection--single.admin-select2-selection,
.select2-container--default .select2-selection--multiple.admin-select2-selection:focus,
.select2-container--default .select2-selection--single.admin-select2-selection:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.select2-container--default .select2-dropdown.admin-select2-dropdown {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #6366f1;
    color: #ffffff;
}

.select2-container--open {
    z-index: 1050 !important;
}

.admin-select2-add-btn {
    width: 100%;
    border: 1px dashed #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.admin-select2-add-btn:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

/* Not found products — filter toolbar */
.nf-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
}

.nf-filter-field .form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.35rem;
}

.nf-filter-field {
    flex: 1 1 auto;
    min-width: 8rem;
}

.nf-filter-search {
    flex: 1 1 14rem;
    min-width: 12rem;
}

.nf-filter-actions {
    flex: 0 0 auto;
    padding-bottom: 0.05rem;
}

.btn.nf-toolbar-search {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4338ca;
    color: #fff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.btn.nf-toolbar-search:hover:not(:disabled) {
    color: #fff;
    filter: brightness(1.05);
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.42);
}

/* Not found products — approval status (accept / reject / pending) */
.nf-badge-pending,
.nf-badge-accepted,
.nf-badge-rejected {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 9999px;
    line-height: 1.2;
    white-space: nowrap;
}

.nf-badge-pending {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border: 1px solid #f59e0b;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.25);
}

.nf-badge-accepted {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
    box-shadow: 0 1px 2px rgba(16, 185, 129, 0.28);
}

.nf-badge-rejected {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
    box-shadow: 0 1px 2px rgba(239, 68, 68, 0.28);
}

.ap-badge-neutral {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.45rem;
    line-height: 1.1;
    white-space: nowrap;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 2px rgba(107, 114, 128, 0.2);
}

/* Not found — row action buttons */
.nf-btn-add-product,
.nf-btn-reject-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 0.4rem;
    line-height: 1.2;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

.nf-btn-add-product {
    color: #fff;
    background: linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%);
    border-color: #047857;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.nf-btn-add-product:hover {
    color: #fff;
    filter: brightness(1.06);
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.4);
}

/* Align global primary buttons with list action color palette */
.btn.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4338ca;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.btn.btn-primary:hover:not(:disabled),
.btn.btn-primary:focus-visible {
    color: #fff;
    filter: brightness(1.06);
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.42);
}

.btn.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.nf-btn-reject-row {
    color: #fff;
    background: linear-gradient(135deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
    border-color: #b91c1c;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.nf-btn-reject-row:hover:not(:disabled) {
    color: #fff;
    filter: brightness(1.06);
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.42);
}

.nf-btn-reject-row:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.nf-label-added {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 0.4rem;
}

/* Not found — reject modal primary action */
.nf-btn-reject-confirm {
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
    font-weight: 600;
    padding: 0.5rem 1.1rem;
    border-radius: 0.45rem;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.nf-btn-reject-confirm:hover:not(:disabled) {
    color: #fff;
    filter: brightness(1.05);
    box-shadow: 0 3px 12px rgba(220, 38, 38, 0.45);
}

.nf-btn-reject-confirm:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Product reports — selectable product rows */
.pr-product-row:hover {
    background-color: rgba(99, 102, 241, 0.06);
}

.pr-product-row-selected {
    background-color: rgba(99, 102, 241, 0.12);
    box-shadow: inset 3px 0 0 #6366f1;
}

/* Dashboard visual refresh */
.ds-hero-card {
    border: 0;
    background:
        radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.18), transparent 40%),
        linear-gradient(135deg, #4f46e5 0%, #0ea5e9 50%, #10b981 100%);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.22);
}

.ds-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #ecfeff;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.ds-kpi-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.ds-kpi-blue {
    background: linear-gradient(145deg, #eff6ff 0%, #ffffff 55%);
}

.ds-kpi-violet {
    background: linear-gradient(145deg, #f5f3ff 0%, #ffffff 55%);
}

.ds-kpi-green {
    background: linear-gradient(145deg, #ecfdf5 0%, #ffffff 55%);
}

.ds-kpi-label {
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.4rem;
}

.ds-kpi-sub {
    color: #64748b;
    font-size: 0.82rem;
}

.ds-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.ds-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    padding: 0.2rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ds-kpi-icon-blue {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #bfdbfe;
}

.ds-kpi-icon-violet {
    color: #6d28d9;
    background: #ede9fe;
    border-color: #ddd6fe;
}

.ds-kpi-icon-green {
    color: #047857;
    background: #d1fae5;
    border-color: #a7f3d0;
}

.ds-trend-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.ds-trend-up {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}

.ds-trend-neutral {
    color: #334155;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}

.ds-mini-card {
    border: 1px solid #e5e7eb;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ds-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.ds-mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ds-mini-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.ds-mini-badge-neutral {
    color: #334155;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}

.ds-mini-badge-good {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
}

.ds-mini-badge-warn {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.ds-chart-host {
    min-height: 320px;
}

.ds-table thead th {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.ds-table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.04);
}

.ds-country-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ds-country-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.7rem;
    padding: 0.7rem 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ds-country-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}

.ds-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #4338ca;
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
    border-radius: 9999px;
}

.ds-country-progress-track {
    width: 100%;
    height: 0.45rem;
    border-radius: 9999px;
    background: #e2e8f0;
    overflow: hidden;
}

.ds-country-progress-fill {
    height: 100%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #6366f1 0%, #0ea5e9 100%);
}

.ds-country-meta {
    margin-top: 0.35rem;
    font-size: 0.74rem;
    color: #64748b;
}

.ds-panel-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
}

.ds-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ds-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0.55rem 0.65rem;
}

.ds-filter-field {
    min-width: 8.2rem;
}

.ds-filter-field .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ds-filter-field .form-input {
    min-width: 8.2rem;
}

.ds-filter-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 1279px) {
    .ds-filter-bar {
        justify-content: flex-start;
    }
}

@media (max-width: 767px) {
    .ds-card-header {
        align-items: stretch;
    }

    .ds-filter-bar {
        width: 100%;
    }

    .ds-filter-field,
    .ds-filter-field .form-input {
        min-width: 100%;
        width: 100%;
    }

    .ds-filter-actions {
        width: 100%;
    }

    .ds-filter-actions .btn {
        flex: 1 1 0;
    }
}

/* Dashboard dark-mode tuning */
.dark .ds-panel-card {
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.35);
    background: #0f172a;
}

.dark .ds-card-header {
    border-bottom-color: rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
}

.dark .ds-kpi-card {
    border-color: rgba(148, 163, 184, 0.2);
}

.dark .ds-kpi-blue {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 55%);
}

.dark .ds-kpi-violet {
    background: linear-gradient(145deg, rgba(46, 16, 101, 0.22) 0%, rgba(15, 23, 42, 0.95) 55%);
}

.dark .ds-kpi-green {
    background: linear-gradient(145deg, rgba(6, 78, 59, 0.25) 0%, rgba(15, 23, 42, 0.95) 55%);
}

.dark .ds-kpi-label,
.dark .ds-kpi-sub,
.dark .ds-country-meta,
.dark .ds-filter-field .form-label {
    color: #94a3b8;
}

.dark .ds-kpi-card h3,
.dark .ds-mini-card h5,
.dark .ds-country-item-head .text-slate-900,
.dark .ds-country-item-head .text-slate-700 {
    color: #e2e8f0 !important;
}

.dark .ds-mini-card {
    border-color: rgba(148, 163, 184, 0.18);
    background: #111827;
}

.dark .ds-mini-card:hover {
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
}

.dark .ds-mini-head .text-gray-500,
.dark .text-gray-500 {
    color: #94a3b8 !important;
}

.dark .ds-mini-badge-neutral,
.dark .ds-trend-neutral {
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(100, 116, 139, 0.6);
}

.dark .ds-mini-badge-good,
.dark .ds-trend-up {
    color: #bbf7d0;
    background: rgba(6, 78, 59, 0.75);
    border-color: rgba(16, 185, 129, 0.65);
}

.dark .ds-mini-badge-warn {
    color: #fde68a;
    background: rgba(120, 53, 15, 0.75);
    border-color: rgba(245, 158, 11, 0.6);
}

.dark .ds-country-item {
    border-color: rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

.dark .ds-country-progress-track {
    background: rgba(51, 65, 85, 0.85);
}

.dark .ds-country-progress-fill {
    background: linear-gradient(90deg, #818cf8 0%, #22d3ee 100%);
}

.dark .ds-rank-badge {
    color: #c7d2fe;
    background: rgba(55, 48, 163, 0.4);
    border-color: rgba(129, 140, 248, 0.55);
}

.dark .ds-table thead th {
    color: #94a3b8;
    border-bottom-color: rgba(148, 163, 184, 0.2);
    background: #111827;
}

.dark .ds-table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.16);
}

/* Dashboard accessibility polish */
.ds-card-header .form-input:focus-visible,
.ds-filter-actions .btn:focus-visible,
.ds-country-item:focus-within,
.ds-mini-card:focus-within,
.ds-kpi-card:focus-within {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.ds-kpi-sub,
.ds-country-meta {
    color: #475569;
}

.ds-mini-badge-neutral,
.ds-trend-neutral {
    color: #1f2937;
    border-color: #94a3b8;
}

.ds-mini-badge-warn {
    color: #78350f;
    border-color: #f59e0b;
}

.dark .ds-card-header .form-input:focus-visible,
.dark .ds-filter-actions .btn:focus-visible,
.dark .ds-country-item:focus-within,
.dark .ds-mini-card:focus-within,
.dark .ds-kpi-card:focus-within {
    outline: 2px solid #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.25);
}

/* Brand wordmark */
.hs-brand-wordmark {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1;
    text-decoration: none;
    font-size: 1.02rem;
}

.hs-brand-wordmark-main {
    color: #0f172a;
}

.hs-brand-wordmark-accent {
    background: linear-gradient(90deg, #4f46e5 0%, #0ea5e9 55%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hs-brand-wordmark-sidebar {
    font-size: 1rem;
}

.dark .hs-brand-wordmark-main {
    color: #e2e8f0;
}

/* Scan viewer status badges */
.hs-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
}

.hs-status-halal {
    color: #065f46;
    background: #d1fae5;
    border-color: #6ee7b7;
}

.hs-status-haram {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fca5a5;
}

.hs-status-mushbooh {
    color: #92400e;
    background: #fef3c7;
    border-color: #fcd34d;
}

.hs-status-unknown {
    color: #334155;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.dark .hs-status-halal {
    color: #bbf7d0;
    background: rgba(6, 78, 59, 0.75);
    border-color: rgba(16, 185, 129, 0.65);
}

.dark .hs-status-haram {
    color: #fecaca;
    background: rgba(127, 29, 29, 0.78);
    border-color: rgba(248, 113, 113, 0.62);
}

.dark .hs-status-mushbooh {
    color: #fde68a;
    background: rgba(120, 53, 15, 0.75);
    border-color: rgba(245, 158, 11, 0.6);
}

.dark .hs-status-unknown {
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(100, 116, 139, 0.6);
}

.hs-token-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.dark .hs-token-chip {
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(100, 116, 139, 0.6);
}

/* Ingredient status color chips inside Select2 multi-select */
.hs-ingredient-choice {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.12rem 0.5rem;
    border: 1px solid transparent;
    font-weight: 600;
}

.hs-ingredient-result {
    display: inline-flex;
    align-items: center;
    border-radius: 0.4rem;
    padding: 0.18rem 0.5rem;
    border: 1px solid transparent;
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Force status colors on Select2 chip container itself */
.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice.hs-choice-halal {
    background: #d1fae5 !important;
    border-color: #6ee7b7 !important;
    color: #065f46 !important;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice.hs-choice-haram {
    background: #fee2e2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice.hs-choice-mushbooh {
    background: #fef3c7 !important;
    border-color: #fcd34d !important;
    color: #92400e !important;
}

.select2-container--default .select2-selection--multiple.admin-select2-selection .select2-selection__choice.hs-choice-unknown {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
    color: #334155 !important;
}

/* Keep admin list tables within viewport width on all screens */
.card-body .overflow-x-auto {
    max-width: 100%;
}

.card-body .overflow-x-auto .table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.card-body .overflow-x-auto .table.whitespace-nowrap th,
.card-body .overflow-x-auto .table.whitespace-nowrap td {
    white-space: nowrap;
    vertical-align: top;
}

/* Active ingredients table: keep name column compact and wrapped */
.ingredients-active-table th.ingredient-name-col,
.ingredients-active-table td.ingredient-name-col {
    width: 16rem;
    min-width: 16rem;
    max-width: 16rem;
}

.ingredients-active-table td.ingredient-name-col {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

/* Responsive action buttons for list tables */
.card-body .overflow-x-auto .table td .nf-btn-add-product,
.card-body .overflow-x-auto .table td .nf-btn-reject-row {
    min-height: 2rem;
}

@media (max-width: 767px) {
    .card-header a.btn.btn-primary {
        width: 100%;
        justify-content: center;
    }

    .card-body .overflow-x-auto .table td:last-child {
        min-width: 7rem;
    }

    .card-body .overflow-x-auto .table td .nf-btn-add-product,
    .card-body .overflow-x-auto .table td .nf-btn-reject-row {
        width: 100%;
        min-width: 5.5rem;
        padding: 0.42rem 0.65rem;
        font-size: 0.78rem;
        justify-content: center;
        white-space: nowrap;
    }
}

/* Modern toast notifications */
.hs-toast-wrap {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(92vw, 24rem);
}

.hs-toast {
    border-radius: 0.65rem;
    border: 1px solid transparent;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
    background: #fff;
    padding: 0.65rem 0.8rem;
}

.hs-toast-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.hs-toast-body {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.35;
}

.hs-toast-close {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-size: 1.05rem;
}

.hs-toast-success {
    border-color: #6ee7b7;
    background: #ecfdf5;
    color: #065f46;
}

.hs-toast-error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.hs-toast-warning {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}

.hs-toast-info {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}
