/* Leadynox Media Platform — Admin Dashboard (Phase F1: Enterprise Design System)
   Self-contained, no external fonts/CDNs/UI libraries — consistent with
   this codebase's no-Composer/hand-rolled convention. Every selector
   already used across every existing admin view is preserved below
   (buyers/campaigns/publishers/analytics/dashboard/auth) so every page
   continues working unchanged — only the values behind those selectors
   changed. New component sections (dropdown menu, notification panel,
   modal, progress) are appended at the end, actively used by later
   phases (Phase F2's modal-driven dialogs, Phase H's cap-usage progress
   bars). Dark theme is the default; a light theme (the platform's
   original palette) is available via [data-theme="light"] for the
   Phase F1 theme toggle. Phase I production hardening removed the
   Drawer and Loading Skeleton component CSS (built "for future use" in
   Phase F1 but never wired to any view) and a few unused single-purpose
   variants (.trend-down/.trend-flat, .progress-bar-success,
   .form-feedback-invalid/valid, .form-control.is-invalid/valid,
   .loading-placeholder) after confirming zero references anywhere in
   this codebase — re-add only alongside the view that will actually use
   them. */

:root {
    /* Tells the browser to render native, OS-drawn controls (a <select>'s
       own dropdown popup, date/time pickers, scrollbars) in dark mode —
       without this, every <select> on this dark-themed page opened a
       plain white dropdown list (owner-reported, 2026-08-19), since
       those popups are drawn by the OS/browser itself and never inherit
       page CSS colors on their own. The authenticated app layout
       (admin/views/layout/app.php) has no light-theme toggle wired up
       (only the guest/login layout does, unused here), so this is safe
       to set unconditionally rather than needing a [data-theme] guard. */
    color-scheme: dark;

    /* --- Leadynox Orange (primary) — brand hex #FF6A00, single source
       of truth is the Leadynox Media brand sheet --- */
    --color-primary: #ff6a00;
    --color-primary-dark: #db5900;
    --color-primary-light: #ff8a3d;
    --color-primary-soft: rgba(255, 106, 0, 0.14);

    /* --- Dark Slate (secondary) --- */
    --color-secondary: #334155;
    --color-secondary-dark: #1e293b;
    --color-secondary-soft: rgba(51, 65, 85, 0.35);

    /* --- Surfaces (brand background/card values) --- */
    --color-bg: #0e1015;
    --color-bg-elevated: #14171d;
    --color-surface: rgba(255, 255, 255, 0.03);
    --color-surface-solid: #171a21;
    --color-surface-hover: rgba(255, 255, 255, 0.06);
    --color-border: rgba(255, 255, 255, 0.06);
    --color-border-strong: rgba(255, 255, 255, 0.14);

    /* --- Text --- */
    --color-text: #ffffff;
    --color-text-muted: #9ca3af;
    --color-text-faint: #6b7280;
    --color-text-on-primary: #1a0d00;

    /* --- Semantic --- */
    --color-success: #22c55e;
    --color-success-bg: rgba(34, 197, 94, 0.14);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.14);
    --color-danger: #f87171;
    --color-danger-bg: rgba(239, 68, 68, 0.14);
    --color-info: #38bdf8;
    --color-info-bg: rgba(56, 189, 248, 0.14);
    --color-neutral-bg: rgba(255, 255, 255, 0.08);

    /* --- Layout --- */
    --sidebar-width: 248px;
    --sidebar-width-collapsed: 76px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 16px;
    --shadow-elevated: 0 16px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.18);
    --shadow-lifted: 0 10px 28px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-glow-primary: 0 0 0 1px rgba(255, 106, 0, 0.4), 0 8px 24px rgba(255, 106, 0, 0.18);
    --font-sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --transition-fast: 150ms ease;
    --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-sidebar: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Poppins, self-hosted (../fonts) — no external font CDN, consistent
   with this codebase's no-external-dependency convention. Only the
   Latin subset/weights actually used by this UI are included. --- */
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/poppins-400.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/poppins-500.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/poppins-600.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/poppins-700.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/poppins-800.woff2") format("woff2");
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background:
        radial-gradient(ellipse 900px 500px at 12% -10%, rgba(255, 106, 0, 0.05), transparent 60%),
        var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.015em; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: none; color: var(--color-primary-light); }
