/* ==========================================================================
   Payment Gateway Dashboard — Layout Chrome Styles
   Dark Theme — Fintech Professional
   ========================================================================== */

/* ---------- CSS Custom Properties (defaults; overridden by MainLayout branding) ---------- */
:root {
    --brand-primary: #3b82f6;
    --brand-secondary: #60a5fa;

    --color-bg: #020617;
    --color-surface: #0f172a;
    --color-surface-raised: #1e293b;
    --color-text: #f1f5f9;
    --color-text-muted: #64748b;
    --color-text-secondary: #94a3b8;
    --color-border: #1e293b;
    --color-border-subtle: #334155;
    --color-hover: rgba(59, 130, 246, 0.08);

    --sidebar-width: 240px;
    --header-height: 56px;
    --footer-height: 40px;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 14px;
    --font-size-sm: 12px;
    --font-size-lg: 16px;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.5);

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Semantic status colours — dark mode safe */
    --color-success: #22c55e;
    --color-success-muted: rgba(34, 197, 94, 0.12);
    --color-success-text: #86efac;
    --color-warning: #f59e0b;
    --color-warning-muted: rgba(245, 158, 11, 0.12);
    --color-warning-text: #fcd34d;
    --color-danger: #ef4444;
    --color-danger-muted: rgba(239, 68, 68, 0.12);
    --color-danger-text: #fca5a5;
    --color-info: #3b82f6;
    --color-info-muted: rgba(59, 130, 246, 0.12);
    --color-info-text: #93c5fd;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background-color: var(--color-bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Skip Link (WCAG 2.1 AA) ---------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--brand-primary);
    color: #ffffff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 8px;
    outline: 2px solid var(--brand-secondary);
    outline-offset: 2px;
}

/* ---------- Visually Hidden (screen-reader only) ---------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Layout Grid ---------- */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dashboard-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---------- Header ---------- */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-logo {
    height: 32px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.header-logo-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-display-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.header-icon-btn:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

.header-icon-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ---------- User Menu ---------- */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-menu-trigger:hover {
    background: var(--color-hover);
}

.user-menu-trigger:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #ffffff;
    font-size: var(--font-size-sm);
    font-weight: 600;
    flex-shrink: 0;
}

.user-name {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    z-index: 200;
    overflow: hidden;
}

.user-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: var(--font-size-base);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-menu-item:hover {
    background: var(--color-hover);
}

.user-menu-item:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.user-menu-logout {
    color: var(--color-danger-text);
    border-top: 1px solid var(--color-border-subtle);
}

/* ---------- Sidebar / Navigation ---------- */
.dashboard-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 16px 0;
}

.nav-menu {
    padding: 0;
}

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

.nav-section {
    margin-bottom: 8px;
}

.nav-section-label {
    display: block;
    padding: 8px 16px 4px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 24px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-base);
    transition: background var(--transition-fast), color var(--transition-fast);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(59, 130, 246, 0.06);
    color: var(--color-text);
}

.nav-link:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: #ffffff;
    border-left-color: var(--brand-primary);
    font-weight: 600;
}

.nav-placeholder {
    color: var(--color-text-muted);
    cursor: default;
    opacity: 0.5;
}

.nav-placeholder:hover {
    background: transparent;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    color: var(--brand-primary);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Main Content ---------- */
.dashboard-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    min-width: 0;
}

.dashboard-main:focus {
    outline: none;
}

/* ---------- Footer ---------- */
.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--footer-height);
    padding: 0 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.footer-brand {
    font-weight: 600;
}

.footer-separator {
    color: var(--color-border-subtle);
}

/* ---------- Responsive: 1024px to 2560px ---------- */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 200px;
    }

    .nav-section-label {
        font-size: 11px;
    }
}

@media (min-width: 1920px) {
    :root {
        --sidebar-width: 280px;
        --font-size-base: 15px;
    }
}

@media (min-width: 2560px) {
    :root {
        --sidebar-width: 300px;
        --font-size-base: 16px;
    }

    .dashboard-main {
        padding: 32px;
    }
}

