/*
|--------------------------------------------------------------------------
| TailAdmin eCommerce Complete Design System & Theme
|--------------------------------------------------------------------------
| Recreating the exact 1:1 TailAdmin eCommerce Admin Dashboard & UI
| Full Light & Dark mode, RTL-ready logical properties, and resource polish.
*/

:root {
    /* TailAdmin Brand Color Tokens */
    --ta-primary: #465fff;
    --ta-primary-hover: #3641f5;
    --ta-primary-active: #2a32c5;
    --ta-primary-soft: #ecf2ff;
    --ta-primary-soft-border: rgba(70, 95, 255, 0.2);
    --ta-primary-glow: rgba(70, 95, 255, 0.18);

    /* Surfaces & Layouts (Light Mode) */
    --ta-bg: #f4f7fa;
    --ta-card-bg: #ffffff;
    --ta-card-hover: #fafcff;
    --ta-sidebar-bg: #ffffff;
    --ta-topbar-bg: rgba(255, 255, 255, 0.92);
    --ta-border: #e2e8f0;
    --ta-border-subtle: #f1f5f9;

    /* Typography */
    --ta-text-primary: #1e293b;
    --ta-text-secondary: #64748b;
    --ta-text-muted: #94a3b8;
    --ta-group-label: #8c98a9;

    /* Accents & Statuses */
    --ta-success: #10b981;
    --ta-success-soft: #ecfdf5;
    --ta-success-text: #059669;

    --ta-warning: #f59e0b;
    --ta-warning-soft: #fffbeb;
    --ta-warning-text: #d97706;

    --ta-danger: #f43f5e;
    --ta-danger-soft: #fff1f2;
    --ta-danger-text: #e11d48;

    --ta-info: #0ea5e9;
    --ta-info-soft: #f0f9ff;
    --ta-info-text: #0284c7;

    --ta-purple: #8b5cf6;
    --ta-purple-soft: #f5f3ff;
    --ta-purple-text: #7c3aed;

    /* Radii & Elevation */
    --ta-radius-sm: 8px;
    --ta-radius: 14px;
    --ta-radius-lg: 18px;
    --ta-radius-pill: 9999px;

    --ta-shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
    --ta-shadow-sm: 0 1px 3px 0 rgba(16, 24, 40, 0.06), 0 1px 2px -1px rgba(16, 24, 40, 0.04);
    --ta-shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.04);
    --ta-shadow-hover: 0 10px 25px -4px rgba(70, 95, 255, 0.12);

    /* Legacy compatibility variables */
    --mh-primary: var(--ta-primary);
    --mh-primary-600: var(--ta-primary-hover);
    --mh-primary-soft: var(--ta-primary-soft);
    --mh-page-bg: var(--ta-bg);
    --mh-card-bg: var(--ta-card-bg);
    --mh-border: var(--ta-border);
    --mh-text: var(--ta-text-primary);
    --mh-muted: var(--ta-text-muted);
    --mh-group-label: var(--ta-group-label);
    --mh-radius: var(--ta-radius);
    --mh-shadow: var(--ta-shadow-sm);
}