code { background: var(--color-neutral-bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--color-text); font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
::selection { background: var(--color-primary-soft); color: var(--color-text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 999px; border: 2px solid var(--color-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }

/* --- App shell / sidebar / topnav --- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width-custom, var(--sidebar-width));
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--color-bg-elevated) 0%, var(--color-bg) 100%);
    color: var(--color-text);
    padding: 0;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-sidebar);
    position: relative;
}

html[data-sidebar-collapsed="1"] .app-shell .sidebar { width: var(--sidebar-width-collapsed); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: -0.015em;
    padding: 18px 20px;
    color: #fff;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-brand::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, var(--color-primary) 0%, transparent 55%);
    opacity: 0.5;
}

.sidebar-brand-mark {
    width: auto;
    height: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(255, 106, 0, 0.35));
}

.sidebar-brand-text { opacity: 1; transition: opacity var(--transition-sidebar); }
html[data-sidebar-collapsed="1"] .app-shell .sidebar-brand-text { opacity: 0; width: 0; overflow: hidden; }

.sidebar-nav { display: flex; flex-direction: column; padding: 12px 12px 16px; flex: 1; overflow-y: auto; }

.sidebar-group { margin-bottom: 14px; }

.sidebar-group-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-faint);
    padding: 6px 10px;
    white-space: nowrap;
    overflow: hidden;
}

html[data-sidebar-collapsed="1"] .app-shell .sidebar-group-title { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-link-icon { flex-shrink: 0; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; transition: color var(--transition-fast); }
.sidebar-link-icon svg { width: 17px; height: 17px; }
.sidebar-link-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-link:hover { background: var(--color-surface-hover); color: #fff; text-decoration: none; }

.sidebar-link-active {
    background: var(--color-primary-soft);
    color: var(--color-primary-light);
    font-weight: 600;
}

.sidebar-link-active .sidebar-link-icon { color: var(--color-primary); }

.sidebar-link-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--color-primary);
    box-shadow: 0 0 8px rgba(255, 106, 0, 0.6);
}

.sidebar-link-disabled {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text-faint);
    font-weight: 600;
    font-size: 13.5px;
    cursor: default;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link-icon-disabled { flex-shrink: 0; width: 18px; height: 18px; opacity: 0.5; display: flex; align-items: center; justify-content: center; }
.sidebar-link-icon-disabled svg { width: 18px; height: 18px; }
.sidebar-soon-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-faint);
    background: var(--color-neutral-bg);
    padding: 2px 6px;
    border-radius: 999px;
    flex-shrink: 0;
}

html[data-sidebar-collapsed="1"] .app-shell .sidebar-link-label,
html[data-sidebar-collapsed="1"] .app-shell .sidebar-soon-badge { display: none; }
html[data-sidebar-collapsed="1"] .app-shell .sidebar-link,
html[data-sidebar-collapsed="1"] .app-shell .sidebar-link-disabled { justify-content: center; }

/* --- Sidebar resize handle: no button, no icon, no click. A slim
   invisible strip on the sidebar's edge turns the cursor into a resize
   cursor on hover; press and drag horizontally to resize (IDE-panel
   style). Dragging past a width threshold snaps to the existing
   collapsed state instead of introducing a third, continuously-variable
   layout mode — every collapsed-mode rule already in this file (label
   hiding, icon centering) keeps working unchanged. See admin.js
   initSidebarResize(). --- */

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 6;
    background: transparent;
}

.sidebar-resize-handle::after {
    content: "";
    position: absolute;
    top: 0;
    left: 2px;
    width: 2px;
    height: 100%;
    background: var(--color-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sidebar-resize-handle:hover::after,
.sidebar.is-resizing .sidebar-resize-handle::after {
    opacity: 0.6;
}

.sidebar.is-resizing { transition: none; }
.sidebar.is-resizing .sidebar-brand-text,
.sidebar.is-resizing .sidebar-group-title,
.sidebar.is-resizing .sidebar-link-label,
.sidebar.is-resizing .sidebar-soon-badge { transition: none; }

body.is-sidebar-resizing { cursor: col-resize; user-select: none; }
body.is-sidebar-resizing * { cursor: col-resize !important; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    height: var(--topbar-height);
    background: var(--color-bg-elevated);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topnav-left { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
.topnav-breadcrumbs { font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb-separator { margin: 0 8px; color: var(--color-text-faint); }

.topnav-search {
    position: relative;
    flex: 1;
    max-width: 360px;
    min-width: 120px;
}

.topnav-search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    font-size: 13px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.topnav-search-input:hover { border-color: var(--color-border-strong); }

.topnav-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.topnav-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--color-text-faint);
    pointer-events: none;
}
.topnav-search-icon svg { width: 14px; height: 14px; }

.topnav-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevated);
    overflow: hidden;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.topnav-search-results.is-open { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.topnav-search-result {
    display: block;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--color-text);
}
.topnav-search-result:hover, .topnav-search-result.is-active { background: var(--color-surface-hover); text-decoration: none; }
.topnav-search-empty { padding: 10px 14px; font-size: 12px; color: var(--color-text-faint); }

.topnav-user { display: flex; align-items: center; gap: 6px; }
.topnav-username { color: var(--color-text-muted); }
.topnav-logout-form { margin: 0; }

.topnav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
}

.topnav-icon-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }
.topnav-icon-btn svg { width: 18px; height: 18px; }

.notification-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--color-primary);
    border: 2px solid var(--color-bg-elevated);
}

