/* ============================================
   IRONCLAD ID ATTACK SIMULATOR — Dashboard CSS
   Dark Theme  |  Brand Design System  |  Production
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Brand colors (shared between themes) */
    --blue: #3C85EF;
    --blue-light: #97C9FF;
    --blue-dark: #0C0C59;
    --teal: #3ECEB6;
    --purple: #370A72;
    --plum: #60003F;
    --gold: #BF873D;
    --red: #EF4444;
    --red-light: #FCA5A5;
    --green: #22C55E;
    --green-light: #86EFAC;
    --yellow: #EAB308;
    --orange: #F97316;

    /* Dark theme (default) */
    --black: #000000;
    --dark: #0a0a0f;
    --dark-card: #111118;
    --dark-surface: #16161f;
    --dark-border: rgba(60, 133, 239, 0.15);
    --dark-border-hover: rgba(60, 133, 239, 0.35);
    --charcoal: #666666;
    --grey-light: #9a9ab0;
    --white: #FFFFFF;

    /* Semantic aliases for theming */
    --bg-body: #0a0a0f;
    --bg-card: #111118;
    --bg-surface: #16161f;
    --bg-sidebar: #111118;
    --border-color: rgba(60, 133, 239, 0.15);
    --border-hover: rgba(60, 133, 239, 0.35);
    --text-primary: #FFFFFF;
    --text-secondary: #9a9ab0;
    --text-muted-color: #666666;
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-text: #e0e0e0;
    --sidebar-hover: rgba(60, 133, 239, 0.08);
    --sidebar-active: rgba(60, 133, 239, 0.12);
    --topbar-bg: rgba(10, 10, 15, 0.95);
    --dropdown-bg: #111118;
    --watermark-opacity: 0.4;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
    --shadow-blue: 0 4px 24px rgba(60, 133, 239, 0.3);

    /* Layout tokens */
    --font-display: 'Poppins', sans-serif;
    --font-body: 'Poppins', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --radius-pill: 50px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
}

/* --- Light Theme --- */
[data-theme="light"] {
    --dark: #f5f6fa;
    --dark-card: #ffffff;
    --dark-surface: #f0f1f5;
    --dark-border: rgba(60, 133, 239, 0.18);
    --dark-border-hover: rgba(60, 133, 239, 0.4);
    --charcoal: #6b7280;
    --grey-light: #4b5563;
    --white: #111827;
    --black: #ffffff;

    --bg-body: #f5f6fa;
    --bg-card: #ffffff;
    --bg-surface: #f0f1f5;
    --bg-sidebar: #ffffff;
    --border-color: #e5e7eb;
    --border-hover: rgba(60, 133, 239, 0.4);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted-color: #6b7280;
    --input-bg: #f9fafb;
    --input-border: #d1d5db;
    --input-text: #1f2937;
    --sidebar-hover: rgba(60, 133, 239, 0.06);
    --sidebar-active: rgba(60, 133, 239, 0.1);
    --topbar-bg: rgba(255, 255, 255, 0.95);
    --dropdown-bg: #ffffff;
    --watermark-opacity: 0.08;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.1);
    --shadow-blue: 0 4px 24px rgba(60, 133, 239, 0.15);

    color-scheme: light;
}

[data-theme="light"] body,
[data-theme="light"].dashboard {
    color: var(--text-secondary);
}

[data-theme="light"] h1, [data-theme="light"] h2,
[data-theme="light"] h3, [data-theme="light"] h4,
[data-theme="light"] h5, [data-theme="light"] h6 {
    color: var(--text-primary);
}

[data-theme="light"] .sidebar__logo {
    /* In light mode, use a filter to darken the white logo, or swap via content */
    filter: brightness(0) saturate(100%);
}

[data-theme="light"] .form__input,
[data-theme="light"] .form__select,
[data-theme="light"] .form-select,
[data-theme="light"] .form__textarea {
    background: var(--input-bg);
    border-color: var(--input-border);
    color: var(--input-text);
}

[data-theme="light"] .form__input:focus,
[data-theme="light"] .form__select:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form__textarea:focus {
    border-color: var(--blue);
}

[data-theme="light"] .form__input::placeholder,
[data-theme="light"] .form__textarea::placeholder {
    color: #9ca3af;
}

[data-theme="light"] .modal__content {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="light"] .data-table thead th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .data-table td {
    border-bottom-color: var(--border-color);
}

[data-theme="light"] .toast {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Theme toggle button */
.topbar__theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.topbar__theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--blue);
}
.topbar__theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
/* Hide the inactive icon */
.topbar__theme-toggle .icon-sun { display: none; }
.topbar__theme-toggle .icon-moon { display: inline; }
[data-theme="light"] .topbar__theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .topbar__theme-toggle .icon-moon { display: none; }

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-body);
    background: var(--bg-body, var(--dark));
    color: var(--text-secondary, var(--grey-light));
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-light); }
img { max-width: 100%; height: auto; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--white);
    font-weight: 600;
    line-height: 1.3;
}

/* --- Fingerprint Watermark Background --- */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    right: -5%;
    transform: translateY(-50%);
    width: 500px;
    height: 800px;
    background: url('../images/brand/fingerprint-watermark.png') no-repeat center;
    background-size: contain;
    opacity: var(--watermark-opacity, 0.4);
    pointer-events: none;
    z-index: 0;
}


/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 24px;
}
.login-page::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(60, 133, 239, 0.08) 0%, transparent 70%);
    pointer-events: none;
}
.login-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}
.login-card__logo {
    text-align: center;
    margin-bottom: 36px;
}
.login-card__logo img {
    height: 48px;
    width: auto;
}
[data-theme="light"] .login-card__logo img {
    /* Same treatment as .sidebar__logo: white PNG wordmark on light card */
    filter: brightness(0) saturate(100%);
}
.login-card__title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 8px;
}
.login-card__subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--grey-light);
    margin-bottom: 32px;
}
.login-card .form__group {
    margin-bottom: 20px;
}
.login-card .btn {
    margin-top: 8px;
}
.org-select-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.org-select-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    text-align: left;
    background: var(--card-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    color: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.org-select-item:hover {
    border-color: var(--blue, #3b82f6);
    background: rgba(59, 130, 246, 0.08);
}
.org-select-item__name {
    font-weight: 600;
    font-size: 0.95rem;
}
.org-select-item__role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* Flash messages */
.flash-messages {
    margin-bottom: 20px;
}
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}
.flash--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red-light);
}
.flash--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green-light);
}
.flash--warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}


/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--dark-card);
    border-right: 1px solid var(--dark-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .sidebar__logo,
.sidebar.collapsed .sidebar__section-label,
.sidebar.collapsed .sidebar__nav-text,
.sidebar.collapsed .sidebar__user-info {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}
.sidebar.collapsed .sidebar__nav-link {
    justify-content: center;
    padding: 12px;
}
.sidebar.collapsed .sidebar__collapse-icon {
    transform: rotate(180deg);
}

.sidebar__header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--dark-border);
    min-height: 64px;
    flex-shrink: 0;
}
.sidebar__logo {
    height: 34px;
    width: auto;
    flex-shrink: 0;
    transition: opacity var(--transition);
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(60, 133, 239, 0.2) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-track { background: transparent; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(60, 133, 239, 0.2); border-radius: 2px; }

.sidebar__section {
    margin-bottom: 24px;
}
.sidebar__section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--charcoal);
    padding: 0 12px 8px;
    white-space: nowrap;
    transition: opacity var(--transition);
}
.sidebar__nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar__nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.sidebar__nav-link:hover {
    background: rgba(60, 133, 239, 0.08);
    color: var(--white);
}
.sidebar__nav-link.active {
    background: rgba(60, 133, 239, 0.12);
    color: var(--blue);
}
.sidebar__nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar__nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sidebar__nav-text {
    transition: opacity var(--transition);
}