/* Dark Mode Overrides */
.fi-theme-dark,
html.dark,
[data-theme="dark"] {
    --ta-primary-soft: rgba(70, 95, 255, 0.18);
    --ta-primary-soft-border: rgba(70, 95, 255, 0.35);
    --ta-primary-glow: rgba(70, 95, 255, 0.3);

    --ta-bg: #0b0f19;
    --ta-card-bg: #161f30;
    --ta-card-hover: #1c273c;
    --ta-sidebar-bg: #111827;
    --ta-topbar-bg: rgba(17, 24, 39, 0.92);
    --ta-border: #283548;
    --ta-border-subtle: #1f2c40;

    --ta-text-primary: #f8fafc;
    --ta-text-secondary: #94a3b8;
    --ta-text-muted: #64748b;
    --ta-group-label: #64748b;

    --ta-success-soft: rgba(16, 185, 129, 0.18);
    --ta-success-text: #34d399;

    --ta-warning-soft: rgba(245, 158, 11, 0.18);
    --ta-warning-text: #fbbf24;

    --ta-danger-soft: rgba(244, 63, 94, 0.18);
    --ta-danger-text: #fb7185;

    --ta-info-soft: rgba(14, 165, 233, 0.18);
    --ta-info-text: #38bdf8;

    --ta-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --ta-shadow-sm: 0 2px 6px 0 rgba(0, 0, 0, 0.3);
    --ta-shadow-md: 0 6px 16px 0 rgba(0, 0, 0, 0.45);
    --ta-shadow-hover: 0 12px 28px 0 rgba(0, 0, 0, 0.55);

    --mh-primary-soft: var(--ta-primary-soft);
    --mh-page-bg: var(--ta-bg);
    --mh-card-bg: var(--ta-card-bg);
    --mh-border: var(--ta-border);
    --mh-text: var(--ta-text-primary);
    --mh-muted: var(--ta-text-muted);
}

/*
|--------------------------------------------------------------------------
| Base Page & Typography
|--------------------------------------------------------------------------
*/

body,
.fi-body {
    background-color: var(--ta-bg) !important;
    color: var(--ta-text-primary);
    font-family: 'Cairo', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

/*
|--------------------------------------------------------------------------
| TailAdmin Sidebar Styling
|--------------------------------------------------------------------------
*/

.fi-sidebar {
    background-color: var(--ta-sidebar-bg) !important;
    border-inline-end: 1px solid var(--ta-border) !important;
    box-shadow: none !important;
}

.fi-sidebar-header {
    background-color: var(--ta-sidebar-bg) !important;
    border-bottom: 1px solid var(--ta-border) !important;
    padding: 1.25rem 1.5rem !important;
}

.fi-sidebar-header .fi-logo {
    font-weight: 900;
    font-size: 1.35rem;
    color: var(--ta-primary);
    letter-spacing: -0.03em;
}

.fi-sidebar-group-label {
    font-size: 0.6875rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    color: var(--ta-group-label) !important;
    padding-inline: 1rem !important;
    margin-block: 0.75rem 0.35rem !important;
}

.fi-sidebar-item-btn {
    border-radius: var(--ta-radius-sm) !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    color: var(--ta-text-secondary) !important;
    padding: 0.65rem 1rem !important;
    margin-inline: 0.5rem !important;
    transition: all 0.15s ease !important;
}

.fi-sidebar-item-btn:hover {
    background-color: var(--ta-primary-soft) !important;
    color: var(--ta-primary) !important;
}

/* Active Menu Item matching TailAdmin screenshot: soft blue pill + primary text */
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--ta-primary-soft) !important;
    color: var(--ta-primary) !important;
    font-weight: 700 !important;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon {
    color: var(--ta-primary) !important;
}

/*
|--------------------------------------------------------------------------
| TailAdmin Topbar (Header)
|--------------------------------------------------------------------------
*/

.fi-topbar > nav,
.fi-topbar-ctn > nav {
    background-color: var(--ta-topbar-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid var(--ta-border) !important;
    box-shadow: var(--ta-shadow-xs) !important;
    padding-inline: 1.5rem !important;
    height: 4.5rem !important;
}

/*
|--------------------------------------------------------------------------
| Generic Card Component
|--------------------------------------------------------------------------
*/

.ta-card {
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    box-shadow: var(--ta-shadow-sm);
    overflow: visible;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ta-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.75rem;
}

.ta-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ta-text-primary);
    letter-spacing: -0.02em;
}

.ta-card-sub {
    font-size: 0.775rem;
    color: var(--ta-text-muted);
    margin-top: 0.15rem;
}

.ta-dots-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--ta-text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ta-dots-btn:hover {
    color: var(--ta-text-primary);
    background-color: var(--ta-border-subtle);
}