.topnav-dropdown { position: relative; }

.topnav-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevated);
    padding: 8px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.topnav-dropdown-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.topnav-dropdown-header { padding: 8px 10px 6px; font-size: 12px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.topnav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}
.topnav-dropdown-item:hover { background: var(--color-surface-hover); text-decoration: none; }
.topnav-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.topnav-dropdown-divider { height: 1px; background: var(--color-border); margin: 6px 2px; }

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    cursor: pointer;
    color: var(--color-text);
}
.profile-trigger:hover { border-color: var(--color-border-strong); }

.profile-avatar {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #1a0f00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.app-content { padding: 24px; flex: 1; }

.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-faint);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Guest (login) layout --- */

.guest-body {
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 106, 0, 0.16), transparent 42%),
        radial-gradient(circle at 85% 90%, rgba(255, 106, 0, 0.08), transparent 45%),
        var(--color-bg);
    position: relative;
}
.guest-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 0%, transparent 75%);
    pointer-events: none;
}
.guest-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; z-index: 1; }
.guest-card {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 388px;
    box-shadow: var(--shadow-elevated);
    position: relative;
    overflow: hidden;
    animation: guest-card-in 420ms cubic-bezier(0.16, 1, 0.3, 1);
}
.guest-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light), var(--color-primary));
}
@keyframes guest-card-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.guest-brand {
    text-align: center;
    font-weight: 800;
    margin-bottom: 28px;
    color: var(--color-text);
    font-size: 17px;
    letter-spacing: -0.01em;
}
.guest-brand-logo { height: 80px; width: auto; max-width: 100%; }
.guest-title { margin: 0 0 5px; color: var(--color-text); font-size: 21px; letter-spacing: -0.015em; }
.guest-subtitle { margin: 0 0 24px; color: var(--color-text-muted); font-size: 13.5px; }
.guest-form .form-group { margin-bottom: 16px; }
.btn-block { width: 100%; padding-top: 11px; padding-bottom: 11px; font-size: 13.5px; }

/* --- Page structure --- */

.page-title { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-subtitle {
    margin: 28px 0 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-subtitle::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--color-border), transparent); }

/* --- Cards (dark glass / soft elevation) --- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card {
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-soft);
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover { border-color: var(--color-border-strong); transform: translateY(-1px); }

.card-label { color: var(--color-text-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.card-value { font-size: 22px; font-weight: 700; color: var(--color-text); font-variant-numeric: tabular-nums; }
.card-value-sm { font-size: 16px; }

/* --- Panels --- */

.panel {
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-soft);
    transition: border-color var(--transition-fast);
}
.panel:hover { border-color: var(--color-border-strong); }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.panel-header h2 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -0.005em; color: var(--color-text); display: flex; align-items: center; gap: 8px; }
.panel-header h2 svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-primary); }

/* --- Tables --- */

.data-table, .editor-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

/* Overflow safety net (owner-reported, 2026-08-19): a number of views
   place a .data-table directly inside a .panel/.card/.tab-panel without
   the .table-responsive wrapper other views already use — on a narrow
   panel (e.g. the 3-up "Recent Activity" grid) a wide table (a "When"
   timestamp column especially) then overflows past the card edge with
   text visibly clipped, instead of scrolling. This makes every
   .data-table scrollable wherever it lands, wrapper or not, without
   having to hunt down and edit every view that forgot one — a table
   already inside .table-responsive is unaffected (that wrapper already
   handles its own overflow one level up). */
.panel > .data-table, .card > .data-table, .tab-panel > .data-table {
    display: block;
    overflow-x: auto;
}

