/* ============================================
   Hunter Mini UI v3 - Design System & Layout
   ============================================ */

/* Design Tokens (STRICT) */
:root {
    --bg: #F6F7FB;
    --surface: #FFFFFF;
    --surface-2: #F1F3F8;
    --text: #0F172A;
    --muted: #475569;
    --border: #E2E8F0;
    --primary: #2563EB;
    --primary-700: #1D4ED8;
    --primary-50: #EFF6FF;
    --success: #16A34A;
    --danger: #DC2626;
    --warning: #D97706;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --z-drawer: 85;
    --z-backdrop: 80;
    /* Sticky stack heights (set dynamically via JavaScript) */
    --header-height: 0px;
    --kpi-height: 0px;
    --filters-height: 0px;
    --bulk-height: 0px;
    /* Deprecated - use calc() with individual heights instead */
    --filters-sticky-top: 0px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    padding-bottom: 40px; /* Space for footer */
}

/* App Shell */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app__header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px; /* Reduced from 16px 24px for more compact layout */
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.app__header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.app__header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

/* Brand Lockup */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand__icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
}

.brand__name {
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0F172A;
}

.brand__sub {
    font-size: 12px;
    color: #64748B;
    font-weight: 600;
    margin-left: 8px;
}

.app__header-status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.app__status-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--success);
    color: white;
    font-weight: 500;
}

.app__status-indicator[data-status="mock"] {
    background: var(--warning);
}

.app__status-indicator[data-status="error"] {
    background: var(--error, #dc3545);
}

.app__status-indicator[data-status="ok"] {
    background: var(--success);
}

.app__status-time {
    color: var(--muted);
}

/* KPI Dashboard */
.app__kpi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px; /* Reduced from 16px */
    padding: 12px 16px; /* Reduced from 16px 24px for more compact layout */
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-height); /* Below header */
    z-index: 99;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.app__kpi-card {
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s;
    cursor: pointer;
}

.app__kpi-card:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.app__kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.app__kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.app__kpi-card:hover .app__kpi-value {
    color: var(--primary-700);
}

/* Main Layout */
.app__main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

/* Split View Mode (>= 1440px) */
@media (min-width: 1440px) {
    .app__main.app__main--split {
        grid-template-columns: 1fr 420px;
    }
}

/* Table Section - REMOVED */
/* Filters - REMOVED */
/* Search - REMOVED */
/* Pagination - REMOVED */
/* Bulk Actions - REMOVED */
/* Table Container & Structure - REMOVED */
/* Table Header - REMOVED */
/* Table Rows & Cells - REMOVED */
/* Table Column Widths - REMOVED */
/* Compact Mode - REMOVED */

/* Checkbox */
.app__checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    vertical-align: top;
    margin: 0;
}

.app__checkbox--header {
    vertical-align: top;
    margin-top: 0;
}

/* Score Pill */
.app__score-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: none;
    border-radius: 12px;
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    position: relative;
    font-family: inherit;
}

.app__score-pill:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.app__score-pill:hover {
    background: var(--primary-50);
    opacity: 0.9;
}

.app__score-bar {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.app__score-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Score Tooltip */
.app__tooltip {
    position: fixed;
    padding: 12px;
    background: var(--text);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: var(--shadow);
    pointer-events: none;
    min-width: 200px;
}

.app__tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--text);
}

.app__tooltip-factor {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.app__tooltip-factor:last-child {
    margin-bottom: 0;
}

.app__tooltip-factor-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.app__tooltip-factor-icon--positive {
    background: var(--success);
}

.app__tooltip-factor-icon--negative {
    background: var(--danger);
}

.app__tooltip-factor-weight {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 11px;
}

/* ============================================
   Company Name & Domain Display
   ============================================ */

.app__company-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    /* Allow text to wrap if needed */
    flex-wrap: wrap;
}

.app__company-domain {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 400;
    line-height: 1.3;
}

/* Insight Text */
.app__insight {
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Provider Badge */
/* Header Sync Status */
.app__header-sync-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app__sync-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.app__sync-status--success {
    color: var(--success);
    background: #F0FDF4;
}

.app__sync-status--syncing {
    color: var(--warning);
    background: #FFFBEB;
}

.app__sync-status--error {
    color: var(--danger);
    background: #FEF2F2;
}

.app__sync-status--idle {
    color: var(--muted);
    background: var(--surface-2);
}

.app__sync-status--auth-required {
    color: var(--error);
    background: #FEF2F2;
    font-weight: 500;
}

/* Badges */
.app__badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.app__badge--partner-center {
    background: #EFF6FF;
    color: var(--primary);
    margin-left: 0; /* Gap in .app__company-name handles spacing */
    flex-shrink: 0; /* Prevent badge from shrinking */
    align-self: center; /* Align with company name text */
}

.app__badge--scan {
    font-size: 11px;
    padding: 3px 8px;
}

.app__badge--scan-scanned {
    background: #F0FDF4;
    color: var(--success);
}

.app__badge--scan-not-scanned {
    background: #FFFBEB;
    color: var(--warning);
}

.app__badge--scan-pending {
    background: #EFF6FF;
    color: var(--primary);
}

.app__badge--scan-error {
    background: #FEF2F2;
    color: var(--danger);
}

.app__badge--scan-unknown {
    background: var(--surface-2);
    color: var(--muted);
}

.app__badge--success {
    background: #D1FAE5; /* Light green */
    color: #065F46; /* Dark green */
}

.app__badge--warning {
    background: #FEF3C7; /* Light yellow */
    color: #92400E; /* Dark yellow */
}

.app__provider-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
}