/*
|--------------------------------------------------------------------------
| TailAdmin Dropdowns & Actions Menu
|--------------------------------------------------------------------------
*/

.ta-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    z-index: 50;
    min-width: 250px;
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    box-shadow: var(--ta-shadow-md);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ta-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--ta-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ta-text-primary);
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: start;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ta-dropdown-item:hover {
    background-color: var(--ta-primary-soft);
    color: var(--ta-primary);
}

.ta-dropdown-icon {
    width: 1.15rem;
    height: 1.15rem;
    color: var(--ta-text-secondary);
    flex: 0 0 auto;
}

.ta-dropdown-item:hover .ta-dropdown-icon {
    color: var(--ta-primary);
}

/*
|--------------------------------------------------------------------------
| TailAdmin Interactive Modal
|--------------------------------------------------------------------------
*/

.ta-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.ta-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ta-modal-dialog {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 580px;
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius-lg);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.ta-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.35rem 1.5rem 1rem;
    border-bottom: 1px solid var(--ta-border-subtle);
}

.ta-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ta-text-primary);
}

.ta-modal-subtitle {
    font-size: 0.8125rem;
    color: var(--ta-text-muted);
    margin-top: 0.2rem;
}

.ta-modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--ta-text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s ease;
}

.ta-modal-close:hover {
    color: var(--ta-danger);
}

.ta-modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 70vh;
    overflow-y: auto;
}

.ta-modal-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .ta-modal-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.ta-modal-metric-card {
    background-color: var(--ta-border-subtle);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ta-modal-metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ta-text-secondary);
}

.ta-modal-metric-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ta-text-primary);
}

.ta-modal-metric-sub {
    font-size: 0.7rem;
    color: var(--ta-text-muted);
}

.ta-modal-progress-section {
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius-sm);
    padding: 1rem;
}

.ta-modal-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.ta-modal-breakdown {
    background-color: var(--ta-border-subtle);
    border-radius: var(--ta-radius-sm);
    padding: 1rem;
}

.ta-modal-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ta-modal-breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--ta-text-secondary);
}

.ta-modal-breakdown-item strong {
    color: var(--ta-text-primary);
}

.ta-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--ta-border-subtle);
    background-color: var(--ta-border-subtle);
}

.ta-btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    border-radius: var(--ta-radius-sm);
    background-color: var(--ta-primary);
    color: #ffffff !important;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.ta-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    border-radius: var(--ta-radius-sm);
    background-color: var(--ta-card-bg);
    color: var(--ta-text-primary) !important;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none !important;
    border: 1px solid var(--ta-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ta-btn-secondary:hover {
    border-color: var(--ta-primary);
    color: var(--ta-primary) !important;
}

.ta-btn-close {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border-radius: var(--ta-radius-sm);
    background: transparent;
    color: var(--ta-text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

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

/*
|--------------------------------------------------------------------------
| ROW 1: TailAdmin KPI Grid + Monthly Sales + Monthly Target Gauge
|--------------------------------------------------------------------------
*/

.ta-row1-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .ta-row1-grid {
        grid-template-columns: 1fr;
    }
}

.ta-left-block {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ta-kpis-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .ta-kpis-top-grid {
        grid-template-columns: 1fr;
    }
}

.ta-kpi-tile {
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--ta-shadow-sm);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ta-kpi-tile:hover {
    transform: translateY(-2px);
    border-color: var(--ta-primary-soft-border);
    box-shadow: var(--ta-shadow-hover);
}

.ta-kpi-icon-wrap {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    background-color: var(--ta-border-subtle);
    color: var(--ta-text-secondary);
    display: grid;
    place-items: center;
}

.ta-icon-svg {
    width: 1.4rem;
    height: 1.4rem;
}

.ta-kpi-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--ta-text-secondary);
}