.data-table { border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }

.data-table th, .data-table td, .editor-table th, .editor-table td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    /* A cell with room to wrap (a timestamp, a $-amount) always chose to
       instead of ever triggering the horizontal scroll its .table-
       responsive wrapper (or the .panel > .data-table safety net above)
       provides — table-layout:auto happily shrinks/wraps columns to fit
       before it ever lets content overflow. Confirmed the actual cause
       of "Recent Activity"'s WHEN/SUBMITTED columns rendering as
       squeezed 3-line timestamps (owner-reported, 2026-08-19) even
       after the overflow wrapper was already in place. */
    white-space: nowrap;
}

.data-table th {
    background: rgba(255, 255, 255, 0.025);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    font-weight: 700;
}

.data-table th a { color: var(--color-text-muted); }
.data-table th a:hover { color: var(--color-text); text-decoration: none; }
.data-table tbody tr { transition: background var(--transition-fast); position: relative; }
.data-table tbody tr:hover { background: var(--color-surface-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 10px; white-space: nowrap; }
.empty-state { text-align: center; color: var(--color-text-faint); padding: 32px !important; font-size: 13px; }
.empty-state-inline { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--color-text-faint); padding: 24px 0; font-size: 13px; }
.empty-state-inline svg { width: 16px; height: 16px; flex-shrink: 0; }

/* --- Chart legend dot (color key next to a panel's title) --- */
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; margin-right: 7px; vertical-align: middle; }

.editor-table { margin-bottom: 10px; }
.editor-table input.form-control, .editor-table select.form-control { min-width: 140px; }

/* --- Badges --- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; flex-shrink: 0; }

.badge-success { background: var(--color-success-bg); color: var(--color-success); border-color: rgba(34, 197, 94, 0.25); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); border-color: rgba(245, 158, 11, 0.25); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); border-color: rgba(239, 68, 68, 0.25); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); border-color: rgba(56, 189, 248, 0.25); }
.badge-neutral { background: var(--color-neutral-bg); color: var(--color-text-muted); border-color: var(--color-border); }

/* --- Alerts / flash messages (styled as toast notifications) --- */

.flash-messages {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100vw - 40px));
}

.alert {
    position: relative;
    padding: 14px 40px 14px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    box-shadow: var(--shadow-elevated);
    background: var(--color-surface-solid);
    animation: toast-in var(--transition-base);
    font-size: 13px;
}

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

.alert-success { border-color: rgba(34, 197, 94, 0.35); }
.alert-success::before, .alert-error::before, .alert-warning::before, .alert-info::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    border-radius: var(--radius) 0 0 var(--radius);
}
.alert-success::before { background: var(--color-success); }
.alert-error { border-color: rgba(239, 68, 68, 0.35); }
.alert-error::before { background: var(--color-danger); }
.alert-warning { border-color: rgba(245, 158, 11, 0.35); }
.alert-warning::before { background: var(--color-warning); }
.alert-info { border-color: rgba(56, 189, 248, 0.35); }
.alert-info::before { background: var(--color-info); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

.alert-dismiss {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--color-text-muted);
    opacity: 0.8;
}
.alert-dismiss:hover { opacity: 1; color: var(--color-text); }

/* --- Forms --- */

.form-group { margin-bottom: 14px; flex: 1; min-width: 160px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stacked-form { max-width: 900px; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 12.5px; color: var(--color-text-muted); }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder { color: var(--color-text-faint); }
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.form-control:disabled { background: rgba(255, 255, 255, 0.02); color: var(--color-text-faint); }


input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); width: 15px; height: 15px; vertical-align: middle; }

.field-hint { color: var(--color-text-faint); font-size: 12px; margin: 4px 0 0; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }
.tab-help { color: var(--color-text-muted); margin-bottom: 12px; }
.tab-help svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    vertical-align: -2px;
    margin-right: 4px;
}

.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { width: auto; min-width: 200px; }

.bulk-actions { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; transition: background var(--transition-fast), border-color var(--transition-fast); border-radius: var(--radius-sm); }
.bulk-actions .form-control { width: auto; }

.inline-form { display: inline-block; margin: 0; }

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    text-align: center;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--color-primary-soft); }
.btn svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; flex-shrink: 0; }

.btn-primary { background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%); color: var(--color-text-on-primary); box-shadow: 0 4px 14px rgba(255, 106, 0, 0.3); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 20px rgba(255, 106, 0, 0.4); }

