/* ==========================================================================
   Assurify Admin — Enterprise Design System (Light Theme Only)
   ========================================================================== */

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg-base:        #f1f5f9;
    --bg-surface:     #ffffff;
    --bg-elevated:    #f8fafc;
    --bg-card:        #ffffff;
    --bg-input:       #ffffff;
    --bg-sidebar:     #ffffff;
    --bg-navbar:      #ffffff;
    --bg-table:       #ffffff;
    --bg-modal:       #ffffff;

    /* Text hierarchy — high-contrast enterprise readability */
    --text-primary:   #0f172a;
    --text-secondary: #1e293b;
    --text-muted:     #334155;
    --text-disabled:  #94a3b8;
    --text-heading:   #0f172a;
    --text-body:      #0f172a;
    --text-label:     #1e293b;
    --text-caption:   #334155;

    /* Borders — visible on white surfaces */
    --border-subtle:  #d1d5db;
    --border-medium:  #9ca3af;
    --border:         #d1d5db;
    --border-input:   #9ca3af;

    /* Brand accents */
    --accent-purple:  #6366f1;
    --accent-primary: #6366f1;
    --accent-teal:    #10b981;
    --accent-blue:    #2563eb;
    --accent-green:   #059669;
    --accent-amber:   #d97706;
    --accent-red:     #dc2626;
    --accent-purple-light: rgba(99, 102, 241, 0.08);
    --primary:        #6366f1;
    --primary-hover:  #4f46e5;
    --primary-light:  rgba(99, 102, 241, 0.1);

    /* Layout */
    --sidebar-w:      260px;
    --sidebar-mini-w: 68px;
    --header-h:       64px;

    /* Spacing scale */
    --space-xs:       4px;
    --space-sm:       8px;
    --space-md:       16px;
    --space-lg:       24px;
    --space-xl:       32px;
    --space-2xl:      40px;

    /* Card padding (see layout-system.css for usage) */
    --card-padding-sm: 16px;
    --card-padding-md: 20px;
    --card-padding-lg: 24px;

    /* Border radius */
    --radius-sm:      6px;
    --radius-md:      8px;
    --radius-lg:      12px;
    --radius-xl:      16px;

    /* Shadows */
    --shadow-sm:      0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-md:      0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg:      0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

    /* Typography */
    --font-xs:        11px;
    --font-sm:        13px;
    --font-base:      14px;
    --font-lg:        16px;
    --font-xl:        20px;
    --font-2xl:       24px;

    /* Icons & buttons */
    --icon-sm:        14px;
    --icon-md:        16px;
    --icon-lg:        20px;
    --btn-h:          38px;
    --btn-h-sm:       32px;

    --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --focus-ring:     0 0 0 3px rgba(99, 102, 241, 0.25);
    --glass-border:   var(--border-subtle);
}

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

html { scroll-behavior: smooth; color-scheme: light; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: grid;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px 0 28px;
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
    height: var(--header-h);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


.brand-icon i { color: #fff; font-size: 16px; }

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.org-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 4px 10px;
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    background: var(--bg-elevated);
    white-space: nowrap;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
}

.topbar-breadcrumb .bc-current {
    color: var(--text-primary);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.topbar-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 180px;
}

.topbar-search-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.topbar-search-btn i { color: var(--text-secondary); }

.search-shortcut-hint {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 2px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    margin-left: auto;
    background: var(--bg-surface);
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 17px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.topbar-icon-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 4px;
}

/* Quick actions dropdown */
.quick-actions-wrap { position: relative; }

.quick-actions-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
    z-index: 200;
}

.quick-actions-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.quick-action-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.quick-action-item i {
    width: 18px;
    text-align: center;
    color: var(--accent-primary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 40px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s;
}

.user-chip:hover { background: var(--bg-elevated); }

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-primary);
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; gap: 1px; }
.user-name { font-size: 12px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.user-role { font-size: 10px; color: var(--text-secondary); font-weight: 600; line-height: 1; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 16px 12px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

.sidebar-mini-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 4px 8px;
}

.sidebar-mini-toggle button {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-medium);
    background: var(--bg-elevated);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.sidebar-mini-toggle button:hover {
    background: var(--accent-purple-light);
    color: var(--text-primary);
}

.sidebar-search { padding: 0 4px 10px; flex-shrink: 0; }

.sidebar-search-wrap { position: relative; }

.sidebar-search-wrap i {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.sidebar-search-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    padding: 7px 10px 7px 30px;
    outline: none;
    transition: border-color 0.15s;
}

.sidebar-search-input::placeholder { color: var(--text-muted); }
.sidebar-search-input:focus { border-color: var(--accent-primary); box-shadow: var(--focus-ring); }

.sidebar-section-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 8px 4px;
}

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