.ta-kpi-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ta-kpi-number {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--ta-text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.ta-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 700;
    line-height: 1;
}

.ta-pill-green {
    background-color: var(--ta-success-soft);
    color: var(--ta-success-text);
}

.ta-pill-orange {
    background-color: var(--ta-warning-soft);
    color: var(--ta-warning-text);
}

.ta-pill-red {
    background-color: var(--ta-danger-soft);
    color: var(--ta-danger-text);
}

/* Monthly Sales Bar Chart */
.ta-sales-bar-card {
    flex: 1 1 auto;
    padding-bottom: 1rem;
}

.ta-sales-chart-body {
    padding: 1rem 1.5rem 0.5rem;
}

.ta-bars-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
    height: 140px;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ta-border-subtle);
}

.ta-bar-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.ta-bar-track {
    flex: 1 1 auto;
    width: 100%;
    max-width: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ta-bar-fill {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background-color: var(--ta-primary);
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease;
}

.ta-bar-fill:hover {
    background-color: var(--ta-primary-hover);
    box-shadow: 0 0 8px var(--ta-primary-glow);
}

.ta-bar-label {
    font-size: 0.6875rem;
    color: var(--ta-text-muted);
    font-weight: 600;
}

/* Monthly Target Card */
.ta-target-card {
    display: flex;
    flex-direction: column;
}

.ta-target-body {
    padding: 0.5rem 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1 1 auto;
    justify-content: space-between;
}

.ta-gauge-wrap {
    position: relative;
    width: 220px;
    margin: 0.5rem auto 0;
    transition: transform 0.2s ease;
}

.ta-gauge-wrap:hover {
    transform: scale(1.03);
}

.ta-gauge-svg {
    width: 100%;
    height: auto;
}

.ta-gauge-center-text {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ta-gauge-percent {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--ta-text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.ta-target-desc {
    font-size: 0.8125rem;
    color: var(--ta-text-secondary);
    line-height: 1.5;
    max-width: 280px;
    margin: 0.75rem 0 1.25rem;
}

.ta-target-kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    padding-top: 1rem;
    border-top: 1px solid var(--ta-border-subtle);
}

.ta-target-kpi-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ta-target-kpi-lbl {
    font-size: 0.75rem;
    color: var(--ta-text-muted);
    font-weight: 600;
}

.ta-target-kpi-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ta-text-primary);
}

.ta-arrow-up { color: var(--ta-success-text); }
.ta-arrow-down { color: var(--ta-danger-text); }

/*
|--------------------------------------------------------------------------
| ROW 2: Statistics Area Chart Widget
|--------------------------------------------------------------------------
*/

.fi-wi-chart .fi-section,
.fi-wi-chart .fi-sc {
    border-radius: var(--ta-radius) !important;
    border: 1px solid var(--ta-border) !important;
    background-color: var(--ta-card-bg) !important;
    box-shadow: var(--ta-shadow-sm) !important;
    margin-bottom: 1.5rem !important;
}

.fi-wi-chart .fi-section-header {
    border-bottom: 1px solid var(--ta-border-subtle) !important;
    padding: 1.25rem 1.5rem !important;
}

.fi-wi-chart .fi-section-header-heading {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: var(--ta-text-primary) !important;
}

/*
|--------------------------------------------------------------------------
| ROW 3: Customers Demographic Map + Recent Orders Table
|--------------------------------------------------------------------------
*/

.ta-row3-grid {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .ta-row3-grid {
        grid-template-columns: 1fr;
    }
}

/* Demographic Card */
.ta-demographic-body {
    padding: 0.5rem 1.5rem 1.25rem;
}

.ta-map-wrapper {
    width: 100%;
    margin-bottom: 1.25rem;
    background-color: var(--ta-border-subtle);
    border-radius: 12px;
    padding: 0.75rem;
    display: grid;
    place-items: center;
}

.ta-map-svg {
    width: 100%;
    max-height: 140px;
}

