:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #f1f5f9;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset & Typography */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    padding: 3rem 1rem;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.logo {
    width: 48px;
    height: 48px;
    background: var(--primary);
    background: linear-gradient(135deg, var(--primary), #a855f7);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

h1 span {
    color: var(--primary);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-title svg {
    color: var(--primary);
}

/* Department pills */
.dept-section {
    margin-bottom: 1.25rem;
}

.dept-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.dept-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 9999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
    transition: transform 0.1s;
}

.dept-pill .remove-dept {
    cursor: pointer;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.dept-pill .remove-dept:hover {
    color: #f43f5e;
}

.add-dept-row {
    display: flex;
    gap: 0.75rem;
}

input[type="text"] {
    background: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-main);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    flex: 1;
    transition: all 0.15s;
}

input[type="text"]:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

input[type="text"]::placeholder {
    color: #94a3b8;
}

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    border: none;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Mapping Sections */
.mapping-section-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.5rem 0 0.5rem 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.unmapped-badge {
    background: #fee2e2;
    color: #ef4444;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Mapping rows */
.mapping-row {
    display: grid;
    grid-template-columns: 1fr 32px 200px;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.mapping-row:last-child {
    border-bottom: none;
}

.task-type-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arrow {
    color: #cbd5e1;
    font-size: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

select {
    background: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

select:focus {
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.save-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.status-msg {
    font-size: 0.9rem;
    font-weight: 600;
    color: #10b981;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-msg.visible {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Search Bar & Pagination */
.search-bar {
    position: relative;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    pointer-events: none;
}

.search-bar input[type="text"] {
    padding-left: 2.75rem;
    width: 100%;
}

.load-more-btn {
    display: block;
    margin: 1.5rem auto 0;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.6rem 1.5rem;
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
}

/* Animations */
@keyframes ild-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ild-spin {
    animation: ild-spin 1.5s linear infinite;
}

@media (max-width: 600px) {
    .mapping-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .arrow {
        display: none;
    }

    select {
        width: 100%;
    }
}