.sidebar__footer {
    padding: 16px;
    border-top: 1px solid var(--dark-border);
    flex-shrink: 0;
}
.sidebar__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}
.sidebar__collapse:hover {
    border-color: var(--dark-border-hover);
    color: var(--white);
}
.sidebar__collapse-icon {
    transition: transform var(--transition);
}
.sidebar__collapse-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* --- Sidebar User --- */
.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    background: rgba(60, 133, 239, 0.05);
    border: 1px solid var(--dark-border);
}
.sidebar__user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar__user-info {
    overflow: hidden;
    transition: opacity var(--transition);
}
.sidebar__user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar__user-role {
    font-size: 0.7rem;
    color: var(--charcoal);
    white-space: nowrap;
}

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition);
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
    position: relative;
    /* z-index removed: was creating a stacking context that trapped
       fixed-position modals (z-index:2000) below the sidebar (z-index:100) */
}
.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* --- Top Bar --- */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 50;
}
.topbar__left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar__hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 4px;
}
.topbar__hamburger svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
.topbar__breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}
.topbar__breadcrumb {
    color: var(--charcoal);
}
.topbar__breadcrumb--active {
    color: var(--white);
    font-weight: 500;
}
.topbar__breadcrumb-sep {
    color: var(--charcoal);
    font-size: 0.75rem;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: 20px;
}
.topbar__org {
    font-size: 0.8rem;
    color: var(--grey-light);
    padding: 6px 14px;
    background: rgba(60, 133, 239, 0.06);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-pill);
}
/* Org Switcher (master admin) */
.topbar__org-switcher {
    position: relative;
}
.topbar__org--switcher {
    cursor: pointer;
    transition: all var(--transition);
}
.topbar__org--switcher:hover {
    border-color: var(--dark-border-hover);
    color: var(--white);
}
.topbar__org-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}
.topbar__org-search {
    width: 100%;
    padding: 10px 14px;
    background: var(--dark-surface);
    border: none;
    border-bottom: 1px solid var(--dark-border);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
}
.topbar__org-search::placeholder {
    color: var(--charcoal);
}
.topbar__org-list {
    max-height: 240px;
    overflow-y: auto;
}
.topbar__org-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--grey-light);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}
.topbar__org-item:hover {
    background: rgba(60, 133, 239, 0.08);
    color: var(--white);
}
.topbar__org-item--active {
    background: rgba(60, 133, 239, 0.12);
    color: var(--blue-light);
}
.topbar__org-item-name {
    flex: 1;
    font-weight: 500;
}
.topbar__org-item-slug {
    font-size: 0.75rem;
    color: var(--charcoal);
}
.topbar__org-item-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(60, 133, 239, 0.15);
    color: var(--blue);
    border-radius: var(--radius-pill);
}
.topbar__org-manage {
    display: block;
    padding: 10px 14px;
    text-align: center;
    color: var(--blue);
    text-decoration: none;
    font-size: 0.8rem;
    border-top: 1px solid var(--dark-border);
    transition: background var(--transition);
}
.topbar__org-manage:hover {
    background: rgba(60, 133, 239, 0.08);
}
.topbar__notification {
    position: relative;
    background: none;
    border: none;
    color: var(--grey-light);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.topbar__notification:hover {
    background: rgba(60, 133, 239, 0.08);
    color: var(--white);
}
.topbar__notification svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}
.topbar__notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--dark);
}
.topbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.topbar__user:hover {
    background: rgba(60, 133, 239, 0.08);
}
.topbar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
}
.topbar__user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--white);
}
.topbar__user-caret {
    opacity: 0.6;
    margin-left: -4px;
}
/* User dropdown menu */
.topbar__user-menu {
    position: relative;
}
.topbar__user-menu .topbar__user {
    background: none;
    border: none;
    font-family: inherit;
    text-decoration: none;
}
.topbar__user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}
.topbar__user-dropdown-header {
    padding: 12px 16px;
}
.topbar__user-dropdown-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
}
.topbar__user-dropdown-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 2px;
}
.topbar__user-dropdown-divider {
    height: 1px;
    background: var(--dark-border);
}
.topbar__user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}
.topbar__user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}
.topbar__user-dropdown-item--logout:hover {
    color: var(--red);
}

/* --- Page Content --- */
.page-content {
    padding: 32px;
    min-height: calc(100vh - var(--topbar-height));
}


/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.card:hover {
    border-color: var(--dark-border-hover);
}
.card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card--flush {
    padding: 0;
}
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.card__header--bordered {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--dark-border);
}
.card__title {
    font-size: 1.1rem;
    font-weight: 600;
}
.card__subtitle {
    font-size: 0.85rem;
    color: var(--grey-light);
    margin-top: 4px;
}
.card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(60, 133, 239, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.card__icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--blue);
    fill: none;
    stroke-width: 1.8;
}
.card__icon--teal { background: rgba(62, 206, 182, 0.1); }
.card__icon--teal svg { stroke: var(--teal); }
.card__icon--green { background: rgba(34, 197, 94, 0.1); }
.card__icon--green svg { stroke: var(--green); }
.card__icon--purple { background: rgba(55, 10, 114, 0.15); }
.card__icon--purple svg { stroke: #a855f7; }
.card__icon--gold { background: rgba(191, 135, 61, 0.1); }
.card__icon--gold svg { stroke: var(--gold); }
.card__icon--red { background: rgba(239, 68, 68, 0.1); }
.card__icon--red svg { stroke: var(--red); }


/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }


/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header__title {
    font-size: 1.5rem;
    font-weight: 700;
}
.page-header__desc {
    font-size: 0.9rem;
    color: var(--grey-light);
    margin-top: 4px;
}
.page-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}


/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}
.btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
.btn--primary {
    background: var(--blue);
    color: var(--white);
    box-shadow: var(--shadow-blue);
}
.btn--primary:hover {
    background: #5a9bf5;
    box-shadow: 0 8px 32px rgba(60, 133, 239, 0.45);
    transform: translateY(-1px);
    color: var(--white);
}
.btn--secondary {
    background: transparent;
    color: var(--white);
    border: 1.5px solid var(--dark-border-hover);
}
.btn--secondary:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(60, 133, 239, 0.05);
}
.btn--ghost {
    background: transparent;
    color: var(--grey-light);
    padding: 8px 16px;
}
.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}
.btn--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn--danger:hover {
    background: rgba(239, 68, 68, 0.25);
}
.btn--success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.btn--success:hover {
    background: rgba(34, 197, 94, 0.25);
}
.btn--sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}
.btn--lg {
    padding: 14px 32px;
    font-size: 1rem;
}
.btn--full {
    width: 100%;
}
.btn--icon-only {
    padding: 8px;
    border-radius: var(--radius-sm);
}
.btn-group {
    display: flex;
    gap: 8px;
}


/* ============================================
   FORMS
   ============================================ */
.form__group {
    margin-bottom: 20px;
}
.form__group.has-error .form__input,
.form__group.has-error .form__select {
    border-color: var(--red);
}
.form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--grey-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.form__input,
.form__select,
.form__textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(60, 133, 239, 0.1);
}
.form__input::placeholder,
.form__textarea::placeholder {
    color: var(--charcoal);
}
.form__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9ab0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}
.form__textarea {
    resize: vertical;
    min-height: 100px;
}
.form__help {
    font-size: 0.75rem;
    color: var(--charcoal);
    margin-top: 4px;
}
.form__hint {
    display: block;
    font-size: 0.75rem;
    color: var(--charcoal);
    margin-top: 4px;
}

