@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4A2C7A;
    --secondary-color: #5EC4E8;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --border-color: #E5E5E5;
    --bg-light: #F8F9FA;
    --bg-white: #FFFFFF;
    --success-color: #10B981;
    --error-color: #EF4444;
    --hover-bg: #F3F4F6;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* Login Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-white);
}

.login-card {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 48px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.logo-image {
    max-width: 120px;
    height: auto;
    object-fit: contain;
}

.nav-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 4px;
}

.chatbot-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
}

.chat-avatar-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.login-card h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

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

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-input,
.filter-select {
    padding: 10px 12px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.form-textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.form-group input,
.form-group select,
.form-input,
.form-textarea,
.filter-select {
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-input:focus,
.form-textarea:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.role-select {
    width: 100%;
}

.checkbox-group {
    margin-top: -8px;
}

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

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Buttons */
.btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: #3A2260;
}

.btn-primary:active {
    background: #2A1638;
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}

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

.btn-full {
    width: 100%;
    margin-top: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-ghost {
    border: 1px solid rgba(74, 44, 122, 0.18);
    background: transparent;
    color: var(--primary-color);
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: rgba(74, 44, 122, 0.08);
    border-color: var(--primary-color);
}

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

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

.error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 8px;
}

.success-message {
    color: var(--success-color);
    font-size: 13px;
    margin-top: 8px;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #fff 0%, #fafbff 100%);
    padding: 0 32px;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(74,44,122,0.06);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.nav-role-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

.logout-btn:hover {
    background: var(--hover-bg);
    border-color: var(--text-secondary);
}

/* Portal Content */
.portal-content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-description {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

.card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.card-header h3 {
    margin-bottom: 0;
}

/* Tabs */
.portal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.portal-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -1px;
    letter-spacing: 0.01em;
    flex-shrink: 0;
    border-radius: 6px 6px 0 0;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(74, 44, 122, 0.05);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: slideUp 0.2s ease;
}

/* Extra safety: sub-tabs inside Manage Tasks never bleed onto other tabs */
#bossManageTasksTab:not(.active) .manage-sub-tabs,
#bossManageTasksTab:not(.active) .manage-sub-content {
    display: none !important;
}

/* Upload Section */
.upload-section {
    margin-bottom: 24px;
}

.upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 48px;
    text-align: center;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-light);
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: var(--bg-white);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.upload-label svg {
    color: var(--text-secondary);
}

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

.upload-label small {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: normal;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 12px;
}

.url-input {
    display: flex;
    gap: 8px;
}

.url-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.url-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.video-preview {
    margin-top: 16px;
}

.video-preview video {
    width: 100%;
    border-radius: 8px;
    max-height: 400px;
    border: 1px solid var(--border-color);
}

.section-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group .btn-primary,
    .button-group .btn-secondary {
        width: 100%;
    }
}

/* Forms */
.transcription-box,
.form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.sop-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid;
}

.status-message.success {
    background: #ECFDF5;
    color: var(--success-color);
    border-color: #A7F3D0;
}

.status-message.error {
    background: #FEF2F2;
    color: var(--error-color);
    border-color: #FECACA;
}

.status-message.info {
    background: #EFF6FF;
    color: #3B82F6;
    border-color: #BFDBFE;
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 12px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bg-white);
}

/* SOPs List */
.sops-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.sop-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
    background: var(--bg-white);
}

.sop-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
}

.sop-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.sop-card .sop-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.sop-card .sop-content-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    max-height: 80px;
    overflow: hidden;
}

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

/* Schedule Editor */
.schedule-editor {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.day-section {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg-white);
}

.day-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.add-task-btn {
    margin-top: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.add-task-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Task Modal */
.task-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.task-modal {
    background: var(--bg-white);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s;
}

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

.task-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.task-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.task-modal-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.task-modal-body {
    padding: 24px;
}

.task-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

/* slideUp defined at bottom of file */

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

.task-item {
    padding: 12px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item .task-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.task-item .task-remove {
    background: var(--bg-white);
    color: var(--error-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.task-item .task-remove:hover {
    background: var(--error-color);
    color: white;
}

/* Video Library */
.video-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.video-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
    background: var(--bg-white);
}

.video-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
}

.video-card video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-light);
}