.ta-pulse-pin {
    animation: taPulse 2s infinite;
}

@keyframes taPulse {
    0%, 100% { r: 3.5; opacity: 1; }
    50% { r: 5.5; opacity: 0.6; }
}

.ta-demographic-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.ta-demo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ta-demo-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.ta-demo-flag {
    font-size: 1.15rem;
}

.ta-demo-name {
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--ta-text-primary);
}

.ta-demo-count {
    font-size: 0.725rem;
    color: var(--ta-text-muted);
}

.ta-demo-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 120px;
}

.ta-demo-progress-track {
    flex: 1 1 auto;
    height: 6px;
    background-color: var(--ta-border-subtle);
    border-radius: 9999px;
    overflow: hidden;
}

.ta-demo-progress-fill {
    height: 100%;
    border-radius: 9999px;
    background-color: var(--ta-primary);
}

.ta-demo-pct {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ta-text-secondary);
    min-width: 30px;
    text-align: end;
}

/* Recent Orders Table Card */
.ta-card-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.ta-btn-seeall {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: var(--ta-radius-sm);
    background-color: var(--ta-primary-soft);
    color: var(--ta-primary);
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ta-btn-seeall:hover {
    background-color: var(--ta-primary);
    color: #ffffff;
}

.ta-orders-table-wrap {
    overflow-x: auto;
    padding: 0 1rem 1rem;
}

.ta-orders-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
}

.ta-orders-table th {
    padding: 0.75rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ta-text-muted);
    border-bottom: 1px solid var(--ta-border-subtle);
    white-space: nowrap;
}

.ta-orders-table td {
    padding: 0.85rem 0.85rem;
    border-bottom: 1px solid var(--ta-border-subtle);
    font-size: 0.875rem;
    color: var(--ta-text-primary);
    vertical-align: middle;
}

.ta-orders-table tbody tr:hover {
    background-color: var(--ta-primary-soft);
}

.ta-product-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ta-product-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    background-color: var(--ta-border-subtle);
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    flex: 0 0 auto;
    overflow: hidden;
}

.ta-product-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ta-product-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ta-text-primary);
    text-decoration: none;
    display: block;
}

.ta-product-name:hover {
    color: var(--ta-primary);
}

.ta-product-sub {
    font-size: 0.725rem;
    color: var(--ta-text-muted);
    display: block;
}

.ta-category-text {
    font-size: 0.8125rem;
    color: var(--ta-text-secondary);
}

.ta-price-text {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ta-text-primary);
}

.ta-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--ta-text-muted);
}

/*
|--------------------------------------------------------------------------
| Internal Resource Pages Polish (Tables, Forms, Modals, Filters)
|--------------------------------------------------------------------------
*/

.fi-ta-ctn {
    border-radius: var(--ta-radius) !important;
    border: 1px solid var(--ta-border) !important;
    box-shadow: var(--ta-shadow-sm) !important;
    background-color: var(--ta-card-bg) !important;
    overflow: hidden;
}

.fi-ta-header {
    border-bottom: 1px solid var(--ta-border-subtle) !important;
    padding: 1.25rem 1.5rem !important;
}

.fi-ta-header-title {
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    color: var(--ta-text-primary) !important;
}

.fi-ta-table thead th {
    background-color: var(--ta-border-subtle) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: var(--ta-text-secondary) !important;
    padding: 0.875rem 1rem !important;
}

.fi-ta-table tbody tr {
    transition: background-color 0.15s ease !important;
}

.fi-ta-table tbody tr:hover {
    background-color: var(--ta-primary-soft) !important;
}

.fi-ta-table tbody td {
    padding: 0.875rem 1rem !important;
    border-bottom: 1px solid var(--ta-border-subtle) !important;
}

/* Inputs & Form Controls */
.fi-input,
.fi-select-input,
.fi-input-wrp {
    border-radius: var(--ta-radius-sm) !important;
    transition: all 0.15s ease !important;
}