/* --- Dark-mode native form controls (Issues #27, #33) --- */
/* Tell browsers to render native controls (date/time pickers, selects) in dark mode */
:root {
    color-scheme: dark;
}

/* Alias .form-select to match .form__select styling (used on analytics pages) */
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a9ab0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}
.form-select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(60, 133, 239, 0.1);
}

/* Style native <select> and <option> elements for dark theme */
select,
.form__select,
.form-select,
.form__input[list],
select.form__input {
    color-scheme: dark;
}
select option,
.form__select option,
.form-select option,
.form__input option,
datalist option {
    background: var(--dark-surface);
    color: var(--white);
}

/* Style time and date input pickers for dark theme */
input[type="time"],
input[type="date"],
input[type="datetime-local"] {
    color-scheme: dark;
}
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7) sepia(0.2) saturate(3) hue-rotate(180deg);
    cursor: pointer;
}

/* Light theme: native date/time pickers follow page color-scheme (Issues: quiet hours, schedule step) */
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="datetime-local"] {
    color-scheme: light;
}
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: none;
    cursor: pointer;
}

/* Ensure disabled/readonly inputs maintain dark styling */
.form__input:disabled,
.form__input[readonly],
.form__select:disabled,
.form-select:disabled {
    background: var(--dark);
    color: var(--charcoal);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Toggle Switch */
.toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.toggle__input {
    display: none;
}
.toggle__track {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    transition: all var(--transition);
}
.toggle__track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--charcoal);
    border-radius: 50%;
    transition: all var(--transition);
}
.toggle__input:checked + .toggle__track {
    background: var(--blue);
    border-color: var(--blue);
}
.toggle__input:checked + .toggle__track::after {
    transform: translateX(20px);
    background: var(--white);
}
.toggle__label {
    font-size: 0.875rem;
    color: var(--grey-light);
}

/* Range Slider */
.slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.slider__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.slider__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--grey-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.slider__value {
    font-size: 0.875rem;
    color: var(--blue);
    font-weight: 600;
}
.slider__input {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--dark-surface);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(60, 133, 239, 0.4);
    transition: transform var(--transition);
}
.slider__input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.slider__input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--blue);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(60, 133, 239, 0.4);
}


/* ============================================
   DATA TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--charcoal);
    border-bottom: 1px solid var(--dark-border);
    white-space: nowrap;
    background: var(--dark-surface);
    position: sticky;
    top: 0;
}
.data-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
}
.data-table th[data-sortable]:hover {
    color: var(--blue);
}
.data-table th.sort-asc::after {
    content: ' \2191';
    color: var(--blue);
}
.data-table th.sort-desc::after {
    content: ' \2193';
    color: var(--blue);
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(60, 133, 239, 0.06);
    color: var(--grey-light);
    vertical-align: middle;
}
.data-table tbody tr {
    transition: background var(--transition);
}
.data-table tbody tr:hover {
    background: rgba(60, 133, 239, 0.04);
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.table-search {
    position: relative;
    flex: 1;
    max-width: 360px;
}
.table-search__input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-pill);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: border-color var(--transition);
}
.table-search__input:focus {
    outline: none;
    border-color: var(--blue);
}
.table-search__input::placeholder {
    color: var(--charcoal);
}
.table-search__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--charcoal);
    pointer-events: none;
}
.table-search__icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
/* Shared search-field pattern (ElevenLabs voice toolbar): native clear + inline spinner */
.search-field__spinner,
.voice-library-toolbar__search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
}
.search-field__spinner[hidden],
.voice-library-toolbar__search-spinner[hidden] {
    display: none;
}
.search-field input[type="search"],
.table-search__input[type="search"],
.user-search__input-wrap input[type="search"],
.voice-library-toolbar__search-input {
    padding-right: 40px;
}
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    height: 14px;
    width: 14px;
    margin-right: 2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") center / contain no-repeat;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity var(--transition), transform var(--transition);
}
input[type="search"]::-webkit-search-cancel-button:hover {
    opacity: 1;
    transform: scale(1.08);
}
input[type="search"][aria-busy="true"]::-webkit-search-cancel-button {
    display: none;
}
[data-theme="light"] input[type="search"]::-webkit-search-cancel-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
}
.table-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 0.8rem;
    color: var(--charcoal);
}
.pagination__pages {
    display: flex;
    gap: 4px;
}
.pagination__btn {
    padding: 6px 12px;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--grey-light);
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}
.pagination__btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}
.pagination__btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}
.pagination__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}


/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge--blue {
    background: rgba(60, 133, 239, 0.12);
    color: var(--blue-light);
}
.badge--green {
    background: rgba(34, 197, 94, 0.12);
    color: var(--green);
}
.badge--red {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
}
.badge--yellow {
    background: rgba(234, 179, 8, 0.12);
    color: var(--yellow);
}
.badge--purple {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}
.badge--grey {
    background: rgba(154, 154, 176, 0.12);
    color: var(--grey-light);
}
.badge--teal {
    background: rgba(62, 206, 182, 0.12);
    color: var(--teal);
}
.badge--gold {
    background: rgba(191, 135, 61, 0.12);
    color: var(--gold);
}

/* Channel icon badges (small) */
.channel-badges {
    display: flex;
    gap: 4px;
}
.channel-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}
.channel-badge svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}
.channel-badge--email {
    background: rgba(60, 133, 239, 0.12);
    color: var(--blue);
}
.channel-badge--sms {
    background: rgba(62, 206, 182, 0.12);
    color: var(--teal);
}
.channel-badge--voice {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}
.channel-badge--video {
    background: rgba(191, 135, 61, 0.12);
    color: var(--gold);
}
.channel-badge--whatsapp {
    background: rgba(37, 211, 102, 0.15);
    color: #25d366;
}
.channel-badge--landing {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
}
.channel-badge--chat {
    background: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
}


/* ============================================
   STATUS INDICATORS
   ============================================ */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot--green {
    background: var(--green);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}
.status-dot--red {
    background: var(--red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}
.status-dot--yellow {
    background: var(--yellow);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.4);
}
.status-dot--blue {
    background: var(--blue);
    box-shadow: 0 0 8px rgba(60, 133, 239, 0.4);
}
.status-dot--grey {
    background: var(--charcoal);
}

/* Pulsing status */
.status-dot--pulse {
    animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}


/* ============================================
   PROGRESS BARS
   ============================================ */
.progress {
    height: 8px;
    background: var(--dark-surface);
    border-radius: 4px;
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.progress__bar--blue { background: var(--blue); }
.progress__bar--green { background: var(--green); }
.progress__bar--teal { background: var(--teal); }
.progress__bar--red { background: var(--red); }
.progress__bar--yellow { background: var(--yellow); }

.progress--lg { height: 12px; }
.progress--sm { height: 4px; }


/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--dark-border);
    margin-bottom: 24px;
    overflow-x: auto;
}
.tab {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--charcoal);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font-body);
}
.tab:hover {
    color: var(--grey-light);
}
.tab.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.tab.tab--contains-current::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--green);
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.tab.tab--contains-current:not(.active) {
    color: var(--grey-light);
}

.tab.active.tab--contains-current {
    color: var(--blue);
}

.voice-library-toolbar__submit .form__label {
    visibility: hidden;
}

.voice-library-toolbar__search-btn {
    height: 46px;
    padding: 0 20px;
    white-space: nowrap;
}

.voice-library-toolbar__search-wrap {
    position: relative;
}

.pagination--list {
    margin-bottom: 16px;
}

.pagination--list-bottom {
    margin-top: 16px;
    margin-bottom: 0;
}

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


/* ============================================
   WIZARD / STEPPER
   ============================================ */
