/* ── KGN Web — Kanban Board Styles ─────────────────────────────────── */

/* ── Board layout ────────────────────────────────────────────────── */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    height: 100%;
    overflow-x: auto;
    align-content: start;
}

/* ── Column ──────────────────────────────────────────────────────── */

.kanban-column {
    display: flex;
    flex-direction: column;
    background: var(--kgn-gray-50, #f9fafb);
    border-radius: var(--kgn-radius, 10px);
    min-height: 200px;
    max-height: calc(100vh - 150px);
    overflow: hidden;
    border: 1px solid var(--kgn-gray-200, #e5e7eb);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    background: var(--kgn-surface, #fff);
    border-top: 3px solid #ccc;
    border-radius: var(--kgn-radius, 10px) var(--kgn-radius, 10px) 0 0;
    font-weight: 700;
    font-size: var(--kgn-text-sm, 0.82rem);
}

.kanban-state-icon {
    font-size: 1rem;
}

.kanban-state-label {
    flex: 1;
}

.kanban-count {
    background: var(--kgn-gray-200, #e5e7eb);
    color: var(--kgn-gray-700, #374151);
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-size: var(--kgn-text-xs, 0.72rem);
    font-weight: 700;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Card ────────────────────────────────────────────────────────── */

.kanban-card {
    background: var(--kgn-surface, #fff);
    border: 1px solid var(--kgn-border, #e5e7eb);
    border-radius: var(--kgn-radius-sm, 6px);
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    transition: box-shadow var(--kgn-ease-fast, 0.15s ease),
                border-color var(--kgn-ease-fast, 0.15s ease),
                transform var(--kgn-ease-fast, 0.15s ease);
    border-left: 3px solid #ccc;
}

.kanban-card:hover {
    box-shadow: var(--kgn-shadow-sm, 0 1px 3px rgba(0,0,0,0.06));
    border-color: var(--kgn-primary, #3b82f6);
    transform: translateY(-1px);
}

/* Priority colours */
.kanban-card.priority-high   { border-left-color: var(--kgn-danger, #ef4444); }
.kanban-card.priority-medium { border-left-color: var(--kgn-warning, #f59e0b); }
.kanban-card.priority-low    { border-left-color: #10b981; }

.card-title {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.35rem;
    word-break: break-word;
    color: var(--kgn-gray-800, #1f2937);
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: var(--kgn-text-xs, 0.72rem);
    color: var(--kgn-gray-500, #6b7280);
    margin-bottom: 0.25rem;
}

.card-priority {
    background: var(--kgn-gray-100, #f3f4f6);
    padding: 0.05rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

.card-attempts {
    color: var(--kgn-gray-400, #9ca3af);
}

/* ── Lease countdown ─────────────────────────────────────────────── */

.card-lease {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--kgn-text-xs, 0.72rem);
    margin-top: 0.25rem;
    padding: 0.25rem 0.4rem;
    border-radius: var(--kgn-radius-xs, 4px);
    background: #fef3c7;
    color: #92400e;
}

.card-lease .lease-label {
    font-weight: 600;
}

.card-lease.lease-warning {
    background: #fee2e2;
    color: #991b1b;
    animation: pulse-warn 1.5s ease-in-out infinite;
}

.card-lease.lease-expired {
    background: #fecaca;
    color: #7f1d1d;
    font-weight: 700;
}

@keyframes pulse-warn {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Agent ────────────────────────────────────────────────────────── */

.card-agent {
    font-size: 0.76rem;
    color: var(--kgn-gray-500, #6b7280);
    margin-top: 0.2rem;
}

.card-agent .agent-label {
    font-weight: 600;
}

/* ── Card ID ─────────────────────────────────────────────────────── */

.card-id {
    font-family: var(--kgn-font-mono, monospace);
    font-size: var(--kgn-text-xs, 0.72rem);
    color: var(--kgn-gray-400, #9ca3af);
    margin-top: 0.3rem;
}

/* ── Empty state ─────────────────────────────────────────────────── */

.kanban-empty {
    text-align: center;
    color: var(--kgn-gray-400, #9ca3af);
    font-style: italic;
    padding: 1.5rem 0.5rem;
    font-size: var(--kgn-text-sm, 0.82rem);
}

/* ── Error state ─────────────────────────────────────────────────── */

.kanban-error {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--kgn-danger, #ef4444);
    padding: 2rem;
    font-size: var(--kgn-text-base, 0.9rem);
}

/* ── Kanban view container ───────────────────────────────────────── */

#kanban-view {
    overflow-y: auto;
}

/* ── Responsive: stack columns on narrow screens ─────────────────── */

@media (max-width: 1100px) {
    .kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}
