:root {
    /* =========================
       Modern Design System 2024
       ========================= */

    /* Enhanced Color Palette */
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-light: #dbeafe;
    --color-primary-dark: #1e40af;
    
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-secondary-light: #f1f5f9;
    
    --color-accent: #8b5cf6;
    --color-accent-hover: #7c3aed;
    --color-accent-light: #ede9fe;
    
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-success-light: #d1fae5;
    
    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;
    --color-warning-light: #fef3c7;
    
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-light: #fee2e2;
    
    --color-info: #06b6d4;
    --color-info-hover: #0891b2;
    --color-info-light: #cffafe;

    /* Modern Semantic Colors */
    --color-bg: #fafbfc;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;
    --color-surface-hover: #f8fafc;
    
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-border-dark: #cbd5e1;
    
    --color-text: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #ffffff;

    /* Enhanced Radii System */
    --radius-none: 0;
    --radius-xs: 2px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-3xl: 24px;
    --radius-pill: 9999px;
    --radius-full: 50%;

    /* Comprehensive Spacing Scale */
    --space-px: 1px;
    --space-0: 0;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Modern Typography Scale */
    --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Fira Code', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */
    
    --font-weight-thin: 100;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --font-weight-black: 900;
    
    --line-height-none: 1;
    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;

    /* Shadow System */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* Animation & Transition System */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    --transition-bounce: 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;

    /* Legacy compatibility */
    --primary-color: var(--color-primary);
    --secondary-color: var(--color-secondary);
    --background: var(--color-bg);
    --surface: var(--color-surface);
    --border: var(--color-border);
    --text-primary: var(--color-text);
    --text-secondary: var(--color-text-secondary);
    --shadow: var(--shadow-md);
    --success: var(--color-success);
    --warning: var(--color-warning);
    --error: var(--color-danger);
}

/* -------------------------------------------------------------------------- */
/* LEGACY STYLES BELOW                                                        */
/* These rules will be consolidated/refactored to use tokens exclusively.     */
/* Avoid adding hard-coded values beneath this line if possible.              */
/* -------------------------------------------------------------------------- */
/* Phase 1 Merge Note:
   The legacy visual definitions that previously lived in style.css are being
   incrementally merged here. Do not add new component styling to the legacy
   block—prefer token-based, semantic classes above. The original style.css
   file is now considered DEPRECATED and will be removed in Phase 2 after
   verification that no unique selectors remain in use.
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Modern Header */
header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border-light);
    transition: var(--transition-normal);
}

.navbar {
    background: transparent;
    padding: var(--space-4) 0;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-logo {
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    transition: var(--transition-normal);
    filter: drop-shadow(var(--shadow-sm));
    border-radius: var(--radius-sm);
}

.nav-logo:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    filter: drop-shadow(var(--shadow-md));
}

/* Modern Responsive Design */
@media (max-width: 768px) {
    .nav-logo {
        height: 36px;
        max-width: 160px;
    }
    
    .nav-container {
        padding: 0 var(--space-4);
        gap: var(--space-3);
    }
    
    .container {
        padding: var(--space-6) var(--space-4);
    }
    
    .stats-section {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: var(--space-4);
    }
    
    .stat-card {
        padding: var(--space-6);
    }
}

@media (max-width: 480px) {
    .nav-logo {
        height: 32px;
        max-width: 140px;
    }
    
    .container {
        padding: var(--space-4) var(--space-3);
    }
    
    .stats-section {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    
    .stat-card {
        padding: var(--space-5);
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }
    
    .stat-card i {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }
}

.nav-actions {
    display: flex;
    gap: 1rem;
}

/* Modern Layout System */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    width: 100%;
    overflow-x: hidden;
}

.container-fluid {
    width: 100%;
    padding: var(--space-8) var(--space-4);
}

.container-sm {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
}

.container-lg {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-8);
}

/* Modern Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-10);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--color-border-dark);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-content {
    flex: 1;
}

.stat-card h3 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0;
    line-height: var(--line-height-tight);
}

.stat-card p {
    color: var(--color-text-secondary);
    margin: var(--space-1) 0 0 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* Filters Section */