/* Action Buttons */
.app__action-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.app__action-btn:hover {
    background: var(--primary-50);
}

.app__action-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-50);
}

/* Table Section */
.app__table-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Filters */
.app__filters {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.app__filters-group {
    flex: 1;
    min-width: 200px;
}

.app__search-input,
.app__filter-select,
.app__filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s ease;
}

.app__search-input:focus,
.app__filter-select:focus,
.app__filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

/* Score Input Wrapper (for clear button) */
.app__filter-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.app__filter-input-wrapper .app__filter-input {
    padding-right: 32px; /* Space for clear button */
}

/* Clear Button */
.app__filter-input-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    border-radius: 4px;
}

.app__filter-input-clear:hover {
    opacity: 1;
    color: var(--text);
    background: var(--surface-2);
}

.app__filter-input-clear:focus {
    outline: none;
    opacity: 1;
    color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-50);
}

/* Validation States */
.app__filter-input[aria-invalid="true"] {
    border-color: var(--danger);
}

.app__filter-input[aria-invalid="true"]:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.app__filter-input-error {
    margin-top: 4px;
    font-size: 12px;
    color: var(--danger);
    line-height: 1.4;
}

/* Bulk Actions Bar */
.app__bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary-50);
    border-left: 4px solid var(--primary);
}

.app__bulk-info {
    font-size: 14px;
    color: var(--text);
}

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

.app__bulk-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--primary);
    color: white;
    transition: background 0.2s;
}

.app__bulk-btn:hover {
    background: var(--primary-700);
}

.app__bulk-btn--danger {
    background: var(--danger);
}

.app__bulk-btn--danger:hover {
    background: var(--danger-700);
}

/* Bulk Progress Modal */
.app__bulk-progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app__bulk-progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.app__bulk-progress-content {
    position: relative;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    z-index: 1;
}

.app__bulk-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.app__bulk-progress-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.app__bulk-progress-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.app__bulk-progress-close:hover {
    background: var(--border);
}

.app__bulk-progress-body {
    padding: 24px;
}

.app__bulk-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.app__bulk-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.app__bulk-progress-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text);
}

.app__bulk-progress-stats strong {
    font-weight: 600;
    color: var(--primary);
}

.app__bulk-progress-errors {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-size: 13px;
}

.app__bulk-progress-error {
    padding: 8px 12px;
    background: var(--danger-light);
    border-left: 3px solid var(--danger);
    border-radius: 4px;
    margin-bottom: 8px;
    color: var(--text);
}

.app__bulk-progress-error strong {
    color: var(--danger);
}

.app__bulk-progress-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.app__bulk-progress-cancel {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.app__bulk-progress-cancel:hover {
    background: var(--border);
}

/* Skeleton Loader */
.app__skeleton {
    padding: 0;
    margin: 0;
}

.app__skeleton-row {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 8px 16px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.app__skeleton-cell {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: 4px;
    flex-shrink: 0;
}

.app__skeleton-cell--checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.app__skeleton-cell--company {
    width: 200px;
    flex-grow: 0;
}

.app__skeleton-cell--score {
    width: 80px;
}

.app__skeleton-cell--insight {
    width: 250px;
    flex-grow: 1;
    min-width: 150px;
}

.app__skeleton-cell--provider {
    width: 100px;
}

.app__skeleton-cell--scan {
    width: 80px;
}

.app__skeleton-cell--d365 {
    width: 100px;
}

.app__skeleton-cell--actions {
    width: 40px;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 200% 0;
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        background-position: -200% 0;
        opacity: 1;
    }
}

/* Table Container */
.app__table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Table */
.app__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.app__table-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
}

.app__table-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.app__table-row:hover {
    background: var(--hover);
}

.app__table-row--header {
    background: var(--surface) !important;
}

.app__table-cell {
    padding: 12px;
    text-align: left;
}

