/* ===========================================================================
   RESPONSIVE — Mobile (max-width: 768px)
   =========================================================================== */
@media (max-width: 768px) {

    body {
        flex-direction: column;
        overflow: hidden;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        padding: 16px;
        padding-top: calc(36px + env(safe-area-inset-top));
        padding-bottom: 85px;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .view-title-section {
        margin-bottom: 12px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .view-title-section h1 {
        font-size: 20px;
    }

    .view-title-section p {
        font-size: 11px;
    }

    .view-title-section .modal-action-btn {
        padding: 8px 14px;
        font-size: 11px;
        border-radius: 12px;
    }

    /* Responsive card-based layout para tabla en móvil */
    .task-table-container {
        overflow-y: auto;
    }

    .task-table thead {
        display: none;
    }

    .task-table,
    .task-table tbody,
    .task-table tr {
        display: block;
        width: 100%;
    }

    .task-table td {
        display: block;
        width: 100%;
        padding: 0;
        border: none;
    }

    .task-table tr {
        background: var(--surface-1);
        border-bottom: 1px solid var(--border-color);
        padding: 10px 12px;
        display: grid;
        grid-template-columns: 24px 1.3fr 1.1fr 0.8fr;
        grid-template-rows: auto auto;
        gap: 6px 8px;
        align-items: center;
    }

    .task-table tr td:nth-child(1) {
        grid-column: 1;
        grid-row: 1 / span 2;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }

    .task-table tr td:nth-child(2) {
        grid-column: 2 / span 3;
        grid-row: 1;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.3;
        display: block;
        width: 100%;
    }

    .task-table tr td:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
        display: block;
        width: 100%;
    }

    .task-table tr td:nth-child(4) {
        grid-column: 3;
        grid-row: 2;
        display: block;
        width: 100%;
    }

    .task-table tr td:nth-child(5) {
        grid-column: 4;
        grid-row: 2;
        display: flex;
        justify-content: flex-end;
        width: 100%;
    }

    .task-table tr td:nth-child(3) .team-select {
        font-size: 12px;
        padding: 4px 14px 4px 0;
        width: 100%;
        max-width: none;
        height: auto;
        background: transparent;
        border: none;
        color: var(--accent-light);
        font-weight: 600;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;utf8,<svg fill='%23c084fc' height='12' viewBox='0 0 24 24' width='12' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
        background-repeat: no-repeat;
        background-position: right center;
        background-size: 10px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    .task-table tr td:nth-child(4) .date-picker {
        font-size: 11px;
        padding: 4px 4px 4px 18px;
        width: 100%;
        max-width: none;
        height: auto;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;utf8,<svg fill='rgba(156,163,175,0.8)' height='14' viewBox='0 0 24 24' width='14' xmlns='http://www.w3.org/2000/svg'><path d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z'/></svg>");
        background-repeat: no-repeat;
        background-position: left center;
        background-size: 12px;
    }

    .task-table tr td:nth-child(5) .badge {
        font-size: 10px;
        padding: 5px 8px;
        width: 100%;
        justify-content: center;
        height: 24px;
    }

    /* Ocultar el creador de tareas inline en móvil */
    .inline-add-task {
        display: none;
    }

    /* Compact card header en móvil */
    .glass-card > div:first-child {
        padding: 8px 12px;
    }

    .glass-card > div:first-child h2 {
        display: none;
    }

    .glass-card > div:first-child > div {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    /* Kanban en móvil */
    .task-kanban-container {
        padding: 12px;
        gap: 12px;
    }

    .kanban-column {
        min-width: 250px;
        max-width: 280px;
        padding: 12px;
    }

    /* BARRA DE NAVEGACIÓN MÓVIL */
    .mobile-nav-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(18, 18, 26, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        justify-content: space-around;
        align-items: center;
        z-index: 90;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        font-size: 10px;
        font-weight: 500;
        gap: 4px;
        flex: 1;
        height: 100%;
        cursor: pointer;
        transition: color 0.2s ease;
    }

    .mobile-nav-item.active {
        color: var(--accent-primary);
    }

    .mobile-nav-item i {
        font-size: 18px;
    }

    /* BOTTOM SHEET OVERLAY */
    .mobile-bottom-sheet-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .mobile-bottom-sheet-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* BOTTOM SHEET DRAWER */
    .mobile-bottom-sheet {
        display: flex;
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        background: var(--modal-bg);
        border-top: 1px solid var(--border-color);
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        z-index: 100;
        padding: 24px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 70vh;
        flex-direction: column;
        gap: 16px;
    }

    .mobile-bottom-sheet.active {
        bottom: 0;
    }

    /* Calendario en móvil */
    .calendar-grid {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        gap: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-day-column {
        flex-shrink: 0;
        width: 160px;
        min-height: 300px;
        padding: 10px;
    }

    .calendar-day-header .day-num {
        font-size: 16px;
    }

}