.filters-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-export {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-export:hover {
    background: #059669;
}

/* Table Section */
.table-section {
    background: var(--surface);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.table-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Modern Table Design */
.table-container {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    background: var(--color-bg);
    padding: var(--space-4) var(--space-5);
    text-align: left;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    vertical-align: top;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

/* Better column sizing - more flexible than fixed widths */
th:nth-child(1), td:nth-child(1) { width: 50px; } /* Checkbox */
th:nth-child(2), td:nth-child(2) { width: 120px; } /* Date */
th:nth-child(3), td:nth-child(3) { min-width: 200px; max-width: 300px; } /* Title */
th:nth-child(4), td:nth-child(4) { min-width: 150px; max-width: 200px; } /* Location (combined) */
th:nth-child(5), td:nth-child(5) { min-width: 150px; max-width: 250px; } /* Recruiter */
th:nth-child(6), td:nth-child(6) { width: 100px; } /* Contact */
th:nth-child(7), td:nth-child(7) { width: 80px; } /* Source */
th:nth-child(8), td:nth-child(8) { width: 120px; } /* Actions */

/* Combined Location Column Styles */
.location-cell {
    vertical-align: top;
    padding: var(--space-3) var(--space-4) !important;
}

.location-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.location-main {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    line-height: 1.3;
}

.location-region {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-normal);
    line-height: 1.2;
    padding: var(--space-1) var(--space-2);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
    display: inline-block;
    max-width: fit-content;
}

/* Only apply responsive changes on very small screens */
@media (max-width: 640px) {
    .table-container {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: var(--space-3) var(--space-4);
    }
    
    /* Slightly reduce column widths on small screens */
    th:nth-child(3), td:nth-child(3) { min-width: 150px; max-width: 250px; } /* Title */
    th:nth-child(4), td:nth-child(4) { min-width: 120px; max-width: 180px; } /* Location (combined) */
    th:nth-child(5), td:nth-child(5) { min-width: 120px; max-width: 200px; } /* Recruiter */
}


/* Table row hover effects */
tbody tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: var(--color-surface-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.25rem; /* room for indicator */
}

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

/* Generic indicator (hidden by default until sorted) */
.sortable::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.55rem;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transform: translateY(-50%);
    opacity: 0.35;
    transition:
        transform var(--transition-fast),
        opacity var(--transition-fast),
        border-top-color var(--transition-fast);
    pointer-events: none;
}

/* Ascending (A → Z, oldest → newest) */
.sortable[aria-sort="ascending"]::after,
.sortable.sorted-asc::after {
    opacity: 1;
    transform: translateY(-40%) rotate(180deg);
    border-top-color: var(--text-primary);
}

/* Descending (Z → A, newest → oldest) */
.sortable[aria-sort="descending"]::after,
.sortable.sorted-desc::after {
    opacity: 1;
    transform: translateY(-60%);
    border-top-color: var(--text-primary);
}

/* Focus outline for keyboard navigation */
.sortable:focus {
    outline: 2px solid var(--color-accent, var(--primary-color));
    outline-offset: 2px;
}

/* Optional hover emphasis when sortable */
.sortable:not([aria-sort]):hover::after {
    opacity: 0.55;
}

tr:hover {
    background: var(--background);
}

.vacancy-title {
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
}

.vacancy-title:hover {
    text-decoration: underline;
}

.vacancy-company,
.vacancy-location {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.vacancy-salary {
    color: var(--success);
    font-weight: 600;
}

.action-buttons {
    padding: var(--space-2) !important;
    min-width: 140px;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-1);
    width: 100%;
}

.action-buttons-grid .btn {
    min-width: 32px;
    height: 32px;
    padding: var(--space-1);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.action-buttons-grid .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-buttons-grid .btn i {
    font-size: 0.75rem;
}

/* Comments Section - Separate row below table */
.comments-row {
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border-light);
}

.comments-section {
    padding: var(--space-4) !important;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border-light);
}