.fi-input-wrp:focus-within {
    border-color: var(--ta-primary) !important;
    box-shadow: 0 0 0 3px var(--ta-primary-glow) !important;
}

.fi-btn-primary {
    background-color: var(--ta-primary) !important;
    border-radius: var(--ta-radius-sm) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px var(--ta-primary-glow) !important;
    transition: all 0.15s ease !important;
}

.fi-btn-primary:hover {
    background-color: var(--ta-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--ta-primary-glow) !important;
}

/* ==========================================================================
   Dashboard widgets  (mh-*)
   --------------------------------------------------------------------------
   The action queue, daily pulse, content health, activity feed.

   Built on the --ta-* tokens defined at the top of this file, so both themes
   come for free and nothing here hardcodes a background or a text colour.
   The only literal colours are the per-tone accents below, which are the same
   hues in both themes and are always used at low alpha over a themed surface.
   ========================================================================== */

.fi-wi {
    --mh-tone: var(--ta-primary);
}

/* Tone accents. One hue per content type, reused by every widget so a colour
   means the same thing wherever it appears: amber = places, violet = market,
   sky = users, emerald = reviews, rose = money/messages. */
.mh-tone-sky      { --mh-tone: #38bdf8; }
.mh-tone-amber    { --mh-tone: #f59e0b; }
.mh-tone-violet   { --mh-tone: #a78bfa; }
.mh-tone-emerald  { --mh-tone: #10b981; }
.mh-tone-rose     { --mh-tone: #f43f5e; }
.mh-tone-slate    { --mh-tone: #94a3b8; }

.mh-fill-emerald  { background-color: #10b981; }
.mh-fill-amber    { background-color: #f59e0b; }
.mh-fill-slate    { background-color: #94a3b8; }
.mh-fill-rose     { background-color: #f43f5e; }
.mh-fill-sky      { background-color: #38bdf8; }

/* --- Shared card shell ---------------------------------------------------- */

.mh-queue,
.mh-pulse,
.mh-health,
.mh-feed {
    background-color: var(--ta-card-bg);
    border: 1px solid var(--ta-border);
    border-radius: var(--ta-radius, 1rem);
    box-shadow: var(--ta-shadow-sm);
    padding: 1.25rem 1.4rem 1.4rem;
}

.mh-queue-head,
.mh-pulse-head,
.mh-health-head,
.mh-feed-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.mh-queue-head h2,
.mh-pulse-head h2,
.mh-health-head h2,
.mh-feed-head h2 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ta-text-primary);
    margin: 0;
}

.mh-queue-total,
.mh-pulse-date,
.mh-health-sub {
    font-size: 0.8rem;
    color: var(--ta-text-secondary);
}

/* --- Action queue --------------------------------------------------------- */

.mh-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.mh-queue-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 1rem 1.1rem;
    border-radius: 0.9rem;
    border: 1px solid var(--ta-border);
    background-color: var(--ta-card-hover);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

/* The tone lives in a bar down the inline-start edge rather than a tinted
   background: five saturated panels side by side is a traffic light, not a
   dashboard. */
.mh-queue-card::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    background-color: var(--mh-tone);
}

.mh-queue-card:hover {
    transform: translateY(-2px);
    border-color: var(--mh-tone);
    box-shadow: 0 10px 24px -14px var(--mh-tone);
}

.mh-queue-icon {
    color: var(--mh-tone);
    width: 1.4rem;
    height: 1.4rem;
    margin-bottom: 0.35rem;
}

.mh-queue-icon svg { width: 100%; height: 100%; }

.mh-queue-count {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.05;
    color: var(--ta-text-primary);
}

.mh-queue-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--ta-text-primary);
}

.mh-queue-hint {
    font-size: 0.74rem;
    color: var(--ta-text-muted);
}

/* --- All clear / alarm ---------------------------------------------------- */

.mh-allclear {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.1rem 1.3rem;
    border-radius: var(--ta-radius, 1rem);
    border: 1px solid var(--ta-success-soft);
    background-color: var(--ta-success-soft);
}

.mh-allclear-check {
    flex: none;
    width: 2.1rem;
    height: 2.1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background-color: var(--ta-success-text);
    color: #fff;
}

.mh-allclear-check svg { width: 1.1rem; height: 1.1rem; }

.mh-allclear strong,
.mh-alarm strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ta-text-primary);
}

.mh-allclear span:not(.mh-allclear-check),
.mh-alarm-body span {
    font-size: 0.82rem;
    color: var(--ta-text-secondary);
}

.mh-alarm {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.25rem;
    margin-bottom: 0.9rem;
    border-radius: var(--ta-radius, 1rem);
    border: 1px solid var(--ta-danger-text);
    background-color: var(--ta-danger-soft);
    text-decoration: none;
}

.mh-alarm-dot {
    flex: none;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background-color: var(--ta-danger-text);
    box-shadow: 0 0 0 0 var(--ta-danger-text);
    animation: mh-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes mh-ping {
    70%, 100% { box-shadow: 0 0 0 0.55rem transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .mh-alarm-dot { animation: none; }
}

.mh-alarm-body { flex: 1 1 auto; }

.mh-alarm-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78em;
    padding: 0.05em 0.35em;
    border-radius: 0.3em;
    background-color: rgb(0 0 0 / 0.14);
}

.mh-alarm-cta {
    flex: none;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ta-danger-text);
    white-space: nowrap;
}

/* --- Today pulse ---------------------------------------------------------- */

.mh-pulse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
}

.mh-pulse-tile {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem 1.1rem 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid var(--ta-border);
    background-color: var(--ta-card-hover);
    text-decoration: none;
    color: var(--mh-tone);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.mh-pulse-tile:hover {
    transform: translateY(-2px);
    border-color: var(--mh-tone);
}

.mh-pulse-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.mh-pulse-value {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ta-text-primary);
}

.mh-pulse-delta {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.12rem 0.42rem;
    border-radius: 999px;
}

.mh-delta-up   { color: var(--ta-success-text); background-color: var(--ta-success-soft); }
.mh-delta-down { color: var(--ta-danger-text);  background-color: var(--ta-danger-soft); }

.mh-pulse-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ta-text-primary);
}

.mh-spark {
    width: 100%;
    height: 30px;
    margin: 0.35rem 0 0.1rem;
    opacity: 0.85;
}

.mh-pulse-foot {
    display: flex;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--ta-text-muted);
}