.nav-group-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 8px;
    margin-bottom: 4px;
}

.nav-group-collapsible { margin-bottom: 4px; }

.nav-group-header {
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    display: flex;
    align-items: center;
}

.nav-group-header:hover { background: var(--bg-elevated); }

.nav-group-label-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.nav-group-toggle {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-group-toggle.rotated { transform: rotate(90deg); }

.nav-group-content {
    display: flex;
    flex-direction: column;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.nav-group-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    margin: 1px 0;
}

.nav-item i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color 0.15s;
}

.nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.nav-item:hover i { color: var(--text-primary); }

.nav-item.active,
.nav-item[aria-current="page"] {
    background: var(--accent-purple-light);
    color: var(--accent-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 0 var(--accent-primary);
    border-radius: var(--radius-sm);
}

.nav-item.active i { color: var(--accent-primary); }

.nav-item.sub-item {
    padding-left: 28px;
    font-size: 12px;
}

.nav-item-hidden { display: none !important; }

.nav-item .nav-fav-btn {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.nav-item:hover .nav-fav-btn,
.nav-item .nav-fav-btn.is-fav { opacity: 1; }

.nav-item .nav-fav-btn.is-fav { color: #f59e0b; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-nav-list { padding: 0 4px 8px; }

.recent-nav-item {
    display: block;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, color 0.15s;
}

.recent-nav-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Sidebar mini mode */
body.sidebar-mini { grid-template-columns: var(--sidebar-mini-w) 1fr; }

body.sidebar-mini .sidebar {
    width: var(--sidebar-mini-w);
    padding: 12px 8px;
}

body.sidebar-mini .sidebar .nav-group-label,
body.sidebar-mini .sidebar .nav-item span,
body.sidebar-mini .sidebar .nav-item .nav-item-label,
body.sidebar-mini .sidebar .sidebar-search,
body.sidebar-mini .sidebar .sidebar-section-label,
body.sidebar-mini .sidebar .recent-nav-list,
body.sidebar-mini .sidebar .nav-group-toggle,
body.sidebar-mini .sidebar .nav-fav-btn {
    display: none;
}

body.sidebar-mini .sidebar .nav-item {
    justify-content: center;
    padding: 9px;
}

body.sidebar-mini .sidebar .nav-item i {
    width: auto;
    font-size: 16px;
}

/* ── Main Content ──────────────────────────────────────────────────────── */
.main-content {
    background: var(--bg-base);
    padding: 24px 32px 40px;
    min-height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

/* ── Breadcrumbs ───────────────────────────────────────────────────────── */
.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.page-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.page-breadcrumb a:hover { color: var(--text-primary); }
.page-breadcrumb .bc-sep { font-size: 10px; color: var(--text-disabled); }
.page-breadcrumb .bc-current { color: var(--text-primary); font-weight: 700; }

/* ── Page Header ───────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left {
    flex: 1;
    min-width: 0;
}

.page-header-left h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-header-left p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-action,
.btn-primary,
.btn-primary-action,
.btn-secondary,
.btn-secondary-action,
.btn-matrix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.2;
}

.btn-primary,
.btn-primary-action,
.btn-matrix {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-primary-action:hover,
.btn-matrix:hover,
.btn-action.btn-primary-action:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary,
.btn-secondary-action,
.btn-action.btn-secondary-action {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 700;
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover,
.btn-secondary-action:hover {
    background: var(--bg-elevated);
    border-color: var(--text-primary);
}

.btn-danger, .btn-danger-action {
    background: #dc2626;
    color: #fff;
    border: 1px solid #dc2626;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 13px;
}

.btn-success, .btn-success-action {
    background: #10b981;
    color: #fff;
    border: 1px solid #10b981;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: 13px;
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.kpi-grid,
.top-stats,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card,
.stat-box,
.stat-card,
.stat-item,
.stat-pill,
.glass-card,
.metric-card,
.module-section,
.panel,
.pm-card,
.pp-section,
.table-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.kpi-card,
.stat-box,
.stat-card {
    padding: var(--card-padding-md) var(--card-padding-lg);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.kpi-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    overflow: hidden;
}

.kpi-card:hover,
.stat-box:hover,
.stat-card:hover,
.stat-pill:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon,
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.kpi-label,
.stat-box .title,
.stat-label,
.stat-lbl,
.stat-pill .sl,
.metric-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 8px;
}

.kpi-value,
.stat-box .amount,
.stat-val,
.stat-pill .sv,
.metric-value {
    font-size: clamp(1.125rem, 2.5vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.15;
    color: var(--text-primary);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
}

.kpi-trend,
.stat-box .trend {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
}

.kpi-trend.up, .stat-box .trend:not(.down) { background: rgba(16,185,129,0.12); color: #059669; }
.kpi-trend.down, .stat-box .trend.down { background: rgba(239,68,68,0.12); color: #dc2626; }

.module-section {
    padding: var(--card-padding-lg);
    margin-bottom: var(--space-lg);
    overflow: hidden;
    min-width: 0;
}

.module-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.module-section-header h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Hero banners (legacy + new) ─────────────────────────────────────────── */
.pm-hero,
.pp-hero,
.dash-header,
.module-hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.05));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.pm-hero-icon,
.pp-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.pm-hero h1,
.pp-hero h1,
.dash-header h1 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 3px;
    color: var(--text-primary);
}

.pm-hero p,
.pp-hero p,
.dash-header p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

.pm-hero-actions,
.pp-hero-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap,
.table-responsive,
.pricing-table-wrap,
.tbl-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table,
.model-table,
.pricing-summary-table,
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
}

