/* ---------- Kanban & Task Management ---------- */
.kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    padding-bottom: .5rem;
}
.kanban-col {
    background: #eceff7;
    border-radius: var(--em-radius);
    padding: .85rem;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, .03);
}
.kanban-col.drop-target {
    outline: 2px dashed var(--em-primary);
    outline-offset: -4px;
    background: #e4e8f7;
}
.kanban-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-weight: 700;
    margin-bottom: .75rem;
}
.kanban-head .count {
    color: var(--em-muted);
    font-weight: 600;
    font-size: .8125rem;
}
.kanban-list {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    flex: 1;
}
.task-card {
    background: var(--em-surface);
    border-radius: 12px;
    padding: .85rem;
    box-shadow: var(--em-shadow);
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.task-card:hover {
    border-color: var(--em-primary-100);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(31, 42, 68, .08);
}
.task-card.overdue {
    border-left: 3px solid var(--em-danger);
}
.task-card .task-title {
    font-weight: 700;
    margin: .5rem 0 .35rem;
    color: #22305f;
    line-height: 1.35;
}

/* Tablet adjustments for board */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .kanban {
        grid-template-columns: repeat(4, minmax(270px, 1fr));
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: .85rem;
    }
    .kanban-col {
        scroll-snap-align: start;
    }
}

/* ---------- Task summary strip ---------- */
.task-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.task-stat {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .85rem 1rem;
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius);
    box-shadow: var(--em-shadow);
    transition: transform .15s ease, box-shadow .15s ease;
}
.task-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(31, 42, 68, .07);
}
.task-stat-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.15rem;
    background: var(--em-primary-050);
    color: var(--em-primary);
}
.task-stat-icon.tone-warning { background: var(--em-warning-bg); color: var(--em-warning); }
.task-stat-icon.tone-danger  { background: var(--em-danger-bg);  color: var(--em-danger);  }
.task-stat-icon.tone-success { background: var(--em-success-bg); color: var(--em-success); }
.task-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
    color: #22305f;
}
.task-stat-label {
    display: block;
    overflow: hidden;
    font-size: .75rem;
    font-weight: 600;
    color: var(--em-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- View switcher ---------- */
.view-switcher .btn {
    font-weight: 600;
    font-size: .85rem;
    padding: .45rem .85rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.view-switcher .btn.active {
    background: var(--em-primary);
    color: #fff;
    border-color: var(--em-primary);
}

/* ---------- Task Report View ---------- */
.task-row-title:hover {
    color: var(--em-primary) !important;
    text-decoration: underline !important;
}
.task-status-select {
    font-size: .8125rem;
    font-weight: 600;
    padding: .3rem 1.6rem .3rem .65rem;
    border-radius: 999px;
    border-color: var(--em-border);
    background-color: var(--em-surface-2);
    cursor: pointer;
    transition: all .15s ease;
}
.task-status-select:hover, .task-status-select:focus {
    border-color: var(--em-primary);
    background-color: #fff;
}

/* ---------- Mobile status switcher (phones only) ---------- */
.kanban-tabs { display: none; }

/* ---------- Quick create FAB ---------- */
.task-fab { display: none; }

@media (max-width: 767.98px) {
    .task-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
    }
    .task-stat {
        padding: .65rem .75rem;
        gap: .6rem;
    }
    .task-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
        border-radius: 10px;
    }
    .task-stat-value {
        font-size: 1.15rem;
    }

    .kanban-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: .3rem;
        margin-bottom: .85rem;
        padding: .3rem;
        background: var(--em-surface);
        border: 1px solid var(--em-border);
        border-radius: var(--em-radius);
        box-shadow: var(--em-shadow);
    }
    .kanban-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .15rem;
        min-width: 0;
        min-height: var(--em-touch);
        padding: .45rem .2rem;
        border: 0;
        border-radius: var(--em-radius-sm);
        background: transparent;
        color: var(--em-muted);
        font-size: .72rem;
        font-weight: 600;
        line-height: 1.15;
        text-align: center;
    }
    .kanban-tab-label {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
    .kanban-tab-count {
        font-size: .8rem;
        font-weight: 700;
        color: #22305f;
    }
    .kanban-tab.is-empty { opacity: .6; }
    .kanban-tab.active {
        background: var(--em-primary);
        color: #fff;
        box-shadow: 0 4px 12px rgba(59, 74, 159, .25);
    }
    .kanban-tab.active .kanban-tab-count { color: #fff; }

    /* One column at a time on phone */
    .kanban {
        display: block;
        overflow: visible;
        padding-bottom: 4.5rem;
        scroll-snap-type: none;
    }
    .kanban-col {
        display: none;
        min-height: 0;
        padding: .75rem;
    }
    .kanban-col.is-mobile-active { display: flex; }
    .kanban-col .kanban-head { margin-bottom: .6rem; }
    .kanban-col .kanban-head .btn { min-width: 38px; min-height: 38px; }
    .kanban-list { gap: .55rem; }
    .task-card { padding: .85rem; }
    .task-card .task-title { font-size: .95rem; margin-top: .4rem; }
    .task-card .btn, .task-card a { min-height: 36px; }

    /* Floating Action Button */
    .task-fab {
        position: fixed;
        right: 1.15rem;
        bottom: 1.15rem;
        z-index: 1025;
        display: inline-flex;
        align-items: center;
        gap: .5rem;
        padding: .75rem 1.25rem;
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(47, 60, 134, .35);
        font-weight: 600;
    }

    .page-header .page-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: .4rem;
    }
    .page-header .page-actions .btn {
        flex: 1 1 auto;
        font-size: .82rem;
        padding: .45rem .6rem;
    }
}

/* ---------- Print Report Styling ---------- */
@media print {
    body { background: #fff !important; }
    .app-sidebar,
    .sidebar-backdrop,
    .app-topbar,
    .page-header .page-actions,
    .list-toolbar,
    .kanban-tabs,
    #boardView,
    .task-fab,
    .modal,
    .toast-stack,
    #btnPrintReportAlt,
    .table-modern tbody td.actions,
    .table-modern thead th:last-child {
        display: none !important;
    }
    #reportView {
        display: block !important;
    }
    .print-report-header {
        display: block !important;
    }
    .card-soft {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        padding: 0 !important;
    }
    .table-responsive {
        overflow: visible !important;
    }
    .table-modern {
        font-size: 10pt !important;
        width: 100% !important;
    }
    .table-modern th, .table-modern td {
        border-color: #dee2e6 !important;
        padding: .45rem .6rem !important;
    }
    .task-status-select {
        border: 0 !important;
        background: transparent !important;
        padding: 0 !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        font-weight: 700 !important;
    }
}