/* --- Content health ------------------------------------------------------- */

.mh-health-group + .mh-health-group {
    margin-top: 1.35rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--ta-border-subtle);
}

.mh-health-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.mh-health-row h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ta-text-primary);
    margin: 0;
}

.mh-health-live {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--ta-text-secondary);
}

.mh-health-live strong {
    font-size: 1.05rem;
    color: var(--ta-text-primary);
}

.mh-health-pct {
    font-weight: 700;
    color: var(--ta-success-text);
    background-color: var(--ta-success-soft);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
}

.mh-bar {
    display: flex;
    gap: 2px;
    height: 0.65rem;
    border-radius: 999px;
    overflow: hidden;
    background-color: var(--ta-border-subtle);
}

.mh-bar-seg {
    display: block;
    min-width: 3px;
    transition: filter 0.18s ease;
}

.mh-bar-seg:hover { filter: brightness(1.25); }

.mh-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.7rem;
}

.mh-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--ta-text-secondary);
    text-decoration: none;
}

.mh-legend-item:hover { color: var(--ta-text-primary); }

.mh-legend-item strong { color: var(--ta-text-primary); }

.mh-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex: none;
}

.mh-note {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.79rem;
    color: var(--ta-warning-text);
    background-color: var(--ta-warning-soft);
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    text-decoration: none;
}