.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); box-shadow: var(--shadow-soft); }

.btn-success { background: var(--color-success); color: #06210f; }
.btn-success:hover { filter: brightness(1.08); }

.btn-warning { background: var(--color-warning); color: #241900; }
.btn-warning:hover { filter: brightness(1.08); }

.btn-link { background: none; border: none; color: var(--color-primary); padding: 4px 6px; font-weight: 600; }
.btn-danger { color: var(--color-danger); }
.btn-danger.btn-primary, .btn-danger.btn-secondary { background: var(--color-danger); border-color: var(--color-danger); color: #2a0a0a; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.buyer-key-chip { font-weight: 400; font-size: 13px; margin-left: 8px; vertical-align: middle; color: var(--color-text-muted); }

/* --- Tabs --- */

.tabs { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); overflow: hidden; }

.tab-nav {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--color-border);
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.015);
}

.tab-link {
    padding: 14px 16px;
    white-space: nowrap;
    color: var(--color-text-muted);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    position: relative;
    transition: color var(--transition-fast);
}

.tab-link:hover { text-decoration: none; color: var(--color-text); }
.tab-link-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-panel { display: none; padding: 20px; }
.tab-panel-active { display: block; }

/* --- Pagination --- */

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.pagination-summary { color: var(--color-text-faint); font-size: 12.5px; }
.pagination-links { display: flex; gap: 4px; }

.pagination-link {
    padding: 6px 11px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 13px;
}

.pagination-link:hover { background: var(--color-surface-hover); text-decoration: none; border-color: var(--color-border-strong); }
.pagination-link-active { background: var(--color-primary); color: var(--color-text-on-primary); border-color: var(--color-primary); }

/* --- Campaign Manager: cards, wizard, reorder, misc --- */

.form-group-checkbox { display: flex; flex-direction: column; justify-content: center; }
.form-group-checkbox label { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--color-text); }
.form-group-action { display: flex; align-items: flex-end; }
.assign-form { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border); }

.checkbox-row { display: flex; gap: 8px; flex-wrap: wrap; }
.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    color: var(--color-text);
}

.campaign-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.campaign-card {
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-soft);
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.campaign-card:hover { border-color: var(--color-border-strong); transform: translateY(-1px); }

.campaign-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.campaign-card-warning { padding: 6px 10px; font-size: 12px; margin: 8px 0 0; }
.campaign-card-stats { display: flex; gap: 16px; margin: 12px 0; }
.campaign-card-stats > div { display: flex; flex-direction: column; }
.campaign-card-actions { display: flex; gap: 10px; margin-top: 12px; border-top: 1px solid var(--color-border); padding-top: 10px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table td { padding: 4px 0; border-bottom: 1px dashed var(--color-border); color: var(--color-text); }
.mini-table td:first-child { color: var(--color-text-muted); }
.mini-table td:last-child { text-align: right; font-weight: 600; }

.wizard-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.wizard-step {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--color-neutral-bg);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
}
.wizard-step-active { background: var(--color-primary); color: var(--color-text-on-primary); }
.wizard-step-complete { background: var(--color-success-bg); color: var(--color-success); }
a.wizard-step:hover { text-decoration: none; opacity: 0.85; }

.wizard-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.wizard-nav { display: flex; justify-content: space-between; align-items: center; }

.drag-handle { cursor: grab; text-align: center; color: var(--color-text-muted); width: 24px; }
[data-reorder-table] tr.dragging { opacity: 0.4; }
[data-reorder-table] tbody tr { cursor: default; }

/* --- Enterprise Analytics Dashboard (Phase E2): chart grid, chart SVGs, KPI variants --- */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.chart-grid .panel { margin-bottom: 0; }

.chart-wrap { position: relative; padding-left: 52px; }
.chart-svg { width: 100%; height: auto; display: block; cursor: crosshair; }
.chart-axis-labels { display: flex; justify-content: space-between; color: var(--color-text-faint); font-size: 11px; margin-top: 4px; }

.chart-yaxis-labels { display: flex; flex-direction: column; justify-content: space-between; position: absolute; top: 0; bottom: 18px; left: 0; width: 44px; font-size: 11px; color: var(--color-text-faint); text-align: right; pointer-events: none; }
.chart-yaxis-labels span:first-child { color: var(--color-text-muted); }

.chart-point { fill: var(--color-surface); stroke: currentColor; stroke-width: 1.5; opacity: 0; transition: opacity 0.1s ease; }
.chart-wrap:hover .chart-point { opacity: 0.55; }
.chart-point-active { opacity: 1 !important; r: 4.5; }