.wizard__steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    padding: 24px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
}
.wizard__step {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    transition: all var(--transition);
}
.wizard__step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dark-surface);
    border: 2px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--charcoal);
    transition: all var(--transition);
    flex-shrink: 0;
}
.wizard__step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--charcoal);
    white-space: nowrap;
    transition: color var(--transition);
}
.wizard__step-connector {
    width: 40px;
    height: 2px;
    background: var(--dark-border);
    flex-shrink: 0;
    transition: background var(--transition);
}
.wizard__step.active .wizard__step-number {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}
.wizard__step.active .wizard__step-label {
    color: var(--white);
}
.wizard__step.completed .wizard__step-number {
    background: var(--teal);
    border-color: var(--teal);
    color: var(--white);
}
.wizard__step.completed .wizard__step-label {
    color: var(--grey-light);
}
.wizard__step.completed + .wizard__step-connector {
    background: var(--teal);
}

.wizard__panel {
    display: none;
}
.wizard__panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
.wizard__actions {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--dark-border);
}

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


/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal.active {
    display: flex;
}
.modal__overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.modal__content {
    position: relative;
    z-index: 1;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}
.modal__content--sm {
    max-width: 420px;
}
.modal__content--lg {
    max-width: 800px;
}
.modal__content--preview {
    max-width: 80vw;
    width: 80vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--grey-light);
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.modal__close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    pointer-events: none;
}
.modal__close svg path {
    pointer-events: none;
}
.modal__close:not(:has(svg)) {
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 300;
}
.modal__close:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
}
.modal__close:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}
.modal__content > .modal__title {
    padding-right: 52px;
}
.modal__title {
    font-size: 1.3rem;
    margin-bottom: 8px;
}
.modal__text {
    font-size: 0.9rem;
    color: var(--grey-light);
    margin-bottom: 24px;
    line-height: 1.7;
}
.modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}


/* ============================================
   CHART PLACEHOLDERS
   ============================================ */
.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: var(--dark-surface);
    border: 1px dashed var(--dark-border);
    border-radius: var(--radius);
    padding: 32px;
    color: var(--charcoal);
    text-align: center;
}
.chart-placeholder svg {
    width: 40px;
    height: 40px;
    stroke: var(--charcoal);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 12px;
    opacity: 0.5;
}
.chart-placeholder__label {
    font-size: 0.85rem;
    font-weight: 500;
}


/* ============================================
   FUNNEL VISUALIZATION
   ============================================ */
.funnel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 24px 0;
}
.funnel__stage {
    display: flex;
    align-items: center;
    gap: 16px;
}
.funnel__bar-wrapper {
    flex: 1;
    position: relative;
}
.funnel__bar {
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    transition: width 0.6s ease;
}
.funnel__bar--sent { background: var(--blue); }
.funnel__bar--delivered { background: rgba(60, 133, 239, 0.8); }
.funnel__bar--opened { background: var(--teal); }
.funnel__bar--clicked { background: rgba(62, 206, 182, 0.8); }
.funnel__bar--submitted { background: var(--gold); }
.funnel__bar--reported { background: var(--green); }
.funnel__label {
    width: 80px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--grey-light);
    text-align: right;
    flex-shrink: 0;
}
.funnel__count {
    width: 60px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    text-align: left;
    flex-shrink: 0;
}


/* ============================================
   DRAG & DROP (Report Builder)
   ============================================ */
.widget-palette {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.widget-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    cursor: grab;
    transition: all var(--transition);
    user-select: none;
}
.widget-item:hover {
    border-color: var(--blue);
    background: rgba(60, 133, 239, 0.05);
}
.widget-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}
.widget-item svg {
    width: 24px;
    height: 24px;
    stroke: var(--blue);
    fill: none;
    stroke-width: 1.8;
}
.widget-item__label {
    font-size: 0.75rem;
    color: var(--grey-light);
    font-weight: 500;
}

.report-canvas {
    min-height: 400px;
    background: var(--dark-surface);
    border: 2px dashed var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    align-content: start;
    transition: border-color var(--transition), background var(--transition);
}
.report-canvas.drag-over {
    border-color: var(--blue);
    background: rgba(60, 133, 239, 0.03);
}
.report-canvas__empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--charcoal);
}
.report-canvas__empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--charcoal);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 16px;
    opacity: 0.4;
}
.report-canvas__empty p {
    font-size: 0.9rem;
}

.report-widget {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}
.report-widget__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--dark-border);
    background: var(--dark-surface);
}
.report-widget__icon svg {
    width: 16px;
    height: 16px;
    stroke: var(--blue);
    fill: none;
    stroke-width: 2;
}
.report-widget__title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    flex: 1;
}
.report-widget__remove {
    background: none;
    border: none;
    color: var(--charcoal);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color var(--transition);
}
.report-widget__remove:hover { color: var(--red); }
.report-widget--dragging {
    opacity: 0.4;
    border: 1px dashed var(--blue);
}
.report-widget[draggable] {
    cursor: grab;
}
.report-widget[draggable]:active {
    cursor: grabbing;
}
.report-widget__body {
    padding: 24px;
}
.report-widget__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--charcoal);
    text-align: center;
    font-size: 0.8rem;
}
.report-widget__placeholder svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 8px;
    opacity: 0.4;
}


/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    background: var(--dark-surface);
    border: 2px dashed var(--dark-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--blue);
    background: rgba(60, 133, 239, 0.03);
}
.upload-area svg {
    width: 40px;
    height: 40px;
    stroke: var(--charcoal);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 16px;
}
.upload-area:hover svg,
.upload-area.drag-over svg {
    stroke: var(--blue);
}
.upload-area__label {
    font-size: 0.9rem;
    color: var(--grey-light);
    margin-bottom: 4px;
}
.upload-area__hint {
    font-size: 0.75rem;
    color: var(--charcoal);
}
.upload-area input[type="file"] {
    display: none;
}
.upload-area.upload-area--busy {
    pointer-events: none;
    opacity: 0.65;
}


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}
.toast.visible {
    transform: translateX(0);
    opacity: 1;
}
.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--red); }
.toast--warning { border-left: 3px solid var(--yellow); }
.toast--info { border-left: 3px solid var(--blue); }
.toast__icon {
    flex-shrink: 0;
    display: flex;
}
.toast--success .toast__icon { color: var(--green); }
.toast--error .toast__icon { color: var(--red); }
.toast--warning .toast__icon { color: var(--yellow); }
.toast--info .toast__icon { color: var(--blue); }
.toast__msg {
    font-size: 0.85rem;
    color: var(--white);
    flex: 1;
}
.toast__close {
    background: none;
    border: none;
    color: var(--charcoal);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color var(--transition);
}
.toast__close:hover { color: var(--white); }


/* ============================================
   SETUP CHECKLIST
   ============================================ */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.checklist__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    transition: all var(--transition);
}
.checklist__item:hover {
    border-color: var(--dark-border-hover);
}
.checklist__item--done {
    border-color: rgba(34, 197, 94, 0.2);
}
.checklist__check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all var(--transition);
}
.checklist__item--done .checklist__check {
    background: var(--green);
    border-color: var(--green);
    color: var(--white);
}
.checklist__check svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 3;
}
.checklist__content {
    flex: 1;
}
.checklist__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
}
.checklist__desc {
    font-size: 0.8rem;
    color: var(--grey-light);
}
.checklist__action {
    flex-shrink: 0;
}


/* ============================================
   INTEGRATION CARDS
   ============================================ */
.integration-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition);
}
.integration-card:hover {
    border-color: var(--dark-border-hover);
}
.integration-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.integration-card__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(60, 133, 239, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.integration-card__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
}
.integration-card__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    margin-top: 2px;
}
.integration-card__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.integration-card__form .form__input {
    padding: 10px 14px;
    font-size: 0.85rem;
}
.integration-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--dark-border);
}
.integration-card__timestamp {
    font-size: 0.7rem;
    color: var(--charcoal);
}