.video-card-info {
    padding: 16px;
}

.video-card-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.video-card-info .video-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Chatbot */
.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-light);
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.user .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    display: flex;
    padding: 16px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-send-btn {
    padding: 10px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #3A2260;
}

/* Employee Schedule */
.employee-schedule {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.schedule-day-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg-white);
}

.schedule-day-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.schedule-task {
    padding: 16px;
    background: var(--bg-light);
    border-radius: 6px;
    margin-bottom: 12px;
}

.schedule-task h5 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.schedule-task .task-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Job Queue */
.job-queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-jobs {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 14px;
}

.job-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    background: var(--bg-white);
    transition: all 0.2s;
}

.job-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.job-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.btn-cancel-job:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

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

.job-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.job-icon {
    font-size: 24px;
    line-height: 1;
}

.job-details {
    flex: 1;
}

.job-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.job-file-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.job-status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.job-status-processing {
    background: #DBEAFE;
    color: #1E40AF;
}

.job-status-completed {
    background: #D1FAE5;
    color: #065F46;
}

.job-status-error {
    background: #FEE2E2;
    color: #991B1B;
}

.job-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

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

.job-error {
    font-size: 13px;
    color: var(--error-color);
    margin-top: 8px;
    padding: 8px;
    background: #FEE2E2;
    border-radius: 4px;
}

.job-result {
    font-size: 13px;
    color: var(--success-color);
    margin-top: 8px;
    padding: 8px;
    background: #D1FAE5;
    border-radius: 4px;
}

.job-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .portal-content {
        padding: 16px;
    }

    .portal-tabs {
        overflow-x: auto;
    }

    .schedule-editor {
        grid-template-columns: 1fr;
    }

    .sops-list,
    .video-library {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar {
        padding: 12px 16px;
    }

    .login-card {
        padding: 32px 24px;
    }
}

/* Chatbot Improvements - ChatGPT Style */
.chatbot-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 300px);
    min-height: 600px;
    max-height: 800px;
    background: linear-gradient(180deg, rgba(94, 196, 232, 0.08) 0%, rgba(74, 44, 122, 0.05) 100%);
    border-radius: 16px;
    border: 1px solid rgba(74, 44, 122, 0.08);
    box-shadow: 0 18px 36px rgba(74, 44, 122, 0.08);
    overflow: hidden;
}

.chatbot-header {
    padding: 20px;
    border-bottom: 1px solid rgba(74, 44, 122, 0.08);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.chatbot-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chatbot-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    margin: 0;
}

.chatbot-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0 20px 20px;
    border: 1px solid rgba(74, 44, 122, 0.08);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
}

.chat-messages {
    flex: 1;
    padding: 32px 28px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f9f9fb 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 80%;
    animation: fadeIn 0.3s ease-in;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-white);
    border: 1px solid rgba(74, 44, 122, 0.1);
    box-shadow: 0 6px 16px rgba(74, 44, 122, 0.12);
}

.chat-message.user .chat-avatar {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chat-message.assistant .chat-avatar {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.message-bubble {
    padding: 16px 18px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
    box-shadow: 0 14px 28px rgba(74, 44, 122, 0.08);
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary-color), #6b4ccf);
    color: white;
    border-top-right-radius: 6px;
    box-shadow: 0 12px 24px rgba(74, 44, 122, 0.25);
}

.chat-message.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    border: 1px solid rgba(74, 44, 122, 0.08);
    border-top-left-radius: 6px;
}

.chat-input-wrapper {
    border-top: 1px solid rgba(74, 44, 122, 0.08);
    background: rgba(255, 255, 255, 0.85);
    padding: 18px 20px;
    backdrop-filter: blur(8px);
}

.chat-input-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(74, 44, 122, 0.12);
    border-radius: 26px;
    padding: 10px 16px;
    transition: all 0.2s;
}