.app__table-cell--header {
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.app__table-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

.app__table-sortable:hover {
    background: var(--hover);
}

.app__table-sort-indicator {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.app__table-sortable:hover .app__table-sort-indicator {
    opacity: 1;
}

.app__table-sort-indicator--active {
    opacity: 1 !important;
    color: var(--primary);
    font-weight: 600;
}

.app__table-cell--checkbox {
    width: 40px;
    padding: 12px 16px;
}

.app__table-cell--company {
    min-width: 200px;
}

.app__table-cell--score {
    width: 120px;
}

.app__table-cell--insight {
    min-width: 200px;
    max-width: 300px;
}

.app__table-cell--provider {
    width: 120px;
}

.app__table-cell--scan-status {
    width: 100px;
}

.app__table-cell--d365 {
    width: 100px;
}

.app__table-cell--actions {
    width: 140px;
}

/* Company Cell */
.app__company-name {
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app__company-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.app__company-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.app__company-domain {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.app__company-domain-link {
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.app__company-domain-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Insight Cell */
.app__insight {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Provider Badge */
.app__provider-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--surface-raised);
    color: var(--text);
}

/* Row Actions */
.app__row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.app__row-action-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s;
}

.app__row-action-btn:hover {
    background: var(--hover);
    border-color: var(--primary);
    color: var(--primary);
}

.app__row-action-btn--primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.app__row-action-btn--primary:hover {
    background: var(--primary-700);
}

.app__row-action-btn--kebab {
    padding: 0;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.app__row-action-btn--kebab .app__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Row Actions Dropdown */
.app__row-actions-dropdown {
    position: relative;
}

.app__row-action-menu {
    position: fixed;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    display: none;
}

.app__row-action-menu--open {
    display: block;
}

.app__row-action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.app__row-action-menu-item:hover {
    background: var(--hover);
}

.app__row-action-menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.app__row-action-menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* Checkbox */
.app__checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Empty State */
.app__empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.app__empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.app__empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.app__empty-text {
    font-size: 14px;
    color: var(--muted);
}

/* Pagination */
.app__pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.app__pagination-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app__pagination-label {
    font-size: 14px;
    color: var(--muted);
}

.app__pagination-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.app__pagination-select:focus {
    outline: none;
    border-color: var(--primary);
}

.app__pagination-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app__pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s;
}

.app__pagination-btn:hover:not(:disabled) {
    background: var(--hover);
    border-color: var(--primary);
    color: var(--primary);
}

.app__pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.app__pagination-info {
    font-size: 14px;
    color: var(--muted);
}

/* Drawer (Adaptive) */
.app__drawer {
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Split View Mode */
.app__main.app__main--split .app__drawer {
    position: relative;
    height: 100%;
}

/* Overlay Mode */
.app__main:not(.app__main--split) .app__drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    z-index: var(--z-drawer);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.app__main:not(.app__main--split) .app__drawer.app__drawer--open {
    transform: translateX(0);
}

.app__drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    padding-right: calc(24px + 8px); /* Scrollbar width compensation */
    border-bottom: 1px solid var(--border);
    gap: 12px;
    min-height: 64px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
    /* Ensure header stays above scrolling content */
    box-shadow: 0 1px 0 var(--border);
}

.app__drawer-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
}

.app__drawer-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.app__drawer-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-left: auto; /* Push to right edge, aligned with header actions */
}

.app__drawer-close:hover {
    background: var(--surface-2);
}

.app__drawer-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-50);
}

.app__drawer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    /* Scrollbar width compensation for header */
    padding-right: calc(24px + 8px);
    /* Ensure body scroll doesn't cover header */
    padding-top: 0; /* Header handles its own spacing */
    /* Prevent horizontal overflow */
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}


/* Drawer Tabs */
.app__drawer-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.app__drawer-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.app__drawer-tab:hover {
    color: var(--text);
}

.app__drawer-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.app__drawer-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.app__drawer-section-content {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    /* Prevent overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    min-width: 0;
}

.app__drawer-link {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

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

.app__drawer-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Drawer Actions */
.app__drawer-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

@media (max-width: 480px) {
    .app__drawer-actions {
        grid-template-columns: repeat(2, 1fr);
        padding: 12px 16px;
        gap: 6px;
    }
}

.app__drawer-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    min-width: fit-content;
}

/* Header actions buttons - slightly larger for better visibility */
.app__drawer-header-actions .app__drawer-btn {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
}

.app__drawer-btn--primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.app__drawer-btn--primary:hover:not(:disabled) {
    background: var(--primary-700);
    border-color: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.app__drawer-btn:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--primary);
}

.app__drawer-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.app__drawer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.app__drawer-btn--loading {
    opacity: 0.7;
    cursor: wait;
    position: relative;
}

.app__drawer-btn--loading::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: drawer-spin 0.6s linear infinite;
    margin-left: 6px;
}

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

.app__drawer-btn--pulse {
    animation: pulse 0.3s ease;
}

.app__drawer-btn--success {
    background: var(--success) !important;
    color: white !important;
    border-color: var(--success) !important;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Backdrop (Overlay Mode) */
.app__backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-backdrop);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.app__backdrop.app__backdrop--visible {
    opacity: 1;
    pointer-events: all;
}