/* ============================================
   TEMPLATE CARDS
   ============================================ */
.template-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition);
    cursor: pointer;
}
.template-card:hover {
    border-color: var(--dark-border-hover);
    transform: translateY(-2px);
}
.template-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.template-card__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
}
.template-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--charcoal);
}
.template-card__lock {
    color: var(--charcoal);
}
.template-card__lock svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}


/* ============================================
   EXPANDABLE TABLE ROWS
   ============================================ */
.expandable-row {
    display: none;
}
.expandable-row.visible {
    display: table-row;
}
.expandable-row td {
    padding: 0 16px 16px;
    background: rgba(60, 133, 239, 0.02);
}
.expandable-row__content {
    padding: 16px;
    background: var(--dark-surface);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}
.expandable-row__content pre {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--grey-light);
    white-space: pre-wrap;
    word-break: break-all;
}

[data-expand-row] {
    cursor: pointer;
    user-select: none;
}
[data-expand-row]::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid var(--charcoal);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-right: 8px;
    transition: transform var(--transition);
}
[data-expand-row].expanded::before {
    transform: rotate(90deg);
}


/* ============================================
   PREVIEW CARDS
   ============================================ */
.preview-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.preview-card__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--dark-surface);
}
.preview-card__channel {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
}
.preview-card__body {
    padding: 24px;
    min-height: 200px;
}
.preview-card__body--email {
    background: #1a1a24;
}
.preview-card__body--sms {
    display: flex;
    justify-content: center;
    padding: 32px;
}
.preview-card__sms-bubble {
    background: var(--dark-surface);
    border-radius: 16px 16px 16px 4px;
    padding: 16px 20px;
    max-width: 280px;
    font-size: 0.9rem;
    line-height: 1.6;
}


/* ============================================
   KPI TILES (Campaign Live)
   ============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.kpi-tile {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.kpi-tile__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1;
    margin-bottom: 6px;
}
.kpi-tile__label {
    font-size: 0.75rem;
    color: var(--charcoal);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}


/* ============================================
   TIMELINE
   ============================================ */
.timeline {
    padding: 16px 0 16px 24px;
    border-left: 2px solid var(--dark-border);
}
.timeline__item {
    position: relative;
    padding-bottom: 16px;
    padding-left: 20px;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dark-surface);
    border: 2px solid var(--blue);
}
.timeline__item--success::before { border-color: var(--green); }
.timeline__item--warning::before { border-color: var(--yellow); }
.timeline__item--error::before { border-color: var(--red); }
.timeline__time {
    font-size: 0.7rem;
    color: var(--charcoal);
    margin-bottom: 2px;
}
.timeline__text {
    font-size: 0.8rem;
    color: var(--grey-light);
}


/* ============================================
   VOICE / VIDEO ASSET LIST
   ============================================ */
.asset-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.avatar-processing-info {
    background: rgba(60, 133, 239, 0.06);
    border-color: rgba(60, 133, 239, 0.22);
}
.avatar-processing-info__title {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
}
.avatar-processing-info__intro {
    margin: 0 0 16px;
    max-width: 720px;
    line-height: 1.55;
}
.avatar-processing-info__table-wrap {
    margin-bottom: 16px;
    max-width: 720px;
}
.avatar-processing-info__table {
    margin: 0;
}
.avatar-processing-info__footer {
    margin: 0;
    max-width: 720px;
    line-height: 1.55;
}

.asset-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    transition: all var(--transition);
}
.asset-item:hover {
    border-color: var(--dark-border-hover);
}
.asset-item__thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--dark-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.asset-item__thumb svg {
    width: 24px;
    height: 24px;
    stroke: var(--blue);
    fill: none;
    stroke-width: 1.5;
}
.asset-item__info {
    flex: 1;
}
.asset-item__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
}
.asset-item__meta {
    font-size: 0.75rem;
    color: var(--charcoal);
    margin-top: 2px;
}
.asset-item__actions {
    display: flex;
    gap: 8px;
}
.asset-item__play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(60, 133, 239, 0.12);
    border: none;
    color: var(--blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.asset-item__play:hover {
    background: var(--blue);
    color: var(--white);
}
.asset-item__play svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: currentColor;
    stroke-width: 0;
}
.asset-item__play.playing {
    background: var(--red);
    color: var(--white);
    animation: pulse-play 1.2s ease-in-out infinite;
}
.asset-item__play.playing svg polygon {
    /* Morph play triangle into a stop square via CSS points override */
    display: none;
}
.asset-item__play.playing svg::after {
    content: '';
}
.asset-item__play.playing::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    background: currentColor;
    border-radius: 2px;
}
.asset-item__play.playing svg {
    display: none;
}
.asset-item__play.loading {
    pointer-events: none;
    cursor: wait;
    opacity: 0.9;
}
.asset-item__play.loading svg {
    display: none;
}
.play-btn-spinner {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(60, 133, 239, 0.25);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}
.asset-item__play.loading .play-btn-spinner {
    border-color: rgba(255, 255, 255, 0.25);
    border-top-color: currentColor;
}
.btn--loading {
    pointer-events: none;
    cursor: wait;
    opacity: 0.85;
}
.btn-spinner--ghost {
    border-color: rgba(255, 255, 255, 0.15);
    border-top-color: var(--gold);
}
@keyframes pulse-play {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.long-task-panel {
    display: none;
    margin: 16px 0 20px;
    padding: 14px 16px;
    background: rgba(60, 133, 239, 0.08);
    border: 1px solid rgba(60, 133, 239, 0.25);
    border-radius: var(--radius);
}
.long-task-panel__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.long-task-panel__title {
    font-weight: 600;
    color: var(--white);
    flex: 1;
}
.long-task-panel__step {
    color: var(--blue-light);
    margin: 0 0 4px;
}
.long-task-panel__hint {
    margin: 6px 0 0;
    opacity: 0.85;
}
.long-task-panel--done {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.45;
}
.notice--info {
    background: rgba(60, 133, 239, 0.1);
    border: 1px solid rgba(60, 133, 239, 0.25);
    color: var(--blue-light);
}
.notice--info .btn-spinner {
    flex-shrink: 0;
    margin-top: 2px;
}
.notice__text strong {
    color: var(--white);
    font-weight: 600;
}

.preview-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-field-row__grow {
    flex: 1;
    min-width: 0;
}

.preview-field-row .form__select {
    flex: 1;
    min-width: 0;
}

.preview-field-row__play {
    flex-shrink: 0;
}

.preview-field-row--voice .voice-picker {
    width: 100%;
}

.voice-picker__search {
    max-width: none;
    margin-bottom: 0;
}

.voice-picker--combobox {
    position: relative;
}
.voice-picker__control {
    position: relative;
    display: flex;
    align-items: center;
}
.voice-picker__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--charcoal);
    pointer-events: none;
    z-index: 1;
}
.voice-picker__input {
    width: 100%;
    padding-left: 36px !important;
    padding-right: 36px !important;
}
.voice-picker__clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--charcoal);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.voice-picker__clear:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}
.voice-picker__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 120;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.voice-picker__group {
    padding: 8px 14px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--charcoal);
}
.voice-picker__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
}
.voice-picker__option:hover,
.voice-picker__option--highlight {
    background: rgba(60, 133, 239, 0.1);
}
.voice-picker__option--active {
    background: rgba(60, 133, 239, 0.16);
}
.voice-picker__option--default {
    color: var(--charcoal);
    font-style: italic;
}
.voice-picker__option-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
}
.voice-picker__option-meta {
    font-size: 0.72rem;
    color: var(--charcoal);
    white-space: nowrap;
}
.voice-picker__empty {
    padding: 14px;
    text-align: center;
    color: var(--charcoal);
    font-size: 0.85rem;
}
.voice-picker__native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.voice-picker__select {
    max-height: 220px;
}