.comments-section .comment-container {
    max-width: none;
    width: 100%;
}

.comment-container {
    position: relative;
    width: 100%;
}

/* Comment Preview Styles */
.comment-preview {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: 0;
    max-width: 600px;
}

.comment-preview:hover {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.comment-preview i {
    color: var(--color-primary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.comment-preview:hover i {
    color: var(--color-text-inverse);
}

.comment-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.comment-text:hover {
    text-decoration: underline;
}

.edit-comment-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.edit-comment-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.comment-preview:hover .edit-comment-btn {
    color: var(--color-text-inverse);
}

/* Add Comment Button */
.add-comment-btn {
    width: auto;
    min-width: 200px;
    padding: var(--space-3) var(--space-4);
    border: 2px dashed var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.add-comment-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.add-comment-btn i {
    font-size: 0.75rem;
}

/* Comment Editor */
.comment-editor {
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10;
}

.comment-textarea {
    width: 100%;
    min-height: 60px;
    max-height: 120px;
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    resize: vertical;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.2s ease;
}

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

.comment-textarea::placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

.comment-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
    justify-content: flex-end;
    flex-wrap: wrap;
}

.comment-actions .btn {
    font-size: 0.75rem;
    padding: var(--space-2) var(--space-3);
    min-width: auto;
}

/* Responsive Comments */
@media (max-width: 768px) {
    .comments-section {
        padding: var(--space-3) !important;
    }
    
    .comment-preview {
        padding: var(--space-2);
        font-size: 0.8rem;
        max-width: 100%;
    }
    
    .comment-text {
        font-size: 0.8rem;
    }
    
    .comment-editor {
        padding: var(--space-2);
    }
    
    .comment-textarea {
        min-height: 50px;
        font-size: 0.8rem;
    }
    
    .comment-actions {
        margin-top: var(--space-2);
        gap: var(--space-1);
    }
    
    .comment-actions .btn {
        font-size: 0.7rem;
        padding: var(--space-1) var(--space-2);
    }
    
    .add-comment-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 640px) {
    .comments-section {
        padding: var(--space-2) !important;
    }
    
    .comment-preview {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
        text-align: left;
        max-width: 100%;
    }
    
    .comment-text {
        width: 100%;
    }
    
    .comment-actions {
        justify-content: center;
        width: 100%;
    }
    
    .location-cell {
        padding: var(--space-2) var(--space-3) !important;
    }
    
    .location-info {
        gap: var(--space-1);
    }
    
    .location-main {
        font-size: var(--font-size-xs);
    }
    
    .location-region {
        font-size: 0.7rem;
        padding: var(--space-1);
    }
}

/* Comment Modal Styles */
#comment-modal .modal-content {
    max-width: 600px;
    width: 90%;
}

.comment-full-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: var(--space-4);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    max-height: 400px;
    overflow-y: auto;
}

/* Fix comment editor spacing */
.comment-editor {
    margin-bottom: 0; /* Remove bottom margin to prevent spacing issues */
}

/* Removed old btn-icon styles - now using action-buttons-grid */

/* Modern Button Styles */
.btn,
.btn-primary,
.btn-secondary,
.btn-warning,
.btn-danger,
.btn-success,
.btn-info,
.btn-outline-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background: linear-gradient(
        135deg,
        var(--primary-color),
        var(--primary-hover)
    );
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(37, 99, 235, 0.4);
}

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

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

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(16, 185, 129, 0.4);
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(59, 130, 246, 0.4);
}

.btn-outline-danger {
    background: transparent;
    color: var(--error);
    border: 2px solid var(--error);
}

.btn-outline-danger:hover {
    background: var(--error);
    color: white;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Multi-Select Filter Styles */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 2.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.multi-select-header:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #f8fafc;
}

.multi-select-header i {
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.multi-select-header.active i {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--surface);
    border: 2px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: var(--shadow-lg);
    margin-top: -1px;
    display: flex;
    flex-direction: column;
    /* Let the internal list own the scrolling; container grows to footer + list */
    max-height: none;
    overflow: hidden;
}