thead th,
.model-table th,
.pricing-summary-table th,
.table th,
.data-table th,
.v-table th,
.mini-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f3f4f6;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-medium);
    text-align: left;
    white-space: nowrap;
}

tbody td,
.model-table td,
.pricing-summary-table td,
.table td,
.data-table td,
.v-table td,
.mini-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    vertical-align: middle;
    background: transparent;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 280px;
}

tbody tr:hover td,
.model-table tr:hover td,
.pricing-summary-table tr:hover td {
    background: var(--bg-elevated);
}

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

.table-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.table-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.table-search input,
.search-bar {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 9px 14px 9px 36px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.table-search input:focus,
.search-bar:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.f-chip,
.filter-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    background: var(--bg-surface);
    font-family: inherit;
    transition: var(--transition);
}

.f-chip.active,
.f-chip:hover,
.filter-chip.active,
.filter-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: var(--accent-purple-light);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-section { margin-bottom: 24px; }

.form-section-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

label,
.form-label,
.label,
.field-label {
    display: block;
    color: var(--text-label);
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

input::placeholder,
textarea::placeholder,
select::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: var(--focus-ring);
}

.form-text,
.help-block,
.helper-text {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.form-error,
.errorlist {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    list-style: none;
}

.pm-card-head,
.panel-header,
.pp-section-head {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pm-card-head h3,
.panel-title,
.pp-section-title {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.pm-card-body,
.panel-body { padding: 20px; }

/* ── Status & Plan Badges ──────────────────────────────────────────────── */
.status-badge,
.badge,
.plan-badge,
.s-badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid transparent;
    letter-spacing: 0.03em;
    line-height: 1.3;
}

/* Extended Warranty — rich green */
.status-badge.active,
.badge-ew,
.source-badge-slab,
.st-active,
.s-active {
    background: rgba(5, 150, 105, 0.14);
    color: #047857;
    border-color: rgba(5, 150, 105, 0.35);
}

/* Combo / Pending — rich amber */
.status-badge.pending,
.badge-ew_adld,
.st-low,
.s-pending {
    background: rgba(217, 119, 6, 0.14);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.35);
}

/* ADLD / Rejected — rich red */
.status-badge.rejected,
.badge-adld,
.st-out,
.s-cancel {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.35);
}