/* Loading Skeleton - REMOVED */
/* Empty State - REMOVED */

/* Toast */
.app__toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10001; /* Above modals (1000) */
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Ensure container is not clipped by overflow parents */
    pointer-events: none; /* Allow clicks to pass through gaps */
}

.app__toast {
    padding: 12px 16px;
    background: var(--text);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: var(--shadow);
    animation: toast-slide-in 0.3s ease;
    max-width: 400px; /* Increased from 300px for better readability */
    min-width: 280px;
    pointer-events: auto; /* Re-enable pointer events on toast itself */
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.app__toast--success {
    background: var(--success);
    color: white;
}

.app__toast--error {
    background: var(--danger);
    color: white;
}

.app__toast--info {
    background: var(--primary);
    color: white;
}

/* Mock Banner */
.app__mock-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 24px;
    background: var(--warning);
    color: white;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    z-index: 1001;
}

/* Dev Panel */
.app__dev-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 1002;
    display: flex;
    flex-direction: column;
}

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

.app__dev-panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.app__dev-panel-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    font-size: 20px;
    color: var(--muted);
    cursor: pointer;
}

.app__dev-panel-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.app__dev-panel-content {
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-all;
}

/* D365 Status Badge */
.app__d365-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.app__d365-badge--success {
    background: var(--primary-50);
    color: var(--primary);
}

.app__d365-badge--success:hover {
    background: var(--primary-50);
    opacity: 0.8;
}

.app__d365-badge--running {
    background: var(--primary-50);
    color: var(--primary);
}

.app__d365-badge--failed {
    background: #FEE2E2;
    color: #DC2626;
}

.app__d365-badge--muted {
    color: var(--muted);
    background: transparent;
}

.app__d365-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: d365-spin 0.6s linear infinite;
}

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

.app__drawer-btn--success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.app__drawer-btn--success:hover:not(:disabled) {
    background: #15803D;
    border-color: #15803D;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

.app__drawer-btn--danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.app__drawer-btn--danger:hover:not(:disabled) {
    background: #B91C1C;
    border-color: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.app__drawer-btn--danger-ghost {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.app__drawer-btn--danger-ghost:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .app__d365-spinner {
        animation: none;
    }
}

/* Scrollbar Styling */
.app__drawer-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.app__drawer-body::-webkit-scrollbar-track {
    background: var(--surface-2);
}

.app__drawer-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.app__drawer-body::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* Header Actions */
.app__header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.app__header-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.app__header-btn:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--primary);
}

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

.app__header-btn--syncing {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary-700);
}

.app__header-btn--success {
    background: #D1FAE5;
    border-color: var(--success);
    color: #065F46;
}

.app__header-btn--error {
    background: #FEF2F2;
    border-color: var(--danger);
    color: #DC2626;
}

.app__header-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.app__header-btn:hover {
    background: var(--primary-700);
}

.app__header-btn:active {
    transform: scale(0.98);
}

/* Modal */
.app__modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app__modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.app__modal-content {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1001;
}

.app__modal-content--small {
    max-width: 480px;
}

.app__modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

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

.app__modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.app__modal-close:hover {
    background: var(--surface-2);
}

.app__modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Tabs */
.app__modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.app__modal-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}

.app__modal-tab:hover {
    color: var(--text);
}

.app__modal-tab--active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.app__modal-tab-content {
    display: block;
    padding-top: 8px;
}

/* Form Styles */
.app__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app__form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app__form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.app__form-input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: all 0.2s;
    width: 100%;
    font-family: inherit;
}

.app__form-input[type="textarea"],
.app__form-input[rows] {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* ============================================
   Sales Summary Modal Styles
   ============================================ */

.app__modal-content--large {
    max-width: 960px;
    width: 90vw;
}

.app__sales-summary-loading,
.app__sales-summary-error {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}

.app__sales-summary-loading .app__loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

.app__sales-summary {
    padding: 0;
}

.app__sales-summary-hero {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--surface) 100%);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.app__sales-summary-domain {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.app__sales-summary-oneliner {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 12px;
}

.app__sales-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app__sales-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__sales-badge--score {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border-color: #2563EB;
}

.app__sales-badge--segment {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary);
}

.app__sales-badge--urgency-low {
    background: #F0FDF4;
    color: #166534;
    border-color: #16A34A;
}

.app__sales-badge--urgency-medium {
    background: #FEF3C7;
    color: #92400E;
    border-color: #D97706;
}

.app__sales-badge--urgency-high {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #DC2626;
}

.app__sales-badge--potential {
    background: var(--surface-2);
    color: var(--text);
}

.app__sales-summary-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.app__sales-summary-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.app__sales-summary-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.app__sales-summary-narrative {
    margin-bottom: 12px;
}

.app__sales-summary-narrative p {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text);
    font-size: 14px;
}

.app__sales-summary-narrative p:last-child {
    margin-bottom: 0;
}