.chat-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 44, 122, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    max-height: 140px;
    overflow-y: auto;
    background: transparent;
    padding: 6px 0;
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--primary-color), #6b4ccf);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #5d3ba8, #7b5ae3);
    transform: translateY(-1px) scale(1.02);
}

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

.chat-suggestions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.suggestion-chip {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.typing-pulse {
    color: #aaa;
    font-size: 20px;
    letter-spacing: 3px;
    animation: typingPulse 1.5s ease-in-out infinite;
    display: inline-block;
}
@keyframes typingPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.chat-resource-card {
    margin-top: 18px;
    border: 1px solid rgba(74, 44, 122, 0.12);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 18px 32px rgba(74, 44, 122, 0.08);
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.chat-video-embed {
    position: relative;
    background: #0f172a;
}

.chat-video-embed video {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.chat-resource-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-resource-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-resource-pill {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(74, 44, 122, 0.12);
    color: var(--primary-color);
    text-transform: uppercase;
}

.chat-resource-pill.subtle {
    background: rgba(94, 196, 232, 0.18);
    color: #1f6b8a;
}

.chat-resource-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chat-resource-body p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.chat-resource-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-resource-btn {
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(74, 44, 122, 0.18);
    background: rgba(74, 44, 122, 0.08);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-resource-btn:hover {
    background: linear-gradient(135deg, var(--primary-color), #6b4ccf);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .chatbot-container {
        margin: 0 12px 16px;
    }

    .chat-video-embed video {
        height: 180px;
    }

    .chat-message {
        max-width: 100%;
    }
}

/* Employee Tasks Dashboard */
.tasks-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.task-section-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.task-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.task-section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.task-count {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    transition: all 0.2s;
}

.task-item-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
}

.task-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.task-item-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.task-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.sop-badge {
    background: #DBEAFE;
    color: #1E40AF;
}

.task-badge-task {
    background: #D1FAE5;
    color: #065F46;
}

.task-item-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.task-item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.no-tasks {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 24px;
}

/* ── Employee Task Board ──────────────────────────────────────────────────── */
.task-progress-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.task-progress-text { font-size: 14px; font-weight: 500; margin-bottom: 8px; opacity: 0.95; }
.task-progress-bar-wrap { background: rgba(255,255,255,0.25); border-radius: 8px; height: 6px; }
.task-progress-bar-fill { background: white; border-radius: 8px; height: 6px; transition: width 0.5s ease; }

.task-section-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.task-section-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-light);
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.task-section-tab:hover { border-color: var(--primary-color); color: var(--primary-color); }
.task-section-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.task-section-badge {
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}
.task-section-tab:not(.active) .task-section-badge {
    background: var(--border-color);
    color: var(--text-secondary);
}

.task-section-panel { display: none; }
.task-section-panel.active { display: block; }
.task-section-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.task-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Employee task card */
.emp-task-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.emp-task-card:hover { border-color: var(--primary-color); box-shadow: 0 2px 12px rgba(74,44,122,0.1); }
.emp-task-card.completed { border-color: #10b981; background: #f0fdf4; }
.emp-task-card.completed .emp-task-name { text-decoration: line-through; color: var(--text-secondary); }

.emp-task-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
}
.emp-task-checkbox {
    width: 20px; height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    background: white;
}
.emp-task-checkbox:hover { border-color: var(--primary-color); }
.emp-task-checkbox.checked    { background: #10b981; border-color: #10b981; color: white; font-size: 11px; }
.emp-task-checkbox.submitted  { background: #f59e0b; border-color: #f59e0b; color: white; font-size: 13px; cursor: default; }
.emp-task-checkbox.submitted:hover { border-color: #f59e0b; transform: none; }
.emp-task-checkbox.rejected   { background: #ef4444; border-color: #ef4444; color: white; font-size: 12px; }
.emp-task-card.rejected-task  { border-color: #fca5a5; background: #fff5f5; }
.emp-task-card.rejected-task .emp-task-name { color: #991b1b; }

.emp-task-body { flex: 1; min-width: 0; }
.emp-task-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 3px; }
.emp-task-desc { font-size: 13px; color: var(--text-secondary); margin: 0 0 8px; line-height: 1.4; }
.emp-task-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.emp-task-badge {
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 10px;
    background: var(--primary-soft); color: var(--primary-color);
    border: 1px solid rgba(74,44,122,0.15);
}
.emp-task-badge.due-soon { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.emp-task-badge.overdue  { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.emp-task-badge.done     { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }

.emp-task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.emp-task-expand-btn {
    width: 28px; height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-light);
    cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    color: var(--text-secondary);
}
.emp-task-expand-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

.emp-task-detail {
    display: none;
    border-top: 1px solid var(--border-color);
    padding: 16px;
    background: var(--bg-light);
    gap: 16px;
    flex-direction: column;
}
.emp-task-detail.open { display: flex; }

.emp-task-detail-section { display: flex; flex-direction: column; gap: 6px; }
.emp-task-detail-section label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.emp-task-notes-area {
    font-family: inherit; font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 8px; padding: 10px;
    resize: vertical; min-height: 80px;
    background: white;
}
.emp-task-notes-area:focus { outline: none; border-color: var(--primary-color); }

/* ── Boss Portal Schedule Improvements ───────────────────────────────────── */
.boss-day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.day-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.day-section-header h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-primary); }

.boss-task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* Boss task card (enhanced) */
.boss-task-card {
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 14px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.boss-task-card:hover { border-color: var(--primary-color); box-shadow: 0 2px 8px rgba(74,44,122,0.1); }
.boss-task-card.status-completed { border-left: 3px solid #10b981; }
.boss-task-card.status-pending   { border-left: 3px solid #f59e0b; }
.boss-task-card.status-in-progress { border-left: 3px solid #3b82f6; }

.boss-task-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.boss-task-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0; flex: 1; }
.boss-task-status-chip {
    font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 8px;
    text-transform: uppercase; flex-shrink: 0;
}
.chip-pending    { background: #fef3c7; color: #92400e; }
.chip-completed  { background: #d1fae5; color: #065f46; }
.chip-in-progress { background: #dbeafe; color: #1e40af; }

.boss-task-card-desc { font-size: 12px; color: var(--text-secondary); margin: 0 0 8px; line-height: 1.4; }
.boss-task-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.boss-task-card-actions { display: flex; gap: 6px; }

/* Stats chips in schedule bar */
.schedule-stat-chip {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}
.schedule-stat-chip span { color: var(--primary-color); font-size: 14px; font-weight: 700; }

/* Settings Section */
.settings-section {
    max-width: 600px;
}

.settings-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-group .form-input {
    flex: 1;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

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

.schedule-tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.schedule-tab-btn:hover {
    color: var(--text-primary);
}

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

.schedule-section {
    display: none;
}

.schedule-section.active {
    display: block;
}

/* Task Item Improvements */
.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.task-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(74, 44, 122, 0.1);
}

.task-item-content {
    flex: 1;
}

.task-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.task-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.task-meta-item {
    display: inline-block;
}

.task-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Upload Box Small */
.upload-box-small {
    margin-bottom: 12px;
}

.upload-label-small {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-label-small:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(74, 44, 122, 0.05);
}

.divider-small {
    text-align: center;
    margin: 12px 0;
    position: relative;
}

.divider-small::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border-color);
}

.divider-small span {
    background: var(--bg-white);
    padding: 0 12px;
    color: var(--text-secondary);
    font-size: 12px;
    position: relative;
}

/* FAQs */
.faqs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg-white);
    transition: all 0.2s;
    margin-bottom: 16px;
}

.faq-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
    transform: translateY(-2px);
}

.faq-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.faq-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 16px;
}

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

.faq-answer {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.faq-answer p {
    margin: 0;
    white-space: pre-wrap;
}

.faq-category {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.faq-item-employee {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    background: var(--bg-white);
    transition: all 0.2s;
    margin-bottom: 16px;
}

.faq-item-employee:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(74, 44, 122, 0.1);
}

.faq-question {
    margin-bottom: 12px;
}

.faq-question h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.faq-item-employee .faq-answer {
    color: var(--text-secondary);
    line-height: 1.6;
}

.faq-item-employee .faq-answer p {
    margin: 0;
    white-space: pre-wrap;
}

.no-items {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-style: italic;
}

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

.btn-danger:hover {
    background: #DC2626;
}

/* Clickable Tasks */
.clickable-task {
    cursor: pointer;
}

.clickable-task:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 44, 122, 0.15);
}

.task-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.task-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.status-in-progress {
    background: #DBEAFE;
    color: #1E40AF;
}

.status-completed {
    background: #D1FAE5;
    color: #065F46;
}

.task-description-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.5;
}

/* Task Detail Modal */
.task-detail-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.task-detail-modal {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.task-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.task-detail-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.task-detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-type-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #E0E7FF;
    color: #3730A3;
}

.task-day-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: #F3F4F6;
    color: var(--text-secondary);
}

.task-detail-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.task-detail-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.task-detail-body {
    padding: 24px;
}

.task-detail-section {
    margin-bottom: 24px;
}

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

.task-detail-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.task-video-container {
    margin-top: 12px;
}

.task-loom-link {
    margin-top: 12px;
}

.task-sop-preview {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.task-sop-preview h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.sop-content-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.task-detail-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Task Manager */
.task-manager-container {
    max-width: 1200px;
    margin: 0 auto;
}

.task-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.task-manager-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.task-manager-filters {
    display: flex;
    gap: 12px;
}

.task-manager-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-manager-item {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s;
}

.task-manager-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(74, 44, 122, 0.1);
}

.task-manager-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.task-manager-item-title {
    flex: 1;
}

.task-manager-item-title h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.task-manager-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-manager-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.task-manager-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.task-manager-resources {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.resource-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Categories */
.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.category-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.category-status {
    margin: 12px 0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.category-status.status-success {
    background: #D1FAE5;
    color: #065F46;
}

.category-status.status-error {
    background: #FEE2E2;
    color: #991B1B;
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.category-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(74, 44, 122, 0.1);
}

.category-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* FAQ Modal */
.faq-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.faq-modal {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.faq-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.faq-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.faq-modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.faq-modal-body {
    padding: 24px;
}

.faq-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ─── Boss Suggestion Chip (alias for suggestion-chip) ─── */
.boss-suggestion-chip {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}

.boss-suggestion-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ─── Dashboard Styles ─── */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    border-radius: 12px;
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    position: relative;
    overflow: hidden;
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    letter-spacing: 0.01em;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dashboard-section {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dashboard-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.progress-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    width: 100px;
    flex-shrink: 0;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 24px;
    text-align: right;
}

.dashboard-sop-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.dashboard-sop-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dashboard-sop-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dashboard-sop-category {
    font-size: 11px;
    font-weight: 600;
    background: rgba(74, 44, 122, 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 10px;
}

.dashboard-day-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-day-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    width: 90px;
    flex-shrink: 0;
}

.dashboard-day-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.dashboard-day-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    min-width: 4px;
    transition: width 0.4s ease;
}

.dashboard-day-count {
    font-size: 12px;
    color: var(--text-secondary);
    width: 60px;
    text-align: right;
}

/* ─── SOP Card Video Placeholder ─── */
.sop-card-video-placeholder {
    width: 100%;
    height: 60px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

/* ─── slideUp animation update ─── */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Video Library Grid */
.video-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-library-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.video-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.video-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(74, 44, 122, 0.1);
    transform: translateY(-2px);
}

.video-card-info {
    padding: 16px;
}

.video-card-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.video-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ── Manage Tasks sub-tabs ─────────────────────────── */
.manage-sub-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    flex-wrap: wrap;
}
.manage-sub-tab-btn {
    padding: 8px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: -2px;
    transition: all 0.18s;
    font-family: inherit;
    border-radius: 6px 6px 0 0;
}
.manage-sub-tab-btn:hover { color: var(--text-primary); background: var(--hover-bg); }
.manage-sub-tab-btn.active { color: var(--primary-color); border-bottom-color: var(--primary-color); font-weight: 600; }
.manage-sub-content { display: none; }
.manage-sub-content.active { display: block; animation: slideUp 0.18s ease; }

/* ── Task item enhanced (with thumbnail) ───────────── */
.task-item.enhanced {
    display: grid;
    grid-template-columns: 80px minmax(0,1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
}
.task-thumb {
    width: 80px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
    flex-shrink: 0;
}
.task-thumb-placeholder {
    width: 80px;
    height: 52px;
    border-radius: 6px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.task-item.enhanced .task-item-content {
    min-width: 0;
    overflow: hidden;
}
.task-item.enhanced .task-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}
.task-item.enhanced .task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    overflow: hidden;
}
.task-item.enhanced .task-item-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}
.sop-linked {
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    display: inline-block;
}

/* ── Task manage modal video ───────────────────────── */
.task-manage-video { width: 100%; border-radius: 8px; margin: 12px 0; max-height: 280px; }
.task-manage-sop { background: var(--bg-light); border-radius: 8px; padding: 16px; font-size: 13px; line-height: 1.7; max-height: 300px; overflow-y: auto; white-space: pre-wrap; margin-top: 12px; }

/* ── SOP Viewer Modal ───────────────────────────────── */
.sop-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sop-viewer-modal {
    background: white;
    border-radius: 16px;
    max-width: 780px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: slideUp 0.2s ease;
}
.sop-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}
.sop-viewer-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
}
.sop-viewer-close {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    color: var(--text-muted, #aaa);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.sop-viewer-close:hover { color: var(--text-primary); }
.sop-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}
.sop-viewer-content { font-size: 14px; line-height: 1.85; color: var(--text-secondary); }
.sop-viewer-content h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 18px 0 8px; }
.sop-viewer-content strong { color: var(--text-primary); }
.sop-viewer-content p { margin-bottom: 10px; }
.sop-viewer-content .sop-step {
    padding: 8px 12px 8px 16px;
    border-left: 3px solid var(--primary-color);
    margin: 6px 0;
    background: rgba(74,44,122,0.04);
    border-radius: 0 6px 6px 0;
}
.sop-viewer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
}