/* ---------- Focus visible polyfill fallback ---------- */
@supports not selector(:focus-visible) {
    .nav-link:focus,
    .header-icon-btn:focus,
    .user-menu-trigger:focus,
    .user-menu-item:focus {
        outline: 2px solid var(--brand-primary);
        outline-offset: 2px;
    }
}

/* ---------- Sortable table header keyboard focus (WCAG 2.1 AA) ---------- */
th[tabindex="0"] {
    cursor: pointer;
}

th[tabindex="0"]:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

/* ---------- Clickable table row keyboard focus (WCAG 2.1 AA) ---------- */
tr[tabindex="0"]:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

/* ==========================================================================
   Tenant Hierarchy Explorer
   ========================================================================== */

.hierarchy-explorer {
    position: relative;
    max-width: 960px;
}

.hierarchy-explorer__header {
    margin-bottom: 16px;
}

.hierarchy-explorer__title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

/* ---------- Breadcrumb ---------- */
.hierarchy-explorer__breadcrumb {
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    min-height: 36px;
    display: flex;
    align-items: center;
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

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

.breadcrumb-item--current {
    color: var(--brand-primary);
    font-weight: 600;
}

.breadcrumb-separator {
    margin: 0 4px;
    color: var(--color-border-subtle);
}

.breadcrumb-empty {
    color: var(--color-text-muted);
    font-style: italic;
}

/* ---------- Search ---------- */
.hierarchy-explorer__search {
    margin-bottom: 16px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 10px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 32px 8px 34px;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-surface-raised);
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

.search-clear {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--color-border-subtle);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-clear:hover {
    background: var(--color-text-muted);
    color: var(--color-surface);
}

.hierarchy-explorer__search-results {
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

/* ---------- Tree ---------- */
.hierarchy-explorer__tree {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.hierarchy-explorer__loading,
.hierarchy-explorer__empty {
    padding: 32px;
    text-align: center;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---------- Tree Node ---------- */
.tenant-node {
    list-style: none;
    border-bottom: 1px solid var(--color-border);
}

.tenant-node:last-child {
    border-bottom: none;
}

.tenant-node:focus {
    outline: none;
}

.tenant-node:focus > .tenant-node__row {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.tenant-node--selected > .tenant-node__row {
    background: var(--color-hover);
}

.tenant-node__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
}

.tenant-node__row:hover {
    background: var(--color-hover);
}

.tenant-node__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.tenant-node__toggle:hover:not(:disabled) {
    color: var(--color-text);
}

.tenant-node__toggle:disabled {
    cursor: default;
    opacity: 0;
}

.tenant-node__arrow {
    transition: transform var(--transition-fast);
}

.tenant-node__arrow--expanded {
    transform: rotate(90deg);
}

.tenant-node__arrow-spacer {
    display: inline-block;
    width: 12px;
}

.tenant-node__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--brand-primary);
}

/* Status dots — colour + distinct icon shape for colour-blind safety */
.tenant-node__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.tenant-node__status--active { color: var(--color-success); }
.tenant-node__status--pending { color: var(--color-warning); }
.tenant-node__status--suspended { color: var(--color-danger); }
.tenant-node__status--inactive { color: var(--color-text-muted); }
.tenant-node__status--unknown { color: var(--color-text-muted); }

.tenant-node__name {
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tenant-node__code {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
}

/* ---------- Children (indented) ---------- */
.tenant-node__children {
    list-style: none;
    margin: 0;
    padding: 0 0 0 24px;
    border-top: 1px solid var(--color-border);
}

.tenant-node__loading,
.tenant-node__empty {
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenant-node__spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Context Menu ---------- */
.context-menu {
    position: fixed;
    z-index: 500;
    min-width: 180px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    padding: 4px 0;
    overflow: hidden;
}

.context-menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--color-text);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.context-menu__item:hover {
    background: var(--color-hover);
}

.context-menu__item:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.context-menu__item--warning {
    color: var(--color-warning-text);
}

.context-menu__item--danger {
    color: var(--color-danger-text);
}

.context-menu__divider {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--color-border-subtle);
}

/* ==========================================================================
   Dashboard Home — Widget Styles
   ========================================================================== */

/* ---------- Dashboard Grid ---------- */
.dashboard {
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard__header {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.dashboard__time-range {
    display: flex;
    gap: 4px;
    align-items: center;
}

.dashboard__time-btn {
    padding: 5px 14px;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dashboard__time-btn:hover {
    border-color: var(--brand-secondary);
    color: var(--brand-secondary);
}

.dashboard__time-btn--active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.dashboard__title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.dashboard__row {
    display: grid;
    gap: 20px;
}

.dashboard__row--chart-feed {
    grid-template-columns: 3fr 2fr;
}

.dashboard__row--alerts-perf {
    grid-template-columns: 1fr 1fr;
}

.dashboard__col {
    min-width: 0;
}

/* Widgets inside grid columns should not add their own bottom margin */
.dashboard__col > .revenue-chart,
.dashboard__col > .realtime-feed,
.dashboard__col > .alert-panel,
.dashboard__col > .top-performers {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Constrain row height so side-by-side widgets stay balanced */
.dashboard__row--chart-feed {
    max-height: 420px;
}

.dashboard__row--alerts-perf {
    max-height: 380px;
}

/* Let scrollable content fill the remaining space */
.dashboard__col > .realtime-feed .realtime-feed__list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

.dashboard__col > .alert-panel .alert-panel__list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
}

/* Responsive: stack on narrow viewports */
@media (max-width: 900px) {
    .dashboard__row--chart-feed,
    .dashboard__row--alerts-perf {
        grid-template-columns: 1fr;
    }

    .dashboard__col > .revenue-chart,
    .dashboard__col > .realtime-feed,
    .dashboard__col > .alert-panel,
    .dashboard__col > .top-performers {
        height: auto;
    }

    .dashboard__col > .realtime-feed .realtime-feed__list,
    .dashboard__col > .alert-panel .alert-panel__list {
        max-height: 320px;
    }
}

/* ---------- Common alert / empty / loading ---------- */
.alert--error {
    padding: 10px 14px;
    background: var(--color-danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--color-danger-text);
    font-size: var(--font-size-sm);
}

/* ---------- KPI Cards ---------- */
.kpi-cards {
    margin-bottom: 0;
}

.kpi-cards__window-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.kpi-cards__toggle-btn {
    padding: 4px 12px;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.kpi-cards__toggle-btn:hover {
    border-color: var(--brand-secondary);
    color: var(--brand-secondary);
}

.kpi-cards__toggle-btn--active {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.kpi-cards__loading {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.kpi-cards__spinner,
.alert-panel__spinner,
.top-performers__spinner,
.balance-widget__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border-subtle);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

.kpi-cards__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.kpi-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-subtle);
}

.kpi-card__title {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-card__value-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.kpi-card__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.kpi-card__suffix {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-weight: 500;
}

.kpi-card__delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.kpi-card__delta--positive {
    color: var(--color-success-text);
    background: var(--color-success-muted);
}

.kpi-card__delta--negative {
    color: var(--color-danger-text);
    background: var(--color-danger-muted);
}

.kpi-card__delta--neutral {
    color: var(--color-text-muted);
    background: rgba(100, 116, 139, 0.1);
}

.kpi-card__arrow {
    font-size: 11px;
}

.kpi-card__sparkline {
    width: 100%;
    height: 24px;
    margin-top: 4px;
    color: var(--brand-secondary);
}

/* ---------- Revenue Chart ---------- */
.revenue-chart {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.revenue-chart__header {
    margin-bottom: 12px;
}

.revenue-chart__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.revenue-chart__loading,
.revenue-chart__empty {
    padding: 32px;
    text-align: center;
    color: var(--color-text-muted);
}

.revenue-chart__container {
    width: 100%;
    overflow: hidden;
}

.revenue-chart__svg {
    width: 100%;
    height: auto;
    max-height: 220px;
    display: block;
}

.revenue-chart__y-label,
.revenue-chart__x-label {
    color: var(--color-text-muted);
    font-family: var(--font-family);
}

.revenue-chart__tooltip {
    position: absolute;
    transform: translateX(-50%);
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    font-family: var(--font-family);
    box-shadow: var(--shadow-md);
    color: var(--color-text);
}

.revenue-chart__tooltip-value {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-text);
}

.revenue-chart__tooltip-detail {
    color: var(--color-text-muted);
    font-size: 11px;
}

.revenue-chart__hit-area {
    position: absolute;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.revenue-chart__hit-area:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: 50%;
}

/* ---------- Real-Time Feed ---------- */
.realtime-feed {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.realtime-feed__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.realtime-feed__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.realtime-feed__status {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.realtime-feed__status--live {
    background: var(--color-success-muted);
    color: var(--color-success-text);
}

.realtime-feed__status--polling {
    background: var(--color-warning-muted);
    color: var(--color-warning-text);
}

.realtime-feed__loading,
.realtime-feed__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.realtime-feed__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.realtime-feed__item {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
    transition: background var(--transition-fast);
}

.realtime-feed__item:hover {
    background: var(--color-hover);
}

.realtime-feed__item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.realtime-feed__type {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.realtime-feed__type--payment { color: var(--brand-secondary); }
.realtime-feed__type--payshap { color: #a78bfa; }
.realtime-feed__type--cashout { color: #22d3ee; }
.realtime-feed__type--refund { color: #fb923c; }
.realtime-feed__type--other { color: var(--color-text-muted); }

.realtime-feed__status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
}

.realtime-feed__status-pill--success { background: var(--color-success-muted); color: var(--color-success-text); }
.realtime-feed__status-pill--pending { background: var(--color-warning-muted); color: var(--color-warning-text); }
.realtime-feed__status-pill--error { background: var(--color-danger-muted); color: var(--color-danger-text); }
.realtime-feed__status-pill--timeout { background: rgba(251, 146, 60, 0.12); color: #fdba74; }
.realtime-feed__status-pill--blocked { background: var(--color-danger-muted); color: var(--color-danger-text); }
.realtime-feed__status-pill--unknown { background: rgba(100, 116, 139, 0.1); color: var(--color-text-muted); }

.realtime-feed__item-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.realtime-feed__merchant {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    font-weight: 500;
}

.realtime-feed__amount {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-text);
}

.realtime-feed__item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.realtime-feed__ref {
    font-size: 11px;
    color: var(--color-text-muted);
    font-family: "SF Mono", "Fira Code", Menlo, monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.realtime-feed__time {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ---------- Alert Panel ---------- */
.alert-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.alert-panel__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.alert-panel__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.alert-panel__count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--color-danger-muted);
    color: var(--color-danger-text);
}

.alert-panel__loading,
.alert-panel__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.alert-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.alert-panel__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
}

.alert-panel__item--critical { background: var(--color-danger-muted); border-left-color: var(--color-danger); }
.alert-panel__item--high { background: rgba(251, 146, 60, 0.1); border-left-color: #fb923c; }
.alert-panel__item--medium { background: var(--color-warning-muted); border-left-color: var(--color-warning); }
.alert-panel__item--info { background: var(--color-info-muted); border-left-color: var(--color-info); }

.alert-panel__severity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.alert-panel__severity-icon {
    font-size: 16px;
}

.alert-panel__severity-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
}

.alert-panel__severity-badge--critical { background: var(--color-danger); color: #fff; }
.alert-panel__severity-badge--high { background: #ea580c; color: #fff; }
.alert-panel__severity-badge--medium { background: var(--color-warning); color: #000; }
.alert-panel__severity-badge--info { background: var(--color-info); color: #fff; }

.alert-panel__content {
    flex: 1;
    min-width: 0;
}

.alert-panel__message {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    line-height: 1.4;
}

.alert-panel__time {
    font-size: 11px;
    color: var(--color-text-muted);
}

.alert-panel__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.alert-panel__action-btn {
    padding: 3px 10px;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alert-panel__action-btn:hover {
    background: var(--color-hover);
}

.alert-panel__action-btn--dismiss {
    color: var(--color-text-muted);
}

.alert-panel__action-btn--snooze {
    color: var(--brand-secondary);
}

/* ---------- Top Performers ---------- */
.top-performers {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.top-performers__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.top-performers__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.top-performers__subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.top-performers__loading,
.top-performers__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.top-performers__table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.top-performers__th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border-subtle);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.top-performers__th--rank { width: 36px; text-align: center; }
.top-performers__th--revenue { width: 40%; }
.top-performers__th--txcount { width: 100px; text-align: right; }

.top-performers__row {
    transition: background var(--transition-fast);
}

.top-performers__row:hover {
    background: var(--color-hover);
}

.top-performers__td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.top-performers__td--rank { text-align: center; }
.top-performers__td--txcount { text-align: right; color: var(--color-text-muted); }

.top-performers__rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

.top-performers__rank-badge--1 { background: rgba(250, 204, 21, 0.15); color: #facc15; }
.top-performers__rank-badge--2 { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.top-performers__rank-badge--3 { background: rgba(251, 146, 60, 0.15); color: #fb923c; }

.top-performers__revenue-bar-container {
    position: relative;
    display: flex;
    align-items: center;
    height: 22px;
}

.top-performers__revenue-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
    transition: width var(--transition-normal);
}

.top-performers__revenue-value {
    position: relative;
    z-index: 1;
    font-weight: 600;
    color: var(--color-text);
    padding-left: 6px;
}

/* ---------- Balance Widget ---------- */
.balance-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 0;
    box-shadow: var(--shadow-sm);
}

.balance-widget__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.balance-widget__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
}

.balance-widget__loading,
.balance-widget__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.balance-widget__alert {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.balance-widget__alert--critical { background: var(--color-danger-muted); color: var(--color-danger-text); }
.balance-widget__alert--warning { background: var(--color-warning-muted); color: var(--color-warning-text); }

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

.balance-widget__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.balance-widget__label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.balance-widget__value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
}

.balance-widget__value--total {
    color: var(--brand-primary);
}

.balance-widget__footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.balance-widget__updated {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ---------- Channel Health Strip ---------- */
.channel-health-strip {
    margin-bottom: 0;
}

.channel-health-strip__loading {
    padding: 12px;
    text-align: center;
    color: var(--color-text-muted);
}

.channel-health-strip__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.channel-health-strip__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: 1px solid transparent;
    transition: box-shadow var(--transition-fast);
}

.channel-health-strip__pill:hover {
    box-shadow: var(--shadow-sm);
}

.channel-health-strip__pill--operational {
    background: var(--color-success-muted);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--color-success-text);
}

.channel-health-strip__pill--degraded {
    background: var(--color-warning-muted);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--color-warning-text);
}

.channel-health-strip__pill--outage {
    background: var(--color-danger-muted);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--color-danger-text);
}

.channel-health-strip__icon {
    font-size: 13px;
}

.channel-health-strip__name {
    font-weight: 600;
}

.channel-health-strip__status {
    font-size: 11px;
    opacity: 0.8;
}

/* ==========================================================================
   Form Components — Dark Theme
   ========================================================================== */

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

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

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

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select.form-control option {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 40px;
}

.btn--primary {
    background: var(--brand-primary);
    color: #fff;
}

.btn--primary:hover:not(:disabled) {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

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

.btn--secondary {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-subtle);
}

.btn--secondary:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: 16px;
    line-height: 1.5;
}

.alert--success {
    background: var(--color-success-muted);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--color-success-text);
}

.alert--error {
    background: var(--color-danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--color-danger-text);
}

/* ==========================================================================
   Profile Page
   ========================================================================== */

.profile-page {
    max-width: 680px;
}

.profile-header {
    margin-bottom: 28px;
}

.profile-header__title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 4px;
}

.profile-header__subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

.profile-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.profile-section__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-section__title svg {
    width: 18px;
    height: 18px;
    color: var(--brand-primary);
}

.security-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.security-item:hover {
    border-color: var(--color-border-subtle);
}

.security-item + .security-item {
    margin-top: 10px;
}

.security-item__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.security-item__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    flex-shrink: 0;
}

.security-item__icon svg {
    width: 18px;
    height: 18px;
    color: var(--brand-primary);
}

.security-item__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.security-item__desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.security-item__action {
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition-fast);
}

.security-item__action--primary {
    color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.security-item__action--primary:hover {
    background: rgba(59, 130, 246, 0.15);
}

.security-item__action--secondary {
    color: var(--color-text-secondary);
    background: transparent;
    border: 1px solid var(--color-border-subtle);
}

.security-item__action--secondary:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

/* ==========================================================================
   Skeleton Loading Placeholders
   ========================================================================== */

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.15; }
}

.skeleton {
    background: var(--color-surface-raised);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.8s ease-in-out infinite;
}

.skeleton--text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton--text-sm {
    height: 11px;
    margin-bottom: 6px;
}

.skeleton--heading {
    height: 22px;
    margin-bottom: 10px;
    width: 60%;
}

.skeleton--value {
    height: 28px;
    width: 45%;
    margin-bottom: 6px;
}

.skeleton--badge {
    height: 18px;
    width: 48px;
    border-radius: 10px;
}

.skeleton--circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.skeleton--chart {
    height: 200px;
    border-radius: var(--radius-md);
}

.skeleton--pill {
    height: 32px;
    width: 120px;
    border-radius: 20px;
    display: inline-block;
}

.skeleton--row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

.skeleton--bar {
    height: 14px;
    flex: 1;
}

/* KPI skeleton grid */
.kpi-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.kpi-skeleton-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    gap: 12px;
}

.empty-state__icon {
    width: 48px;
    height: 48px;
    color: var(--color-text-muted);
    opacity: 0.5;
}

.empty-state__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0;
}

.empty-state__description {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin: 0;
    max-width: 280px;
    line-height: 1.5;
}

.empty-state__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.empty-state__action:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* ==========================================================================
   Error State with Retry
   ========================================================================== */

.error-state {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-danger-muted);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--color-danger-text);
}

.error-state__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.error-state__content {
    flex: 1;
    min-width: 0;
}

.error-state__message {
    margin: 0 0 8px;
    line-height: 1.4;
}

.error-state__retry {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-danger);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.error-state__retry:hover {
    opacity: 0.85;
}

.error-state__retry:focus-visible {
    outline: 2px solid var(--color-danger);
    outline-offset: 2px;
}

/* ==========================================================================
   Notification Dropdown (themed)
   ========================================================================== */

.notification-bell {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    width: 360px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    z-index: 300;
    overflow: hidden;
    animation: dropdown-enter 150ms ease-out;
}

@keyframes dropdown-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.notification-dropdown__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.notification-dropdown__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}

.notification-dropdown__loading {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.notification-dropdown__empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.notification-dropdown__list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--color-text);
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--color-border);
}