.app__sales-summary-suggested-approach {
    padding: 12px;
    background: var(--primary-50);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.app__sales-summary-suggested-approach p {
    margin: 0;
    line-height: 1.5;
    color: var(--text);
    font-size: 14px;
}

/* Score Breakdown Modal Styles */
.app__score-breakdown-loading,
.app__score-breakdown-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 32px 24px;
    text-align: center;
    color: var(--text);
}

.app__score-breakdown-loading .app__loading-spinner {
    margin-bottom: 16px;
}

.app__score-breakdown-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.app__score-breakdown-error h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.app__score-breakdown-error p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 8px;
}

.app__score-breakdown-error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.app__score-breakdown {
    padding: 0;
}

.app__score-breakdown-hero {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--surface-2) 100%);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.app__score-breakdown-domain {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.app__score-breakdown-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.app__score-breakdown-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.app__score-breakdown-badge--score {
    background-color: var(--primary);
    color: white;
}

.app__score-breakdown-badge--segment {
    background-color: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__score-breakdown-badge--tenant {
    background-color: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__score-breakdown-badge--provider {
    background-color: var(--primary-700);
    color: white;
}

.app__score-breakdown-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.app__score-breakdown-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.app__score-breakdown-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.app__score-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.app__score-breakdown-card {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.app__score-breakdown-card-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.app__score-breakdown-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.app__score-breakdown-accordion {
    margin-top: 12px;
}

.app__score-breakdown-accordion-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--surface);
}

.app__score-breakdown-accordion-header {
    width: 100%;
    padding: 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.app__score-breakdown-accordion-header:hover {
    background: var(--surface-2);
}

.app__score-breakdown-accordion-icon {
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.2s;
}

.app__score-breakdown-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 12px;
}

.app__score-breakdown-accordion-content--open {
    max-height: 1000px;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.app__score-breakdown-signal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app__score-breakdown-signal-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.app__score-breakdown-signal-list li:last-child {
    border-bottom: none;
}

.app__score-breakdown-signal-name {
    font-size: 13px;
    color: var(--text);
}

.app__score-breakdown-signal-points {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

.app__score-breakdown-signal-points--risk {
    color: var(--danger);
}

.app__score-breakdown-info {
    padding: 12px;
    background: var(--surface-2);
    border-radius: 6px;
}

.app__score-breakdown-info-item {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text);
}

.app__score-breakdown-info-item:last-child {
    margin-bottom: 0;
}

.app__drawer-btn--secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__drawer-btn--secondary:hover {
    background: var(--border);
}

/* Sales Cockpit Styles */
#sales-summary-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    min-width: 0;
}

.app__sales-cockpit-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    max-width: 100%;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.app__sales-cockpit-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.app__sales-cockpit-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.app__sales-cockpit-bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app__sales-cockpit-bullet-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    line-height: 1.5;
    color: var(--text);
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.app__sales-cockpit-bullet-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
    font-size: 18px;
}

.app__sales-cockpit-bullet-list li:last-child {
    margin-bottom: 0;
}

.app__sales-cockpit-chip {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
    margin-bottom: 8px;
}

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

.app__sales-cockpit-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__sales-cockpit-badge--tier {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary);
}

.app__sales-cockpit-badge--score {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border-color: #2563EB;
}

.app__sales-cockpit-opportunity-label {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.app__sales-cockpit-opportunity-label--low {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
}

.app__sales-cockpit-opportunity-label--medium {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #D97706;
}

.app__sales-cockpit-opportunity-label--high {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #16A34A;
}

.app__sales-cockpit-text {
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.app__sales-cockpit-description {
    margin-top: 8px;
    margin-bottom: 0;
    line-height: 1.5;
    color: var(--muted);
    font-size: 13px;
}

/* Confidence Badges */
.conf-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
    white-space: nowrap;
}

.conf-badge--signal {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary-50);
}

.conf-badge--crm {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.18);
}

.conf-badge--d365-sync {
    background: rgba(59, 130, 246, 0.12);
    color: #2563EB;
    border-color: rgba(59, 130, 246, 0.18);
}

.conf-badge--estimate {
    background: rgba(217, 119, 6, 0.12);
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.18);
}

/* Sales Card Info Banner */
.app__sales-cockpit-info-banner {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--surface-2) 100%);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.app__sales-cockpit-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.app__sales-cockpit-info-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__sales-cockpit-info-badge--segment {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary);
}