/* Inactive / Draft / Off */
.status-badge.inactive,
.st-off,
.s-draft,
.s-expired {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

/* Info / Custom / Approved */
.status-badge.info,
.source-badge-custom,
.badge-cat,
.s-claimed {
    background: rgba(37, 99, 235, 0.12);
    color: #1e40af;
    border-color: rgba(37, 99, 235, 0.35);
}

/* Theft protection — rich purple */
.badge-theft {
    background: rgba(79, 70, 229, 0.12);
    color: #3730a3;
    border-color: rgba(79, 70, 229, 0.35);
}

.badge-v { background: rgba(5, 150, 105, 0.14); color: #047857; border-color: rgba(5, 150, 105, 0.35); }
.badge-warn { background: rgba(217, 119, 6, 0.14); color: #92400e; border-color: rgba(217, 119, 6, 0.35); }
.badge-none { background: #f1f5f9; color: var(--text-secondary); border-color: var(--border-medium); }

/* Finance / order status pills */
.status-pending { background: rgba(217, 119, 6, 0.14); color: #92400e; border: 1px solid rgba(217, 119, 6, 0.35); font-weight: 800; }
.status-approved { background: rgba(5, 150, 105, 0.14); color: #047857; border: 1px solid rgba(5, 150, 105, 0.35); font-weight: 800; }
.status-rejected { background: rgba(220, 38, 38, 0.12); color: #991b1b; border: 1px solid rgba(220, 38, 38, 0.35); font-weight: 800; }

/* ── Empty & Loading States ──────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
    color: var(--text-disabled);
}

.empty-state h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p { font-size: 13px; margin-bottom: 16px; color: var(--text-secondary); font-weight: 500; }

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-muted);
    gap: 12px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success, .px-toast.success { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); color: #065f46; }
.alert-error, .px-toast.error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #991b1b; }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #92400e; }
.alert-info { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #1e40af; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--bg-elevated);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.pagination .current,
.pagination .active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

/* ── Dashboard layout ────────────────────────────────────────────────────── */
.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header a {
    font-size: 12px;
    color: var(--accent-primary);
    font-weight: 600;
}

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

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child { border-bottom: none; }

.act-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.act-title { font-size: 14px; font-weight: 600; }
.act-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.act-time { font-size: 11px; color: var(--text-muted); text-align: right; flex-shrink: 0; }

.quick-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.quick-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.q-link {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.q-link:hover {
    border-color: var(--accent-primary);
    background: var(--accent-purple-light);
    transform: translateY(-1px);
}

.q-link i { font-size: 18px; color: var(--accent-primary); }

.coverage-card {
    background: rgba(16,185,129,0.05);
    border: 1px solid rgba(16,185,129,0.15);
    border-radius: var(--radius-md);
    padding: 20px;
}

.coverage-title {
    font-size: 12px;
    font-weight: 700;
    color: #059669;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.coverage-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.coverage-fill {
    height: 100%;
    background: #10b981;
    border-radius: 4px;
}

.coverage-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Feature cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.feature-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    padding: 24px;
    transition: var(--transition);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent-primary));
    opacity: 0.8;
}

.fc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
    background: var(--bg-elevated);
}

.fc-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.fc-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.soon-tag {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* Stat strip / attention cards */
.stat-strip { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }

.stat-pill {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex: 1;
    min-width: 120px;
}

.warn-pill { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.06); }
.warn-pill .sv { color: #d97706; }

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

.att-card {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.att-card-val { font-size: 22px; font-weight: 800; }
.att-card-lbl { font-size: 11px; color: var(--text-muted); }

.stat-mini-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.stat-mini-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.stat-mini-value { font-size: 18px; font-weight: 700; }

/* Grid layouts */
.pm-grid { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }

/* Modals */
.help-overlay,
.search-overlay,
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s, visibility 0.18s;
    padding: 20px;
}

.search-overlay { align-items: flex-start; padding-top: 10vh; }

.help-overlay.active,
.search-overlay.active,
.modal-overlay.active { opacity: 1; visibility: visible; }

.help-modal,
.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    box-shadow: var(--shadow-lg);
    transform: translateY(8px);
    transition: transform 0.2s;
}

.help-overlay.active .help-modal,
.modal-overlay.active .modal { transform: translateY(0); }

.search-modal {
    width: min(760px, 100%);
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(10px);
    transition: transform 0.2s;
}

.search-overlay.active .search-modal { transform: translateY(0); }

.search-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.search-input-field {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
}

.search-body { max-height: min(62vh, 640px); overflow: auto; }

.search-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.search-recent { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px 0; }

.search-pill {
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.search-section { padding: 14px 18px 0; }

.search-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-result {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.search-result:hover {
    background: var(--accent-purple-light);
    border-color: var(--border-subtle);
}

.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-purple-light);
    color: var(--accent-primary);
    flex-shrink: 0;
}

.search-result-title { font-size: 14px; font-weight: 600; }
.search-result-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.search-empty { padding: 28px 18px; text-align: center; color: var(--text-muted); font-size: 13px; }

.search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
}

.kbd {
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-primary);
}

/* Mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    backdrop-filter: blur(4px);
}

.mobile-overlay.active { display: block; }

.hamburger-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
}

.hamburger-btn:hover { background: var(--bg-elevated); }

@media (max-width: 1024px) {
    :root { --sidebar-w: 240px; }
    .topbar-search-btn { min-width: 140px; }
    .org-badge { display: none; }
}

@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-h) 1fr;
    }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: -100%;
        height: calc(100vh - var(--header-h));
        width: 260px !important;
        z-index: 950;
        transition: left 0.25s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open { left: 0; }

    .main-content {
        grid-column: 1;
        padding: 16px;
    }

    .hamburger-btn { display: flex; }

    .topbar-search-btn { display: none; }

    .kpi-grid, .top-stats { grid-template-columns: 1fr 1fr; }

    .pm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .kpi-grid, .top-stats, .stat-strip { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
    .page-header { flex-direction: column; }
    .quick-links { grid-template-columns: 1fr; }
}

/* ── Legacy dark-theme inline style normalization ──────────────────────── */
/* Ensures pages with old rgba(255,255,255,…) inline styles remain readable */
[class*="glass-"],
.stat-box .amount,
.fc-title,
.panel-title,
.tl-sublabel,
.cat-name,
.brand-name,
.m-name,
.field-value,
.modal-content h3 {
    color: var(--text-primary) !important;
}

.cat-meta,
.m-brand,
.no-results,
.review-label {
    color: var(--text-secondary) !important;
}

.form-label,
.field-label {
    color: var(--text-label) !important;
    font-weight: 700 !important;
}

.card-action,
.tbl-action {
    color: var(--accent-primary) !important;
    font-weight: 700 !important;
}

.field-value { color: var(--text-primary) !important; font-weight: 600; }

/* Shared page component classes used across module templates */
.plan-search i,
.search-icon { color: var(--text-secondary) !important; }

.plan-search input,
.plan-select,
.form-control,
.form-select {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-input) !important;
    color: var(--text-primary) !important;
}

.plan-search input::placeholder,
.form-control::placeholder { color: var(--text-muted) !important; opacity: 1; }

.plan-chip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-secondary) !important;
}