.multi-select-search {
    padding: 1rem;
    border-bottom: 2px solid #f1f5f9;
    background-color: #f8fafc;
}

.multi-select-search input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--surface);
    transition: all 0.2s ease;
}

.multi-select-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--surface);
}

.multi-select-options {
    flex: 1 1 auto;
    /* Fixed scrollable region so footer never overlaps; adjust height as needed */
    max-height: 260px;
    overflow-y: auto;
    padding: 0.25rem 0;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.multi-select-options::-webkit-scrollbar {
    width: 6px;
}

.multi-select-options::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.multi-select-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.multi-select-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
    min-height: 2.4rem;
    line-height: 1.25;
}

#recruiter-dropdown.multi-select-dropdown {
    width: 340px;
    max-width: calc(100vw - 2rem);
}

#source-dropdown.multi-select-dropdown {
    width: 340px;
    max-width: calc(100vw - 2rem);
}


.multi-select-option:last-child {
    border-bottom: none;
}

.multi-select-option:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

.multi-select-option.selected {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.multi-select-option input[type="checkbox"] {
    margin-right: 0.75rem;
    margin-left: 0;
    accent-color: var(--primary-color);
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    border: 2px solid #cbd5e1;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.multi-select-option input[type="checkbox"]:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.multi-select-option input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.multi-select-option .option-text {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.25;
    transition: color 0.15s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.multi-select-option.selected .option-text {
    font-weight: 600;
    color: var(--primary-color);
}

.multi-select-option .option-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    padding: 0.2rem 0.55rem;
    border-radius: 1rem;
    margin-left: auto;
    min-width: 2rem;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.multi-select-option:hover .option-count {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.multi-select-option.selected .option-count {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.multi-select-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--background);
    flex-shrink: 0;
}

.multi-select-footer .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.65rem;
    padding: 0.45rem 0.5rem;
    display: inline-flex;
    justify-content: center;
    line-height: 1.1;
}

@media (max-width: 600px) {
    .multi-select-footer .btn {
        font-size: 0.6rem;
        padding: 0.4rem 0.4rem;
    }
}

/* Enhanced action button styles */
.btn-outline-warning {
    background: transparent;
    color: #f59e0b;
    border: 1px solid #f59e0b;
    transition: all 0.2s ease;
}

.btn-outline-warning:hover,
.btn-outline-warning.active {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(245, 158, 11, 0.3);
}

.btn-outline-success {
    background: transparent;
    color: #10b981;
    border: 1px solid #10b981;
    transition: all 0.2s ease;
}

.btn-outline-success:hover,
.btn-outline-success.active {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(16, 185, 129, 0.3);
}

.btn-outline-danger:hover,
.btn-outline-danger.active {
    background: var(--error);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(239, 68, 68, 0.3);
}

/* Modern View Tabs */
.view-tabs {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-8);
    padding: var(--space-2);
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.tab-btn {
    padding: var(--space-3) var(--space-6);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: var(--radius-xl);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    text-align: center;
    justify-content: center;
}

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

.tab-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}

.tab-btn.active:hover {
    background: var(--color-primary-hover);
}