.app__sales-cockpit-info-badge--provider {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.app__sales-cockpit-info-badge--score {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border-color: #2563EB;
}

/* Action Buttons */
.app__sales-cockpit-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.app__sales-cockpit-action-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app__sales-cockpit-action-btn--primary {
    background: var(--primary);
    color: white;
}

.app__sales-cockpit-action-btn--primary:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app__sales-cockpit-action-btn--secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__sales-cockpit-action-btn--secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Pricing Explanation */
.app__sales-cockpit-pricing-explanation {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    margin-top: 12px;
}

.app__sales-cockpit-pricing-explanation-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.app__sales-cockpit-pricing-explanation-text {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* One Liner */
.app__sales-cockpit-one-liner {
    background: var(--primary-50);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.app__sales-cockpit-one-liner-text {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Next Step CTA */
.app__sales-cockpit-cta-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    min-height: 48px;
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
}

.app__sales-cockpit-cta-btn:hover {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.app__sales-cockpit-cta-btn:active {
    transform: translateY(0);
}

.app__sales-cockpit-timeline-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.app__sales-cockpit-message-preview {
    background: var(--surface-2);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-top: 12px;
    max-width: 100%;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.app__sales-cockpit-message-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app__sales-cockpit-message-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 12px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    min-width: 0;
}

.app__sales-cockpit-copy-btn {
    padding: 6px 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.app__sales-cockpit-copy-btn:hover {
    background: var(--surface-2);
    border-color: var(--primary);
}

.app__sales-cockpit-copy-btn--success {
    background: var(--success) !important;
    color: white !important;
    border-color: var(--success) !important;
}

/* Pricing Details */
.app__sales-cockpit-pricing-container {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.app__sales-cockpit-pricing-header {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-2);
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.app__sales-cockpit-pricing-header:hover {
    background: var(--surface);
}

.app__sales-cockpit-pricing-icon {
    font-size: 10px;
    color: var(--muted);
    transition: transform 0.2s;
}

.app__sales-cockpit-pricing-content {
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.app__sales-cockpit-pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    min-width: 0;
}

.app__sales-cockpit-pricing-row:last-child {
    border-bottom: none;
}

.app__sales-cockpit-pricing-label {
    font-size: 13px;
    color: var(--muted);
    flex-shrink: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.app__sales-cockpit-pricing-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
    white-space: nowrap;
}

.app__sales-summary-insights,
.app__sales-summary-script,
.app__sales-summary-questions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app__sales-summary-insights li,
.app__sales-summary-script li,
.app__sales-summary-questions li {
    padding: 8px 0 8px 24px;
    position: relative;
    line-height: 1.6;
    color: var(--text);
}

.app__sales-summary-insights li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: var(--primary);
    font-weight: bold;
}

.app__sales-summary-script li::before {
    content: '💬';
    position: absolute;
    left: 0;
}

.app__sales-summary-questions li::before {
    content: '❓';
    position: absolute;
    left: 0;
}

.app__sales-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.app__sales-summary-card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.app__sales-summary-card--opportunity {
    background: #F0FDF4;
    border-color: #16A34A;
}

.app__sales-summary-card--risk {
    background: #FEF2F2;
    border-color: #DC2626;
}

.app__sales-summary-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.app__sales-summary-security {
    padding: 16px;
    background: var(--surface-2);
    border-radius: 6px;
    border-left: 3px solid var(--warning);
}

.app__sales-summary-security-risk {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.app__sales-summary-security ul {
    margin: 12px 0;
    padding-left: 24px;
}

.app__sales-summary-security li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.app__sales-summary-offer {
    padding: 16px;
    background: var(--surface-2);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.app__sales-summary-offer-tier {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-700);
}

.app__sales-summary-offer > div {
    margin-bottom: 8px;
    line-height: 1.5;
}

.app__sales-summary-offer-recommendation {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-style: italic;
    color: var(--muted);
}

.app__sales-summary-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    font-size: 14px;
    color: var(--muted);
}

.app__sales-summary-metadata strong {
    color: var(--text);
    margin-right: 4px;
}

/* Row Actions */
.app__row-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.app__row-action-btn {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.app__row-action-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.app__row-action-btn:hover {
    background: var(--surface-2);
    border-color: var(--primary);
    color: var(--primary);
}

.app__row-action-btn--primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.app__row-action-btn--primary:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
    color: white;
}

/* ============================================
   Kebab Menu (Row Actions Dropdown)
   ============================================ */

.app__row-actions-dropdown {
    position: relative;
    display: inline-block;
}

.app__row-action-btn--kebab {
    padding: 0;
    min-width: auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.app__row-action-btn--kebab .app__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.app__row-actions-menu {
    /* Menu is portaled to body via JavaScript */
    position: fixed; /* Fixed to viewport, not parent */
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 10000; /* Above modals (1000), drawer (85), toast (10001) */
    display: none;
    flex-direction: column;
    padding: 4px;
    gap: 2px;
    /* Ensure menu is not clipped by overflow containers */
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth appearance */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.app__row-actions-menu.show {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.app__row-action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    width: 100%;
}

.app__row-action-menu-item:hover {
    background: var(--surface-2);
    color: var(--primary);
}

.app__row-action-menu-item:focus {
    outline: none;
    background: var(--surface-2);
    box-shadow: 0 0 0 2px var(--primary-50);
}

.app__row-action-menu-item .app__icon {
    flex-shrink: 0;
    color: var(--muted);
}

.app__row-action-menu-item:hover .app__icon {
    color: var(--primary);
}

/* Icon Styles */
.app__icon {
    display: inline-block;
    vertical-align: middle;
    stroke: currentColor;
    fill: none;
}

.app__kpi-label .app__icon {
    margin-right: 6px;
    color: var(--muted);
}


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

.app__form-input::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

.app__form-hint {
    font-size: 12px;
    color: var(--muted);
}

.app__form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.app__form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.app__form-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.app__form-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.app__form-btn--primary {
    background: var(--primary);
    color: white;
}

.app__form-btn--primary:hover:not(:disabled) {
    background: var(--primary-700);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.app__form-btn:not(.app__form-btn--primary) {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.app__form-btn:not(.app__form-btn--primary):hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--primary);
}

.app__form-btn--danger {
    background: var(--danger);
    color: white;
}

.app__form-btn--danger:hover:not(:disabled) {
    background: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

.app__archive-message {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.app__form-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.app__form-message {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    display: none;
    margin-top: 12px;
}

.app__form-message[style*="block"] {
    border-left: 3px solid transparent;
}

.app__form-message--success {
    background: #F0FDF4;
    color: #166534;
    border-left-color: var(--success);
}

.app__form-message--error {
    background: #FEF2F2;
    color: #991B1B;
    border-left-color: var(--danger);
}

.app__form-message--info {
    background: var(--primary-50);
    color: var(--primary);
    border-left-color: var(--primary);
}

/* ============================================
   Partner Center Detail Modal
   ============================================ */

.app__pc-detail-loading,
.app__pc-detail-error {
    text-align: center;
    padding: 40px 20px;
}

.app__pc-detail-loading .app__loading-spinner {
    margin: 0 auto 16px;
}

.app__pc-detail-error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.app__pc-detail-error h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.app__pc-detail-error p {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 20px;
}

.app__pc-detail-section {
    margin-bottom: 32px;
}

.app__pc-detail-section:last-child {
    margin-bottom: 0;
}

.app__pc-detail-section--two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .app__pc-detail-section--two-col {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.app__pc-detail-col-title,
.app__pc-detail-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.app__pc-detail-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app__pc-detail-info-item {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

.app__pc-detail-info-item strong {
    display: inline-block;
    min-width: 140px;
    color: var(--muted);
    font-weight: 500;
    margin-right: 8px;
}

.app__pc-detail-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.app__pc-detail-link:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

.app__pc-detail-team-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.app__pc-detail-team-item {
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.app__pc-detail-team-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.app__pc-detail-team-email,
.app__pc-detail-team-phone,
.app__pc-detail-team-role {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.app__pc-detail-empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.app__form-message--warning {
    background: #FFFBEB;
    color: #92400E;
    border-left-color: var(--warning);
}

/* Progress Bar */
.app__form-progress {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.app__progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.app__progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.app__progress-text {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    font-weight: 500;
}

/* Notes Textarea */
.app__notes-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    background: var(--surface);
    color: var(--text);
}

.app__notes-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

/* Timeline */
.app__timeline-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.app__timeline-date {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.app__timeline-event {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.app__timeline-detail {
    font-size: 13px;
    color: var(--muted);
}

/* Footer */
.app-footer {
    margin-top: 16px;
    padding: 10px 16px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.app-footer strong {
    color: #0f172a;
    font-weight: 700;
}

.app__footer-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.app__footer-link:hover {
    color: #0f172a;
    text-decoration: underline;
}

/* ============================================
   Help Modal
   ============================================ */

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-modal.hidden {
    display: none;
}

.help-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.help-modal__container {
    position: relative;
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 900px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 20001;
}

.help-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

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

.help-modal__close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-modal__close:hover {
    background: var(--surface-2);
    color: var(--text);
}

.help-modal__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-modal__search {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.help-modal__search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s;
}

.help-modal__search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.help-modal__content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.help-modal__sidebar {
    width: 300px;
    border-right: 1px solid var(--border);
    background: var(--surface-2);
    overflow-y: auto;
    flex-shrink: 0;
}

.help-modal__list {
    padding: 8px;
}

.help-article-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.help-article-item:hover {
    background: var(--surface);
    border-color: var(--border);
}

.help-article-item.active {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary-700);
}

.help-article-item__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: inherit;
}

.help-article-item__meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.help-article-item__category {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.help-article-item.active .help-article-item__category {
    background: var(--primary);
    color: white;
}

.help-modal__main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--surface);
}

.help-modal__article {
    max-width: 800px;
    margin: 0 auto;
}

.help-article-content {
    line-height: 1.7;
}

.help-article-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.help-article-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-top: 32px;
    margin-bottom: 16px;
}

.help-article-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 12px;
}

.help-article-content p {
    margin-bottom: 16px;
    color: var(--text);
}

.help-article-content ul,
.help-article-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.help-article-content li {
    margin-bottom: 8px;
    color: var(--text);
}

.help-article-content code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--primary-700);
}

.help-article-content pre {
    background: var(--surface-2);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.help-article-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text);
}

.help-section {
    margin-bottom: 32px;
}

.help-numbered-list {
    list-style: decimal;
    padding-left: 24px;
}

.help-numbered-list li {
    margin-bottom: 12px;
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 14px;
}

.help-table thead {
    background: var(--surface-2);
}

.help-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

.help-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.help-table tbody tr:hover {
    background: var(--surface-2);
}

.help-warning {
    background: #FEF3C7;
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 4px;
    color: #92400E;
}

.help-tip {
    background: #D1FAE5;
    border-left: 4px solid var(--success);
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 4px;
    color: #065F46;
}

.help-snippet {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
}

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

.help-snippet__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.help-snippet__copy {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.help-snippet__copy:hover {
    background: var(--primary-700);
}

.help-snippet__copy:active {
    transform: scale(0.98);
}

.help-snippet__copy.copied {
    background: var(--success);
}

.help-snippet__content {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-all;
    background: var(--surface);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.help-snippet__message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--text);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.help-snippet__message.show {
    opacity: 1;
}

/* Responsive: Mobile */
@media (max-width: 768px) {
    .help-modal__container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .help-modal__content {
        flex-direction: column;
    }

    .help-modal__sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .help-modal__main {
        flex: 1;
        overflow-y: auto;
    }
}

/* Mobile Optimization - Enhanced Responsive Styles */
@media (max-width: 768px) {
    /* Header - Compact layout */
    .app__header-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .app__header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .app__header-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 44px; /* Touch-friendly */
    }
    
    /* Filters - Stack vertically */
    .app__filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .app__filters-group {
        width: 100%;
    }
    
    .app__search-input,
    .app__filter-select,
    .app__filter-input {
        width: 100%;
        min-height: 44px; /* Touch-friendly */
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Table - Hide on mobile, show card view */
    .app__table-container {
        display: none;
    }
    
    /* Mobile Card View */
    .app__mobile-cards {
        display: block;
    }
    
    .app__mobile-card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-sm);
    }
    
    .app__mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }
    
    .app__mobile-card-header h3 {
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
        margin: 0;
        flex: 1;
    }
    
    .app__mobile-card-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
        font-size: 14px;
        color: var(--text);
    }
    
    .app__mobile-card-body > div {
        display: flex;
        justify-content: space-between;
    }
    
    .app__mobile-card-body strong {
        color: var(--muted);
        font-weight: 500;
        margin-right: 8px;
    }
    
    .app__mobile-card-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .app__mobile-card-actions button {
        flex: 1;
        min-width: 120px;
        min-height: 44px; /* Touch-friendly */
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .app__mobile-card-btn {
        padding: 10px 16px;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--surface);
        color: var(--text);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        min-height: 44px; /* Touch-friendly */
    }
    
    .app__mobile-card-btn--primary {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }
    
    .app__mobile-card-btn--primary:hover {
        background: var(--primary-700);
    }
    
    .app__mobile-card-btn:hover {
        background: var(--hover);
    }
    
    /* Bulk bar - Stack on mobile */
    .app__bulk-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .app__bulk-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .app__bulk-btn {
        width: 100%;
        min-height: 44px; /* Touch-friendly */
    }
    
    /* Pagination - Touch-friendly */
    .app__pagination {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .app__pagination-center {
        display: flex;
        justify-content: center;
        gap: 12px;
    }
    
    .app__pagination-btn {
        min-width: 80px;
        min-height: 44px; /* Touch-friendly */
        padding: 10px 16px;
    }
    
    /* KPI Dashboard - Stack on mobile */
    .app__kpi-dashboard {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .app__kpi-card {
        padding: 12px;
    }
    
    /* Drawer - Full screen on mobile */
    .app__drawer {
        width: 100vw;
        max-width: 100vw;
    }
    
    /* Modal - Full screen on mobile */
    .app__modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    /* Bulk progress modal - Full screen on mobile */
    .app__bulk-progress-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Desktop - Hide mobile cards */
@media (min-width: 769px) {
    .app__mobile-cards {
        display: none;
    }
}

/* Tablet (768px-1023px) - Table with horizontal scroll */
@media (min-width: 769px) and (max-width: 1023px) {
    .app__table-container {
        overflow-x: auto;
    }
    
    .app__table {
        min-width: 800px;
    }
}

/* Very small mobile (<480px) */
@media (max-width: 480px) {
    .app__kpi-dashboard {
        grid-template-columns: 1fr;
    }
    
    .app__header-title {
        font-size: 14px;
    }
    
    .app__header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .app__mobile-card {
        padding: 12px;
    }
    
    .app__mobile-card-actions {
        flex-direction: column;
    }
    
    .app__mobile-card-actions button {
        width: 100%;
    }
}