.plan-chip.active,
.plan-chip:hover {
    border-color: var(--accent-primary) !important;
    background: var(--accent-purple-light) !important;
    color: var(--accent-primary) !important;
}

.plan-action-btn {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
}

.plan-action-btn.activate { background: rgba(16,185,129,0.1) !important; color: #059669 !important; border-color: rgba(16,185,129,0.25) !important; }
.plan-action-btn.deactivate { background: rgba(245,158,11,0.1) !important; color: #b45309 !important; border-color: rgba(245,158,11,0.25) !important; }

.pol-hero p,
.pm-hero p { color: var(--text-secondary) !important; }

.pol-hero h1,
.pm-hero h1 { color: var(--text-primary) !important; }

.pm-card,
.pol-hero,
.pp-section {
    background: var(--bg-card) !important;
    border-color: var(--border-subtle) !important;
}

.btn-secondary,
.btn-ghost {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-medium) !important;
    color: var(--text-primary) !important;
}

/* Modals & dropdowns */
.modal-overlay,
.help-overlay {
    background: rgba(15, 23, 42, 0.45) !important;
}

.modal-content,
.help-modal,
.search-modal,
.dropdown-menu {
    background: var(--bg-modal) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-lg) !important;
}

.dropdown-item,
.quick-action-item {
    color: var(--text-secondary) !important;
}

.dropdown-item:hover,
.quick-action-item:hover {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}

/* Charts — light axis/grid defaults */
.chart-container canvas,
canvas.chart { background: transparent !important; }