.asset-item--processing .asset-item__meta {
    color: var(--blue-light);
}

.asset-item--current,
.card--current-voice {
    border-color: var(--green) !important;
    border-left: 4px solid var(--green) !important;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}

.asset-item--current .asset-item__thumb {
    box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.45);
}

.asset-item__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.asset-item__current-badge {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.68rem;
}

.asset-item__in-use {
    color: var(--green) !important;
    cursor: default;
    font-weight: 600;
    pointer-events: none;
}

.card--current-voice h4.text-white::after {
    content: 'Current voice';
    display: inline-block;
    margin-left: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}


/* ============================================
   EXPORT LIST
   ============================================ */
.export-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.export-item__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(60, 133, 239, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.export-item__icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--blue);
    fill: none;
    stroke-width: 1.8;
}
.export-item__info {
    flex: 1;
}
.export-item__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
}
.export-item__meta {
    font-size: 0.75rem;
    color: var(--charcoal);
}


/* ============================================
   MODE SELECTOR
   ============================================ */
.mode-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.mode-option {
    flex: 1;
    padding: 16px 20px;
    background: var(--dark-surface);
    border: 2px solid var(--dark-border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
}
.mode-option:hover {
    border-color: var(--dark-border-hover);
}
.mode-option.active {
    border-color: var(--blue);
    background: rgba(60, 133, 239, 0.05);
}
.mode-option input {
    display: none;
}
.mode-option__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    display: block;
    margin-bottom: 4px;
}
.mode-option__desc {
    font-size: 0.75rem;
    color: var(--charcoal);
}


/* ============================================
   QUIET HOURS CONFIG
   ============================================ */
.time-range {
    display: flex;
    align-items: center;
    gap: 12px;
}
.time-range__sep {
    color: var(--charcoal);
    font-size: 0.85rem;
    font-weight: 600;
}


/* ============================================
   SCORING PREVIEW
   ============================================ */
.score-preview {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 24px;
}
.score-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.score-preview__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
}
.score-preview__value {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
}
.score-preview__value--high { color: var(--red); }
.score-preview__value--medium { color: var(--yellow); }
.score-preview__value--low { color: var(--green); }
.score-preview__breakdown {
    font-size: 0.8rem;
    color: var(--grey-light);
}
.score-preview__breakdown li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(60, 133, 239, 0.06);
}


/* ============================================
   ATTACK CHAIN BUILDER
   ============================================ */
.chain__container {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 24px;
    min-height: 100px;
}

.chain__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--charcoal);
    text-align: center;
    padding: 40px;
}
.chain__empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--charcoal);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 16px;
    opacity: 0.4;
}
.chain__empty p {
    font-size: 0.9rem;
}

.chain__step-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color var(--transition);
    position: relative;
}
.chain__step-card:hover {
    border-color: var(--dark-border-hover);
}

.chain__step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.chain__step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.chain__step-channel {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    flex: 1;
}
.chain__step-delivery {
    font-size: 0.75rem;
    color: var(--grey-light);
    background: rgba(60, 133, 239, 0.08);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
}

.chain__step-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
.chain__step-actions button {
    background: none;
    border: 1px solid var(--dark-border);
    color: var(--grey-light);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    padding: 0;
}
.chain__step-actions button:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(60, 133, 239, 0.05);
}
.chain__step-actions button.chain__remove-btn:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(239, 68, 68, 0.05);
}
.chain__step-actions button svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.chain__step-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.chain__step-body .form__group {
    margin-bottom: 0;
}
.chain__step-body .form__group--full {
    grid-column: 1 / -1;
}

.chain__connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    position: relative;
}
.chain__connector-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--dark-border);
    transform: translateX(-50%);
}
.chain__connector-label {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--grey-light);
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.chain__connector-label--delay {
    color: var(--blue-light);
    border-color: rgba(60, 133, 239, 0.3);
}
.chain__connector-label--positive {
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
}
.chain__connector-label--negative {
    color: var(--yellow);
    border-color: rgba(234, 179, 8, 0.3);
}

.chain__trigger-config {
    grid-column: 1 / -1;
    background: rgba(60, 133, 239, 0.03);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.chain__trigger-config .form__group {
    margin-bottom: 0;
}
.chain__trigger-config .form__group--full {
    grid-column: 1 / -1;
}

/* Scoring Info Card (collapsible per-channel criteria) */
.scoring-info-card {
    grid-column: 1 / -1;
    border: 1px solid rgba(60, 133, 239, 0.15);
    border-radius: var(--radius-sm);
    background: rgba(60, 133, 239, 0.04);
    overflow: hidden;
}
.scoring-info-card__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}
.scoring-info-card__toggle:hover {
    color: #d1d5db;
}
.scoring-info-card__chevron {
    margin-left: auto;
    transition: transform 0.2s;
}
.scoring-info-card--open .scoring-info-card__chevron {
    transform: rotate(180deg);
}
.scoring-info-card__body {
    display: none;
    padding: 0 12px 10px;
    flex-direction: column;
    gap: 6px;
}
.scoring-info-card--open .scoring-info-card__body {
    display: flex;
}
.scoring-info-card__row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}
.scoring-info-card__badge {
    flex-shrink: 0;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.chain__delivery-select {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chain__delivery-select .form__label {
    margin-bottom: 0;
    white-space: nowrap;
}


/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }


/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-white { color: var(--white); }
.text-blue { color: var(--blue); }
.text-teal { color: var(--teal); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-grey { color: var(--grey-light); }
.text-charcoal { color: var(--charcoal); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .widget-palette { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .wizard__step-label { display: none; }
    .wizard__step-connector { width: 24px; }
}

@media (max-width: 768px) {
    /* Sidebar becomes off-canvas */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }
    .sidebar.collapsed.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
    .topbar__hamburger {
        display: flex;
    }
    .topbar__org {
        display: none;
    }
    .page-content {
        padding: 20px 16px;
    }
    .grid--2, .grid--3, .grid--4 {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .table-search {
        max-width: 100%;
    }
    .wizard__steps {
        padding: 16px;
    }
    .wizard__step {
        padding: 8px;
    }
    .funnel__label { width: 60px; font-size: 0.7rem; }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .widget-palette {
        grid-template-columns: repeat(2, 1fr);
    }
    .report-canvas {
        grid-template-columns: 1fr;
    }
    .mode-selector {
        flex-direction: column;
    }
    .form__row {
        grid-template-columns: 1fr;
    }
    .topbar__user-name { display: none; }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .btn-group {
        flex-direction: column;
    }
    .pagination {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================================
   AI PERSONA CONFIGURATION
   ============================================ */
.ai-persona-config {
    margin-top: 16px;
    padding: 16px;
    background: var(--dark);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
}

.ai-persona-config__header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-persona__objective-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-persona__objective-row .form__input {
    flex: 1;
}

.ai-persona__objective-row .btn {
    flex-shrink: 0;
    color: var(--red);
}


/* ============================================
   USER SEARCH (Campaign Builder Step 3)
   ============================================ */
.user-search {
    position: relative;
}
.user-search__input-wrap {
    position: relative;
}
.user-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--charcoal);
    pointer-events: none;
}
.user-search__input-wrap .form__input {
    padding-left: 36px;
    padding-right: 40px;
}
.user-search__results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.user-search__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--dark-border);
}
.user-search__item:last-child {
    border-bottom: none;
}
.user-search__item:hover:not(.user-search__item--selected) {
    background: rgba(60, 133, 239, 0.08);
}
.user-search__item--selected {
    opacity: 0.5;
    cursor: default;
}
.user-search__item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.user-search__item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
}
.user-search__item-meta {
    font-size: 0.75rem;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-search__empty {
    padding: 16px;
    text-align: center;
    color: var(--charcoal);
    font-size: 0.85rem;
}


/* ============================================
   CUSTOM RECIPIENT (Campaign Builder Step 3)
   ============================================ */
.custom-recipient-section {
    border-top: 1px solid var(--dark-border);
    padding-top: 16px;
}
.custom-recipient-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    justify-content: center;
}
.custom-recipient-toggle:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(60, 133, 239, 0.05);
}
.custom-recipient-toggle svg {
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}
.custom-recipient-toggle__chevron {
    margin-left: auto;
    transition: transform var(--transition);
}
.custom-recipient-toggle.active .custom-recipient-toggle__chevron {
    transform: rotate(180deg);
}
.custom-recipient-form {
    margin-top: 12px;
    padding: 16px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    animation: fadeIn 0.2s ease;
}
.custom-recipient-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.recipient-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(60, 133, 239, 0.06);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    animation: fadeIn 0.2s ease;
}
.recipient-chip__info {
    flex: 1;
    min-width: 0;
}
.recipient-chip__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
}
.recipient-chip__detail {
    font-size: 0.7rem;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recipient-chip__remove {
    background: none;
    border: none;
    color: var(--charcoal);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.recipient-chip__remove:hover {
    color: var(--red);
    background: rgba(239, 68, 68, 0.1);
}
.recipient-chip__remove svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}


/* --- Transcript Modal Overlay --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    animation: fadeIn 0.2s ease-out;
}
.modal-overlay .modal {
    display: flex;
    position: relative;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    animation: modalIn 0.25s ease-out;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    width: 100%;
}
.modal-overlay .modal__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 20px 64px 20px 24px;
    border-bottom: 1px solid var(--dark-border);
    flex-shrink: 0;
}
.modal-overlay .modal__header .modal__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.modal-overlay .modal__body {
    padding: 20px 24px;
}
.modal-overlay .modal__close {
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
}
.modal-overlay .modal__close:hover {
    transform: translateY(-50%);
}
.modal-overlay .modal__footer,
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--dark-border);
}

/* --- Card body, Empty state --- */
.card__body { padding: 20px 24px; }
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--charcoal);
}
.grid .empty-state--grid-full {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: min(420px, calc(100vh - 280px));
    width: 100%;
    padding: 48px 16px;
}
.page-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.empty-row td {
    text-align: center;
    padding: 24px 16px;
    color: var(--charcoal);
    font-style: italic;
}