.chart-crosshair { stroke: var(--color-border-strong); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

.chart-tooltip {
    position: absolute;
    top: -4px;
    transform: translateY(-100%);
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--shadow-soft);
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chart-tooltip strong { color: var(--color-text); font-size: 13px; }
.chart-tooltip span { color: var(--color-text-faint); }

.chart-svg-bars { min-height: 40px; }
.chart-bar-label { font-size: 11px; fill: var(--color-text-muted); }
.chart-bar-value { font-size: 11px; fill: var(--color-text); font-weight: 600; }

.kpi-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lifted); }

.kpi-card-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}
.kpi-card-icon svg { width: 15px; height: 15px; }
.kpi-card-icon-img { width: 18px; height: 18px; object-fit: contain; }
.kpi-card-accent-success .kpi-card-icon { background: var(--color-success-bg); color: var(--color-success); }
.kpi-card-accent-warning .kpi-card-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.kpi-card-accent-danger .kpi-card-icon { background: var(--color-danger-bg); color: var(--color-danger); }
.kpi-card-accent-info .kpi-card-icon { background: var(--color-info-bg); color: var(--color-info); }

.kpi-card-accent-success { border-left-color: var(--color-success); }
.kpi-card-accent-warning { border-left-color: var(--color-warning); }
.kpi-card-accent-danger { border-left-color: var(--color-danger); }
.kpi-card-accent-info { border-left-color: var(--color-info); }

.kpi-card-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.kpi-card-value { font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--color-text); }
.kpi-card-subvalue { color: var(--color-text-faint); font-size: 12px; margin-top: 4px; }

.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Premium export/action cards: replaces plain CSV/Excel/PDF-style
   buttons wherever a set of export/download destinations is offered
   (Analytics header, Audit Logs header, Import/Export Center) — one
   component, reused everywhere instead of redesigning each spot
   separately. --- */

.export-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

.export-action-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    box-shadow: var(--shadow-soft);
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.export-action-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px var(--color-primary-soft), 0 10px 26px rgba(255, 122, 26, 0.22);
    text-decoration: none;
}

.export-action-card:active { transform: translateY(0); box-shadow: var(--shadow-soft); }

.export-action-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    flex-shrink: 0;
}
.export-action-icon svg { width: 16px; height: 16px; }

.export-action-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.export-action-title { font-weight: 700; font-size: 13px; color: var(--color-text); white-space: nowrap; }
.export-action-desc { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================================================
   Phase F1 — new reusable components
   ========================================================= */

/* --- Breadcrumbs (standalone variant, e.g. inside .app-content) --- */

.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--color-text-muted); margin-bottom: 10px; }
.breadcrumbs a { color: var(--color-text-muted); }
.breadcrumbs a:hover { color: var(--color-primary); }
.breadcrumbs .breadcrumb-current { color: var(--color-text); font-weight: 600; }

/* --- Modal --- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 4, 6, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: modal-in var(--transition-base);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--color-border); }
.modal-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--color-text-muted); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--color-border); }

/* --- Progress bar --- */

.progress { width: 100%; height: 8px; border-radius: 999px; background: var(--color-neutral-bg); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%); transition: width var(--transition-base); }
.progress-bar-warning { background: var(--color-warning); }
.progress-bar-danger { background: var(--color-danger); }
.progress-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--color-text-muted); margin-bottom: 5px; }

/* =========================================================
   Phase F2 — Enterprise Dashboard UX
   ========================================================= */

/* --- Health / status indicators --- */

.health-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--color-text); white-space: nowrap; }
.health-indicator svg { width: 13px; height: 13px; flex-shrink: 0; }
.health-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.health-dot-success { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-bg); }
.health-dot-warning { background: var(--color-warning); box-shadow: 0 0 0 3px var(--color-warning-bg); }
.health-dot-danger { background: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-bg); }
.health-dot-neutral { background: var(--color-text-faint); box-shadow: 0 0 0 3px var(--color-neutral-bg); }

.metric-pill { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12.5px; color: var(--color-text); }
.metric-pill-muted { color: var(--color-text-muted); font-weight: 600; }