/* --- Live feed ------------------------------------------------------------ */

.mh-feed-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ta-info-text);
    background-color: var(--ta-info-soft);
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
}

.mh-feed-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mh-feed-item > a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: 0.7rem;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.mh-feed-item > a:hover { background-color: var(--ta-card-hover); }

.mh-feed-item + .mh-feed-item {
    border-top: 1px solid var(--ta-border-subtle);
}

.mh-feed-icon {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 0.6rem;
    color: var(--mh-tone);
    background-color: color-mix(in srgb, var(--mh-tone) 14%, transparent);
}

.mh-feed-icon svg { width: 1.05rem; height: 1.05rem; }

.mh-feed-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mh-feed-title,
.mh-feed-meta {
    /* Long ad titles and Arabic business names must not push the timestamp
       off the row. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mh-feed-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ta-text-primary);
}

.mh-feed-meta {
    font-size: 0.74rem;
    color: var(--ta-text-muted);
}

.mh-feed-time {
    flex: none;
    font-size: 0.72rem;
    color: var(--ta-text-muted);
    white-space: nowrap;
}

.mh-feed-today .mh-feed-time {
    color: var(--ta-info-text);
    font-weight: 700;
}

.mh-feed-empty {
    font-size: 0.85rem;
    color: var(--ta-text-muted);
    margin: 0;
    padding: 1.5rem 0;
    text-align: center;
}

@media (max-width: 640px) {
    .mh-feed-meta { display: none; }
    .mh-alarm { flex-wrap: wrap; }
}

/* How long the oldest item in a queue has waited. Kept quiet unless it is
   actually old — an amber tint only once something has been sitting for a
   while, so the colour still means something when it appears. */
.mh-queue-waiting {
    margin-top: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ta-warning-text);
    background-color: var(--ta-warning-soft);
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    align-self: flex-start;
}

/*
|--------------------------------------------------------------------------
| Alert radar — the notification sound toggle in the topbar
|--------------------------------------------------------------------------
|
| Sits next to the bell it rings for, and reads as one of Filament's own
| ghost icon buttons rather than something bolted on. Deliberately visible
| rather than tucked into a settings page: a sound the admin cannot see the
| state of is one they will assume is broken the first time a quiet hour
| passes, and the mute has to be one click away when they are on a call.
|
| Muted state goes grey and drops the tint, so "off" is legible at a glance
| without reading a tooltip.
*/
.mh-radar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.6rem;
    margin-inline-end: 0.25rem;
    border: 1px solid transparent;
    border-radius: var(--ta-radius-pill);
    background-color: var(--ta-primary-soft);
    color: var(--ta-primary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mh-radar-toggle:hover {
    border-color: var(--ta-primary-soft-border);
}

.mh-radar-toggle svg {
    width: 1.05rem;
    height: 1.05rem;
}

.mh-radar-toggle.mh-radar-muted {
    background-color: transparent;
    color: var(--ta-text-muted);
}

.mh-radar-toggle.mh-radar-muted:hover {
    border-color: var(--ta-border);
    background-color: var(--ta-border-subtle);
}

/* The word is a nicety on a wide topbar and clutter on a phone; the icon
   already carries the state. */
@media (max-width: 768px) {
    .mh-radar-label { display: none; }
}

/* The soft background is already a token that changes with the theme; only
   the foreground needs help, because #465fff on a dark panel is unreadable. */
.fi-theme-dark .mh-radar-toggle,
html.dark .mh-radar-toggle,
[data-theme="dark"] .mh-radar-toggle {
    color: #aebfff;
}

.fi-theme-dark .mh-radar-toggle.mh-radar-muted,
html.dark .mh-radar-toggle.mh-radar-muted,
[data-theme="dark"] .mh-radar-toggle.mh-radar-muted {
    color: var(--ta-text-muted);
}