.tab-btn.active i {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tab-btn i {
    font-size: 1rem;
    transition: all 0.2s ease;
}

.tab-count {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    opacity: 0.8;
    margin-left: var(--space-1);
}

.tab-btn.active .tab-count {
    opacity: 1;
    font-weight: var(--font-weight-medium);
}

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

.pagination button {
    padding: 0.75rem 1.5rem;
    border: none;
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination button:not(:disabled):hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px 0 rgba(37, 99, 235, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.3s ease-out;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background-color: var(--color-surface);
    margin: 5% auto;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    position: relative;
    z-index: calc(var(--z-modal) + 1);
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    transform: translateY(0);
}


.modal-header {
    padding: var(--space-6) var(--space-8);
    border-bottom: 1px solid var(--color-border-light);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: var(--color-text-inverse);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    position: relative;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--color-text-inverse);
    font-size: var(--font-size-lg);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.modal-body {
    padding: var(--space-8);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: var(--space-6) var(--space-8);
    border-top: 1px solid var(--color-border-light);
    background-color: var(--color-surface-hover);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Vacancy Details Styling */
.vacancy-details {
    display: grid;
    gap: 1.5rem;
}

.vacancy-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.vacancy-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.vacancy-info-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vacancy-info-value {
    color: var(--text-primary);
    font-size: 1rem;
    word-break: break-word;
}

.vacancy-description {
    margin-top: 1rem;
}

.vacancy-description-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.vacancy-description-content {
    background-color: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    color: var(--text-primary);
}

.vacancy-description-content h1,
.vacancy-description-content h2,
.vacancy-description-content h3,
.vacancy-description-content h4,
.vacancy-description-content h5,
.vacancy-description-content h6 {
    color: var(--primary-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.vacancy-description-content h1:first-child,
.vacancy-description-content h2:first-child,
.vacancy-description-content h3:first-child,
.vacancy-description-content h4:first-child,
.vacancy-description-content h5:first-child,
.vacancy-description-content h6:first-child {
    margin-top: 0;
}

.vacancy-description-content ul,
.vacancy-description-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.vacancy-description-content li {
    margin: 0.25rem 0;
}

.vacancy-description-content p {
    margin: 0.75rem 0;
}

.vacancy-description-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.vacancy-link {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--surface-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.vacancy-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

.vacancy-link a:hover {
    text-decoration: underline;
}

/* Action buttons in modal */
.modal-footer .btn {
    min-width: 120px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.modal-footer .btn i {
    margin-right: 0.5rem;
}

.modal-footer .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Status indicators */
.vacancy-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.vacancy-status.starred {
    background-color: rgba(255, 193, 7, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.vacancy-status.processed {
    background-color: rgba(34, 197, 94, 0.1);
    color: #059669;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.vacancy-status.flagged {
    background-color: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Enhanced scrollbar for description */
.vacancy-description-content::-webkit-scrollbar {
    width: 8px;
}

.vacancy-description-content::-webkit-scrollbar-track {
    background: var(--surface-secondary);
    border-radius: 4px;
}

.vacancy-description-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.vacancy-description-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Modern Loading States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
    color: var(--color-text-secondary);
    gap: var(--space-4);
}

.loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-light);
    border-top: 3px solid var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.loading p {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin: 0;
}

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

/* Bulk Actions */
.bulk-actions {
    background: var(--background);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.bulk-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.bulk-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Enhanced Table Responsiveness */
.table-container {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .view-tabs {
        flex-wrap: wrap;
    }

    .bulk-buttons {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .table-container {
        font-size: 0.875rem;
    }

    th,
    td {
        padding: 0.5rem 0.25rem;
    }

    .action-buttons {
        min-width: 120px;
    }
    
    .action-buttons-grid {
        gap: var(--space-1);
    }
    
    .action-buttons-grid .btn {
        min-width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .action-buttons-grid .btn i {
        font-size: 0.7rem;
    }

    .view-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.5rem 1rem;
    }

    .bulk-actions {
        padding: 0.75rem;
    }

    .bulk-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .bulk-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .bulk-buttons .btn {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .modal-content {
        margin: 1% auto;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-title {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .vacancy-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .vacancy-description-content {
        max-height: 300px;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .filter-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .pagination button {
        width: 100%;
        justify-content: center;
    }

    table {
        min-width: 600px;
    }

    .view-tabs {
        padding: 0.25rem;
    }

    .tab-btn {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

/* =========================================================
   A11y / Skip Link & Utility Visibility Helpers (Phase 1)
   ========================================================= */

.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    border: 0;
}

.skip-link:focus,
.skip-link:active {
    position: fixed;
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.75rem 1rem;
    background: var(--color-primary);
    color: #fff;
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: var(--z-modal);
    clip: auto;
    clip-path: none;
    white-space: normal;
}

/* Screen-reader only (non-focusable) */
.sr-only,
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Allow element to become visible on focus */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: initial !important;
    margin: initial !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
}

/* High-contrast focus outline utility */
.focus-outline:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* Reduced motion preference helper (can wrap transitions) */
@media (prefers-reduced-motion: reduce) {
    .no-motion,
    .reduce-motion {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   PRESET MANAGEMENT STYLES
   ============================================================================ */

.preset-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.preset-section h3 {
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.preset-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
}

.preset-select-group,
.preset-save-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.preset-select-group label,
.preset-save-group label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.preset-select-container {
    display: flex;
    gap: var(--space-2);
    align-items: flex-end;
}

.preset-select-container select {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast);
}

.preset-select-container select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.preset-save-group input[type="text"] {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast);
}

.preset-save-group input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.preset-save-options {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-surface);
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.preset-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Modern Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-none);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    position: relative;
    overflow: hidden;
}

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

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary-dark) 100%);
    border-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    border-color: #475569;
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
}

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

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    border-color: #d97706;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
}

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

.btn-outline-danger:hover:not(:disabled) {
    background: var(--color-danger);
    color: white;
}

/* Responsive design for preset controls */
@media (max-width: 768px) {
    .preset-controls {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .preset-select-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .preset-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================================================================
   AGENCY MANAGEMENT STYLES
   ============================================================================ */

.agency-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.agency-section h3 {
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.agency-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
    align-items: start;
}

.agency-select-group,
.agency-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    width: 100%;
}

.agency-select-group label,
.agency-list label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.agency-select-container {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
    margin-top: var(--space-2);
}

.agency-select-container .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.agency-select-container select {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--color-surface);
    color: var(--color-text);
    max-width: 250px;
    min-width: 150px;
}

.agency-select-container select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.agency-list-container {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: var(--space-2);
    width: 100%;
    box-sizing: border-box;
}

.agency-list-container .agency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    transition: all 0.2s ease;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.agency-list-container .agency-item:last-child {
    margin-bottom: 0;
}

.agency-list-container .agency-item:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.agency-list-container .agency-item .agency-name {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: var(--space-2);
}

.agency-list-container .agency-item .agency-remove {
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
    flex-shrink: 0;
}

.agency-list-container .agency-item .agency-remove:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.agency-list-container .text-muted {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--space-4);
}

/* Exclusion Keywords Section */
.exclusion-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.exclusion-section h3 {
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.exclusion-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
}

.exclusion-input-group,
.exclusion-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.exclusion-input-group label,
.exclusion-list label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
}

.exclusion-input-container {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

.exclusion-input-container input {
    flex: 1;
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
}

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

.exclusion-list-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-bg);
}

.exclusion-list-container .exclusion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border-light);
    transition: var(--transition-fast);
}

.exclusion-list-container .exclusion-item:last-child {
    border-bottom: none;
}

.exclusion-list-container .exclusion-item:hover {
    background: var(--color-surface-hover);
}

.exclusion-list-container .exclusion-item .exclusion-keyword {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    flex: 1;
}

.exclusion-list-container .exclusion-item .exclusion-remove {
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: background-color 0.2s;
}

.exclusion-list-container .exclusion-item .exclusion-remove:hover {
    background: #dc2626;
}

.exclusion-list-container .text-muted {
    color: var(--color-text-muted);
    font-style: italic;
    text-align: center;
    padding: var(--space-4);
}

/* Responsive design for agency and exclusion controls */
@media (max-width: 768px) {
    .agency-controls,
    .exclusion-controls {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .agency-select-container,
    .exclusion-input-container {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    
    .agency-select-container select {
        max-width: none;
        min-width: auto;
    }
    
    .agency-select-container .btn {
        font-size: 0.8rem;
        padding: var(--space-1) var(--space-2);
    }
    
    .agency-list-container {
        max-height: 120px;
    }
    
    .agency-list-container .agency-item {
        padding: var(--space-2) var(--space-3);
    }
    
    .agency-list-container .agency-item .agency-remove {
        padding: var(--space-1) var(--space-2);
        min-width: 50px;
        font-size: 0.7rem;
    }
}