.trend-value { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.trend-value svg { width: 13px; height: 13px; }
.trend-up { color: var(--color-success); }

/* --- Sticky / scrollable tables --- */

.table-responsive { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: auto; }
.table-responsive .data-table { border: none; border-radius: 0; }
.table-responsive.table-scroll { max-height: 480px; }
.table-responsive thead th { position: sticky; top: 0; z-index: 5; background: var(--color-surface-solid); box-shadow: 0 1px 0 var(--color-border); }

.data-table th a.is-sorted { color: var(--color-text); }
.sort-arrow { display: inline-block; margin-left: 3px; font-size: 9px; opacity: 0.85; }

/* --- Table toolbar: search-with-icon + filters + bulk-actions polish --- */

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.search-input-wrap { position: relative; flex: 1; min-width: 180px; }
.search-input-wrap .search-input-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--color-text-faint); pointer-events: none; transition: color var(--transition-fast); }
.search-input-wrap .search-input-icon svg { width: 14px; height: 14px; }
.search-input-wrap input.form-control { padding-left: 34px; }
.search-input-wrap:focus-within .search-input-icon { color: var(--color-primary); }

.bulk-actions.is-active { background: var(--color-primary-soft); border: 1px solid var(--color-primary); padding: 8px 12px; }
.bulk-actions-count { font-size: 12px; font-weight: 700; color: var(--color-primary); }

/* --- Quick actions grid (Dashboard) --- */

.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }

.quick-action-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--color-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    color: var(--color-text);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.quick-action-card:hover { transform: translateY(-2px); border-color: var(--color-border-strong); text-decoration: none; }

.quick-action-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--color-primary-soft); color: var(--color-primary); }
.quick-action-icon svg { width: 18px; height: 18px; }
.quick-action-label { font-weight: 700; font-size: 13.5px; }
.quick-action-desc { color: var(--color-text-muted); font-size: 12px; }

/* --- Not-yet-built feature card (Security page placeholders): same
   shape as .quick-action-card, but static — no hover lift, since
   nothing happens on click yet. --- */
.quick-action-card-disabled { opacity: 0.6; cursor: default; }
.quick-action-card-disabled:hover { transform: none; border-color: var(--color-border); }
.quick-action-card-disabled .quick-action-icon { background: var(--color-neutral-bg); color: var(--color-text-faint); }

/* --- Activity timeline --- */

.activity-timeline { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--color-border); }
.activity-item:last-child { border-bottom: none; }

.activity-icon { width: 32px; height: 32px; border-radius: 999px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--color-surface-hover); color: var(--color-text-muted); }
.activity-icon svg { width: 15px; height: 15px; }
.activity-icon-success { background: var(--color-success-bg); color: var(--color-success); }
.activity-icon-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.activity-icon-info { background: var(--color-info-bg); color: var(--color-info); }

.activity-content { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 600; color: var(--color-text); }
.activity-meta { font-size: 12px; color: var(--color-text-faint); margin-top: 2px; }
.activity-time { font-size: 11.5px; color: var(--color-text-faint); white-space: nowrap; }

/* --- System status widget --- */

.status-widget { display: flex; flex-direction: column; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.status-row:last-child { border-bottom: none; }
.status-row-label { color: var(--color-text-muted); font-size: 13px; font-weight: 600; }
.status-row-value { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }

/* --- KPI hero variant (Revenue Overview row) --- */

.kpi-card-hero { padding: 20px; }
.kpi-card-hero .kpi-card-value { font-size: 28px; }

/* --- Button loading state --- */

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    top: 50%;
    left: 50%;
    margin: -7px 0 0 -7px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: btn-spin 0.6s linear infinite;
}
.btn-secondary.btn-loading::after, .btn-link.btn-loading::after { border: 2px solid var(--color-border-strong); border-top-color: var(--color-text); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* --- Copy-to-clipboard button --- */

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
}
.copy-btn:hover { color: var(--color-primary); border-color: var(--color-border-strong); }
.copy-btn svg { width: 12px; height: 12px; }

.input-with-copy { display: flex; align-items: center; gap: 6px; }
.input-with-copy .form-control { flex: 1; }
.input-with-copy .copy-btn { margin-left: 0; flex-shrink: 0; }

/* --- Professional empty states --- */

.empty-state-pro { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 24px; color: var(--color-text-faint); gap: 6px; }
.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-primary-soft) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    margin-bottom: 10px;
}
.empty-state-icon svg { width: 24px; height: 24px; }
.empty-state-title { font-size: 15px; font-weight: 700; color: var(--color-text); letter-spacing: -0.01em; }
.empty-state-desc { font-size: 12.5px; max-width: 360px; }
.empty-state-pro .btn { margin-top: 12px; }
.empty-state-pro .empty-state-actions { display: flex; gap: 8px; margin-top: 12px; }