/* ── Team Members Card ────────────────────────────── */
.team-member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--bg-white);
    transition: background 0.15s;
}
.team-member-card:hover { background: var(--hover-bg); }
.team-member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #6b4ccf);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}
.team-member-info { flex: 1; margin-left: 12px; min-width: 0; }
.team-member-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.team-member-role {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.role-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(74,44,122,0.1);
    color: var(--primary-color);
}
.role-pill.boss { background: rgba(74,44,122,0.15); color: var(--primary-color); }
.role-pill.employee { background: rgba(94,196,232,0.18); color: #0891b2; }
.team-member-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Training Hub (Employee) ──────────────────────── */
.hub-sub-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-light);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}
.hub-sub-tab-btn {
    padding: 8px 22px;
    background: none;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    white-space: nowrap;
}
.hub-sub-tab-btn:hover { color: var(--text-primary); }
.hub-sub-tab-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 5px rgba(0,0,0,0.09);
}
.hub-sub-content { display: none; }
.hub-sub-content.active { display: block; animation: slideUp 0.18s ease; }

/* ── Hub task search bar ──────────────────────────── */
.hub-task-search {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.hub-task-search input {
    flex: 1;
    min-width: 160px;
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--text-primary);
}
.hub-task-search input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(74,44,122,0.08); }
.hub-task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    background: white;
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}
.hub-task-item:hover { border-color: var(--primary-color); box-shadow: 0 2px 8px rgba(74,44,122,0.08); }
.hub-task-thumb {
    width: 70px;
    height: 46px;
    border-radius: 6px;
    background: var(--bg-light);
    object-fit: cover;
    flex-shrink: 0;
}
.hub-task-thumb-placeholder {
    width: 70px;
    height: 46px;
    border-radius: 6px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.hub-task-info { flex: 1; min-width: 0; }
.hub-task-name { font-weight: 600; font-size: 14px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-task-meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.hub-task-actions { flex-shrink: 0; display: flex; gap: 6px; align-items: center; }
.hub-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(74,44,122,0.08);
    color: var(--primary-color);
}
.hub-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