/* --- Transcript Chat Bubbles --- */
.transcript-chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.transcript-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
}

.transcript-msg--assistant {
    align-self: flex-start;
    background: rgba(60, 133, 239, 0.15);
    border: 1px solid rgba(60, 133, 239, 0.25);
    color: var(--blue-light);
    border-bottom-left-radius: 4px;
}

.transcript-msg--human {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.transcript-msg__role {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    opacity: 0.6;
}

.transcript-msg__time {
    font-size: 0.7rem;
    color: var(--charcoal);
    margin-top: 4px;
}

.transcript-msg--highlight {
    border-color: var(--yellow) !important;
    background: rgba(234, 179, 8, 0.08) !important;
}

/* Outcome badges */
.outcome-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.outcome-badge--pass {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.outcome-badge--soft_fail {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.outcome-badge--fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.outcome-badge--pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--charcoal);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Transcript view button */
.btn--transcript {
    padding: 4px 10px;
    font-size: 0.7rem;
    border-radius: 6px;
    background: rgba(60, 133, 239, 0.1);
    border: 1px solid rgba(60, 133, 239, 0.2);
    color: var(--blue);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn--transcript:hover {
    background: rgba(60, 133, 239, 0.2);
    border-color: rgba(60, 133, 239, 0.4);
}

/* ── Quick Testing Dashboard ──────────────────────────────────── */
.test-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 900px) {
    .test-grid {
        grid-template-columns: 1fr;
    }
}

.test-checklist {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.test-checklist__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.test-checklist__icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.test-checklist__icon--pending {
    color: rgba(255, 255, 255, 0.3);
}

.test-checklist__icon--polling {
    color: #3C85EF;
    animation: pulse-check 1.5s ease-in-out infinite;
}

.test-checklist__icon--pass {
    color: #22c55e;
    font-weight: 700;
}

.test-checklist__icon--fail {
    color: #ef4444;
    font-weight: 700;
}

.test-checklist__icon--timeout {
    color: rgba(255, 255, 255, 0.4);
}

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

.test-landing-url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.test-landing-url__label {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.4);
}

.test-landing-url__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 280px;
    color: #3C85EF;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    text-decoration: none;
}

.test-landing-url__value:hover {
    text-decoration: underline;
    color: #60a5fa;
}

.test-history-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.test-history-toolbar__search {
    flex: 1 1 220px;
    min-width: 180px;
}

.test-history-toolbar__search .form__input {
    width: 100%;
}

.test-history-toolbar__channel {
    flex: 0 0 160px;
    max-width: 100%;
}

.test-history-pagination {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--dark-border);
}

.test-history-pagination .pagination__summary {
    font-size: 0.8rem;
}

/* Hidden channels — no-JS fallback via html[data-hidden-channels]; primary source is /api/config */
html[data-hidden-channels~="whatsapp"] [data-channel="whatsapp"],
html[data-hidden-channels~="whatsapp"] [data-channel-ui="whatsapp"],
html[data-hidden-channels~="whatsapp"] #card-whatsapp,
html[data-hidden-channels~="whatsapp"] [data-tab="whatsapp-tab"],
html[data-hidden-channels~="whatsapp"] [data-tab-panel="whatsapp-tab"] {
    display: none !important;
}

.integration-card--highlight {
    box-shadow: 0 0 0 2px #3C85EF, 0 0 20px rgba(60, 133, 239, 0.3);
    transition: box-shadow 0.3s ease;
}

/* Video Quick Test — progress panel shown after Launch Test */
.test-progress {
    margin: 0 1rem 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(60, 133, 239, 0.12), rgba(60, 133, 239, 0.04));
    border: 1px solid rgba(60, 133, 239, 0.25);
}

.test-progress--success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04));
    border-color: rgba(34, 197, 94, 0.35);
}

.test-progress--failed {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.04));
    border-color: rgba(239, 68, 68, 0.35);
}

.test-progress__header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.test-progress__spinner {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid rgba(60, 133, 239, 0.25);
    border-top-color: #3C85EF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.test-progress--success .test-progress__spinner,
.test-progress--failed .test-progress__spinner {
    display: none;
}

.test-progress__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

.test-progress__subtitle {
    font-size: 0.8rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.65);
}

.test-progress__bar {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.test-progress__bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3C85EF, #60a5fa);
    transition: width 0.6s ease;
}