/* --- White Label / branding workspace --- */

.branding-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr); gap: 20px; align-items: start; }

.branding-section { margin-bottom: 20px; }
.branding-section:last-child { margin-bottom: 0; }
.branding-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
}
.branding-section-title svg { width: 15px; height: 15px; color: var(--color-primary); flex-shrink: 0; }

.logo-field { display: flex; align-items: center; gap: 12px; }
.logo-field .form-group { margin-bottom: 0; }
.logo-preview {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 20px;
}
.logo-preview img { max-width: 78%; max-height: 78%; object-fit: contain; }
.logo-preview-empty { color: var(--color-text-faint); }
.logo-preview-empty svg { width: 18px; height: 18px; }

.color-field { display: flex; align-items: center; gap: 10px; }
.color-field .form-group { margin-bottom: 0; }
.color-swatch {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-strong);
    margin-top: 20px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.typography-preview {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: baseline;
    gap: 18px;
}
.typography-preview .type-sample { font-family: var(--font-sans); color: var(--color-text); }
.typography-preview .type-sample-weight { display: block; font-size: 10px; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; text-align: center; }

/* --- Browser-chrome live preview mockup --- */

.browser-mockup {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    box-shadow: var(--shadow-lifted);
    background: var(--color-bg);
}
.browser-mockup-chrome {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #1c1f26;
    border-bottom: 1px solid var(--color-border);
}
.browser-mockup-dot { width: 9px; height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); }
.browser-mockup-bar {
    flex: 1;
    margin-left: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 10.5px;
    color: var(--color-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.browser-mockup-topbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: #fff; font-weight: 700; transition: background var(--transition-fast); }
.browser-mockup-topbar img { height: 22px; width: auto; max-width: 120px; object-fit: contain; }
.browser-mockup-body { padding: 32px 24px; text-align: center; }
.browser-mockup-body img { height: 48px; width: auto; max-width: 80%; object-fit: contain; margin-bottom: 10px; }
.browser-mockup-name { color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 4px; letter-spacing: -0.01em; }
.browser-mockup-subtitle { color: var(--color-text-muted); font-size: 13px; margin-bottom: 18px; }
.browser-mockup-footer { padding: 10px 16px; color: #fff; font-size: 11.5px; transition: background var(--transition-fast); }

/* --- Keyboard shortcuts modal trigger + kbd styling --- */

kbd.key-hint { display: inline-block; padding: 2px 6px; border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--color-surface-hover); font-family: var(--font-sans); font-size: 11.5px; font-weight: 700; color: var(--color-text); }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.shortcut-row:last-child { border-bottom: none; }

/* --- Accessibility: visible focus rings on interactive elements not already covered --- */

.sidebar-link:focus-visible,
.tab-link:focus-visible,
.pagination-link:focus-visible,
.data-table th a:focus-visible,
.checkbox-pill:focus-within,
.topnav-icon-btn:focus-visible,
.quick-action-card:focus-visible,
.export-action-card:focus-visible,
.modal-close:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --- Responsive --- */

@media (max-width: 1100px) {
    .chart-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    html[data-sidebar-collapsed="1"] .app-shell .sidebar { width: 100%; }
    .sidebar { width: 100%; padding: 0; }
    .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 10px; }
    .sidebar-group { display: flex; align-items: center; margin-bottom: 0; }
    .sidebar-group-title { display: none; }
    .sidebar-resize-handle { display: none; }
    .topnav-search { order: 3; max-width: 100%; flex-basis: 100%; }
    .form-row { flex-direction: column; }
    .data-table { display: block; overflow-x: auto; }
    .campaign-card-grid { grid-template-columns: 1fr; }
    .wizard-nav { flex-direction: column; gap: 10px; align-items: stretch; }
    .chart-grid { grid-template-columns: 1fr; }
    .kpi-card-grid { grid-template-columns: repeat(2, 1fr); }
    .flash-messages { left: 12px; right: 12px; width: auto; top: 12px; }
    .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .branding-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .kpi-card-grid { grid-template-columns: 1fr; }
    .app-content { padding: 16px; }
    .topnav { padding: 0 14px; }
    .guest-card { padding: 24px; }
    .quick-actions-grid { grid-template-columns: 1fr; }
    .activity-item { gap: 8px; }
}
