/* ── Department Module Shared Styles ─────────────────────────────────────── */

.dept-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dept-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.dept-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dept-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* KPI Row */
.dept-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.dept-kpi {
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Split view (list + detail) */
.dept-split {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 16px;
}

.dept-split-list {
    padding: 0;
    overflow-y: auto;
    max-height: 600px;
}

.dept-split-detail {
    padding: 16px;
}

/* Department list items */
.dept-list-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dept-list-item:hover {
    background: rgba(255,255,255,0.03);
}

.dept-list-item.active {
    background: rgba(255,255,255,0.06);
    border-left: 3px solid var(--accent-green);
}

.dept-list-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dept-list-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

/* Kanzi chat input */
.kanzi-input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.kanzi-input:focus {
    border-color: var(--accent-green);
}

.kanzi-msg {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 80%;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.kanzi-msg-user {
    background: rgba(45,197,140,0.15);
    color: var(--text-primary);
    align-self: flex-end;
    margin-left: auto;
}

.kanzi-msg-ai {
    background: var(--bg-elevated);
    color: var(--text-primary);
    align-self: flex-start;
}

/* Department table */
.dept-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dept-table th {
    text-align: left;
    padding: 8px 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dept-table td {
    padding: 10px 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.dept-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* Responsive */
@media (max-width: 768px) {
    .dept-split {
        grid-template-columns: 1fr;
    }
    .dept-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .dept-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .dept-actions {
        width: 100%;
    }
    .dept-actions select,
    .dept-actions button {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .dept-kpi-row {
        grid-template-columns: 1fr 1fr;
    }
    .kpi-value {
        font-size: 18px;
    }
}

/* Task dependency badge */
.task-dep-badge {
    font-size: 9px;
    color: var(--accent-amber);
    background: rgba(255,179,71,0.12);
    padding: 1px 5px;
    border-radius: 4px;
    cursor: help;
    white-space: nowrap;
}

/* ── Toast Notification System ──────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 420px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-elevated, #1A1A26);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: toastIn 0.3s ease;
    transition: opacity 0.3s, transform 0.3s;
    min-width: 280px;
}

.toast.toast-exit {
    opacity: 0;
    transform: translateX(60px);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 2px;
}

.toast-msg {
    font-size: 11px;
    color: var(--text-secondary, #8B8B9E);
    line-height: 1.4;
    word-break: break-word;
}

.toast-progress {
    height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.toast-progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted, #5A5A6E);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary, #fff);
}

.toast-success { border-left: 3px solid var(--accent-green, #2dc58c); }
.toast-error { border-left: 3px solid var(--accent-red, #ff4d4d); }
.toast-warning { border-left: 3px solid var(--accent-amber, #ffb347); }
.toast-info { border-left: 3px solid cornflowerblue; }
.toast-progress-bar.success { background: var(--accent-green, #2dc58c); }
.toast-progress-bar.error { background: var(--accent-red, #ff4d4d); }
.toast-progress-bar.working { background: var(--accent-amber, #ffb347); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Session row clickable */
.session-row-clickable { cursor: pointer; transition: background 0.15s; }
.session-row-clickable:hover td { background: rgba(255,255,255,0.03); }
.session-detail-panel {
    background: var(--bg-elevated, #1A1A26);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 14px;
    margin-top: 12px;
    font-size: 12px;
}
.session-detail-panel pre {
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    overflow-x: auto;
    white-space: pre-wrap;
    color: var(--text-secondary, #8B8B9E);
    max-height: 200px;
    overflow-y: auto;
}

/* Cron run log expand */
.cron-run-log {
    background: var(--bg-elevated, #1A1A26);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 11px;
}
.cron-run-entry {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: grid;
    grid-template-columns: 80px 60px 80px 1fr;
    gap: 8px;
    align-items: start;
}
.cron-run-entry:last-child { border-bottom: none; }