/* Finance module nav */
.finance-nav { background: var(--bg-elevated) !important; border-color: var(--border-subtle) !important; }
.fin-link { color: var(--text-secondary) !important; }
.fin-link:hover { background: var(--bg-surface) !important; color: var(--text-primary) !important; }
.fin-link.active { background: var(--accent-primary) !important; color: #fff !important; }

/* Status chips with light-readable colors */
.s-draft { background: var(--bg-elevated) !important; color: var(--text-muted) !important; }
.s-expired { background: var(--bg-elevated) !important; color: var(--text-disabled) !important; }

/* Table row striping — subtle but readable */
tbody tr:nth-child(even) td { background: #f9fafb; color: var(--text-primary); }
tbody tr:hover td,
.model-table tr:hover td,
.pricing-summary-table tr:hover td,
.data-table tr:hover td {
    background: #f3f4f6 !important;
    color: var(--text-primary) !important;
}

.stat-pill .sl { color: var(--text-secondary) !important; font-weight: 800 !important; }
.stat-pill .sv { color: var(--text-primary) !important; }

.pill-models { color: #6366f1 !important; }
.pill-vars { color: #2563eb !important; }
.pill-ok { color: #059669 !important; }
.pill-warn { color: #b45309 !important; }

.search-kpi .label,
.result-subtitle,
.empty-search {
    color: var(--text-muted) !important;
}

.w-step.done { color: #059669 !important; }
.w-step.active { color: var(--accent-primary) !important; }
.w-arrow { color: var(--border-medium) !important; }

.card-action:hover,
.tbl-action:hover { color: var(--accent-primary) !important; }

.cat-row,
.brand-row,
.brand-panel {
    border-color: var(--border-subtle) !important;
    background: transparent !important;
}

.cat-row:hover,
.brand-row:hover { background: var(--bg-elevated) !important; }

.brand-panel { background: var(--bg-base) !important; }

.no-results { padding: 48px; text-align: center; font-size: 13px; }

.cat-row {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.15s;
}

.cat-row:last-child { border-bottom: none; }

.card-action {
    font-size: 12px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.tbl-action {
    color: var(--accent-primary);
    font-size: 11px;
    text-decoration: none;
    font-weight: 600;
}

.timeline-panel .timeline { display: flex; position: relative; gap: 8px; flex-wrap: wrap; }
.timeline-panel .tl-item { flex: 1; min-width: 80px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.timeline-panel .tl-dot {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}
.timeline-panel .tl-dot.done { background: rgba(16,185,129,0.1); border-color: #10b981; color: #059669; }
.timeline-panel .tl-dot.active { background: rgba(37,99,235,0.1); border-color: #2563eb; color: #2563eb; }
.timeline-panel .tl-label { font-size: 10px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; text-align: center; }

@media (min-width: 769px) {
    .d-none-mobile { display: flex; }
}

@media (max-width: 768px) {
    .d-none-mobile { display: none !important; }
}

/* ==========================================================================
   Typography & Contrast Enhancement — Light Theme Readability
   ========================================================================== */

/* Force high-contrast table cell content (overrides inline muted styles) */
.main-content table tbody td,
.main-content .data-table tbody td,
.main-content .model-table tbody td,
.main-content .pricing-summary-table tbody td,
.main-content .mini-table tbody td,
.table-panel tbody td,
.tbl-scroll tbody td,
.panel tbody td {
    color: var(--text-primary) !important;
    font-weight: 500 !important;
}

.main-content table tbody td a:not(.btn):not(.tbl-action):not(.card-action),
.main-content .data-table tbody td a:not(.btn):not(.tbl-action) {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

.main-content table thead th,
.main-content .data-table thead th,
.main-content .model-table thead th,
.main-content .mini-table thead th,
.panel thead th {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
}

/* Dashboard KPI emphasis */
.kpi-value,
.stat-val,
.stat-box .amount,
.metric-value,
.kpi-card .kpi-val,
.rate-pct,
.rate-stat-val {
    color: var(--text-primary) !important;
    font-weight: 800 !important;
}

.kpi-lbl,
.kpi-card .kpi-lbl,
.rate-stat-lbl,
.rate-lbl {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
}

/* Icons — sharper contrast */
.sidebar i.bi,
.topbar-icon-btn i,
.table-search i,
.sidebar-search-wrap i,
.kpi-icon i,
.stat-icon i,
.panel-title i {
    color: var(--text-secondary);
}

.nav-item.active i,
.nav-item:hover i {
    color: var(--accent-primary);
}

/* Form controls */
input, select, textarea, .input, .select, .form-control {
    color: var(--text-primary) !important;
    font-weight: 500;
}

select option {
    color: var(--text-primary);
    background: #fff;
}

.helper-text,
.form-text,
.hint,
.hint-text {
    color: var(--text-secondary) !important;
    font-weight: 500;
}

/* Search modal */
.search-input-field {
    color: var(--text-primary) !important;
    font-weight: 500;
}

.search-input-field::placeholder {
    color: var(--text-muted) !important;
    opacity: 1;
}

.search-meta {
    color: var(--text-secondary) !important;
    font-weight: 500;
}

/* Chart.js / canvas axis readability */
.chart-card,
.chart-panel,
.analytics-chart {
    color: var(--text-primary);
}

/* Hardcoded legacy gray hex fallback */
[style*="#64748b"],
[style*="#64748B"],
[style*="#94a3b8"],
[style*="#94A3B8"] {
    color: var(--text-secondary) !important;
}

/* Module-specific table classes */
.pol-table th,
.inv-table th,
.fin-table th,
.pol-table td,
.inv-table td,
.fin-table td {
    color: var(--text-primary) !important;
}

.pol-table th,
.inv-table th,
.fin-table th {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
}

.prod-meta,
.txt-muted,
.empty-text,
.review-label {
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
}

.empty-icon {
    opacity: 1 !important;
    color: var(--text-disabled) !important;
}

.s-draft,
.s-expired {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
}

/* Disabled elements only */
[disabled],
.disabled,
.is-disabled,
input:disabled,
select:disabled,
textarea:disabled,
.btn:disabled {
    color: var(--text-disabled) !important;
    opacity: 1;
}

/* ==========================================================================
   Enterprise Contrast — Final Production Overrides
   Beats per-page inline dark-theme styles without changing markup/JS
   ========================================================================== */

/* ── Plan badges (override page-level pastel colors) ── */
.plan-badge.badge-ew,
.badge-ew,
.plan-type-card .badge-ew {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.35) !important;
    font-weight: 800 !important;
}

.plan-badge.badge-adld,
.badge-adld,
.plan-type-card .badge-adld {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #991b1b !important;
    border: 1px solid rgba(220, 38, 38, 0.35) !important;
    font-weight: 800 !important;
}

.plan-badge.badge-ew_adld,
.badge-ew_adld,
.plan-type-card .badge-ew_adld {
    background: rgba(217, 119, 6, 0.14) !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
    font-weight: 800 !important;
}

.plan-badge.badge-theft,
.badge-theft,
.plan-type-card .badge-theft {
    background: rgba(79, 70, 229, 0.12) !important;
    color: #3730a3 !important;
    border: 1px solid rgba(79, 70, 229, 0.35) !important;
    font-weight: 800 !important;
}

/* ── Policy status badges ── */
.s-badge.s-pending {
    background: rgba(217, 119, 6, 0.14) !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
}

.s-badge.s-active {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.35) !important;
}

.s-badge.s-cancel {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #991b1b !important;
    border: 1px solid rgba(220, 38, 38, 0.35) !important;
}

.s-badge.s-claimed {
    background: rgba(79, 70, 229, 0.12) !important;
    color: #3730a3 !important;
    border: 1px solid rgba(79, 70, 229, 0.35) !important;
}

/* ── Inventory / stock status pills ── */
.status-pill.st-active {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.35) !important;
}

.status-pill.st-low {
    background: rgba(217, 119, 6, 0.14) !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
}

.status-pill.st-out {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #991b1b !important;
    border: 1px solid rgba(220, 38, 38, 0.35) !important;
}

.status-pill.st-off {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

/* ── Order workflow badges ── */
.badge-pending,
.badge-under_review,
.badge-insurer_pending,
.badge-activation_pending {
    background: rgba(217, 119, 6, 0.14) !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
    font-weight: 800 !important;
}

.badge-approved,
.badge-activated,
.badge-insurer_approved {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.35) !important;
    font-weight: 800 !important;
}

.badge-rejected,
.badge-failed,
.badge-insurer_rejected,
.badge-cancelled {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #991b1b !important;
    border: 1px solid rgba(220, 38, 38, 0.35) !important;
    font-weight: 800 !important;
}

/* ── Pricing source badges ── */
.source-badge-slab {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border-color: rgba(5, 150, 105, 0.35) !important;
}

.source-badge-custom {
    background: rgba(37, 99, 235, 0.12) !important;
    color: #1e40af !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

/* ── Dark-theme inline color remediation ── */
[style*="rgba(255,255,255,0.45)"],
[style*="rgba(255,255,255,.45)"],
[style*="rgba(255,255,255,0.4)"],
[style*="rgba(255,255,255,.4)"],
[style*="rgba(255,255,255,0.35)"],
[style*="rgba(255,255,255,.35)"],
[style*="rgba(255,255,255,0.85)"],
[style*="rgba(255,255,255,.85)"] {
    color: var(--text-primary) !important;
}

[style*="#34d399"],
[style*="#34D399"],
[style*="#fca5a5"],
[style*="#FCA5A5"],
[style*="#fcd34d"],
[style*="#FCD34D"],
[style*="#c4b5fd"],
[style*="#C4B5FD"],
[style*="#60a5fa"],
[style*="#60A5FA"],
[style*="#fde047"],
[style*="#FDE047"],
[style*="#f87171"],
[style*="#F87171"],
[style*="#a5b4fc"],
[style*="#A5B4FC"],
[style*="#818cf8"],
[style*="#818CF8"],
[style*="#a78bfa"],
[style*="#A78BFA"] {
    color: var(--text-secondary) !important;
}

/* ── Product & subtitle typography ── */
.prod-name,
.slab-name,
.m-name,
.brand-name,
.cat-name,
.exp-name,
.merchant-name,
.pol-id,
.price-val {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

.prod-meta,
.slab-sub,
.exp-meta,
.brand-meta,
.cat-meta,
.m-brand,
.ptc-dur,
.ptc-count,
.price-range,
.no-price {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

/* ── Table hover & header fixes (dark-theme leftovers) ── */
.inv-table thead tr,
.pol-table thead tr,
.pricing-summary-table thead tr {
    background: #f3f4f6 !important;
}

.inv-table tr:hover td,
.pol-table tr:hover td,
.pricing-summary-table tr:hover td,
.data-table tr:hover td {
    background: #f3f4f6 !important;
}

.inv-table th,
.pol-table th,
.pricing-summary-table th {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
}

/* ── Stat strip & KPI labels ── */
.stat-pill .sl,
.kpi-lbl,
.stat-lbl,
.metric-label,
.att-card-lbl,
.insight-title {
    color: var(--text-secondary) !important;
    font-weight: 800 !important;
}

.alert-desc strong {
    color: var(--text-primary) !important;
}

/* ── Icons — stronger default contrast ── */
.action-btn,
.cat-arrow,
.bi.text-muted {
    color: var(--text-muted) !important;
}

.action-btn:hover {
    color: var(--text-primary) !important;
}

.sidebar .nav-item:not(.active) i,
.topbar-icon-btn i,
.table-search i,
.search-input-wrap i,
.plan-search i {
    color: var(--text-muted) !important;
}

.sidebar .nav-item.active i {
    color: var(--accent-primary) !important;
}

/* ── Buttons — label readability ── */
.btn-secondary,
.btn-secondary-action,
.btn-ghost,
.btn-outline {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    border-color: var(--border-medium) !important;
}

.btn-primary,
.btn-primary-action {
    font-weight: 700 !important;
}

/* ── Card & panel borders ── */
.pm-card,
.pp-section,
.analytics-card,
.alert-widget,
.stat-item,
.att-card,
.comm-card,
.glass-card,
.modal-content {
    border-color: var(--border-medium) !important;
}

/* ── Finance nav tabs ── */
.fin-link {
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
}

.fin-link.active {
    color: #fff !important;
    font-weight: 700 !important;
}

/* ── Breadcrumbs & page chrome ── */
.topbar-breadcrumb,
.page-header p,
.dash-header p,
.pm-hero p,
.pp-hero p,
.pol-hero p,
.form-subtitle {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

/* ── Empty states — readable but secondary ── */
.empty-state,
.empty-alerts,
.empty-search,
.no-results {
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

/* ── Verified / KYC status pills ── */
.status-pill.verified,
.status-pill.approved {
    background: rgba(5, 150, 105, 0.14) !important;
    color: #047857 !important;
    border: 1px solid rgba(5, 150, 105, 0.35) !important;
    font-weight: 800 !important;
}

.status-pill.pending {
    background: rgba(217, 119, 6, 0.14) !important;
    color: #92400e !important;
    border: 1px solid rgba(217, 119, 6, 0.35) !important;
    font-weight: 800 !important;
}

.status-pill.rejected {
    background: rgba(220, 38, 38, 0.12) !important;
    color: #991b1b !important;
    border: 1px solid rgba(220, 38, 38, 0.35) !important;
    font-weight: 800 !important;
}