.notification-item:hover {
    background: var(--color-hover);
}

.notification-item--unread {
    background: rgba(59, 130, 246, 0.05);
    border-left: 2px solid var(--brand-primary);
}

.notification-item__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-item__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-item__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
}

.notification-item__body {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item__time {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

.notification-dropdown__footer {
    padding: 8px 16px;
    text-align: center;
    border-top: 1px solid var(--color-border);
}

/* General btn overrides for dark theme */
.btn--link {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: none;
    font-family: var(--font-family);
}

.btn--link:hover {
    text-decoration: underline;
}

.btn--sm {
    font-size: 0.75rem;
    padding: 4px 10px;
}

/* ==========================================================================
   Animations — Feed Items, Sidebar Sections
   ========================================================================== */

/* Real-time feed item entrance */
@keyframes feed-item-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.realtime-feed__item {
    animation: feed-item-enter 200ms ease-out;
}

/* Live indicator pulse */
.realtime-feed__status--live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    margin-right: 6px;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Sidebar section collapse */
.nav-section-body {
    overflow: hidden;
    transition: max-height 200ms ease, opacity 150ms ease;
}

.nav-section-body--collapsed {
    max-height: 0 !important;
    opacity: 0;
}

.nav-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 16px 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.nav-section-toggle:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.nav-section-chevron {
    width: 12px;
    height: 12px;
    color: var(--color-text-muted);
    transition: transform 200ms ease;
    flex-shrink: 0;
}

.nav-section-chevron--collapsed {
    transform: rotate(-90deg);
}

/* ==========================================================================
   Mobile Sidebar Drawer
   ========================================================================== */

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: var(--color-hover);
}

.mobile-menu-toggle svg {
    width: 20px;
    height: 20px;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .dashboard-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 250ms ease;
        box-shadow: none;
    }

    .dashboard-sidebar--open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        top: var(--header-height);
        background: rgba(0, 0, 0, 0.5);
        z-index: 499;
        opacity: 0;
        pointer-events: none;
        transition: opacity 250ms ease;
    }

    .sidebar-backdrop--visible {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ==========================================================================
   Welcome Tour — Dark Theme
   ========================================================================== */

.welcome-tour-tooltip {
    background: var(--color-surface-raised) !important;
    border: 1px solid var(--color-border-subtle);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    color: var(--color-text);
    animation: tour-enter 200ms ease-out;
}

@keyframes tour-enter {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.welcome-tour-step-indicator { color: var(--color-text-muted) !important; }
.welcome-tour-close { color: var(--color-text-muted) !important; }
.welcome-tour-close:hover { color: var(--color-text) !important; }
.welcome-tour-title { color: var(--color-text) !important; }
.welcome-tour-description { color: var(--color-text-secondary) !important; }

/* Tour action buttons */
.welcome-tour-actions .btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    transition: background var(--transition-fast);
}

.welcome-tour-actions .btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.welcome-tour-actions .btn-primary:hover {
    background: #2563eb;
}

.welcome-tour-actions .btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border-subtle);
}