.test-progress--success .test-progress__bar-fill {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.test-progress--failed .test-progress__bar-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.test-progress__meta {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'JetBrains Mono', monospace;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

.channel-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: capitalize;
}

.channel-badge--email { background: rgba(60, 133, 239, 0.15); color: #3C85EF; }
.channel-badge--sms { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.channel-badge--voice { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.channel-badge--video { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.channel-badge--whatsapp { background: rgba(37, 211, 102, 0.15); color: #25d366; }
.channel-badge--chat { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; }

.text-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.text-green { color: #22c55e; }
.text-yellow { color: #eab308; }

.btn--xs {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   ANALYTICS PAGES
   ============================================ */

.analytics-page { padding: 0; }

/* KPI Row */
.analytics-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.analytics-kpi-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
}

.analytics-kpi-card--sm {
    padding: 12px 16px;
}

.analytics-kpi-card__label {
    font-size: 0.75rem;
    color: var(--grey-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.analytics-kpi-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--white);
}

.analytics-kpi-card--sm .analytics-kpi-card__value {
    font-size: 1.25rem;
}

/* Two-column layout */
.analytics-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .analytics-two-col { grid-template-columns: 1fr; }
}

/* Cards */
.analytics-card {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.analytics-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.analytics-card__link {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--blue);
}

/* Risk Gauge */
.risk-gauge {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
}

.risk-gauge__svg {
    width: 200px;
    height: 120px;
}

.risk-gauge__arc {
    transition: stroke-dasharray 0.6s ease;
}

/* Department Cards Grid */
.dept-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.dept-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: border-color var(--transition), transform var(--transition);
}

.dept-card:hover {
    border-color: var(--dark-border-hover);
    transform: translateY(-2px);
}

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

.dept-card__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
}

.dept-card__score {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.dept-card__meta {
    font-size: 0.75rem;
    color: var(--grey-light);
    margin-bottom: 12px;
}

.dept-card__bar {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}

.dept-card__bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-container--sm {
    height: 220px;
}

/* Trend arrows */
.trend-arrow { font-size: 0.85rem; }
.trend-arrow--up { color: var(--green); }
.trend-arrow--down { color: var(--red); }
.trend-arrow--stable { color: var(--grey-light); }

/* Risk badges */
.risk-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-badge--low { background: rgba(34,197,94,0.15); color: var(--green); }
.risk-badge--medium { background: rgba(234,179,8,0.15); color: var(--yellow); }
.risk-badge--high { background: rgba(249,115,22,0.15); color: var(--orange); }
.risk-badge--critical { background: rgba(239,68,68,0.15); color: var(--red); }

/* Outcome badges */
.outcome-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.outcome-badge--pass { background: rgba(34,197,94,0.15); color: var(--green); }
.outcome-badge--soft-fail { background: rgba(234,179,8,0.15); color: var(--yellow); }
.outcome-badge--fail { background: rgba(239,68,68,0.15); color: var(--red); }

/* Department Header */
.analytics-dept-header {
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.analytics-dept-header__name {
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 8px;
}

.analytics-dept-header__stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.analytics-stat {
    font-size: 0.85rem;
    color: var(--grey-light);
}

/* User Info Card */
.analytics-user-info__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.analytics-user-info__avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
}

.analytics-user-info__name {
    font-size: 1.25rem;
    color: var(--white);
    margin-bottom: 4px;
}

.analytics-user-info__meta {
    font-size: 0.85rem;
    color: var(--grey-light);
    display: flex;
    gap: 8px;
}

/* Definition list */
.analytics-dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 16px;
}

.analytics-dl dt {
    font-size: 0.8rem;
    color: var(--grey-light);
    font-weight: 500;
}

.analytics-dl dd {
    font-size: 0.85rem;
    color: var(--white);
}

/* Risk Stats */
.analytics-risk-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 16px;
    font-size: 0.85rem;
}

.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }

/* Filter Bar */
.analytics-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    padding: 16px 24px;
    margin-bottom: 24px;
}

.analytics-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.analytics-filter-label {
    font-size: 0.75rem;
    color: var(--grey-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Pagination */
.pagination__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination__btn {
    padding: 6px 12px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.pagination__btn:hover {
    border-color: var(--blue);
    color: var(--white);
}

.pagination__current {
    padding: 6px 12px;
    background: var(--blue);
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
}

.pagination__dots {
    color: var(--grey-light);
    font-size: 0.8rem;
}

/* Compact data tables */
.data-table--compact { font-size: 0.8rem; }
.data-table--compact td, .data-table--compact th { padding: 8px 12px; }

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

/* Breadcrumb separator */
.topbar__breadcrumb-sep {
    margin: 0 6px;
    color: var(--grey-light);
    opacity: 0.5;
}

/* ───────────────────────── Platform Admin (standalone) ───────────────────────── */
.platform {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg, #0d0d14);
}
.platform__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--dark-border);
    background: var(--dark-surface);
    position: sticky;
    top: 0;
    z-index: 100;
}
.platform__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.platform__logo { height: 28px; width: auto; }
.platform__brand-label {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--teal);
    border-left: 1px solid var(--dark-border);
    padding-left: 12px;
}
.platform__topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.platform__user {
    color: var(--grey-light);
    font-size: 0.85rem;
}
.platform__theme-toggle {
    background: none;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    color: var(--grey-light);
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
}
.platform__theme-toggle svg { width: 18px; height: 18px; }
.platform__content {
    flex: 1;
    padding: 28px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Shared form grid (was inline before) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
}

.platform-rule { border: none; border-top: 1px solid var(--dark-border); margin: 20px 0; }
.platform-subhead { font-size: 0.95rem; color: var(--grey-light); margin-bottom: 6px; }

/* Wide modal that scrolls its body */
.modal-overlay .modal--wide {
    flex-direction: column;
    max-width: 860px;
    max-height: 90vh;
}
.modal-overlay .modal--wide .modal__body {
    overflow-y: auto;
}

/* Tabs inside the tenant modal */
.platform-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--dark-border);
    margin-bottom: 20px;
}
.platform-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--grey-light);
    cursor: pointer;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
}
.platform-tab:hover { color: var(--white); }
.platform-tab--active { color: var(--teal); border-bottom-color: var(--teal); }
.platform-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.platform-tab-panel { display: none; }
.platform-tab-panel--active { display: block; }

/* Top-level platform sections (Tenants / Platform Settings) */
.platform-section { display: none; }
.platform-section--active { display: block; }

.platform-services-note {
    text-align: center;
    padding: 32px 16px;
    color: var(--grey-light);
}

/* Per-service config cards */
.svc-card {
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.015);
}
.svc-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.svc-card__title { font-size: 0.95rem; margin: 0; }
.svc-card__status { white-space: nowrap; }
.svc-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* Action button cluster in tables */
.data-table__actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.campaign-recipients-col {
    text-align: center;
    width: 1%;
    white-space: nowrap;
}

#campaigns-table .campaign-status-badge {
    justify-content: center;
    width: 6rem;
    box-sizing: border-box;
}

#campaigns-table tbody tr.campaign-row-clickable {
    cursor: pointer;
}
#campaigns-table tbody tr.campaign-row-clickable:hover {
    background: rgba(255, 255, 255, 0.03);
}

.campaign-actions-heading {
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--charcoal);
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 8px;
}

.campaign-actions-group {
    width: 1%;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
    padding: 8px 10px;
    overflow: visible;
}

.campaign-actions-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.campaign-actions-row .btn,
.campaign-actions-row .campaign-action-btn {
    min-width: 0;
    width: 30px;
    height: 30px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}
.campaign-action-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%) translateY(4px);
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(15, 18, 28, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--white);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 30;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.campaign-action-btn::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 18, 28, 0.96);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 30;
}
.campaign-action-btn:hover::after,
.campaign-action-btn:focus-visible::after,
.campaign-action-btn:hover::before,
.campaign-action-btn:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
#campaigns-table .campaign-actions-group {
    overflow: visible;
}
.card--flush > .table-wrapper:has(#campaigns-table) {
    overflow-x: auto;
    overflow-y: visible;
}
.campaign-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.campaign-action-btn svg.campaign-action-icon-fill {
    fill: currentColor;
    stroke: none;
}
.campaign-action-btn--green {
    color: var(--green);
}
.campaign-action-btn--red {
    color: var(--red);
}
.campaign-actions-col__empty {
    color: var(--charcoal);
    opacity: 0.35;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}