.welcome-tour-actions .btn-secondary:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

.welcome-tour-actions .btn-outline-secondary {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-subtle);
}

.welcome-tour-actions .btn-outline-secondary:hover {
    background: var(--color-hover);
}

/* Tour progress bar */
.welcome-tour-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.welcome-tour-progress__segment {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--color-border-subtle);
    transition: background 200ms ease;
}

.welcome-tour-progress__segment--active {
    background: var(--brand-primary);
}

/* ==========================================================================
   Checklist Widget — Dark Theme Override
   ========================================================================== */

.checklist-widget {
    background: var(--color-surface-raised) !important;
    border-color: var(--color-border-subtle) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4) !important;
}

.checklist-widget-body {
    transition: max-height 200ms ease, opacity 150ms ease;
    overflow: hidden;
}

.checklist-item {
    border-bottom-color: var(--color-border) !important;
}

.checklist-item-check { color: var(--color-text-muted) !important; }
.checklist-item--done .checklist-item-check { color: var(--color-success) !important; }

.checklist-item-label--done {
    color: var(--color-text-muted) !important;
}

/* ==========================================================================
   Test Mode Banner — Dark Theme
   ========================================================================== */

.test-mode-banner {
    background: rgba(245, 158, 11, 0.15) !important;
    color: var(--color-warning-text) !important;
    text-align: center;
    padding: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 1100;
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}

.test-mode-banner a {
    color: var(--color-warning-text) !important;
    text-decoration: underline;
}

/* ==========================================================================
   Top Performers — Clickable Rows
   ========================================================================== */

.top-performers__row {
    cursor: pointer;
}

.top-performers__row:nth-child(even) {
    background: rgba(15, 23, 42, 0.3);
}

.top-performers__row:nth-child(even):hover {
    background: var(--color-hover);
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        opacity: 0.25;
    }

    .realtime-feed__item {
        animation: none;
    }

    .notification-dropdown {
        animation: none;
    }

    .welcome-tour-tooltip {
        animation: none !important;
    }

    .realtime-feed__status--live::before {
        animation: none;
    }

    .nav-section-body,
    .nav-section-chevron,
    .dashboard-sidebar {
        transition: none;
    }
}
